|
||||||||||
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,
org.ofbiz.core.entity.DelegatorInterface genericDelegator,
MimeManager mimeManager,
ApplicationProperties applicationProperties,
AttachmentPathManager attachmentPathManager)
|
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. |
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. |
protected void |
createAttachmentOnDisk(Attachment attachment,
File file,
User user)
|
protected void |
createAttachmentOnDiskCopySourceFile(Attachment attachment,
File file)
|
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<Attachment> |
getAttachments(org.ofbiz.core.entity.GenericValue issue)
Get a list of all attachments for a certain issue |
List<Attachment> |
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 |
---|
public DefaultAttachmentManager(IssueManager issueManager, org.ofbiz.core.entity.DelegatorInterface genericDelegator, MimeManager mimeManager, ApplicationProperties applicationProperties, AttachmentPathManager attachmentPathManager)
Method Detail |
---|
public Attachment getAttachment(Long id)
getAttachment
in interface AttachmentManager
id
- the Attachment ID
public List<Attachment> getAttachments(org.ofbiz.core.entity.GenericValue issue)
getAttachments
in interface AttachmentManager
issue
- the Issue
Attachment
objects for the given issue.public List<Attachment> getAttachments(Issue issue)
AttachmentManager
getAttachments
in interface AttachmentManager
issue
- the Issue
Attachment
objectspublic Attachment createAttachmentCopySourceFile(File file, String filename, String contentType, String attachmentAuthor, Issue issue, Map 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, User author, String mimetype, String filename, Long filesize, Map attachmentProperties, Date createdTime) throws org.ofbiz.core.entity.GenericEntityException
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
org.ofbiz.core.entity.GenericEntityException
- if there is an error in creating the DB record for the attachmentpublic 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(org.ofbiz.core.entity.GenericValue 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
public boolean isScreenshotAppletSupportedByOS()
AttachmentManager
isScreenshotAppletSupportedByOS
in interface AttachmentManager
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
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 mapcreatedTime
- 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)remoteUser
- The use 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 attachmentpublic ChangeItemBean createAttachment(File file, String filename, String contentType, User remoteUser, org.ofbiz.core.entity.GenericValue issue) throws AttachmentException, org.ofbiz.core.entity.GenericEntityException
AttachmentManager
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.
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 use 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 attachmentprotected void createAttachmentOnDisk(Attachment attachment, File file, User user) throws AttachmentException
AttachmentException
protected void createAttachmentOnDiskCopySourceFile(Attachment attachment, File file) throws AttachmentException
AttachmentException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |