Package com.atlassian.confluence.it.rpc
Class LabelsRpc
- java.lang.Object
-
- com.atlassian.confluence.it.rpc.LabelsRpc
-
public class LabelsRpc extends Object
Makes CRUD RPC calls for Labels and Labelled content.
-
-
Constructor Summary
Constructors Constructor Description LabelsRpc(ConfluenceRpc rpc, AuthenticatedWebResourceProvider authenticatedWebResourceProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addLabel(long labelId, long contentId)
Adds a label to the content specified by the supplied contentIdvoid
addLabel(String label, AbstractContentEntity target)
boolean
addLabelByObject(Object remoteLabel, Page page)
Adds a label to the specified pagevoid
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 objectList<Label>
getLabels(long pageId)
Retrieves the labels for the page matching the specified pageIdList<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 labelsList<Label>
getMostPopularLabelsInSpace(String spaceKey, int maxCount)
Returns the most popular labels in the space with the specified keyList<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 keyList<Label>
getRelatedLabels(String labelName, int maxCount)
Returns the labels related to the given label nameList<Label>
getRelatedLabelsInSpace(String labelName, String spaceKey, int maxCount)
Returns the labels related to the given label name in the given spacevoid
removeLabel(String label, ContentId id)
-
-
-
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 addcontentId
- 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 ofConfluenceRpc.execute(String, Object...)
and not any of wrapper methods that return a Label objectpage
- 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 byspaceKey
- the key of the space to restrict byowner
- 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 spacemaxCount
- 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 spacemaxCount
- 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 withmaxCount
- 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 withspaceKey
- the key of the space to search inmaxCount
- 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 ofConfluenceRpc.execute(String, Object...)
and not any of wrapper methods that return a Label object- Returns:
- content for the given label object
-
-