com.atlassian.jira.issue
Interface AttachmentManager

All Known Implementing Classes:
DefaultAttachmentManager

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.
 ChangeItemBean createAttachment(File file, String filename, String contentType, User remoteUser, org.ofbiz.core.entity.GenericValue issue)
          Same as the createAttachment(java.io.File, String, String, com.opensymphony.user.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, User remoteUser, org.ofbiz.core.entity.GenericValue issue, Map attachmentProperties, Date createdTime)
          Create an attachment both on disk, and in the database.
 Attachment createAttachment(org.ofbiz.core.entity.GenericValue issue, User author, String mimetype, String filename, Long filesize, Map attachmentProperties, Date createdTime)
          Create an attachment in the database.
 Attachment createAttachmentCopySourceFile(File file, String filename, String contentType, String attachmentAuthor, Issue issue, Map 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(org.ofbiz.core.entity.GenericValue issue)
          Delete the attachment directory from disk if the directory is empty
 Attachment getAttachment(Long id)
          Get a single attachment by its id
 List getAttachments(org.ofbiz.core.entity.GenericValue issue)
          Get a list of all attachments for a certain issue
 List getAttachments(Issue issue)
          Get a list of all attachments for a certain issue
 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

getAttachment

Attachment getAttachment(Long id)
                         throws DataAccessException
Get a single attachment by its id

Throws:
DataAccessException

getAttachments

List getAttachments(org.ofbiz.core.entity.GenericValue issue)
                    throws DataAccessException
Get a list of all attachments for a certain issue

Returns:
a list of Attachment objects
Throws:
DataAccessException

getAttachments

List getAttachments(Issue issue)
                    throws DataAccessException
Get a list of all attachments for a certain issue

Returns:
a list of Attachment objects
Throws:
DataAccessException

createAttachmentCopySourceFile

Attachment createAttachmentCopySourceFile(File file,
                                          String filename,
                                          String contentType,
                                          String attachmentAuthor,
                                          Issue issue,
                                          Map attachmentProperties,
                                          Date createdTime)
                                          throws AttachmentException
Create an attachment both on disk, and in the database by copying the provided file instead of moving it.

Parameters:
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 appropriate
attachmentAuthor - The username of the user who created this attachment, this is not validated so it must be a valid username
issue - The id of the issue that this attachment is attached to
attachmentProperties - 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 properties
createdTime - when the attachment was created
Throws:
AttachmentException

createAttachment

ChangeItemBean createAttachment(File file,
                                String filename,
                                String contentType,
                                User remoteUser,
                                org.ofbiz.core.entity.GenericValue issue,
                                Map attachmentProperties,
                                Date createdTime)
                                throws AttachmentException,
                                       org.ofbiz.core.entity.GenericEntityException
Create an attachment both on disk, and in the database.

Parameters:
file - A file on a locally accessible filesystem
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 appropriate
remoteUser - The use who created this attachment
issue - The issue that this attachment is attached to
attachmentProperties - 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 properties
createdTime -
Throws:
AttachmentException
org.ofbiz.core.entity.GenericEntityException

createAttachment

ChangeItemBean createAttachment(File file,
                                String filename,
                                String contentType,
                                User remoteUser,
                                org.ofbiz.core.entity.GenericValue issue)
                                throws AttachmentException,
                                       org.ofbiz.core.entity.GenericEntityException
Same as the createAttachment(java.io.File, String, String, com.opensymphony.user.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.

Parameters:
file - A file on a locally accessible filesystem
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 appropriate
remoteUser - The use who created this attachment
issue - The issue that this attachment is attached to
Returns:
A ChangeItemBean with all the changes to the issue.
Throws:
AttachmentException
org.ofbiz.core.entity.GenericEntityException

createAttachment

Attachment createAttachment(org.ofbiz.core.entity.GenericValue issue,
                            User author,
                            String mimetype,
                            String filename,
                            Long filesize,
                            Map attachmentProperties,
                            Date createdTime)
                            throws org.ofbiz.core.entity.GenericEntityException
Create an attachment in the database. Note that this does not create it on disk, nor does it create a change item.

Parameters:
attachmentProperties - Attachment properties (a Map of String -> Object properties).
createdTime -
Throws:
org.ofbiz.core.entity.GenericEntityException

deleteAttachment

void deleteAttachment(Attachment attachment)
                      throws RemoveException
Delete an attachment from the database and from disk

Throws:
RemoveException - if the attachment cannot be removed from the disk

deleteAttachmentDirectory

void deleteAttachmentDirectory(org.ofbiz.core.entity.GenericValue issue)
                               throws RemoveException,
                                      org.ofbiz.core.entity.GenericEntityException
Delete the attachment directory from disk if the directory is empty

Parameters:
issue - the attachment directory for the issue
Throws:
RemoveException - if the directory can not be removed or is not empty
org.ofbiz.core.entity.GenericEntityException

attachmentsEnabled

boolean attachmentsEnabled()
Determine if attachments have been enabled in JIRA and if the attachments directory exists.

Returns:
true if enabled, false otherwise

isScreenshotAppletEnabled

boolean isScreenshotAppletEnabled()
Determine if screenshot applet has been enabled in JIRA.

Returns:
true if enabled, false otherwise

isScreenshotAppletSupportedByOS

boolean isScreenshotAppletSupportedByOS()
Determine if the screenshot applet is supported by the user's operating system.

Returns:
true if applet is supported by the user's OS, false otherwise


Copyright © 2002-2008 Atlassian. All Rights Reserved.