com.atlassian.confluence.ui.rest.service.content
Class ContentServiceImpl

java.lang.Object
  extended by com.atlassian.confluence.ui.rest.service.content.ContentServiceImpl
All Implemented Interfaces:
ContentService

public class ContentServiceImpl
extends java.lang.Object
implements ContentService


Constructor Summary
ContentServiceImpl(PageManager pageManager, CommentManager commentManager, ContentEntityManager contentEntityManager, PermissionManager permissionManager, ContentBuilder contentBuilder, ContentBodyBuilder contentBodyBuilder, FormatConverter formatConverter, ThemeManager themeManager, CustomLayoutManager customLayoutManager, LabelsService labelsService)
           
 
Method Summary
 java.lang.Iterable<Label> addLabels(long contentId, java.lang.Iterable<Label> labels)
          Adds the given labels to the specified content
 com.atlassian.fugue.Option<Content> find(ContentLocator locator, Expansion... expansions)
          Retrieve a piece of content by some more complex criteria (defined by the ContentLocator).
 com.atlassian.fugue.Option<Content> findById(long id, Expansion... expansions)
          Retrieve a piece of content by its ID.
 com.atlassian.fugue.Option<Content> findCurrentVersion(long id, Expansion... expansions)
          Retrieve the next version of a piece of content, if it exists
 com.atlassian.fugue.Option<Content> findNextVersion(long id, Expansion... expansions)
          Retrieve the next version of a piece of content, if it exists
 com.atlassian.fugue.Option<Content> findPreviousVersion(long id, Expansion... expansions)
          Retrieve the next version of a piece of content, if it exists
 PartialList<Content> findSubContent(long id, ContentType subContentType, int offset, int count, Expansion... expansions)
          Retrieve content that is "contained within" some other piece of content (i.e.
 PartialList<ContentTree> findSubContentTree(long parentId, ContentType subContentType, Expansion... expansions)
          Retrieve content that is "contained within" some other piece of content (i.e.
 ContentBody getContentBody(long contentId, ContentRepresentation contentRepresentation)
          Get the body of a piece of content in a given representation
 java.lang.Iterable<Label> getLabels(long contentId, java.util.Collection<Label.Prefix> prefixes)
          Get the labels attached to a given piece of content in the given namespaces
 java.lang.String getThemeKey(long contentId)
          Temporary method to check whether the page/blog post represented by contentId uses a theme that the new stack can render.
 boolean hasCustomLayout(java.lang.String spaceKey)
          Temporary method to check whether a space has custom layouts applied to it
 void removeLabel(long contentId, long labelId)
          Remove a label with labelId from the specified content
 ContentBody updateContentBody(long contentId, ContentRepresentation contentRepresentation, ContentBody body)
          Update the body of a given piece of content (i.e.
 java.lang.Iterable<Label> validateLabels(java.lang.Iterable<Label> labels)
          Validates the list of labels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentServiceImpl

public ContentServiceImpl(PageManager pageManager,
                          CommentManager commentManager,
                          ContentEntityManager contentEntityManager,
                          PermissionManager permissionManager,
                          ContentBuilder contentBuilder,
                          ContentBodyBuilder contentBodyBuilder,
                          FormatConverter formatConverter,
                          ThemeManager themeManager,
                          CustomLayoutManager customLayoutManager,
                          LabelsService labelsService)
Method Detail

findById

public com.atlassian.fugue.Option<Content> findById(long id,
                                                    Expansion... expansions)
Description copied from interface: ContentService
Retrieve a piece of content by its ID.

Specified by:
findById in interface ContentService
Parameters:
id - the id of the content to retrieve.
Returns:
the content, if any exists by this ID and optional type restriction, or none otherwise.

findNextVersion

public com.atlassian.fugue.Option<Content> findNextVersion(long id,
                                                           Expansion... expansions)
Description copied from interface: ContentService
Retrieve the next version of a piece of content, if it exists

Specified by:
findNextVersion in interface ContentService
Parameters:
id - the id of the content in question
Returns:
the next version of the content, if it exists

findPreviousVersion

public com.atlassian.fugue.Option<Content> findPreviousVersion(long id,
                                                               Expansion... expansions)
Description copied from interface: ContentService
Retrieve the next version of a piece of content, if it exists

Specified by:
findPreviousVersion in interface ContentService
Parameters:
id - the id of the content in question
Returns:
the previous version of the content, if it exists

findCurrentVersion

public com.atlassian.fugue.Option<Content> findCurrentVersion(long id,
                                                              Expansion... expansions)
Description copied from interface: ContentService
Retrieve the next version of a piece of content, if it exists

Specified by:
findCurrentVersion in interface ContentService
Parameters:
id - the id of the content in question
Returns:
the current version of the content, if it exists

find

public com.atlassian.fugue.Option<Content> find(ContentLocator locator,
                                                Expansion... expansions)
Description copied from interface: ContentService
Retrieve a piece of content by some more complex criteria (defined by the ContentLocator).

Specified by:
find in interface ContentService
Parameters:
locator - the locator containing the criteria for the content you are looking for
Returns:
the content, if one exists matching the criteria, or none otherwise.

findSubContent

public PartialList<Content> findSubContent(long id,
                                           ContentType subContentType,
                                           int offset,
                                           int count,
                                           Expansion... expansions)
Description copied from interface: ContentService
Retrieve content that is "contained within" some other piece of content (i.e. comments attached to a page).

Specified by:
findSubContent in interface ContentService

findSubContentTree

public PartialList<ContentTree> findSubContentTree(long parentId,
                                                   ContentType subContentType,
                                                   Expansion... expansions)
Description copied from interface: ContentService
Retrieve content that is "contained within" some other piece of content (i.e. comments attached to a page), returned as a tree of parent/child content to a given depth. Any expansions are applied to every node of the tree. This method should have some kind of depth sanity, but I can't think how...

Specified by:
findSubContentTree in interface ContentService

getContentBody

public ContentBody getContentBody(long contentId,
                                  ContentRepresentation contentRepresentation)
                           throws NotFoundException,
                                  InvalidRepresentationException
Description copied from interface: ContentService
Get the body of a piece of content in a given representation

Specified by:
getContentBody in interface ContentService
Parameters:
contentId - The ID of the content to look up
contentRepresentation - the format in which to render the content body
Returns:
the requested content body
Throws:
NotFoundException - if the content does not exist, or is not viewable by the user
InvalidRepresentationException - if the content can not be provided in the requested representation

updateContentBody

public ContentBody updateContentBody(long contentId,
                                     ContentRepresentation contentRepresentation,
                                     ContentBody body)
                              throws NotFoundException,
                                     InvalidRepresentationException,
                                     NotPermittedException
Description copied from interface: ContentService
Update the body of a given piece of content (i.e. perform an edit)

Specified by:
updateContentBody in interface ContentService
Parameters:
contentId - the ID of the content to edit
contentRepresentation - the way the content is represented in the body
body - the new body for the given content
Throws:
NotFoundException - if the content does not exist, or is not viewable by the user
InvalidRepresentationException - if the content can not be provided in the requested representation
NotPermittedException - if the current user does not have permission to update the content

getLabels

public java.lang.Iterable<Label> getLabels(long contentId,
                                           java.util.Collection<Label.Prefix> prefixes)
                                    throws NotFoundException
Description copied from interface: ContentService
Get the labels attached to a given piece of content in the given namespaces

Specified by:
getLabels in interface ContentService
Parameters:
contentId - the id of the content to retrieve
Throws:
NotFoundException - if the content does not exist, or is not viewable by the user

addLabels

public java.lang.Iterable<Label> addLabels(long contentId,
                                           java.lang.Iterable<Label> labels)
                                    throws java.lang.IllegalArgumentException
Description copied from interface: ContentService
Adds the given labels to the specified content

Specified by:
addLabels in interface ContentService
Parameters:
contentId - the id of the content to add labels to
labels - the label(s) that will be added
Returns:
all the labels that are associated with the specified content
Throws:
java.lang.IllegalArgumentException - if at least one label is invalid. Provides an error message

removeLabel

public void removeLabel(long contentId,
                        long labelId)
                 throws java.lang.IllegalArgumentException
Description copied from interface: ContentService
Remove a label with labelId from the specified content

Specified by:
removeLabel in interface ContentService
Parameters:
contentId - the id of the content to remove the label from
labelId - the id of the label to remove
Throws:
java.lang.IllegalArgumentException - failed to remove the label

validateLabels

public java.lang.Iterable<Label> validateLabels(java.lang.Iterable<Label> labels)
                                         throws java.lang.IllegalArgumentException
Description copied from interface: ContentService
Validates the list of labels

Specified by:
validateLabels in interface ContentService
Parameters:
labels - the list of labels to validate
Returns:
the list of labels iff all labels are valid
Throws:
java.lang.IllegalArgumentException - if at least one label is invalid. Provides an error message

getThemeKey

public java.lang.String getThemeKey(long contentId)
Description copied from interface: ContentService
Temporary method to check whether the page/blog post represented by contentId uses a theme that the new stack can render.

Specified by:
getThemeKey in interface ContentService
Returns:
String of the form "pluginKey:moduleKey" if the content represents a page/blog post, null otherwise

hasCustomLayout

public boolean hasCustomLayout(java.lang.String spaceKey)
Description copied from interface: ContentService
Temporary method to check whether a space has custom layouts applied to it

Specified by:
hasCustomLayout in interface ContentService


Copyright © 2003-2014 Atlassian. All Rights Reserved.