com.atlassian.jira.issue
Interface AttachmentManager

All Known Implementing Classes:
DefaultAttachmentManager

public interface AttachmentManager


Method Summary
 ChangeItemBean createAttachment(java.io.File file, java.lang.String filename, java.lang.String contentType, com.opensymphony.user.User remoteUser, org.ofbiz.core.entity.GenericValue issue)
          Create an attachment both on disk, and in the database.
 Attachment createAttachment(org.ofbiz.core.entity.GenericValue issue, com.opensymphony.user.User author, java.lang.String mimetype, java.lang.String filename, java.lang.Long filesize)
          Create an attachment in the database.
 void deleteAttachment(Attachment attachment)
          Delete an attachment from the database and from disk
 Attachment getAttachment(java.lang.Long id)
          Get a single attachment by its id
 java.util.List getAttachments(org.ofbiz.core.entity.GenericValue issue)
          Get a list of all attachments for a certain issue
 boolean isAttachable(com.opensymphony.user.User user, org.ofbiz.core.entity.GenericValue entity)
          Determine if this user can attach a file to this issue.
 

Method Detail

getAttachment

public Attachment getAttachment(java.lang.Long id)
                         throws org.ofbiz.core.entity.GenericEntityException
Get a single attachment by its id

Throws:
org.ofbiz.core.entity.GenericEntityException

getAttachments

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

Returns:
a list of Attachment objects
Throws:
org.ofbiz.core.entity.GenericEntityException

createAttachment

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

createAttachment

public Attachment createAttachment(org.ofbiz.core.entity.GenericValue issue,
                                   com.opensymphony.user.User author,
                                   java.lang.String mimetype,
                                   java.lang.String filename,
                                   java.lang.Long filesize)
                            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.

Throws:
org.ofbiz.core.entity.GenericEntityException

deleteAttachment

public void deleteAttachment(Attachment attachment)
                      throws org.ofbiz.core.entity.GenericEntityException,
                             RemoveException
Delete an attachment from the database and from disk

Throws:
RemoveException - if the attachment cannot be removed from the disk
org.ofbiz.core.entity.GenericEntityException

isAttachable

public boolean isAttachable(com.opensymphony.user.User user,
                            org.ofbiz.core.entity.GenericValue entity)
Determine if this user can attach a file to this issue. This method will return true if the user both has the permissions to attach the file, and attachments are enabled and working.

Parameters:
entity - Either a project or an Issue


Copyright © 2002-2005 Atlassian. All Rights Reserved.