com.atlassian.jira.web.util
Class DefaultWebAttachmentManager

java.lang.Object
  extended by com.atlassian.jira.web.util.DefaultWebAttachmentManager
All Implemented Interfaces:
WebAttachmentManager

public class DefaultWebAttachmentManager
extends Object
implements WebAttachmentManager


Constructor Summary
DefaultWebAttachmentManager(AttachmentManager attachmentManager)
           
 
Method Summary
 ChangeItemBean createAttachment(webwork.multipart.MultiPartRequestWrapper requestWrapper, User remoteUser, org.ofbiz.core.entity.GenericValue issue, String fileParamName, Map attachmentProperties)
          Create an issue's attachment.
protected  String getAttachmentSize()
           
protected  I18nBean getI18n()
           
 boolean validateAttachmentIfExists(File file, String fileName)
          Determine whether an attachment exists and is valid (i.e.
 boolean validateAttachmentIfExists(webwork.multipart.MultiPartRequestWrapper requestWrapper, String fileParamName, boolean required)
          Determine whether an attachment exists and is valid (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWebAttachmentManager

public DefaultWebAttachmentManager(AttachmentManager attachmentManager)
Method Detail

createAttachment

public ChangeItemBean createAttachment(webwork.multipart.MultiPartRequestWrapper requestWrapper,
                                       User remoteUser,
                                       org.ofbiz.core.entity.GenericValue issue,
                                       String fileParamName,
                                       Map attachmentProperties)
                                throws AttachmentException,
                                       org.ofbiz.core.entity.GenericEntityException
Description copied from interface: WebAttachmentManager
Create an issue's attachment.

Specified by:
createAttachment in interface WebAttachmentManager
Parameters:
requestWrapper - eg. obtained from ServletActionContext.getMultiPartRequest()
remoteUser - eg. from JiraWebActionSupport.getRemoteUser()
issue - Issue to associate attachment with
fileParamName - Name of form parameter specifying filename (in requestWrapper).
attachmentProperties - Arbitrary key:value properties to store with this attachment. Key is a String, value is an Object mappable to a PropertySet. Eg. {"attachment.copyright.licensed" -> Boolean.TRUE}
Throws:
AttachmentException
org.ofbiz.core.entity.GenericEntityException

validateAttachmentIfExists

public boolean validateAttachmentIfExists(webwork.multipart.MultiPartRequestWrapper requestWrapper,
                                          String fileParamName,
                                          boolean required)
                                   throws AttachmentException
Description copied from interface: WebAttachmentManager
Determine whether an attachment exists and is valid (i.e. non-zero and contains no invalid characters)

Specified by:
validateAttachmentIfExists in interface WebAttachmentManager
Parameters:
requestWrapper - the wrapper containing getFile() and getFilesystemName() describing the attachment
fileParamName - the parameter in the wrapper to use to find attachment info
required - whether having an valid and existent attachment is mandatory
Returns:
whether the attachment is valid and exists
Throws:
AttachmentException - if the attachment is zero-length, contains invalid characters, or simply doesn't exist when required

validateAttachmentIfExists

public boolean validateAttachmentIfExists(File file,
                                          String fileName)
                                   throws AttachmentException
Description copied from interface: WebAttachmentManager
Determine whether an attachment exists and is valid (i.e. non-zero and contains no invalid characters)

Specified by:
validateAttachmentIfExists in interface WebAttachmentManager
Parameters:
file - the attachment File object
fileName - the filename of the attachment
Returns:
true if the file exists, false if it doesn't.
Throws:
AttachmentException - If the file exists and is not valid.

getAttachmentSize

protected String getAttachmentSize()

getI18n

protected I18nBean getI18n()


Copyright © 2002-2009 Atlassian. All Rights Reserved.