public interface SmartAttachmentsFacade
| Modifier and Type | Method and Description |
|---|---|
void |
addAttachmentsToCategory(com.atlassian.jira.issue.Issue issue,
int categoryId,
java.util.List<com.atlassian.jira.issue.attachment.Attachment> attachments,
com.atlassian.jira.user.ApplicationUser user)
Places attachments within the category.
|
void |
addDocumentRevision(com.atlassian.jira.issue.Issue issue,
int documentId,
com.atlassian.jira.issue.attachment.Attachment attachment,
com.atlassian.jira.user.ApplicationUser user)
Adds a new revision to the document.
|
void |
addTempAttachmentsToCategory(com.atlassian.jira.issue.Issue issue,
int categoryId,
java.util.List<TempAttachment> tempAttachments)
Adds names of temporary attachments to the category prior to their actual upload.
|
com.atlassian.jira.issue.attachment.Attachment |
archiveAttachments(com.atlassian.jira.issue.Issue issue,
int categoryId,
java.lang.String archiveName,
java.util.List<com.atlassian.jira.issue.attachment.Attachment> attachments,
java.util.List<java.lang.Integer> documentIds,
com.atlassian.jira.user.ApplicationUser user)
Creates a ZIP archive with attachments.
|
Scheme |
copyScheme(int schemeId,
java.lang.String name,
com.atlassian.jira.user.ApplicationUser user)
Creates a copy of the category scheme.
|
Document |
createDocument(com.atlassian.jira.issue.Issue issue,
int categoryId,
java.lang.String name,
java.util.List<com.atlassian.jira.issue.attachment.Attachment> attachments,
com.atlassian.jira.user.ApplicationUser user)
Creates a new document from attachments.
|
Scheme |
createScheme(java.lang.String name,
com.atlassian.jira.user.ApplicationUser user)
Creates a new category scheme.
|
void |
deleteDocument(int documentId)
Converts the document (with revisions) to generic attachments.
|
boolean |
deleteScheme(Scheme scheme)
Deletes the scheme.
|
CategoryConfig |
generateNewConfigCategory(java.lang.String name)
Generates a new category.
|
TempAttachment |
generateTempAttachment(com.atlassian.jira.user.ApplicationUser user,
java.lang.String attachmentName)
Creates an object which corresponds to the temporary attachment.
|
AttachmentCategories |
getAttachmentCategories(com.atlassian.jira.issue.Issue issue)
Returns the list of categories and attachments stored in them for a specific issue.
|
java.util.List<CommentThread> |
getCommentThreadsForAttachment(com.atlassian.jira.issue.attachment.Attachment attachment)
Deprecated.
since 2.15.2. We removed the attachments commenting feature in January 2024
and all the code associated with this feature. In this regard, the method returns an empty array.
At the moment, the list of past comments can only be obtained by direct query to the database.
|
java.util.Optional<Scheme> |
getSchemeByName(java.lang.String name)
Returns a scheme by name.
|
java.util.Optional<Scheme> |
getSchemeByProject(com.atlassian.jira.project.Project project)
Returns the scheme for a specific project.
|
java.util.List<Scheme> |
getSchemes()
Returns the collection with all schemes.
|
void |
removeRevisionsFromDocuments(java.util.List<com.atlassian.jira.issue.attachment.Attachment> attachments)
Deletes the mappings of attachments to documents.
|
void |
removeTempAttachmentsForUser(com.atlassian.jira.issue.Issue issue,
com.atlassian.jira.user.ApplicationUser user,
int categoryId)
Deletes temporary attachments.
|
com.atlassian.jira.issue.attachment.Attachment |
renameAttachment(com.atlassian.jira.issue.attachment.Attachment attachment,
java.lang.String newName,
com.atlassian.jira.user.ApplicationUser user)
Renames the attachment.
|
Document |
renameDocument(com.atlassian.jira.issue.Issue issue,
int documentId,
java.lang.String newName)
Renames the document.
|
Scheme |
updateScheme(Scheme scheme,
com.atlassian.jira.user.ApplicationUser user)
Updates the category scheme.
|
java.util.List<Scheme> getSchemes()
Scheme.java.util.Optional<Scheme> getSchemeByName(java.lang.String name)
Returns the found scheme which is wrapped with Optional.
name - the scheme nameScheme wrapped with OptionalSmartAttachmentsException - if the name provided is null or emptyjava.util.Optional<Scheme> getSchemeByProject(com.atlassian.jira.project.Project project) throws SmartAttachmentsException
Returns the project-specific category scheme wrapped with Optional.
project - ProjectScheme wrapped with OptionalSmartAttachmentsException - if the project provided is nullboolean deleteScheme(Scheme scheme) throws SmartAttachmentsException
Deletes the category scheme if it is not associated with any project. If the category scheme has been already deleted, the method returns true.
scheme - SchemeSmartAttachmentsException - if the scheme provided is nullupdateScheme(Scheme, ApplicationUser)Scheme createScheme(java.lang.String name, com.atlassian.jira.user.ApplicationUser user) throws SmartAttachmentsException
Creates a new category scheme with the specified name. The scheme contains the default Uncategorized category. If the category scheme with such name already exists, the method will return the existing category scheme.
name - the scheme nameuser - ApplicationUserSchemeSmartAttachmentsException - if the category scheme is null or empty or if the user is nullScheme updateScheme(Scheme scheme, com.atlassian.jira.user.ApplicationUser user) throws SmartAttachmentsException
The Scheme entity includes setters that allow you to modify configuration of the category scheme.
This method is use to save the modifications in the category scheme. If the scheme is being edited by someone
the method throws SmartAttachmentsException
scheme - the for updatinguser - ApplicationUser who updating the schemeScheme with stored fieldsSmartAttachmentsException - if parameters are empty or null, the scheme is lockedScheme copyScheme(int schemeId, java.lang.String name, com.atlassian.jira.user.ApplicationUser user) throws SmartAttachmentsException
Copies all settings of the specified category scheme. If the scheme is locked (being edited) by someone
the method throws SmartAttachmentsException
schemeId - ID of the source category schemename - name for the category scheme copyuser - ApplicationUser who copies the schemeSchemeSmartAttachmentsException - if the category scheme name is empty or null, user is null or scheme is lockedCategoryConfig generateNewConfigCategory(java.lang.String name)
Creates a new category with the specified name. The category exists only in memory (RAM). To save it in the category scheme,
you need to put it withing the Scheme object Scheme and run updateScheme(Scheme, ApplicationUser).
The CategoryConfig fields include the default values.
name - the category nameCategoryConfigAttachmentCategories getAttachmentCategories(com.atlassian.jira.issue.Issue issue) throws SmartAttachmentsException
Returns the object which includes the collection of the AttachmentCategory elements.
issue - Jira IssueAttachmentCategoriesSmartAttachmentsException - if issue is nullAttachmentCategoryDocument createDocument(com.atlassian.jira.issue.Issue issue, int categoryId, java.lang.String name, java.util.List<com.atlassian.jira.issue.attachment.Attachment> attachments, com.atlassian.jira.user.ApplicationUser user) throws SmartAttachmentsException
Creates a new document from the specified attachments within the issue.
issue - IssuecategoryId - ID of categoryname - the name of the documentattachments - a collection of Attachmentuser - ApplicationUser author of the documentDocumentSmartAttachmentsException - if any of the parameters is null or collection of attachments has less than 2 itemsvoid deleteDocument(int documentId)
This method deletes the mappings of attachments to the document and all the attachments are preserved in the issue as individual files.
documentId - document's ID for deletingvoid addDocumentRevision(com.atlassian.jira.issue.Issue issue,
int documentId,
com.atlassian.jira.issue.attachment.Attachment attachment,
com.atlassian.jira.user.ApplicationUser user)
throws SmartAttachmentsException
Creates a new document revision based on the attached file.
issue - IssuedocumentId - document's IDattachment - Attachmentuser - ApplicationUser author of the documentSmartAttachmentsException - if issue/attachment/user is null or attachment is already used in another documentvoid removeRevisionsFromDocuments(java.util.List<com.atlassian.jira.issue.attachment.Attachment> attachments)
throws SmartAttachmentsException
The specified attachments remain in the issue as separate attachments. If the document contains fewer than 2 revisions, it is converted to a generic attachment.
attachments - a collection of AttachmentSmartAttachmentsException - if a param 'attachments' is nullvoid addAttachmentsToCategory(com.atlassian.jira.issue.Issue issue,
int categoryId,
java.util.List<com.atlassian.jira.issue.attachment.Attachment> attachments,
com.atlassian.jira.user.ApplicationUser user)
throws SmartAttachmentsException
Moves the specified attachments to the specified category. If the category is not found or the list of attachments is empty, the moving will not run.
issue - IssuecategoryId - ID of the category, AttachmentCategory.getId()attachments - a collection of Attachmentuser - ApplicationUser who performs the actionSmartAttachmentsException - if any of the parameters is nullvoid addTempAttachmentsToCategory(com.atlassian.jira.issue.Issue issue,
int categoryId,
java.util.List<TempAttachment> tempAttachments)
throws SmartAttachmentsException
Adds temporary attachments to the catgory before their actual upload into the issue.
Once attachments appear in the issue, they will be placed to the category according to TempAttachment.
issue - IssuecategoryId - ID of the category, AttachmentCategory.getId()tempAttachments - TempAttachmentSmartAttachmentsException - if any of the parameters is nullgenerateTempAttachment(ApplicationUser, String)TempAttachment generateTempAttachment(com.atlassian.jira.user.ApplicationUser user, java.lang.String attachmentName) throws SmartAttachmentsException
It generates the temporary attachments that are used in addTempAttachmentsToCategory(Issue, int, List).
user - ApplicationUser author of the attachmentattachmentName - name of the future attachmentTempAttachmentSmartAttachmentsException - if any of the parameters is null or attachmentName is emptyaddTempAttachmentsToCategory(Issue, int, List)void removeTempAttachmentsForUser(com.atlassian.jira.issue.Issue issue,
com.atlassian.jira.user.ApplicationUser user,
int categoryId)
throws SmartAttachmentsException
Deletes TempAttachment that was created by the user in the specified category.
issue - Issueuser - ApplicationUsercategoryId - ID of the category, AttachmentCategory.getId()SmartAttachmentsException - if any of the parameters is nulladdTempAttachmentsToCategory(Issue, int, List)com.atlassian.jira.issue.attachment.Attachment archiveAttachments(com.atlassian.jira.issue.Issue issue,
int categoryId,
java.lang.String archiveName,
java.util.List<com.atlassian.jira.issue.attachment.Attachment> attachments,
java.util.List<java.lang.Integer> documentIds,
com.atlassian.jira.user.ApplicationUser user)
throws SmartAttachmentsException
Creates a ZIP archive with the specified attachments and documents.
issue - IssuecategoryId - ID of the category, AttachmentCategory.getId()archiveName - the name of the new archiveattachments - a collection of AttachmentdocumentIds - collection of the document IDs, Document.getId()user - ApplicationUser authorAttachmentSmartAttachmentsException - if any of the parameters is null or the category doesn't existcom.atlassian.jira.issue.attachment.Attachment renameAttachment(com.atlassian.jira.issue.attachment.Attachment attachment,
java.lang.String newName,
com.atlassian.jira.user.ApplicationUser user)
throws SmartAttachmentsException
attachment - AttachmentnewName - a new attachment nameuser - ApplicationUserAttachmentSmartAttachmentsException - if any of the parameters is null or a newName is blankDocument renameDocument(com.atlassian.jira.issue.Issue issue, int documentId, java.lang.String newName) throws SmartAttachmentsException
issue - IssuedocumentId - ID of the documentnewName - a new document nameDocumentSmartAttachmentsException - if any of the parameters is null or newName is blankDocument.getId()@Deprecated java.util.List<CommentThread> getCommentThreadsForAttachment(com.atlassian.jira.issue.attachment.Attachment attachment)
attachment - AttachmentCommentThreadSmartAttachmentsException - if the attachment provided is null