com.atlassian.confluence.it.rpc
Class LabelsRpc

java.lang.Object
  extended by com.atlassian.confluence.it.rpc.LabelsRpc

public class LabelsRpc
extends Object

Makes CRUD RPC calls for Labels and Labelled content.


Constructor Summary
LabelsRpc(ConfluenceRpc rpc, AuthenticatedWebResourceProvider authenticatedWebResourceProvider)
           
 
Method Summary
 boolean addLabel(long labelId, long contentId)
          Adds a label to the content specified by the supplied contentId
 void addLabel(String label, AbstractContentEntity target)
           
 boolean addLabelByObject(Object remoteLabel, Page page)
          Adds a label to the specified page
 void addLabelToLabelable(long labelableId, LabelableType type, String label)
           
 Hashtable<String,Object> getAllContentForAllLabels(int offset, int maxResults, String labelsString)
           
 Hashtable<String,Object> getContentForAllLabels(int offset, int maxResults, String labelsString)
           
 Hashtable<String,Object> getContentInSpacesForAllLabels(int offset, int maxResults, String spaceKeys, String labelsString)
           
 Hashtable<String,Object> getForLabels(LabelableType labelableType, int offset, int maxResults, String labelsString)
           
 List<SearchResult> getLabelContentById(long labelId)
           
 List<SearchResult> getLabelContentByName(String labelName)
           
 List<SearchResult> getLabelContentByObject(Object remoteLabel)
          Returns the content for a given label object
 List<Label> getLabels(long pageId)
          Retrieves the labels for the page matching the specified pageId
 List<Label> getLabels(String labelName, String namespace, String spaceKey, String owner)
          Retrieves the labels matching the given labelName, namespace or owner.
 List<Label> getMostPopularLabels(int maxCount)
          Returns the most popular labels
 List<Label> getMostPopularLabelsInSpace(String spaceKey, int maxCount)
          Returns the most popular labels in the space with the specified key
 List<Label> getRecentlyUsedLabels(int maxCount)
          Returns the recently used labels for the Confluence instance, with a specified maximum number of results.
 List<Label> getRecentlyUsedLabelsInSpace(String spaceKey, int maxCount)
          Returns the recently used labels in the space with the specified key
 List<Label> getRelatedLabels(String labelName, int maxCount)
          Returns the labels related to the given label name
 List<Label> getRelatedLabelsInSpace(String labelName, String spaceKey, int maxCount)
          Returns the labels related to the given label name in the given space
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelsRpc

public LabelsRpc(ConfluenceRpc rpc,
                 AuthenticatedWebResourceProvider authenticatedWebResourceProvider)
Method Detail

addLabelToLabelable

public void addLabelToLabelable(long labelableId,
                                LabelableType type,
                                String label)

addLabel

public void addLabel(String label,
                     AbstractContentEntity target)

addLabel

public boolean addLabel(long labelId,
                        long contentId)
Adds a label to the content specified by the supplied contentId

Parameters:
labelId - id of the label to add
contentId - id of a page or blogpost to add the label to
Returns:
true if the label is successfully added

addLabelByObject

public boolean addLabelByObject(Object remoteLabel,
                                Page page)
Adds a label to the specified page

Parameters:
remoteLabel - the object retrieved from a direct call to an rpc method that returns a label, i.e. this parameter should be the return value of ConfluenceRpc.execute(String, Object...) and not any of wrapper methods that return a Label object
page - page to add the label to
Returns:
true if the label is successfully added

getForLabels

public Hashtable<String,Object> getForLabels(LabelableType labelableType,
                                             int offset,
                                             int maxResults,
                                             String labelsString)

getContentForAllLabels

public Hashtable<String,Object> getContentForAllLabels(int offset,
                                                       int maxResults,
                                                       String labelsString)

getAllContentForAllLabels

public Hashtable<String,Object> getAllContentForAllLabels(int offset,
                                                          int maxResults,
                                                          String labelsString)

getContentInSpacesForAllLabels

public Hashtable<String,Object> getContentInSpacesForAllLabels(int offset,
                                                               int maxResults,
                                                               String spaceKeys,
                                                               String labelsString)

getLabels

public List<Label> getLabels(long pageId)
Retrieves the labels for the page matching the specified pageId

Returns:
labels for the page

getLabels

public List<Label> getLabels(String labelName,
                             String namespace,
                             String spaceKey,
                             String owner)
Retrieves the labels matching the given labelName, namespace or owner. This method can be used to retrieve labels of a specific type, such as personal labels, by setting the namespace. Parameters with empty strings are ignored.

Parameters:
labelName - the name of the label to search for (not parsed for prefixes)
namespace - the namespace to restrict by
spaceKey - the key of the space to restrict by
owner - the owner of the labels
Returns:
labels matching the specified details

getMostPopularLabels

public List<Label> getMostPopularLabels(int maxCount)
Returns the most popular labels

Parameters:
maxCount - the maximum number of labels to return, or no limit if this is 0
Returns:
labels sorted by descending popularity

getMostPopularLabelsInSpace

public List<Label> getMostPopularLabelsInSpace(String spaceKey,
                                               int maxCount)
Returns the most popular labels in the space with the specified key

Parameters:
spaceKey - key for the space
maxCount - the maximum number of labels to return, or no limit if this is 0
Returns:
labels sorted by descending popularity

getRecentlyUsedLabels

public List<Label> getRecentlyUsedLabels(int maxCount)
Returns the recently used labels for the Confluence instance, with a specified maximum number of results.

Parameters:
maxCount - the maximum number of labels to return, or the default if this is 0
Returns:
labels sorted by most recent use

getRecentlyUsedLabelsInSpace

public List<Label> getRecentlyUsedLabelsInSpace(String spaceKey,
                                                int maxCount)
Returns the recently used labels in the space with the specified key

Parameters:
spaceKey - key for the space
maxCount - the maximum number of labels to return, or the default if this is 0
Returns:
labels sorted by most recent use

getRelatedLabels

public List<Label> getRelatedLabels(String labelName,
                                    int maxCount)
Returns the labels related to the given label name

Parameters:
labelName - name of the label to find related labels with
maxCount - the maximum number of labels to return, or the default if this is 0

getRelatedLabelsInSpace

public List<Label> getRelatedLabelsInSpace(String labelName,
                                           String spaceKey,
                                           int maxCount)
Returns the labels related to the given label name in the given space

Parameters:
labelName - name of the label to find related labels with
spaceKey - the key of the space to search in
maxCount - the maximum number of labels to return, or the default if this is 0

getLabelContentById

public List<SearchResult> getLabelContentById(long labelId)

getLabelContentByName

public List<SearchResult> getLabelContentByName(String labelName)

getLabelContentByObject

public List<SearchResult> getLabelContentByObject(Object remoteLabel)
Returns the content for a given label object

Parameters:
remoteLabel - the object retrieved from a direct call to an rpc method that returns a label, i.e. this parameter should be the return value of ConfluenceRpc.execute(String, Object...) and not any of wrapper methods that return a Label object
Returns:
content for the given label object


Copyright © 2003–2015 Atlassian. All rights reserved.