com.atlassian.jira.issue.managers
Class DefaultAttachmentManager

java.lang.Object
  extended by com.atlassian.jira.issue.managers.DefaultAttachmentManager
All Implemented Interfaces:
AttachmentManager

public class DefaultAttachmentManager
extends Object
implements AttachmentManager


Constructor Summary
DefaultAttachmentManager(IssueManager issueManager, org.ofbiz.core.entity.DelegatorInterface genericDelegator, MimeManager mimeManager, ApplicationProperties applicationProperties)
           
 
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 AttachmentManager.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.
protected  void createAttachmentOnDisk(Attachment attachment, File file, User user)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAttachmentManager

public DefaultAttachmentManager(IssueManager issueManager,
                                org.ofbiz.core.entity.DelegatorInterface genericDelegator,
                                MimeManager mimeManager,
                                ApplicationProperties applicationProperties)
Method Detail

getAttachment

public Attachment getAttachment(Long id)
Get a single attachment by its id.

Specified by:
getAttachment in interface AttachmentManager
Returns:
The attachment, or null if that id was not found.

getAttachments

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

Specified by:
getAttachments in interface AttachmentManager
Returns:
a list of Attachment objects

getAttachments

public List getAttachments(Issue issue)
Description copied from interface: AttachmentManager
Get a list of all attachments for a certain issue

Specified by:
getAttachments in interface AttachmentManager
Returns:
a list of Attachment objects

createAttachment

public 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
Description copied from interface: AttachmentManager
Create an attachment in the database. Note that this does not create it on disk, nor does it create a change item.

Specified by:
createAttachment in interface AttachmentManager
attachmentProperties - Attachment properties (a Map of String -> Object properties).
Throws:
org.ofbiz.core.entity.GenericEntityException

deleteAttachment

public void deleteAttachment(Attachment attachment)
                      throws RemoveException
Description copied from interface: AttachmentManager
Delete an attachment from the database and from disk

Specified by:
deleteAttachment in interface AttachmentManager
Throws:
RemoveException - if the attachment cannot be removed from the disk

deleteAttachmentDirectory

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

Specified by:
deleteAttachmentDirectory in interface AttachmentManager
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

public boolean attachmentsEnabled()
Description copied from interface: AttachmentManager
Determine if attachments have been enabled in JIRA and if the attachments directory exists.

Specified by:
attachmentsEnabled in interface AttachmentManager
Returns:
true if enabled, false otherwise

isScreenshotAppletEnabled

public boolean isScreenshotAppletEnabled()
Description copied from interface: AttachmentManager
Determine if screenshot applet has been enabled in JIRA.

Specified by:
isScreenshotAppletEnabled in interface AttachmentManager
Returns:
true if enabled, false otherwise

isScreenshotAppletSupportedByOS

public boolean isScreenshotAppletSupportedByOS()
Description copied from interface: AttachmentManager
Determine if the screenshot applet is supported by the user's operating system.

Specified by:
isScreenshotAppletSupportedByOS in interface AttachmentManager
Returns:
true if applet is supported by the user's OS, false otherwise

createAttachment

public 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
Description copied from interface: AttachmentManager
Create an attachment both on disk, and in the database.

Specified by:
createAttachment in interface AttachmentManager
Parameters:
contentType - The desired contentType. This may be modified if a better alternative is suggested by MimeManager.getSanitisedMimeType(String, String)
attachmentProperties - String -> Object property map
createdTime -
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)
remoteUser - The use who created this attachment
issue - The issue that this attachment is attached to
Throws:
AttachmentException
org.ofbiz.core.entity.GenericEntityException

createAttachment

public ChangeItemBean createAttachment(File file,
                                       String filename,
                                       String contentType,
                                       User remoteUser,
                                       org.ofbiz.core.entity.GenericValue issue)
                                throws AttachmentException,
                                       org.ofbiz.core.entity.GenericEntityException
Description copied from interface: AttachmentManager
Same as the AttachmentManager.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.

Specified by:
createAttachment in interface AttachmentManager
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

createAttachmentOnDisk

protected void createAttachmentOnDisk(Attachment attachment,
                                      File file,
                                      User user)
                               throws org.ofbiz.core.entity.GenericEntityException,
                                      AttachmentException
Throws:
org.ofbiz.core.entity.GenericEntityException
AttachmentException


Copyright © 2002-2007 Atlassian. All Rights Reserved.