com.atlassian.confluence.it.rpc
Class LabelsRpc

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

public class LabelsRpc
extends java.lang.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(java.lang.String label, AbstractContentEntity target)
           
 boolean addLabelByObject(java.lang.Object remoteLabel, Page page)
          Adds a label to the specified page
 void addLabelToLabelable(long labelableId, LabelableType type, java.lang.String label)
           
 java.util.Hashtable<java.lang.String,java.lang.Object> getAllContentForAllLabels(int offset, int maxResults, java.lang.String labelsString)
           
 java.util.Hashtable<java.lang.String,java.lang.Object> getContentForAllLabels(int offset, int maxResults, java.lang.String labelsString)
           
 java.util.Hashtable<java.lang.String,java.lang.Object> getContentInSpacesForAllLabels(int offset, int maxResults, java.lang.String spaceKeys, java.lang.String labelsString)
           
 java.util.Hashtable<java.lang.String,java.lang.Object> getForLabels(LabelableType labelableType, int offset, int maxResults, java.lang.String labelsString)
           
 java.util.List<SearchResult> getLabelContentById(long labelId)
           
 java.util.List<SearchResult> getLabelContentByName(java.lang.String labelName)
           
 java.util.List<SearchResult> getLabelContentByObject(java.lang.Object remoteLabel)
          Returns the content for a given label object
 java.util.List<Label> getLabels(long pageId)
          Retrieves the labels for the page matching the specified pageId
 java.util.List<Label> getLabels(java.lang.String labelName, java.lang.String namespace, java.lang.String spaceKey, java.lang.String owner)
          Retrieves the labels matching the given labelName, namespace or owner.
 java.util.List<Label> getMostPopularLabels(int maxCount)
          Returns the most popular labels
 java.util.List<Label> getMostPopularLabelsInSpace(java.lang.String spaceKey, int maxCount)
          Returns the most popular labels in the space with the specified key
 java.util.List<Label> getRecentlyUsedLabels(int maxCount)
          Returns the recently used labels for the Confluence instance, with a specified maximum number of results.
 java.util.List<Label> getRecentlyUsedLabelsInSpace(java.lang.String spaceKey, int maxCount)
          Returns the recently used labels in the space with the specified key
 java.util.List<Label> getRelatedLabels(java.lang.String labelName, int maxCount)
          Returns the labels related to the given label name
 java.util.List<Label> getRelatedLabelsInSpace(java.lang.String labelName, java.lang.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,
                                java.lang.String label)

addLabel

public void addLabel(java.lang.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(java.lang.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 java.util.Hashtable<java.lang.String,java.lang.Object> getForLabels(LabelableType labelableType,
                                                                           int offset,
                                                                           int maxResults,
                                                                           java.lang.String labelsString)

getContentForAllLabels

public java.util.Hashtable<java.lang.String,java.lang.Object> getContentForAllLabels(int offset,
                                                                                     int maxResults,
                                                                                     java.lang.String labelsString)

getAllContentForAllLabels

public java.util.Hashtable<java.lang.String,java.lang.Object> getAllContentForAllLabels(int offset,
                                                                                        int maxResults,
                                                                                        java.lang.String labelsString)

getContentInSpacesForAllLabels

public java.util.Hashtable<java.lang.String,java.lang.Object> getContentInSpacesForAllLabels(int offset,
                                                                                             int maxResults,
                                                                                             java.lang.String spaceKeys,
                                                                                             java.lang.String labelsString)

getLabels

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

Returns:
labels for the page

getLabels

public java.util.List<Label> getLabels(java.lang.String labelName,
                                       java.lang.String namespace,
                                       java.lang.String spaceKey,
                                       java.lang.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 java.util.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 java.util.List<Label> getMostPopularLabelsInSpace(java.lang.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 java.util.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 java.util.List<Label> getRecentlyUsedLabelsInSpace(java.lang.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 java.util.List<Label> getRelatedLabels(java.lang.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 java.util.List<Label> getRelatedLabelsInSpace(java.lang.String labelName,
                                                     java.lang.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 java.util.List<SearchResult> getLabelContentById(long labelId)

getLabelContentByName

public java.util.List<SearchResult> getLabelContentByName(java.lang.String labelName)

getLabelContentByObject

public java.util.List<SearchResult> getLabelContentByObject(java.lang.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-2014 Atlassian. All Rights Reserved.