Package com.atlassian.confluence.it.rpc
Class LabelsRpc
java.lang.Object
com.atlassian.confluence.it.rpc.LabelsRpc
Makes CRUD RPC calls for Labels and Labelled content.
-
Constructor Summary
ConstructorDescriptionLabelsRpc
(ConfluenceRpc rpc, AuthenticatedWebResourceProvider authenticatedWebResourceProvider) -
Method Summary
Modifier and TypeMethodDescriptionboolean
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) getAllContentForAllLabels
(int offset, int maxResults, String labelsString) getContentForAllLabels
(int offset, int maxResults, String labelsString) getContentInSpacesForAllLabels
(int offset, int maxResults, String spaceKeys, String labelsString) getForLabels
(LabelableType labelableType, int offset, int maxResults, String labelsString) getLabelContentById
(long labelId) getLabelContentByName
(String labelName) getLabelContentByObject
(Object remoteLabel) Returns the content for a given label objectgetLabels
(long pageId) Retrieves the labels for the page matching the specified pageIdRetrieves the labels matching the given labelName, namespace or owner.getMostPopularLabels
(int maxCount) Returns the most popular labelsgetMostPopularLabelsInSpace
(String spaceKey, int maxCount) Returns the most popular labels in the space with the specified keygetRecentlyUsedLabels
(int maxCount) Returns the recently used labels for the Confluence instance, with a specified maximum number of results.getRecentlyUsedLabelsInSpace
(String spaceKey, int maxCount) Returns the recently used labels in the space with the specified keygetRelatedLabels
(String labelName, int maxCount) Returns the labels related to the given label namegetRelatedLabelsInSpace
(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 Details
-
LabelsRpc
public LabelsRpc(ConfluenceRpc rpc, AuthenticatedWebResourceProvider authenticatedWebResourceProvider)
-
-
Method Details
-
addLabelToLabelable
-
removeLabel
-
addLabel
-
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
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
-
getAllContentForAllLabels
-
getContentInSpacesForAllLabels
-
getLabels
Retrieves the labels for the page matching the specified pageId- Returns:
- labels for the page
-
getLabels
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
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
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
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
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
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
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
-
getLabelContentByName
-
getLabelContentByObject
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
-