com.atlassian.jira.web.util
Interface WebAttachmentManager

All Known Implementing Classes:
DefaultWebAttachmentManager

public interface WebAttachmentManager

Manager for issue attachments.


Method Summary
 ChangeItemBean createAttachment(webwork.multipart.MultiPartRequestWrapper requestWrapper, com.opensymphony.user.User remoteUser, org.ofbiz.core.entity.GenericValue issue, java.lang.String fileParamName, java.util.Map<java.lang.String,java.lang.Object> attachmentProperties)
          Create an issue's attachment.
 TemporaryAttachment createTemporaryAttachment(webwork.multipart.MultiPartRequestWrapper requestWrapper, java.lang.Long issueId, java.lang.String fileParamName)
          Creates a temporary attachment on disk.
 boolean validateAttachmentIfExists(webwork.multipart.MultiPartRequestWrapper requestWrapper, java.lang.String fileParamName, boolean required)
          Determine whether an attachment exists and is valid (i.e.
 

Method Detail

createAttachment

ChangeItemBean createAttachment(webwork.multipart.MultiPartRequestWrapper requestWrapper,
                                com.opensymphony.user.User remoteUser,
                                org.ofbiz.core.entity.GenericValue issue,
                                java.lang.String fileParamName,
                                java.util.Map<java.lang.String,java.lang.Object> attachmentProperties)
                                throws AttachmentException,
                                       org.ofbiz.core.entity.GenericEntityException
Create an issue's attachment.

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

createTemporaryAttachment

TemporaryAttachment createTemporaryAttachment(webwork.multipart.MultiPartRequestWrapper requestWrapper,
                                              java.lang.Long issueId,
                                              java.lang.String fileParamName)
                                              throws AttachmentException
Creates a temporary attachment on disk. These attachment generally only live for the duration of a user's session and will also be deleted on exit of the JVM. This method will not create a link to the issue yet, but simply copy the attachment to a temp directory in the attachments folder and store all the relevant details in the returned TemporaryAttachment object

Parameters:
requestWrapper - the wrapper containing getFile() and getFilesystemName() describing the attachment
issueId - The issue id that this temporary attachment is for. Can be null when creating a new issue
fileParamName - ame of form parameter specifying filename (in requestWrapper).
Returns:
A TemporaryAttachment containing details about where the temp attachment was created
Throws:
AttachmentException - if there was an error saving the temporary attachment.

validateAttachmentIfExists

boolean validateAttachmentIfExists(webwork.multipart.MultiPartRequestWrapper requestWrapper,
                                   java.lang.String fileParamName,
                                   boolean required)
                                   throws AttachmentException
Determine whether an attachment exists and is valid (i.e. non-zero and contains no invalid characters)

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


Copyright © 2002-2010 Atlassian. All Rights Reserved.