public class DefaultLabelManager extends Object implements LabelManagerInternal
CONTENT_TYPES, DEFAULT_LABEL_COUNT, FAVOURITE_LABEL, FAVOURITE_LABEL_YANKEE, LABEL_ADDED, LABEL_CREATED, LABEL_DELETED, LABEL_REMOVED, NO_CHANGE, NO_MAX_RESULTS, NO_OFFSET
Constructor and Description |
---|
DefaultLabelManager() |
Modifier and Type | Method and Description |
---|---|
int |
addLabel(ContentEntityObject content,
Label label) |
int |
addLabel(Labelable labelable,
Label label)
Add a label to the specified content.
|
Label |
createLabel(Label label) |
boolean |
deleteLabel(Label label)
Delete the specified label.
|
boolean |
deleteLabel(long id)
Delete the label with the specified id.
|
PageResponse<Label> |
findGlobalLabelsByNamePrefix(String namePrefix,
LimitedRequest pageRequest)
Returns global-namespaced labels starting with the given string.
|
PartialList<ContentEntityObject> |
getAllContentForAllLabels(int offset,
int maxResults,
Label... labels)
Retrieve all ContentEntityObjects, current or deleted which are labelled with ALL provided labels.
|
PartialList<ContentEntityObject> |
getAllContentForLabel(int offset,
int maxResults,
Label label)
Retrieve all ContentEntityObjects, current or deleted which are labelled with the provided label.
|
List |
getContent(Label label)
Get all content associated with a label
Get all versions of content associated with a label and any space.
|
int |
getContentCount(Label label) |
List<? extends Labelable> |
getContentForAllLabels(Collection<Label> labels,
int maxResults,
int offset) |
PartialList<ContentEntityObject> |
getContentForAllLabels(int offset,
int maxResults,
Label... labels)
Retrieve current ContentEntityObjects which are labelled with ALL provided labels.
|
PartialList<ContentEntityObject> |
getContentForLabel(int offset,
int maxResults,
Label label)
Retrieve current ContentEntityObjects which are labelled with the provided label.
|
List<? extends Labelable> |
getContentForLabel(Label label,
int maxResults)
Get all content associated with a label
Get all versions of content associated with a label and any space.
|
PartialList<ContentEntityObject> |
getContentInSpaceForAllLabels(int offset,
int maxResults,
String spaceKey,
Label... labels)
Retrieve current ContentEntityObjects in the given space which are labelled with ALL provided labels.
|
PartialList<ContentEntityObject> |
getContentInSpaceForLabel(int offset,
int maxResults,
String spaceKey,
Label label)
Retrieve current ContentEntityObjects in the given space which are labelled with the provided label.
|
PartialList<ContentEntityObject> |
getContentInSpacesForAllLabels(int offset,
int maxResults,
Set<String> spaceKeys,
Label... labels)
Retrieve current ContentEntityObjects in the given spaces which are labelled with ALL provided labels.
|
List |
getCurrentContentForLabel(Label label)
Get all content associated with a label and space
Get all current content associated with a label and any space.
|
List<? extends Labelable> |
getCurrentContentForLabelAndSpace(Label label,
String spaceKey)
Get all current content associated with a label and space.
|
List |
getCurrentContentWithPersonalLabel(String username)
Get all current content labelled by a user
|
List<Labelling> |
getFavouriteLabellingsByContentIds(Collection<ContentId> contentIds,
com.atlassian.sal.api.user.UserKey userKey)
Get the labellings that represent the favourite labellings for the given user on the given content.
|
List |
getFavouriteSpaces(String username) |
<T extends EditableLabelable> |
getForLabel(Class<T> labelableClass,
int offset,
int maxResults,
Label label)
Retrieve EditableLabelables of the supplied type which are labelled with the provided label.
|
<T extends EditableLabelable> |
getForLabels(Class<T> labelableClass,
int offset,
int maxResults,
Label... labels)
Retrieve EditableLabelables of the supplied type which are labelled with the provided labels.
|
PartialList<EditableLabelable> |
getForLabels(int offset,
int maxResults,
Label... labels)
Retrieve EditableLabelables of any type which are labelled with the provided labels.
|
Label |
getLabel(Label label)
Retrieve the persistent instance of the label with the exact same details as the specified label.
|
Label |
getLabel(long id)
Retrieve a label based on its id.
|
Label |
getLabel(ParsedLabelName parsedLabelName)
Retrieve the label by name.
|
Label |
getLabel(String unparsedLabelName)
convenience method to fetch a label without having to call the label parser
|
Label |
getLabel(String labelName,
Namespace namespace)
Convenience method to fetch a label without having to create a Label object
|
List<Label> |
getLabels(Collection<String> unparsedLabelNames)
convenience method to fetch labels without having to call the label parser
|
List |
getLabelsByDetail(String labelName,
String namespace,
String spaceKey,
String owner)
Retrieves the labels matching the given labelName, namespace or owner
|
List |
getLabelsInSpace(String key)
Retrieve all of the labels that label content within the specified space.
|
List<LabelSearchResult> |
getMostPopularLabels()
Retrieve the list of the DEFAULT_LABEL_COUNT most popular labels within the system.
|
List<LabelSearchResult> |
getMostPopularLabels(int count)
Retrieve the most popular labels within the system.
|
List<LabelSearchResult> |
getMostPopularLabelsInSpace(String key)
Retrieve the list of the DEFAULT_LABEL_COUNT most used labels in the specific space, ordered from most
popular to least popular.
|
List<LabelSearchResult> |
getMostPopularLabelsInSpace(String key,
int count)
Retrieve a list of the 'n' most used labels in the specified space, ordered from most popular to least
popular.
|
Set |
getMostPopularLabelsWithRanks(Comparator comparator)
Retrieve a set of the DEFAULT_LABEL_COUNT most popular labels within the system, including their ranks and
ordered using the compartor provided.
|
Set |
getMostPopularLabelsWithRanks(int maxResults,
Comparator comparator)
Retrieve the most popular labels within the system, including their ranks and ordered using the comparator
provided.
|
Set |
getMostPopularLabelsWithRanksInSpace(String key,
int maxResults,
Comparator comparator)
Retrieve a set of the 'n' most used labels in the specified space, ordered using the compartor given.
|
List |
getRecentlyUsedLabellings(int maxResults) |
List |
getRecentlyUsedLabellingsInSpace(String spaceKey,
int maxResults) |
List |
getRecentlyUsedLabels()
Retrieve the DEFAULT_LABEL_COUNT most recently used labels within the system.
|
List |
getRecentlyUsedLabels(int maxResults)
Retrieve the x most recently used labels.
|
List |
getRecentlyUsedLabelsInSpace(String key)
Retrieve the DEFAULT_LABEL_COUNT most recently used labels within the specified space.
|
List |
getRecentlyUsedLabelsInSpace(String key,
int maxResults)
Retrieve the most recently used labels within the specified spae.
|
List |
getRecentlyUsedPersonalLabellings(String username,
int maxResults) |
List |
getRecentlyUsedPersonalLabels(String username)
Retrieve the labels that were recently used by currently authenticated user.
|
List |
getRecentlyUsedPersonalLabels(String username,
int maxResults)
Retrieve the labels that were recently used by currently authenticated user.
|
List<Label> |
getRelatedLabels(Label label)
Retrieve the DEFAULT_LABEL_COUNT labels that are 'related' to the specified label.
|
List<Label> |
getRelatedLabels(Label label,
int count)
Retrieve the labels that are 'related' to the specified label.
|
List<Label> |
getRelatedLabels(List<? extends Label> labels,
String spaceKey,
int maxResultsPerLabel)
Retrieve the labels that are 'related' to the labels in the list.
|
List<Label> |
getRelatedLabelsInSpace(Label label,
String spaceKey)
Retrieve the DEFAULT_LABEL_COUNT labels that are 'related' to the specified label and that are used to label
content within the specified space.
|
List<Label> |
getRelatedLabelsInSpace(Label label,
String spaceKey,
int maxResults)
Retrieve the labels that are 'related' to the specified label and that are used to to label content within
the specified space.
|
List |
getSpacesContainingContentWithLabel(Label label)
Look up the spaces that have been labelled by the specific label.
|
List |
getSpacesWithLabel(Label label)
Spaces cannot be directly labelled.
|
List |
getSuggestedLabels(ContentEntityObject content)
Deprecated.
|
List |
getSuggestedLabels(ContentEntityObject content,
int count)
Deprecated.
|
List |
getSuggestedLabels(Labelable content)
Retrieve the DEFAULT_LABEL_COUNT suggested labels for the specified content.
|
List |
getSuggestedLabels(Labelable content,
int count)
Retrieve the suggested labels for the specified content.
|
List |
getSuggestedLabelsInSpace(ContentEntityObject content,
String spaceKey)
Deprecated.
|
List |
getSuggestedLabelsInSpace(ContentEntityObject content,
String spaceKey,
int maxResults)
Deprecated.
|
List |
getSuggestedLabelsInSpace(Labelable content,
String spaceKey)
Retrieve the DEFAULT_LABEL_COUNT suggested labels for the specified content bound to the specified space.
|
List |
getSuggestedLabelsInSpace(Labelable content,
String spaceKey,
int maxResults)
Retrieve the suggested labels for the specified content bound to the specified space.
|
List |
getTeamLabels()
Retrieve all of the team labels in the system.
|
List |
getTeamLabelsForSpace(String spaceKey)
Retrieve all of the team labels used to label content in the specified space.
|
List<Label> |
getTeamLabelsForSpaces(Collection<Space> spaces)
Retrieve all of the team labels used to label content in the specified spaces.
|
List |
getUsersLabels(String name)
Retrieve the personal labels that belong to the specified user.
|
void |
removeAllLabels(ContentEntityObject ceo)
Deprecated.
|
void |
removeAllLabels(Labelable content)
Remove all of the labels from the specified content.
|
int |
removeLabel(ContentEntityObject ceo,
Label label)
Deprecated.
|
int |
removeLabel(Labelable content,
Label label)
Remove a label from the specified content.
|
void |
removeLabels(ContentEntityObject ceo,
List labels)
Deprecated.
|
void |
removeLabels(Labelable content,
List labels)
removes a list of labels from the labelable object
|
void |
setEventManager(com.atlassian.event.EventManager manager) |
void |
setIndexer(ConfluenceIndexer indexer) |
void |
setLabelDao(LabelDao dao) |
public void setLabelDao(LabelDao dao)
public void setEventManager(com.atlassian.event.EventManager manager)
public void setIndexer(ConfluenceIndexer indexer)
public int addLabel(ContentEntityObject content, Label label)
addLabel
in interface LabelManager
public int addLabel(Labelable labelable, Label label)
LabelManager
labelManager.addLabel(page, new Label("name", "namespace", "owner"));
addLabel
in interface LabelManager
public int removeLabel(Labelable content, Label label)
LabelManager
removeLabel
in interface LabelManager
@Deprecated public int removeLabel(ContentEntityObject ceo, Label label)
removeLabel
in interface LabelManager
public void removeLabels(Labelable content, List labels)
LabelManager
removeLabels
in interface LabelManager
@Deprecated public void removeLabels(ContentEntityObject ceo, List labels)
removeLabels
in interface LabelManager
public void removeAllLabels(Labelable content)
LabelManager
removeAllLabels
in interface LabelManager
@Deprecated public void removeAllLabels(ContentEntityObject ceo)
removeAllLabels
in interface LabelManager
public Label getLabel(long id)
getLabel
in interface LabelManager
public List getSuggestedLabels(Labelable content)
LabelManager
getSuggestedLabels
in interface LabelManager
LabelManager.DEFAULT_LABEL_COUNT
@Deprecated public List getSuggestedLabels(ContentEntityObject content)
getSuggestedLabels
in interface LabelManager
public List getSuggestedLabels(Labelable content, int count)
LabelManager
getSuggestedLabels
in interface LabelManager
count
- is the maximum number of labels to be returned.@Deprecated public List getSuggestedLabels(ContentEntityObject content, int count)
getSuggestedLabels
in interface LabelManager
public List getSuggestedLabelsInSpace(Labelable content, String spaceKey)
LabelManager
getSuggestedLabelsInSpace
in interface LabelManager
LabelManager.DEFAULT_LABEL_COUNT
@Deprecated public List getSuggestedLabelsInSpace(ContentEntityObject content, String spaceKey)
getSuggestedLabelsInSpace
in interface LabelManager
public List getSuggestedLabelsInSpace(Labelable content, String spaceKey, int maxResults)
LabelManager
getSuggestedLabelsInSpace
in interface LabelManager
maxResults
- is the maximum number of labels to be returned.@Deprecated public List getSuggestedLabelsInSpace(ContentEntityObject content, String spaceKey, int maxResults)
getSuggestedLabelsInSpace
in interface LabelManager
public List<Label> getRelatedLabels(Label label)
LabelManager
getRelatedLabels
in interface LabelManager
LabelManager.DEFAULT_LABEL_COUNT
public List<Label> getRelatedLabels(Label label, int count)
LabelManager
getRelatedLabels
in interface LabelManager
count
- is the maximum number of labels to be returned.public List<Label> getRelatedLabels(List<? extends Label> labels, String spaceKey, int maxResultsPerLabel)
LabelManager
getRelatedLabels
in interface LabelManager
spaceKey
- - may be null to search globallymaxResultsPerLabel
- is the maximum number of labels to be returned for each label.public List<Label> getRelatedLabelsInSpace(Label label, String spaceKey)
LabelManager
getRelatedLabelsInSpace
in interface LabelManager
LabelManager.DEFAULT_LABEL_COUNT
public List<Label> getRelatedLabelsInSpace(Label label, String spaceKey, int maxResults)
LabelManager
getRelatedLabelsInSpace
in interface LabelManager
public List getSpacesContainingContentWithLabel(Label label)
LabelManager
getSpacesContainingContentWithLabel
in interface LabelManager
public List getUsersLabels(String name)
LabelManager
getUsersLabels
in interface LabelManager
public List getTeamLabels()
LabelManager
getTeamLabels
in interface LabelManager
public List getTeamLabelsForSpace(String spaceKey)
LabelManager
getTeamLabelsForSpace
in interface LabelManager
public List<Label> getTeamLabelsForSpaces(Collection<Space> spaces)
LabelManager
getTeamLabelsForSpaces
in interface LabelManager
spaces
- collection of spaces whose labels to getpublic List getRecentlyUsedLabelsInSpace(String key)
LabelManager
getRecentlyUsedLabelsInSpace
in interface LabelManager
key
- identifies the space to which the results are restricted.LabelManager.DEFAULT_LABEL_COUNT
public List getRecentlyUsedLabelsInSpace(String key, int maxResults)
LabelManager
getRecentlyUsedLabelsInSpace
in interface LabelManager
maxResults
- is the maximum number of labels to be returned.public List getRecentlyUsedLabels(int maxResults)
LabelManager
getRecentlyUsedLabels
in interface LabelManager
maxResults
- is the maximum number of labels to be returned.public List getRecentlyUsedLabels()
LabelManager
getRecentlyUsedLabels
in interface LabelManager
LabelManager.DEFAULT_LABEL_COUNT
public List getRecentlyUsedPersonalLabels(String username)
LabelManager
getRecentlyUsedPersonalLabels
in interface LabelManager
username
- the user history from the sessionpublic List getRecentlyUsedPersonalLabels(String username, int maxResults)
LabelManager
getRecentlyUsedPersonalLabels
in interface LabelManager
username
- the user history from the sessionmaxResults
- the maximum number of results to return to the userpublic List getRecentlyUsedPersonalLabellings(String username, int maxResults)
getRecentlyUsedPersonalLabellings
in interface LabelManager
public List getCurrentContentForLabel(Label label)
LabelManager
getCurrentContentForLabel
in interface LabelManager
public List<? extends Labelable> getContentForAllLabels(Collection<Label> labels, int maxResults, int offset)
getContentForAllLabels
in interface LabelManager
public PartialList<ContentEntityObject> getContentForLabel(int offset, int maxResults, Label label)
LabelManager
getContentForLabel
in interface LabelManager
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabel
- label which must appear on ContentEntityObjectspublic PartialList<ContentEntityObject> getContentForAllLabels(int offset, int maxResults, Label... labels)
LabelManager
getContentForAllLabels
in interface LabelManager
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabels
- labels which must appear on ContentEntityObjectspublic <T extends EditableLabelable> PartialList<T> getForLabel(Class<T> labelableClass, int offset, int maxResults, Label label)
LabelManager
getForLabel
in interface LabelManager
labelableClass
- the type of labelable to return. Use one of these values:
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabel
- label which must appear on labelablespublic <T extends EditableLabelable> PartialList<T> getForLabels(Class<T> labelableClass, int offset, int maxResults, Label... labels)
LabelManager
getForLabels
in interface LabelManager
labelableClass
- the type of labelable to return. Use one of these values:
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabels
- labels which must all appear on labelablespublic PartialList<EditableLabelable> getForLabels(int offset, int maxResults, Label... labels)
LabelManager
getForLabels
in interface LabelManager
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabels
- labels which must all appear on labelablespublic PartialList<ContentEntityObject> getContentInSpaceForLabel(int offset, int maxResults, String spaceKey, Label label)
LabelManager
getContentInSpaceForLabel
in interface LabelManager
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnspaceKey
- the key of the space to search content inlabel
- label which must appear on ContentEntityObjectspublic PartialList<ContentEntityObject> getContentInSpaceForAllLabels(int offset, int maxResults, String spaceKey, Label... labels)
LabelManager
getContentInSpaceForAllLabels
in interface LabelManager
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnspaceKey
- the key of the space to search content inlabels
- labels which must appear on ContentEntityObjectspublic PartialList<ContentEntityObject> getContentInSpacesForAllLabels(int offset, int maxResults, Set<String> spaceKeys, Label... labels)
LabelManager
getContentInSpacesForAllLabels
in interface LabelManager
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnspaceKeys
- the keys of the spaces to search content inlabels
- labels which must appear on ContentEntityObjectspublic PartialList<ContentEntityObject> getAllContentForLabel(int offset, int maxResults, Label label)
LabelManager
getAllContentForLabel
in interface LabelManager
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabel
- label which must appear on ContentEntityObjectspublic PartialList<ContentEntityObject> getAllContentForAllLabels(int offset, int maxResults, Label... labels)
LabelManager
getAllContentForAllLabels
in interface LabelManager
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabels
- labels which must appear on ContentEntityObjectspublic List<? extends Labelable> getContentForLabel(Label label, int maxResults)
LabelManager
getContentForLabel
in interface LabelManager
public List<? extends Labelable> getCurrentContentForLabelAndSpace(Label label, String spaceKey)
LabelManager
getCurrentContentForLabelAndSpace
in interface LabelManager
public List getCurrentContentWithPersonalLabel(String username)
LabelManager
getCurrentContentWithPersonalLabel
in interface LabelManager
public List getSpacesWithLabel(Label label)
LabelManager
getSpacesWithLabel
in interface LabelManager
public boolean deleteLabel(long id)
LabelManager
deleteLabel
in interface LabelManager
public List getFavouriteSpaces(String username)
getFavouriteSpaces
in interface LabelManager
username
- username of label ownerpublic List<Labelling> getFavouriteLabellingsByContentIds(Collection<ContentId> contentIds, com.atlassian.sal.api.user.UserKey userKey)
LabelManager
getFavouriteLabellingsByContentIds
in interface LabelManager
contentIds
- the contentIds to get favourite labellings foruserKey
- the key of the user to get favourite labellings forpublic boolean deleteLabel(Label label)
LabelManager
deleteLabel
in interface LabelManager
public Label getLabel(ParsedLabelName parsedLabelName)
LabelManager
getLabel
in interface LabelManager
for details on the format of the labelReference parameter.
public Label getLabel(String unparsedLabelName)
LabelManager
getLabel
in interface LabelManager
unparsedLabelName
- - example - my:foopublic List<Label> getLabels(Collection<String> unparsedLabelNames)
LabelManager
getLabels
in interface LabelManager
unparsedLabelNames
- - example - my:foo, barpublic Label getLabel(Label label)
LabelManager
getLabel
in interface LabelManager
public Label getLabel(String labelName, Namespace namespace)
LabelManager
getLabel
in interface LabelManager
labelName
- The label namenamespace
- The namespace of the labelpublic List getLabelsByDetail(String labelName, String namespace, String spaceKey, String owner)
LabelManager
getLabelsByDetail
in interface LabelManager
labelName
- The name of the label (null to ignore)namespace
- The namespace of the labels (null to ignore)spaceKey
- The spaceKey to restrict by (null to ignore)owner
- The owner of the labels (null to ignore)public List getLabelsInSpace(String key)
LabelManager
getLabelsInSpace
in interface LabelManager
key
- public List<LabelSearchResult> getMostPopularLabels()
LabelManager
getMostPopularLabels
in interface LabelManager
LabelManager.DEFAULT_LABEL_COUNT
,
LabelSearchResult
public List<LabelSearchResult> getMostPopularLabels(int count)
LabelManager
This function does not return the labels itself, but wrapped into a search result with a count!
getMostPopularLabels
in interface LabelManager
count
- is the maximum number of labels to be returned.LabelSearchResult
public List<LabelSearchResult> getMostPopularLabelsInSpace(String key)
LabelManager
This function does not return the labels itself, but wrapped into a search result with a count!
getMostPopularLabelsInSpace
in interface LabelManager
key
- the space keyLabelManager.DEFAULT_LABEL_COUNT
,
LabelSearchResult
public List<LabelSearchResult> getMostPopularLabelsInSpace(String key, int count)
LabelManager
This function does not return the labels itself, but wrapped into a search result with a count!
getMostPopularLabelsInSpace
in interface LabelManager
key
- is the space keycount
- is the maximum number of labels to be returned.LabelSearchResult
public Set getMostPopularLabelsWithRanks(Comparator comparator)
LabelManager
getMostPopularLabelsWithRanks
in interface LabelManager
LabelManager.DEFAULT_LABEL_COUNT
,
RankedLabelSearchResult
public Set getMostPopularLabelsWithRanks(int maxResults, Comparator comparator)
LabelManager
This function does not return the labels itself, but wrapped into a search result with a count!
getMostPopularLabelsWithRanks
in interface LabelManager
maxResults
- is the maximum number of labels to be returned.RankedLabelSearchResult
public Set getMostPopularLabelsWithRanksInSpace(String key, int maxResults, Comparator comparator)
LabelManager
This function does not return the labels itself, but wrapped into a search result with a count!
getMostPopularLabelsWithRanksInSpace
in interface LabelManager
key
- is the space keymaxResults
- is the maximum number of labels to be returned.RankedLabelSearchResult
public List getContent(Label label)
LabelManager
getContent
in interface LabelManager
public int getContentCount(Label label)
getContentCount
in interface LabelManager
public Label createLabel(Label label)
createLabel
in interface LabelManager
public List getRecentlyUsedLabellings(int maxResults)
getRecentlyUsedLabellings
in interface LabelManager
public List getRecentlyUsedLabellingsInSpace(String spaceKey, int maxResults)
getRecentlyUsedLabellingsInSpace
in interface LabelManager
public PageResponse<Label> findGlobalLabelsByNamePrefix(String namePrefix, LimitedRequest pageRequest)
LabelManagerInternal
findGlobalLabelsByNamePrefix
in interface LabelManagerInternal
Copyright © 2003–2015 Atlassian. All rights reserved.