public class AttachmentServiceImpl extends Object implements AttachmentService
AttachmentService.AttachmentFinder, AttachmentService.Validator
COMMENT_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 . |
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
AttachmentService
Content
.addAttachments
in interface AttachmentService
containerId
- the id of the content to attach touploads
- the attachments being uploadedServiceException
public PageResponse<Content> addAttachments(ContentId containerId, ContentStatus containerStatus, Collection<AttachmentUpload> uploads) throws ServiceException
AttachmentService
Content
.addAttachments
in interface AttachmentService
containerId
- the id of the content to attach tocontainerStatus
- the status of the container, specifically allows adding attachments to draftsuploads
- the attachments being uploadedServiceException
public AttachmentService.AttachmentFinder find(Expansion... expansions)
AttachmentService
Currently 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 AttachmentService
expansions
- the expansions to apply to the values returned from a fetchpublic Content update(Content updatedContent) throws ServiceException
AttachmentService
Content
instance.
This method can be used to update the container, filename, media-type and comment of an Attachment.
update
in interface AttachmentService
updatedContent
- the attachment to update, must include an idServiceException
public Content updateData(ContentId attachmentId, AttachmentUpload upload) throws ServiceException
AttachmentService
Content
instance.updateData
in interface AttachmentService
attachmentId
- the id of the attachment to updateupload
- the new content of the AttachmentServiceException
public void delete(Content attachmentContent) throws ServiceException
AttachmentService
delete
in interface AttachmentService
attachmentContent
- the content to trashServiceException
- if the content cannot be found, or cannot be deletedpublic com.atlassian.confluence.api.impl.service.content.AttachmentServiceImpl.ValidatorImpl validator()
AttachmentService
validator
in interface AttachmentService
Copyright © 2003–2017 Atlassian. All rights reserved.