com.atlassian.confluence.api.impl.service.content
Class AttachmentServiceImpl

java.lang.Object
  extended by com.atlassian.confluence.api.impl.service.content.AttachmentServiceImpl
All Implemented Interfaces:
AttachmentService

public class AttachmentServiceImpl
extends Object
implements AttachmentService


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.confluence.api.service.content.AttachmentService
AttachmentService.AttachmentFinder, AttachmentService.Validator
 
Field Summary
 
Fields inherited from interface com.atlassian.confluence.api.service.content.AttachmentService
COMMENT_METADATA_KEY, MEDIA_TYPE_METADATA_KEY
 
Constructor Summary
AttachmentServiceImpl(PermissionManager permissionManager, ContentEntityManager contentEntityManager, FileUploadManager fileUploadManager, AttachmentManagerInternal attachmentManager, AttachmentFactory attachmentFactory, AttachmentContentTypeApiSupport binding, org.springframework.aop.Advisor transactionAdvice)
           
 
Method Summary
 PageResponse<Content> addAttachments(ContentId containerId, Collection<AttachmentUpload> uploads)
          Add one or more attachments to a piece of Content.
 void delete(Content attachmentContent)
          Removes an Attachment from the system.
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachmentServiceImpl

public AttachmentServiceImpl(PermissionManager permissionManager,
                             ContentEntityManager contentEntityManager,
                             FileUploadManager fileUploadManager,
                             AttachmentManagerInternal attachmentManager,
                             AttachmentFactory attachmentFactory,
                             AttachmentContentTypeApiSupport binding,
                             org.springframework.aop.Advisor transactionAdvice)
Method Detail

addAttachments

public PageResponse<Content> addAttachments(ContentId containerId,
                                            Collection<AttachmentUpload> uploads)
                                     throws ServiceException
Description copied from interface: AttachmentService
Add one or more attachments to a piece of Content.

Specified by:
addAttachments in interface AttachmentService
Parameters:
containerId - the id of the content to attach to
uploads - the attachments being uploaded
Returns:
the attachments added
Throws:
ServiceException

find

public AttachmentService.AttachmentFinder find(Expansion... expansions)
Description copied from interface: AttachmentService
Creates an attachment finder for locating attachments. 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();
 
 

Specified by:
find in interface AttachmentService
Parameters:
expansions - the expansions to apply to the values returned from a fetch
Returns:
an AttachmentFinder

update

public Content update(Content updatedContent)
               throws ServiceException
Description copied from interface: AttachmentService
Updates the non-data parts of an Attachment Content instance.

This method can be used to update the container, filename, media-type and comment of an Attachment.

Specified by:
update in interface AttachmentService
Parameters:
updatedContent - the attachment to update, must include an id
Returns:
the updated attachment as stored in the database
Throws:
ServiceException

updateData

public Content updateData(ContentId attachmentId,
                          AttachmentUpload upload)
                   throws ServiceException
Description copied from interface: AttachmentService
Updates the data part of an Attachment Content instance.

Specified by:
updateData in interface AttachmentService
Parameters:
attachmentId - the id of the attachment to update
upload - the new content of the Attachment
Returns:
the updated attachment as stored in the database
Throws:
ServiceException

delete

public void delete(Content attachmentContent)
            throws ServiceException
Description copied from interface: AttachmentService
Removes an Attachment from the system.

Specified by:
delete in interface AttachmentService
Parameters:
attachmentContent - the content to remove
Throws:
ServiceException - if the content cannot be found, or cannot be deleted

validator

public com.atlassian.confluence.api.impl.service.content.AttachmentServiceImpl.ValidatorImpl validator()
Description copied from interface: AttachmentService
Provides a validator for validating actions on the AttachmentService and checking permissions related to attachments on Content

Specified by:
validator in interface AttachmentService
Returns:
an attachmentService Validator


Copyright © 2003–2015 Atlassian. All rights reserved.