|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.issue.managers.DefaultAttachmentManager
public class DefaultAttachmentManager
Constructor Summary | |
---|---|
DefaultAttachmentManager(IssueManager issueManager,
OfBizDelegator ofBizDelegator,
MimeManager mimeManager,
ApplicationProperties applicationProperties,
AttachmentPathManager attachmentPathManager,
ComponentLocator componentLocator,
I18nHelper.BeanFactory i18nBeanFactory,
UserManager userManager,
AttachmentStore attachmentStore)
|
Method Summary | ||
---|---|---|
boolean |
attachmentsEnabled()
Determine if attachments have been enabled in JIRA and if the attachments directory exists. |
|
List<ChangeItemBean> |
convertTemporaryAttachments(ApplicationUser user,
Issue issue,
List<Long> selectedAttachments,
TemporaryAttachmentsMonitor temporaryAttachmentsMonitor)
Converts a set of provided temporary attachments to real attachments attached to an issue. |
|
List<ChangeItemBean> |
convertTemporaryAttachments(com.atlassian.crowd.embedded.api.User user,
Issue issue,
List<Long> selectedAttachments,
TemporaryAttachmentsMonitor temporaryAttachmentsMonitor)
Converts a set of provided temporary attachments to real attachments attached to an issue. |
|
ChangeItemBean |
createAttachment(CreateAttachmentParamsBean bean)
Create an attachment both on disk, and in the database. |
|
ChangeItemBean |
createAttachment(File file,
String filename,
String contentType,
com.atlassian.crowd.embedded.api.User remoteUser,
org.ofbiz.core.entity.GenericValue issue)
Same as the AttachmentManager.createAttachment(java.io.File, String, String, User, org.ofbiz.core.entity.GenericValue, java.util.Map, java.util.Date) method, except it
submits no attachmentProperties and uses now() for the created time. |
|
ChangeItemBean |
createAttachment(File file,
String filename,
String contentType,
com.atlassian.crowd.embedded.api.User author,
org.ofbiz.core.entity.GenericValue issue,
Boolean zip,
Boolean thumbnailable,
Map<String,Object> attachmentProperties,
Date createdTime)
Create an attachment both on disk, and in the database. |
|
ChangeItemBean |
createAttachment(File file,
String filename,
String contentType,
com.atlassian.crowd.embedded.api.User author,
org.ofbiz.core.entity.GenericValue issue,
Map<String,Object> attachmentProperties,
Date createdTime)
Create an attachment both on disk, and in the database. |
|
ChangeItemBean |
createAttachment(File file,
String filename,
String contentType,
com.atlassian.crowd.embedded.api.User remoteUser,
Issue issue)
Same as the AttachmentManager.createAttachment(File, String, String, User, Issue, Map, Date) method, except it submits no
attachmentProperties and uses now() for the created time. |
|
ChangeItemBean |
createAttachment(File file,
String filename,
String contentType,
com.atlassian.crowd.embedded.api.User remoteUser,
Issue issue,
Boolean zip,
Boolean thumbnailable,
Map<String,Object> attachmentProperties,
Date createdTime)
Create an attachment both on disk, and in the database. |
|
ChangeItemBean |
createAttachment(File file,
String filename,
String contentType,
com.atlassian.crowd.embedded.api.User remoteUser,
Issue issue,
Map<String,Object> attachmentProperties,
Date createdTime)
Create an attachment both on disk, and in the database. |
|
Attachment |
createAttachment(org.ofbiz.core.entity.GenericValue issue,
com.atlassian.crowd.embedded.api.User author,
String mimetype,
String filename,
Long filesize,
Map<String,Object> attachmentProperties,
Date createdTime)
Create an attachment in the database. |
|
Attachment |
createAttachmentCopySourceFile(File file,
String filename,
String contentType,
String attachmentAuthor,
Issue issue,
Map<String,Object> attachmentProperties,
Date createdTime)
Create an attachment both on disk, and in the database by copying the provided file instead of moving it. |
|
void |
deleteAttachment(Attachment attachment)
Delete an attachment from the database and from disk. |
|
void |
deleteAttachmentDirectory(Issue issue)
Delete the attachment directory from disk if the directory is empty. |
|
Attachment |
getAttachment(Long id)
Get a single attachment by its ID. |
|
List<Attachment> |
getAttachments(Issue issue)
Get a list of all attachments for a certain issue. |
|
List<Attachment> |
getAttachments(Issue issue,
Comparator<? super Attachment> comparator)
Get a list of all attachments for a certain issue, sorted according to the specified comparator. |
|
List<Attachment> |
getStoredAttachments(Issue issue)
|
|
boolean |
isScreenshotAppletEnabled()
Determine if screenshot applet has been enabled in JIRA. |
|
protected boolean |
isScreenshotAppletEnabledForLinux()
|
|
boolean |
isScreenshotAppletSupportedByOS()
Determine if the screenshot applet is supported by the user's operating system. |
|
void |
moveAttachments(Issue oldIssue,
String newIssueKey)
Create a new directory for this issue, and move all the attachments from the old directory to the new directory. |
|
Attachment |
setThumbnailable(Attachment attachment,
boolean thumbnailable)
Stores the thumbnailble flag for this attachment |
|
Attachment |
setZip(Attachment attachment,
boolean zip)
Stores the zip flag for this attachment |
|
|
streamAttachmentContent(Attachment attachment,
InputStreamConsumer<T> consumer)
Get binary content of the attachment |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultAttachmentManager(IssueManager issueManager, OfBizDelegator ofBizDelegator, MimeManager mimeManager, ApplicationProperties applicationProperties, AttachmentPathManager attachmentPathManager, ComponentLocator componentLocator, I18nHelper.BeanFactory i18nBeanFactory, UserManager userManager, AttachmentStore attachmentStore)
Method Detail |
---|
public Attachment getAttachment(Long id)
AttachmentManager
getAttachment
in interface AttachmentManager
id
- the Attachment ID
public List<Attachment> getAttachments(Issue issue)
AttachmentManager
getAttachments
in interface AttachmentManager
issue
- the Issue
Attachment
objectspublic List<Attachment> getStoredAttachments(Issue issue)
public List<Attachment> getAttachments(Issue issue, Comparator<? super Attachment> comparator)
AttachmentManager
getAttachments
in interface AttachmentManager
issue
- the Issuecomparator
- used for sorting
Attachment
objectspublic Attachment createAttachmentCopySourceFile(File file, String filename, String contentType, String attachmentAuthor, Issue issue, Map<String,Object> attachmentProperties, Date createdTime) throws AttachmentException
AttachmentManager
createAttachmentCopySourceFile
in interface AttachmentManager
file
- A file on a locally accessible filesystem, this will be copied, not moved.filename
- The desired filename for this attachment. This may be different to the filename on disk (for example with temp files used in file uploads)contentType
- The desired contentType. Implementations of this interface can choose to override this value as appropriateattachmentAuthor
- The username of the user who created this attachment, this is not validated so it must be a valid usernameissue
- The id of the issue that this attachment is attached toattachmentProperties
- Attachment properties (a Map of String -> Object properties). These are optional,
and are used to populate a PropertySet on the Attachment (Attachment.getProperties()
. Pass null to set no propertiescreatedTime
- when the attachment was created
AttachmentException
- if any errors occur.public Attachment createAttachment(org.ofbiz.core.entity.GenericValue issue, com.atlassian.crowd.embedded.api.User author, String mimetype, String filename, Long filesize, Map<String,Object> attachmentProperties, Date createdTime)
AttachmentManager
createAttachment
in interface AttachmentManager
issue
- the issue that this attachment is attached toauthor
- The user who created this attachmentmimetype
- mimetypefilename
- The desired filename for this attachment.filesize
- filesizeattachmentProperties
- Attachment properties (a Map of String -> Object properties).createdTime
- when the attachment was created
public void deleteAttachment(Attachment attachment) throws RemoveException
AttachmentManager
deleteAttachment
in interface AttachmentManager
attachment
- the Attachment
RemoveException
- if the attachment cannot be removed from the diskpublic void deleteAttachmentDirectory(Issue issue) throws RemoveException
AttachmentManager
deleteAttachmentDirectory
in interface AttachmentManager
issue
- the issue whose attachment directory we wish to delete.
RemoveException
- if the directory can not be removed or is not empty.public boolean attachmentsEnabled()
AttachmentManager
attachmentsEnabled
in interface AttachmentManager
public boolean isScreenshotAppletEnabled()
AttachmentManager
isScreenshotAppletEnabled
in interface AttachmentManager
protected boolean isScreenshotAppletEnabledForLinux()
public boolean isScreenshotAppletSupportedByOS()
AttachmentManager
isScreenshotAppletSupportedByOS
in interface AttachmentManager
public List<ChangeItemBean> convertTemporaryAttachments(com.atlassian.crowd.embedded.api.User user, Issue issue, List<Long> selectedAttachments, TemporaryAttachmentsMonitor temporaryAttachmentsMonitor) throws AttachmentException
AttachmentManager
convertTemporaryAttachments
in interface AttachmentManager
user
- The user performing the actionissue
- The issue attachments should be linked toselectedAttachments
- The temporary attachment ids to convert as selected by the usertemporaryAttachmentsMonitor
- TemporaryAttachmentsMonitor containing information about all temporary attachments
AttachmentException
- If there were problems with the Attachment itselfpublic ChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User remoteUser, Issue issue, Map<String,Object> attachmentProperties, Date createdTime) throws AttachmentException
AttachmentManager
createAttachment
in interface AttachmentManager
file
- A file on a locally accessible filesystemfilename
- The desired filename for this attachment. This may be different to the filename on disk (for example with temp files used in file uploads)contentType
- The desired contentType. Implementations of this interface can choose to override this value as appropriateremoteUser
- The user who created this attachmentissue
- The issue that this file is to be attached toattachmentProperties
- Attachment properties (a Map of String -> Object properties). These are optional,
and are used to populate a PropertySet on the Attachment (Attachment.getProperties()
. Pass null to set no propertiescreatedTime
- the created time
ChangeItemBean
with all the changes to the issue.
AttachmentException
- if an IO error occurs while attempting to copy the fileAttachmentManager.createAttachment(java.io.File, String, String, com.atlassian.crowd.embedded.api.User, Issue)
public ChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User remoteUser, Issue issue, Boolean zip, Boolean thumbnailable, Map<String,Object> attachmentProperties, Date createdTime) throws AttachmentException
AttachmentManager
createAttachment
in interface AttachmentManager
file
- A file on a locally accessible filesystemfilename
- The desired filename for this attachment. This may be different to the filename on disk (for example with temp files used in file uploads)contentType
- The desired contentType. Implementations of this interface can choose to override this value as appropriateremoteUser
- The user who created this attachmentissue
- The issue that this file is to be attached tozip
- This file is a zip file. Null indicates that it is not know if this attachment is a zip file or notthumbnailable
- This file is thumbnailable (e.g. a png image). Null indicates that it is not know if this attachment is thumbnailable or notattachmentProperties
- Attachment properties (a Map of String -> Object properties). These are optional,
and are used to populate a PropertySet on the Attachment (Attachment.getProperties()
. Pass null to set no propertiescreatedTime
- the created time
ChangeItemBean
with all the changes to the issue.
AttachmentException
- if an IO error occurs while attempting to copy the fileAttachmentManager.createAttachment(java.io.File, String, String, com.atlassian.crowd.embedded.api.User, Issue)
public ChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User author, org.ofbiz.core.entity.GenericValue issue, Map<String,Object> attachmentProperties, Date createdTime) throws AttachmentException
AttachmentManager
createAttachment
in interface AttachmentManager
contentType
- The desired contentType. This may be modified if a better alternative is suggested by MimeManager.getSanitisedMimeType(String, String)
attachmentProperties
- String -> Object property mapfile
- A file on a locally accessible filesystemfilename
- The desired filename for this attachment. This may be different to the filename on disk (for example with temp files used in file uploads)author
- The user who created this attachmentissue
- The issue that this attachment is attached tocreatedTime
- the created time
ChangeItemBean
with all the changes to the issue.
AttachmentException
- if an error occurs while attempting to copy the filepublic ChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User author, org.ofbiz.core.entity.GenericValue issue, Boolean zip, Boolean thumbnailable, Map<String,Object> attachmentProperties, Date createdTime) throws AttachmentException
AttachmentManager
createAttachment
in interface AttachmentManager
contentType
- The desired contentType. This may be modified if a better alternative is suggested by MimeManager.getSanitisedMimeType(String, String)
attachmentProperties
- String -> Object property mapfile
- A file on a locally accessible filesystemfilename
- The desired filename for this attachment. This may be different to the filename on disk (for example with temp files used in file uploads)author
- The user who created this attachmentissue
- The issue that this attachment is attached tozip
- This file is a zip file. Null indicates that it is not know if this attachment is a zip file or notthumbnailable
- This file is thumbnailable (e.g. a png image). Null indicates that it is not know if this attachment is thumbnailable or notcreatedTime
- the created time
ChangeItemBean
with all the changes to the issue.
AttachmentException
- if an error occurs while attempting to copy the filepublic ChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User remoteUser, org.ofbiz.core.entity.GenericValue issue) throws AttachmentException
AttachmentManager
AttachmentManager.createAttachment(java.io.File, String, String, User, org.ofbiz.core.entity.GenericValue, java.util.Map, java.util.Date)
method, except it
submits no attachmentProperties and uses now() for the created time.
createAttachment
in interface AttachmentManager
file
- A file on a locally accessible filesystemfilename
- The desired filename for this attachment. This may be different to the filename on disk (for example with temp files used in file uploads)contentType
- The desired contentType. Implementations of this interface can choose to override this value as appropriateremoteUser
- The user who created this attachmentissue
- The issue that this attachment is attached to
ChangeItemBean
with all the changes to the issue.
AttachmentException
- if an error occurs while attempting to copy the filepublic ChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User remoteUser, Issue issue) throws AttachmentException
AttachmentManager
AttachmentManager.createAttachment(File, String, String, User, Issue, Map, Date)
method, except it submits no
attachmentProperties and uses now() for the created time.
createAttachment
in interface AttachmentManager
file
- A file on a locally accessible filesystemfilename
- The desired filename for this attachment. This may be different to the filename on disk (for example with temp files used in file uploads)contentType
- The desired contentType. Implementations of this interface can choose to override this value as appropriateremoteUser
- The user who created this attachmentissue
- The issue that this attachment is attached to
ChangeItemBean
with all the changes to the issue.
AttachmentException
- if an IO error occurs while attempting to copy the fileAttachmentManager.createAttachment(java.io.File, String, String, com.atlassian.crowd.embedded.api.User, Issue, java.util.Map, java.util.Date)
public ChangeItemBean createAttachment(CreateAttachmentParamsBean bean) throws AttachmentException
AttachmentManager
createAttachment
in interface AttachmentManager
bean
- Parameters which describe created attachment
ChangeItemBean
with all the changes to the issue.
AttachmentException
- if an IO error occurs while attempting to copy the filefor creating beans
public List<ChangeItemBean> convertTemporaryAttachments(ApplicationUser user, Issue issue, List<Long> selectedAttachments, TemporaryAttachmentsMonitor temporaryAttachmentsMonitor) throws AttachmentException
AttachmentManager
convertTemporaryAttachments
in interface AttachmentManager
user
- The user performing the actionissue
- The issue attachments should be linked toselectedAttachments
- The temporary attachment ids to convert as selected by the usertemporaryAttachmentsMonitor
- TemporaryAttachmentsMonitor containing information about all temporary attachments
AttachmentException
- If there were problems with the Attachment itselfpublic Attachment setThumbnailable(Attachment attachment, boolean thumbnailable)
AttachmentManager
setThumbnailable
in interface AttachmentManager
attachment
- The attachmentthumbnailable
- True if this attachment is thumnailablepublic Attachment setZip(Attachment attachment, boolean zip)
AttachmentManager
setZip
in interface AttachmentManager
attachment
- The attachmentzip
- True if this attachment is a zip filepublic <T> T streamAttachmentContent(Attachment attachment, InputStreamConsumer<T> consumer) throws IOException
AttachmentManager
streamAttachmentContent
in interface AttachmentManager
IOException
public void moveAttachments(Issue oldIssue, String newIssueKey)
File.renameTo(java.io.File)
fails across filesystems.
moveAttachments
in interface AttachmentManager
oldIssue
- the issue we're moving attachments fromnewIssueKey
- the new destination issue key
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |