com.atlassian.jira.web.util
Class DefaultWebAttachmentManager
java.lang.Object
com.atlassian.jira.web.util.DefaultWebAttachmentManager
- All Implemented Interfaces:
- WebAttachmentManager
public class DefaultWebAttachmentManager
- extends java.lang.Object
- implements WebAttachmentManager
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. |
protected java.lang.String |
getAttachmentSize()
|
protected I18nHelper |
getI18n()
|
boolean |
validateAttachmentIfExists(webwork.multipart.MultiPartRequestWrapper requestWrapper,
java.lang.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 |
DefaultWebAttachmentManager
public DefaultWebAttachmentManager(AttachmentManager attachmentManager,
I18nHelper.BeanFactory beanFactory,
JiraAuthenticationContext authenticationContext)
createAttachment
public 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
- 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 withfileParamName
- 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
public TemporaryAttachment createTemporaryAttachment(webwork.multipart.MultiPartRequestWrapper requestWrapper,
java.lang.Long issueId,
java.lang.String fileParamName)
throws AttachmentException
- Description copied from interface:
WebAttachmentManager
- 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
- Specified by:
createTemporaryAttachment
in interface WebAttachmentManager
- Parameters:
requestWrapper
- the wrapper containing getFile() and getFilesystemName() describing the attachmentissueId
- The issue id that this temporary attachment is for. Can be null when creating a new issuefileParamName
- 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
public boolean validateAttachmentIfExists(webwork.multipart.MultiPartRequestWrapper requestWrapper,
java.lang.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 attachmentfileParamName
- the parameter in the wrapper to use to find attachment inforequired
- 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
getAttachmentSize
protected java.lang.String getAttachmentSize()
getI18n
protected I18nHelper getI18n()
Copyright © 2002-2010 Atlassian. All Rights Reserved.