public class AttachmentServiceImpl extends Object implements AttachmentService
AttachmentService.AttachmentFinder, AttachmentService.ValidatorCOMMENT_METADATA_KEY, FILE_SIZE, LABELS_METADATA_KEY, MEDIA_TYPE_METADATA_KEY| Constructor and Description |
|---|
AttachmentServiceImpl(PermissionManager permissionManager,
ContentEntityManager contentEntityManager,
FileUploadManager fileUploadManager,
AttachmentManagerInternal attachmentManager,
ContentFactory contentFactory,
AttachmentContentTypeApiSupport binding,
FinderProxyFactory finderProxyFactory,
ContentTrashService trashService) |
| Modifier and Type | Method and Description |
|---|---|
PageResponse<Content> |
addAttachments(ContentId containerId,
Collection<AttachmentUpload> uploads)
Add one or more attachments to a piece of
Content. |
PageResponse<Content> |
addAttachments(ContentId containerId,
ContentStatus containerStatus,
Collection<AttachmentUpload> uploads)
Add one or more attachments to a piece of
Content. |
PageResponse<Content> |
addAttachments(ContentId containerId,
ContentStatus containerStatus,
Collection<AttachmentUpload> uploads,
boolean allowDuplicated,
Expansions expansions)
Add one or more attachments to a piece of
Content. |
void |
delete(Content attachmentContent)
Moves an Attachment to trash.
|
AttachmentService.AttachmentFinder |
find(Expansion... expansions)
Creates an attachment finder for locating attachments.
|
Content |
update(Content updatedContent)
Updates the non-data parts of an Attachment
Content instance. |
Content |
updateData(ContentId attachmentId,
AttachmentUpload upload)
Updates the data part of an Attachment
Content instance. |
com.atlassian.confluence.api.impl.service.content.AttachmentServiceImpl.ValidatorImpl |
validator()
Provides a validator for validating actions on the AttachmentService and checking permissions
related to attachments on Content
|
public AttachmentServiceImpl(PermissionManager permissionManager, ContentEntityManager contentEntityManager, FileUploadManager fileUploadManager, AttachmentManagerInternal attachmentManager, ContentFactory contentFactory, AttachmentContentTypeApiSupport binding, FinderProxyFactory finderProxyFactory, ContentTrashService trashService)
public PageResponse<Content> addAttachments(ContentId containerId, Collection<AttachmentUpload> uploads) throws ServiceException
AttachmentServiceContent.addAttachments in interface AttachmentServicecontainerId - the id of the content to attach touploads - the attachments being uploadedServiceExceptionpublic PageResponse<Content> addAttachments(ContentId containerId, ContentStatus containerStatus, Collection<AttachmentUpload> uploads) throws ServiceException
AttachmentServiceContent.addAttachments in interface AttachmentServicecontainerId - the id of the content to attach tocontainerStatus - the status of the container, specifically allows adding attachments to draftsuploads - the attachments being uploadedServiceExceptionpublic PageResponse<Content> addAttachments(ContentId containerId, ContentStatus containerStatus, Collection<AttachmentUpload> uploads, boolean allowDuplicated, Expansions expansions) throws ServiceException
AttachmentServiceContent.addAttachments in interface AttachmentServicecontainerId - the id of the content to attach tocontainerStatus - the status of the container, specifically allows adding attachments to draftsuploads - the attachments being uploadedexpansions - the expansions to apply to the values returned after uploadedServiceExceptionpublic AttachmentService.AttachmentFinder find(Expansion... expansions)
AttachmentServiceCurrently an attachment finder requires a Content container id, unless the attachment is being requested by its id via the "withId" method.
For example, to locate an attachment in a given page with a particular filename:
Content attachment = attachmentService.find()
.withContainerId(pageId)
.withFilename("myfile.txt")
.fetchOneOrNull();
find in interface AttachmentServiceexpansions - the expansions to apply to the values returned from a fetchpublic Content update(Content updatedContent) throws ServiceException
AttachmentServiceContent instance.
This method can be used to update the container, filename, media-type and comment of an Attachment.
update in interface AttachmentServiceupdatedContent - the attachment to update, must include an idServiceExceptionpublic Content updateData(ContentId attachmentId, AttachmentUpload upload) throws ServiceException
AttachmentServiceContent instance.updateData in interface AttachmentServiceattachmentId - the id of the attachment to updateupload - the new content of the AttachmentServiceExceptionpublic void delete(Content attachmentContent) throws ServiceException
AttachmentServicedelete in interface AttachmentServiceattachmentContent - the content to trashServiceException - if the content cannot be found, or cannot be deletedpublic com.atlassian.confluence.api.impl.service.content.AttachmentServiceImpl.ValidatorImpl validator()
AttachmentServicevalidator in interface AttachmentServiceCopyright © 2003–2020 Atlassian. All rights reserved.