|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@PublicApi public interface AttachmentManager
Manages all attachment related tasks in JIRA, which involves retrieving an attachment, creating an attachment and deleting an attachment.
Method Summary | |
---|---|
boolean |
attachmentsEnabled()
Determine if attachments have been enabled in JIRA and if the attachments directory exists. |
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(File file,
String filename,
String contentType,
com.atlassian.crowd.embedded.api.User author,
org.ofbiz.core.entity.GenericValue issue)
Deprecated. Use createAttachment(File, String, String, User, Issue) instead. Since v5.0. |
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)
Deprecated. Use createAttachment(File, String, String, User, Issue, Map, Date) instead. Since v5.0. |
ChangeItemBean |
createAttachment(File file,
String filename,
String contentType,
com.atlassian.crowd.embedded.api.User author,
Issue issue)
Same as the 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 author,
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)
Deprecated. Use createAttachment(File, String, String, User, Issue, Map, Date) instead. Since v5.0. |
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. |
boolean |
isScreenshotAppletEnabled()
Determine if screenshot applet has been enabled in JIRA. |
boolean |
isScreenshotAppletSupportedByOS()
Determine if the screenshot applet is supported by the user's operating system. |
Method Detail |
---|
Attachment getAttachment(Long id) throws DataAccessException, AttachmentNotFoundException
id
- the Attachment ID
DataAccessException
- if there is a problem accessing the database.
AttachmentNotFoundException
- thrown if an attachment with the passed id does not exist.List<Attachment> getAttachments(Issue issue) throws DataAccessException
issue
- the Issue
Attachment
objects
DataAccessException
- if there is a problem accessing the database.List<Attachment> getAttachments(Issue issue, Comparator<? super Attachment> comparator) throws DataAccessException
issue
- the Issuecomparator
- used for sorting
Attachment
objects
DataAccessException
- if there is a problem accessing the database.Attachment createAttachmentCopySourceFile(File file, String filename, String contentType, String attachmentAuthor, Issue issue, Map<String,Object> attachmentProperties, Date createdTime) throws AttachmentException
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.ChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User author, Issue issue, Map<String,Object> attachmentProperties, Date createdTime) throws AttachmentException
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 appropriateauthor
- 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 filecreateAttachment(java.io.File, String, String, com.atlassian.crowd.embedded.api.User, Issue)
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
createAttachment(File, String, String, User, Issue, Map, Date)
instead. Since v5.0.
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 appropriateauthor
- The user who created this attachmentissue
- 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
- the created time
ChangeItemBean
with all the changes to the issue.
AttachmentException
- if an error occurs while attempting to copy the file
org.ofbiz.core.entity.GenericEntityException
- if there is an error in creating the DB record for the attachmentChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User author, Issue issue) throws AttachmentException
createAttachment(File, String, String, User, Issue, Map, Date)
method, except it submits no
attachmentProperties and uses now() for the created time.
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 appropriateauthor
- 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 filecreateAttachment(java.io.File, String, String, com.atlassian.crowd.embedded.api.User, Issue, java.util.Map, java.util.Date)
ChangeItemBean createAttachment(File file, String filename, String contentType, com.atlassian.crowd.embedded.api.User author, org.ofbiz.core.entity.GenericValue issue) throws AttachmentException
createAttachment(File, String, String, User, Issue)
instead. Since v5.0.
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.
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 appropriateauthor
- 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 file
org.ofbiz.core.entity.GenericEntityException
- if there is an error in creating the DB record for the attachmentAttachment 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)
createAttachment(File, String, String, User, Issue, Map, Date)
instead. Since v5.0.
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
void deleteAttachment(Attachment attachment) throws RemoveException
attachment
- the Attachment
RemoveException
- if the attachment cannot be removed from the diskvoid deleteAttachmentDirectory(Issue issue) throws RemoveException
issue
- the issue whose attachment directory we wish to delete.
RemoveException
- if the directory can not be removed or is not empty.boolean attachmentsEnabled()
boolean isScreenshotAppletEnabled()
boolean isScreenshotAppletSupportedByOS()
List<ChangeItemBean> convertTemporaryAttachments(com.atlassian.crowd.embedded.api.User user, Issue issue, List<Long> selectedAttachments, TemporaryAttachmentsMonitor temporaryAttachmentsMonitor) throws AttachmentException
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 itself
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |