com.atlassian.confluence.rest.client
Class RemoteAttachmentServiceImpl

java.lang.Object
  extended by com.atlassian.confluence.rest.client.AbstractRemoteService<AttachmentService>
      extended by com.atlassian.confluence.rest.client.RemoteAttachmentServiceImpl
All Implemented Interfaces:
RemoteAttachmentService

public class RemoteAttachmentServiceImpl
extends AbstractRemoteService<AttachmentService>
implements RemoteAttachmentService

AttachmentService implementation that communicates with Confluence remotely using the Confluence REST api


Constructor Summary
RemoteAttachmentServiceImpl(AuthenticatedWebResourceProvider provider, com.google.common.util.concurrent.ListeningExecutorService executor)
           
 
Method Summary
 java.util.concurrent.Future<PageResponse<Content>> addAttachments(ContentId contentId, java.util.Collection<AttachmentUpload> uploads)
          Add one or more attachments to a piece of Content.
 java.util.concurrent.Future<java.lang.Boolean> canCreateAttachments(ContentId contentId)
          Checks if the user is permitted to add attachments to the given content
 java.util.concurrent.Future<com.atlassian.fugue.Option<Content>> findByContainerAndFilename(ContentId containerId, java.lang.String filename, Expansion... expansions)
          Locates a single Attachment given the id of its container Content and its file name.
 java.util.concurrent.Future<PageResponse<Content>> getAttachments(ContentId contentId, PageRequest pageRequest, AttachmentFilter filter, Expansion... expansions)
          Get a page of attachments under the Content with the specified id.
 java.util.concurrent.Future<Content> updateData(ContentId attachmentId, AttachmentUpload upload)
          Updates the data part of an Attachment Content instance.
 
Methods inherited from class com.atlassian.confluence.rest.client.AbstractRemoteService
addExpansions, addPageRequest, addPageRequestParams, deleteFuture, getFutureGenericCollection, getFutureMapOfPageResponses, getFutureOption, getFuturePageResponseList, newRestWebResource, postFuture, postFuture, postFuture, postFutureToPageResponse, putFuture
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteAttachmentServiceImpl

public RemoteAttachmentServiceImpl(AuthenticatedWebResourceProvider provider,
                                   com.google.common.util.concurrent.ListeningExecutorService executor)
Method Detail

addAttachments

public java.util.concurrent.Future<PageResponse<Content>> addAttachments(ContentId contentId,
                                                                         java.util.Collection<AttachmentUpload> uploads)
                                                                  throws ServiceException
Description copied from interface: RemoteAttachmentService
Add one or more attachments to a piece of Content.

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

canCreateAttachments

public java.util.concurrent.Future<java.lang.Boolean> canCreateAttachments(ContentId contentId)
Description copied from interface: RemoteAttachmentService
Checks if the user is permitted to add attachments to the given content

Specified by:
canCreateAttachments in interface RemoteAttachmentService
Parameters:
contentId - the id of the content to attach to
Returns:
true if the user can add attachments to the given content

getAttachments

public java.util.concurrent.Future<PageResponse<Content>> getAttachments(ContentId contentId,
                                                                         PageRequest pageRequest,
                                                                         AttachmentFilter filter,
                                                                         Expansion... expansions)
                                                                  throws ServiceException
Description copied from interface: RemoteAttachmentService
Get a page of attachments under the Content with the specified id.

Specified by:
getAttachments in interface RemoteAttachmentService
Parameters:
contentId - id of the Content that contains the attachments.
pageRequest - - a pageRequest indicating how much content to retrieve.
filter - - a filter to apply to the found Attachments
expansions - the expansions to apply to each Attachment in the returned page
Returns:
a page of attachments
Throws:
ServiceException

findByContainerAndFilename

public java.util.concurrent.Future<com.atlassian.fugue.Option<Content>> findByContainerAndFilename(ContentId containerId,
                                                                                                   java.lang.String filename,
                                                                                                   Expansion... expansions)
                                                                                            throws ServiceException
Description copied from interface: RemoteAttachmentService
Locates a single Attachment given the id of its container Content and its file name.

Specified by:
findByContainerAndFilename in interface RemoteAttachmentService
Parameters:
containerId - the id of the content containing the attachment
filename - the name of the attachment file
expansions - expansions to return on the Attachment content
Returns:
the found attachment in an Option
Throws:
ServiceException

updateData

public java.util.concurrent.Future<Content> updateData(ContentId attachmentId,
                                                       AttachmentUpload upload)
                                                throws ServiceException
Description copied from interface: RemoteAttachmentService
Updates the data part of an Attachment Content instance.

Specified by:
updateData in interface RemoteAttachmentService
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


Copyright © 2003-2014 Atlassian. All Rights Reserved.