com.atlassian.confluence.labels
Class DefaultLabelManager

java.lang.Object
  extended by com.atlassian.confluence.labels.DefaultLabelManager
All Implemented Interfaces:
LabelManager

public class DefaultLabelManager
extends java.lang.Object
implements LabelManager

Default implementation of the label manager interface. This implementation uses the LabelDao to access the label persistent store.


Field Summary
 
Fields inherited from interface com.atlassian.confluence.labels.LabelManager
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 Summary
DefaultLabelManager()
           
 
Method Summary
 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.
 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.
 java.util.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)
           
 java.util.List<? extends Labelable> getContentForAllLabels(java.util.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.
 java.util.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, java.lang.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, java.lang.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, java.util.Set<java.lang.String> spaceKeys, Label... labels)
          Retrieve current ContentEntityObjects in the given spaces which are labelled with ALL provided labels.
 java.util.List getCurrentContentForLabel(Label label)
          Get all content associated with a label and space Get all current content associated with a label and any space.
 java.util.List<? extends Labelable> getCurrentContentForLabelAndSpace(Label label, java.lang.String spaceKey)
          Get all current content associated with a label and space.
 java.util.List getCurrentContentWithPersonalLabel(java.lang.String username)
          Get all current content labelled by a user
 java.util.List getFavouriteSpaces(java.lang.String username)
           
<T extends EditableLabelable>
PartialList<T>
getForLabel(java.lang.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>
PartialList<T>
getForLabels(java.lang.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(java.lang.String unparsedLabelName)
          convenience method to fetch a label without having to call the label parser
 Label getLabel(java.lang.String labelName, Namespace namespace)
          Convenience method to fetch a label without having to create a Label object
 java.util.List<Label> getLabels(java.util.Collection<java.lang.String> unparsedLabelNames)
          convenience method to fetch labels without having to call the label parser
 java.util.List getLabelsByDetail(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 getLabelsInSpace(java.lang.String key)
          Retrieve all of the labels that label content within the specified space.
 java.util.List<LabelSearchResult> getMostPopularLabels()
          Retrieve the list of the DEFAULT_LABEL_COUNT most popular labels within the system.
 java.util.List<LabelSearchResult> getMostPopularLabels(int count)
          Retrieve the most popular labels within the system.
 java.util.List<LabelSearchResult> getMostPopularLabelsInSpace(java.lang.String key)
          Retrieve the list of the DEFAULT_LABEL_COUNT most used labels in the specific space, ordered from most popular to least popular.
 java.util.List<LabelSearchResult> getMostPopularLabelsInSpace(java.lang.String key, int count)
          Retrieve a list of the 'n' most used labels in the specified space, ordered from most popular to least popular.
 java.util.Set getMostPopularLabelsWithRanks(java.util.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.
 java.util.Set getMostPopularLabelsWithRanks(int maxResults, java.util.Comparator comparator)
          Retrieve the most popular labels within the system, including their ranks and ordered using the comparator provided.
 java.util.Set getMostPopularLabelsWithRanksInSpace(java.lang.String key, int maxResults, java.util.Comparator comparator)
          Retrieve a set of the 'n' most used labels in the specified space, ordered using the compartor given.
 java.util.List getRecentlyUsedLabellings(int maxResults)
           
 java.util.List getRecentlyUsedLabellingsInSpace(java.lang.String spaceKey, int maxResults)
           
 java.util.List getRecentlyUsedLabels()
          Retrieve the DEFAULT_LABEL_COUNT most recently used labels within the system.
 java.util.List getRecentlyUsedLabels(int maxResults)
          Retrieve the x most recently used labels.
 java.util.List getRecentlyUsedLabelsInSpace(java.lang.String key)
          Retrieve the DEFAULT_LABEL_COUNT most recently used labels within the specified space.
 java.util.List getRecentlyUsedLabelsInSpace(java.lang.String key, int maxResults)
          Retrieve the most recently used labels within the specified spae.
 java.util.List getRecentlyUsedPersonalLabellings(java.lang.String username, int maxResults)
           
 java.util.List getRecentlyUsedPersonalLabels(java.lang.String username)
          Retrieve the labels that were recently used by currently authenticated user.
 java.util.List getRecentlyUsedPersonalLabels(java.lang.String username, int maxResults)
          Retrieve the labels that were recently used by currently authenticated user.
 java.util.List<Label> getRelatedLabels(Label label)
          Retrieve the DEFAULT_LABEL_COUNT labels that are 'related' to the specified label.
 java.util.List<Label> getRelatedLabels(Label label, int count)
          Retrieve the labels that are 'related' to the specified label.
 java.util.List<Label> getRelatedLabels(java.util.List<? extends Label> labels, java.lang.String spaceKey, int maxResultsPerLabel)
          Retrieve the labels that are 'related' to the labels in the list.
 java.util.List<Label> getRelatedLabelsInSpace(Label label, java.lang.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.
 java.util.List<Label> getRelatedLabelsInSpace(Label label, java.lang.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.
 java.util.List getSpacesContainingContentWithLabel(Label label)
          Look up the spaces that have been labelled by the specific label.
 java.util.List getSpacesWithLabel(Label label)
          Spaces cannot be directly labelled.
 java.util.List getSuggestedLabels(ContentEntityObject content)
          Deprecated. 
 java.util.List getSuggestedLabels(ContentEntityObject content, int count)
          Deprecated. 
 java.util.List getSuggestedLabels(Labelable content)
          Retrieve the DEFAULT_LABEL_COUNT suggested labels for the specified content.
 java.util.List getSuggestedLabels(Labelable content, int count)
          Retrieve the suggested labels for the specified content.
 java.util.List getSuggestedLabelsInSpace(ContentEntityObject content, java.lang.String spaceKey)
          Deprecated. 
 java.util.List getSuggestedLabelsInSpace(ContentEntityObject content, java.lang.String spaceKey, int maxResults)
          Deprecated. 
 java.util.List getSuggestedLabelsInSpace(Labelable content, java.lang.String spaceKey)
          Retrieve the DEFAULT_LABEL_COUNT suggested labels for the specified content bound to the specified space.
 java.util.List getSuggestedLabelsInSpace(Labelable content, java.lang.String spaceKey, int maxResults)
          Retrieve the suggested labels for the specified content bound to the specified space.
 java.util.List getTeamLabels()
          Retrieve all of the team labels in the system.
 java.util.List getTeamLabelsForSpace(java.lang.String spaceKey)
          Retrieve all of the team labels used to label content in the specified space.
 java.util.List<Label> getTeamLabelsForSpaces(java.util.Collection<Space> spaces)
          Retrieve all of the team labels used to label content in the specified spaces.
 java.util.List getUsersLabels(java.lang.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, java.util.List labels)
          Deprecated. 
 void removeLabels(Labelable content, java.util.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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLabelManager

public DefaultLabelManager()
Method Detail

setLabelDao

public void setLabelDao(LabelDao dao)

setEventManager

public void setEventManager(com.atlassian.event.EventManager manager)

setIndexer

public void setIndexer(ConfluenceIndexer indexer)

addLabel

public int addLabel(ContentEntityObject content,
                    Label label)
Specified by:
addLabel in interface LabelManager

addLabel

public int addLabel(Labelable labelable,
                    Label label)
Description copied from interface: LabelManager
Add a label to the specified content.

Note: the specified label does not need to be persistent. A persistent instance of the label will be created if necessary. eg: you can write code like: labelManager.addLabel(page, new Label("name", "namespace", "owner"));

Specified by:
addLabel in interface LabelManager
Returns:
one of NO_CHANGE, LABEL_ADDED or LABEL_CREATED

removeLabel

public int removeLabel(Labelable content,
                       Label label)
Description copied from interface: LabelManager
Remove a label from the specified content.

Specified by:
removeLabel in interface LabelManager
Returns:
one of NO_CHANGE, LABEL_DELETED, LABEL_REMOVED

removeLabel

@Deprecated
public int removeLabel(ContentEntityObject ceo,
                                  Label label)
Deprecated. 

Specified by:
removeLabel in interface LabelManager

removeLabels

public void removeLabels(Labelable content,
                         java.util.List labels)
Description copied from interface: LabelManager
removes a list of labels from the labelable object

Specified by:
removeLabels in interface LabelManager

removeLabels

@Deprecated
public void removeLabels(ContentEntityObject ceo,
                                    java.util.List labels)
Deprecated. 

Specified by:
removeLabels in interface LabelManager

removeAllLabels

public void removeAllLabels(Labelable content)
Description copied from interface: LabelManager
Remove all of the labels from the specified content. Any labels that then no longer label content will be deleted.

Specified by:
removeAllLabels in interface LabelManager

removeAllLabels

@Deprecated
public void removeAllLabels(ContentEntityObject ceo)
Deprecated. 

Specified by:
removeAllLabels in interface LabelManager

getLabel

public Label getLabel(long id)
Retrieve a label based on its id.

Specified by:
getLabel in interface LabelManager
Returns:
the label instance.

getSuggestedLabels

public java.util.List getSuggestedLabels(Labelable content)
Description copied from interface: LabelManager
Retrieve the DEFAULT_LABEL_COUNT suggested labels for the specified content. The process used to identify 'suggested' labels may change and therefore is not defined here.

Specified by:
getSuggestedLabels in interface LabelManager
Returns:
a list of label instances. The order of these labels is undefined.
See Also:
LabelManager.DEFAULT_LABEL_COUNT

getSuggestedLabels

@Deprecated
public java.util.List getSuggestedLabels(ContentEntityObject content)
Deprecated. 

Specified by:
getSuggestedLabels in interface LabelManager

getSuggestedLabels

public java.util.List getSuggestedLabels(Labelable content,
                                         int count)
Description copied from interface: LabelManager
Retrieve the suggested labels for the specified content. The process used to identify 'suggested' labels may change and therefore is not defined here.

Specified by:
getSuggestedLabels in interface LabelManager
count - is the maximum number of labels to be returned.
Returns:
a list of label instances. The order of these labels is undefined.

getSuggestedLabels

@Deprecated
public java.util.List getSuggestedLabels(ContentEntityObject content,
                                                    int count)
Deprecated. 

Specified by:
getSuggestedLabels in interface LabelManager

getSuggestedLabelsInSpace

public java.util.List getSuggestedLabelsInSpace(Labelable content,
                                                java.lang.String spaceKey)
Description copied from interface: LabelManager
Retrieve the DEFAULT_LABEL_COUNT suggested labels for the specified content bound to the specified space.

Specified by:
getSuggestedLabelsInSpace in interface LabelManager
Returns:
a list of label instances. The order of these labels is undefined.
See Also:
LabelManager.DEFAULT_LABEL_COUNT

getSuggestedLabelsInSpace

@Deprecated
public java.util.List getSuggestedLabelsInSpace(ContentEntityObject content,
                                                           java.lang.String spaceKey)
Deprecated. 

Specified by:
getSuggestedLabelsInSpace in interface LabelManager

getSuggestedLabelsInSpace

public java.util.List getSuggestedLabelsInSpace(Labelable content,
                                                java.lang.String spaceKey,
                                                int maxResults)
Description copied from interface: LabelManager
Retrieve the suggested labels for the specified content bound to the specified space.

Specified by:
getSuggestedLabelsInSpace in interface LabelManager
maxResults - is the maximum number of labels to be returned.
Returns:
a list of label instances. The order of these labels is undefined.

getSuggestedLabelsInSpace

@Deprecated
public java.util.List getSuggestedLabelsInSpace(ContentEntityObject content,
                                                           java.lang.String spaceKey,
                                                           int maxResults)
Deprecated. 

Specified by:
getSuggestedLabelsInSpace in interface LabelManager

getRelatedLabels

public java.util.List<Label> getRelatedLabels(Label label)
Description copied from interface: LabelManager
Retrieve the DEFAULT_LABEL_COUNT labels that are 'related' to the specified label. The process used to identify 'related' labels may change and therefore is not define here.

Specified by:
getRelatedLabels in interface LabelManager
Returns:
a list of label instances. The order of these labels is undefined.
See Also:
LabelManager.DEFAULT_LABEL_COUNT

getRelatedLabels

public java.util.List<Label> getRelatedLabels(Label label,
                                              int count)
Description copied from interface: LabelManager
Retrieve the labels that are 'related' to the specified label. The process used to identify 'related' labels may change and therefore is not defined here.

Specified by:
getRelatedLabels in interface LabelManager
count - is the maximum number of labels to be returned.
Returns:
a list of label instances. The order of these labels is undefined.

getRelatedLabels

public java.util.List<Label> getRelatedLabels(java.util.List<? extends Label> labels,
                                              java.lang.String spaceKey,
                                              int maxResultsPerLabel)
Description copied from interface: LabelManager
Retrieve the labels that are 'related' to the labels in the list. The process used to identify 'related' labels may change and therefore is not defined here.

Specified by:
getRelatedLabels in interface LabelManager
spaceKey - - may be null to search globally
maxResultsPerLabel - is the maximum number of labels to be returned for each label.
Returns:
a list of label instances. The order of these labels is undefined.

getRelatedLabelsInSpace

public java.util.List<Label> getRelatedLabelsInSpace(Label label,
                                                     java.lang.String spaceKey)
Description copied from interface: LabelManager
Retrieve the DEFAULT_LABEL_COUNT labels that are 'related' to the specified label and that are used to label content within the specified space.

Specified by:
getRelatedLabelsInSpace in interface LabelManager
Returns:
a list of label instances. The order of these labels is undefined.
See Also:
LabelManager.DEFAULT_LABEL_COUNT

getRelatedLabelsInSpace

public java.util.List<Label> getRelatedLabelsInSpace(Label label,
                                                     java.lang.String spaceKey,
                                                     int maxResults)
Description copied from interface: LabelManager
Retrieve the labels that are 'related' to the specified label and that are used to to label content within the specified space.

Specified by:
getRelatedLabelsInSpace in interface LabelManager
Returns:
a list of label instance. The order of these labels is undefined.

getSpacesContainingContentWithLabel

public java.util.List getSpacesContainingContentWithLabel(Label label)
Description copied from interface: LabelManager
Look up the spaces that have been labelled by the specific label.

Specified by:
getSpacesContainingContentWithLabel in interface LabelManager
Returns:
a list of Spaces. The order of these labels is undefined.

getUsersLabels

public java.util.List getUsersLabels(java.lang.String name)
Description copied from interface: LabelManager
Retrieve the personal labels that belong to the specified user.

Specified by:
getUsersLabels in interface LabelManager

getTeamLabels

public java.util.List getTeamLabels()
Description copied from interface: LabelManager
Retrieve all of the team labels in the system.

Specified by:
getTeamLabels in interface LabelManager
Returns:
a list of labels with the namespace Namespace.TEAM

getTeamLabelsForSpace

public java.util.List getTeamLabelsForSpace(java.lang.String spaceKey)
Description copied from interface: LabelManager
Retrieve all of the team labels used to label content in the specified space.

Specified by:
getTeamLabelsForSpace in interface LabelManager
Returns:
a list of team labels with the namespace Namespace.TEAM. The order of the list is undefined.

getTeamLabelsForSpaces

public java.util.List<Label> getTeamLabelsForSpaces(java.util.Collection<Space> spaces)
Description copied from interface: LabelManager
Retrieve all of the team labels used to label content in the specified spaces.

Specified by:
getTeamLabelsForSpaces in interface LabelManager
Parameters:
spaces - collection of spaces whose labels to get
Returns:
a list of team labels with the namespace Namespace.TEAM. The order of the list is undefined.

getRecentlyUsedLabelsInSpace

public java.util.List getRecentlyUsedLabelsInSpace(java.lang.String key)
Description copied from interface: LabelManager
Retrieve the DEFAULT_LABEL_COUNT most recently used labels within the specified space.

Specified by:
getRecentlyUsedLabelsInSpace in interface LabelManager
Parameters:
key - identifies the space to which the results are restricted.
Returns:
a list of label instances in order of most recently used to least recently used.
See Also:
LabelManager.DEFAULT_LABEL_COUNT

getRecentlyUsedLabelsInSpace

public java.util.List getRecentlyUsedLabelsInSpace(java.lang.String key,
                                                   int maxResults)
Description copied from interface: LabelManager
Retrieve the most recently used labels within the specified spae.

Specified by:
getRecentlyUsedLabelsInSpace in interface LabelManager
maxResults - is the maximum number of labels to be returned.
Returns:
a list of label instances in order of the most recently used to least recently used.

getRecentlyUsedLabels

public java.util.List getRecentlyUsedLabels(int maxResults)
Description copied from interface: LabelManager
Retrieve the x most recently used labels.

Specified by:
getRecentlyUsedLabels in interface LabelManager
Parameters:
maxResults - is the maximum number of labels to be returned.
Returns:
a list of label instances in order of most recently used to least recently used.

getRecentlyUsedLabels

public java.util.List getRecentlyUsedLabels()
Description copied from interface: LabelManager
Retrieve the DEFAULT_LABEL_COUNT most recently used labels within the system.

Specified by:
getRecentlyUsedLabels in interface LabelManager
Returns:
a list of label instances in order of most recently used to least recently used.
See Also:
LabelManager.DEFAULT_LABEL_COUNT

getRecentlyUsedPersonalLabels

public java.util.List getRecentlyUsedPersonalLabels(java.lang.String username)
Description copied from interface: LabelManager
Retrieve the labels that were recently used by currently authenticated user. 'Recently Used' includes labels that the user recently added, created, removed and deleted.

Note: labels in this list may or may not exist.

The UserHistory can be retrieved from the session via the ActionContext (if using an action) or the Execution Context (DWR)

Specified by:
getRecentlyUsedPersonalLabels in interface LabelManager
Parameters:
username - the user history from the session
Returns:
a list of labels

getRecentlyUsedPersonalLabels

public java.util.List getRecentlyUsedPersonalLabels(java.lang.String username,
                                                    int maxResults)
Description copied from interface: LabelManager
Retrieve the labels that were recently used by currently authenticated user. 'Recently Used' includes labels that the user recently added, created, removed and deleted.

Note: labels in this list may or may not exist.

The UserHistory can be retrieved from the session via the ActionContext (if using an action) or the Execution Context (DWR)

Specified by:
getRecentlyUsedPersonalLabels in interface LabelManager
Parameters:
username - the user history from the session
maxResults - the maximum number of results to return to the user
Returns:
a list of labels

getRecentlyUsedPersonalLabellings

public java.util.List getRecentlyUsedPersonalLabellings(java.lang.String username,
                                                        int maxResults)
Specified by:
getRecentlyUsedPersonalLabellings in interface LabelManager

getCurrentContentForLabel

public java.util.List getCurrentContentForLabel(Label label)
Description copied from interface: LabelManager
Get all content associated with a label and space Get all current content associated with a label and any space. Content in the trash will not be returned.

Specified by:
getCurrentContentForLabel in interface LabelManager
Returns:
a list of Labelables, sorted by last modification date

getContentForAllLabels

public java.util.List<? extends Labelable> getContentForAllLabels(java.util.Collection<Label> labels,
                                                                  int maxResults,
                                                                  int offset)
Specified by:
getContentForAllLabels in interface LabelManager

getContentForLabel

public PartialList<ContentEntityObject> getContentForLabel(int offset,
                                                           int maxResults,
                                                           Label label)
Description copied from interface: LabelManager
Retrieve current ContentEntityObjects which are labelled with the provided label. ContentEntityObjects in the Trash will *not* be returned.

Specified by:
getContentForLabel in interface LabelManager
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
label - label which must appear on ContentEntityObjects
Returns:
a partial list of ContentEntityObjects labelled with the labels provided

getContentForAllLabels

public PartialList<ContentEntityObject> getContentForAllLabels(int offset,
                                                               int maxResults,
                                                               Label... labels)
Description copied from interface: LabelManager
Retrieve current ContentEntityObjects which are labelled with ALL provided labels. ContentEntityObjects in the Trash will *not* be returned.

Specified by:
getContentForAllLabels in interface LabelManager
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
labels - labels which must appear on ContentEntityObjects
Returns:
a partial list of ContentEntityObjects labelled with the labels provided

getForLabel

public <T extends EditableLabelable> PartialList<T> getForLabel(java.lang.Class<T> labelableClass,
                                                                int offset,
                                                                int maxResults,
                                                                Label label)
Description copied from interface: LabelManager
Retrieve EditableLabelables of the supplied type which are labelled with the provided label. ContentEntityObjects in the Trash *will* be returned.

Specified by:
getForLabel in interface LabelManager
Parameters:
labelableClass - the type of labelable to return
offset - the offset into the results
maxResults - the maximum number of results to return
label - label which must appear on labelables
Returns:
a partial list of EditableLabelables labelled with the labels provided

getForLabels

public <T extends EditableLabelable> PartialList<T> getForLabels(java.lang.Class<T> labelableClass,
                                                                 int offset,
                                                                 int maxResults,
                                                                 Label... labels)
Description copied from interface: LabelManager
Retrieve EditableLabelables of the supplied type which are labelled with the provided labels. ContentEntityObjects in the Trash will *not* be returned.

Specified by:
getForLabels in interface LabelManager
Parameters:
labelableClass - the type of labelable to return
offset - the offset into the results
maxResults - the maximum number of results to return
labels - labels which must all appear on labelables
Returns:
a partial list of EditableLabelables labelled with the labels provided

getForLabels

public PartialList<EditableLabelable> getForLabels(int offset,
                                                   int maxResults,
                                                   Label... labels)
Description copied from interface: LabelManager
Retrieve EditableLabelables of any type which are labelled with the provided labels. ContentEntityObjects in the Trash *will* be returned.

Specified by:
getForLabels in interface LabelManager
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
labels - labels which must all appear on labelables
Returns:
a partial list of EditableLabelables labelled with the labels provided

getContentInSpaceForLabel

public PartialList<ContentEntityObject> getContentInSpaceForLabel(int offset,
                                                                  int maxResults,
                                                                  java.lang.String spaceKey,
                                                                  Label label)
Description copied from interface: LabelManager
Retrieve current ContentEntityObjects in the given space which are labelled with the provided label. ContentEntityObjects in the Trash will *not* be returned.

Specified by:
getContentInSpaceForLabel in interface LabelManager
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
spaceKey - the key of the space to search content in
label - label which must appear on ContentEntityObjects
Returns:
a partial list of ContentEntityObjects labelled with the labels provided

getContentInSpaceForAllLabels

public PartialList<ContentEntityObject> getContentInSpaceForAllLabels(int offset,
                                                                      int maxResults,
                                                                      java.lang.String spaceKey,
                                                                      Label... labels)
Description copied from interface: LabelManager
Retrieve current ContentEntityObjects in the given space which are labelled with ALL provided labels. ContentEntityObjects in the Trash will *not* be returned.

Specified by:
getContentInSpaceForAllLabels in interface LabelManager
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
spaceKey - the key of the space to search content in
labels - labels which must appear on ContentEntityObjects
Returns:
a partial list of ContentEntityObjects labelled with the labels provided

getContentInSpacesForAllLabels

public PartialList<ContentEntityObject> getContentInSpacesForAllLabels(int offset,
                                                                       int maxResults,
                                                                       java.util.Set<java.lang.String> spaceKeys,
                                                                       Label... labels)
Description copied from interface: LabelManager
Retrieve current ContentEntityObjects in the given spaces which are labelled with ALL provided labels. ContentEntityObjects in the Trash will *not* be returned.

Specified by:
getContentInSpacesForAllLabels in interface LabelManager
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
spaceKeys - the keys of the spaces to search content in
labels - labels which must appear on ContentEntityObjects
Returns:
a partial list of ContentEntityObjects labelled with the labels provided

getAllContentForLabel

public PartialList<ContentEntityObject> getAllContentForLabel(int offset,
                                                              int maxResults,
                                                              Label label)
Description copied from interface: LabelManager
Retrieve all ContentEntityObjects, current or deleted which are labelled with the provided label. ContentEntityObjects in the Trash *will* be returned.

Specified by:
getAllContentForLabel in interface LabelManager
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
label - label which must appear on ContentEntityObjects
Returns:
a partial list of ContentEntityObjects labelled with the labels provided

getAllContentForAllLabels

public PartialList<ContentEntityObject> getAllContentForAllLabels(int offset,
                                                                  int maxResults,
                                                                  Label... labels)
Description copied from interface: LabelManager
Retrieve all ContentEntityObjects, current or deleted which are labelled with ALL provided labels. ContentEntityObjects in the Trash *will* be returned.

Specified by:
getAllContentForAllLabels in interface LabelManager
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
labels - labels which must appear on ContentEntityObjects
Returns:
a partial list of ContentEntityObjects labelled with the labels provided

getContentForLabel

public java.util.List<? extends Labelable> getContentForLabel(Label label,
                                                              int maxResults)
Description copied from interface: LabelManager
Get all content associated with a label Get all versions of content associated with a label and any space. Content in the trash will not be returned.

Specified by:
getContentForLabel in interface LabelManager
Returns:
a list of Labelables

getCurrentContentForLabelAndSpace

public java.util.List<? extends Labelable> getCurrentContentForLabelAndSpace(Label label,
                                                                             java.lang.String spaceKey)
Description copied from interface: LabelManager
Get all current content associated with a label and space. Content in the trash will not be returned.

Specified by:
getCurrentContentForLabelAndSpace in interface LabelManager
Returns:
a list of Labelable

getCurrentContentWithPersonalLabel

public java.util.List getCurrentContentWithPersonalLabel(java.lang.String username)
Description copied from interface: LabelManager
Get all current content labelled by a user

Specified by:
getCurrentContentWithPersonalLabel in interface LabelManager

getSpacesWithLabel

public java.util.List getSpacesWithLabel(Label label)
Description copied from interface: LabelManager
Spaces cannot be directly labelled. Howevever, their space descriptions can. This method searches for all space descriptions with the label passed in

Specified by:
getSpacesWithLabel in interface LabelManager
Returns:
list of spaces associated with matching space descriptions

deleteLabel

public boolean deleteLabel(long id)
Description copied from interface: LabelManager
Delete the label with the specified id.

Specified by:
deleteLabel in interface LabelManager
Returns:
true if the label was deleted, false otherwise.

getFavouriteSpaces

public java.util.List getFavouriteSpaces(java.lang.String username)
Specified by:
getFavouriteSpaces in interface LabelManager
Parameters:
username - username of label owner

deleteLabel

public boolean deleteLabel(Label label)
Description copied from interface: LabelManager
Delete the specified label.

NOTE: The specified label does note need to be the persistent instance of the label, it simply needs to uniquely identify the label.

Specified by:
deleteLabel in interface LabelManager
Returns:
true if the label was deleted, false otherwise.

getLabel

public Label getLabel(ParsedLabelName parsedLabelName)
Description copied from interface: LabelManager
Retrieve the label by name.

Specified by:
getLabel in interface LabelManager
Returns:
a persistent instance of the label or null if it can not be found.
See Also:
for details on the format of the labelReference parameter.

getLabel

public Label getLabel(java.lang.String unparsedLabelName)
Description copied from interface: LabelManager
convenience method to fetch a label without having to call the label parser

Specified by:
getLabel in interface LabelManager
Parameters:
unparsedLabelName - - example - my:foo

getLabels

public java.util.List<Label> getLabels(java.util.Collection<java.lang.String> unparsedLabelNames)
Description copied from interface: LabelManager
convenience method to fetch labels without having to call the label parser

Specified by:
getLabels in interface LabelManager
Parameters:
unparsedLabelNames - - example - my:foo, bar

getLabel

public Label getLabel(Label label)
Description copied from interface: LabelManager
Retrieve the persistent instance of the label with the exact same details as the specified label. Note, the specified label does not need to contain an id.

Specified by:
getLabel in interface LabelManager
Returns:
a persistent instance of the label, or null if it does not exist.

getLabel

public Label getLabel(java.lang.String labelName,
                      Namespace namespace)
Description copied from interface: LabelManager
Convenience method to fetch a label without having to create a Label object

Specified by:
getLabel in interface LabelManager
Parameters:
labelName - The label name
namespace - The namespace of the label
Returns:
a label instance or null if no such label exists

getLabelsByDetail

public java.util.List getLabelsByDetail(java.lang.String labelName,
                                        java.lang.String namespace,
                                        java.lang.String spaceKey,
                                        java.lang.String owner)
Description copied from interface: LabelManager
Retrieves the labels matching the given labelName, namespace or owner

Specified by:
getLabelsByDetail in interface LabelManager
Parameters:
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)
Returns:
a list of Label instances

getLabelsInSpace

public java.util.List getLabelsInSpace(java.lang.String key)
Description copied from interface: LabelManager
Retrieve all of the labels that label content within the specified space.

Specified by:
getLabelsInSpace in interface LabelManager
Parameters:
key -
Returns:
a list of labels that appear in the space.

getMostPopularLabels

public java.util.List<LabelSearchResult> getMostPopularLabels()
Description copied from interface: LabelManager
Retrieve the list of the DEFAULT_LABEL_COUNT most popular labels within the system.

Specified by:
getMostPopularLabels in interface LabelManager
Returns:
a list of label search result instances in order of their popularity.
See Also:
LabelManager.DEFAULT_LABEL_COUNT, LabelSearchResult

getMostPopularLabels

public java.util.List<LabelSearchResult> getMostPopularLabels(int count)
Description copied from interface: LabelManager
Retrieve the most popular labels within the system. The number of labels returned can be specified through the count parameter. If the count value is greater than the number of labels, then all labels will be returned.

This function does not return the labels itself, but wrapped into a search result with a count!

Specified by:
getMostPopularLabels in interface LabelManager
Parameters:
count - is the maximum number of labels to be returned.
Returns:
a list of label search result instances in order of their popularity.
See Also:
LabelSearchResult

getMostPopularLabelsInSpace

public java.util.List<LabelSearchResult> getMostPopularLabelsInSpace(java.lang.String key)
Description copied from interface: LabelManager
Retrieve the list of the DEFAULT_LABEL_COUNT most used labels in the specific space, ordered from most popular to least popular.

This function does not return the labels itself, but wrapped into a search result with a count!

Specified by:
getMostPopularLabelsInSpace in interface LabelManager
Parameters:
key - the space key
Returns:
a list of label search result instances in order of their popularity.
See Also:
LabelManager.DEFAULT_LABEL_COUNT, LabelSearchResult

getMostPopularLabelsInSpace

public java.util.List<LabelSearchResult> getMostPopularLabelsInSpace(java.lang.String key,
                                                                     int count)
Description copied from interface: LabelManager
Retrieve a list of the 'n' most used labels in the specified space, ordered from most popular to least popular.

This function does not return the labels itself, but wrapped into a search result with a count!

Specified by:
getMostPopularLabelsInSpace in interface LabelManager
Parameters:
key - is the space key
count - is the maximum number of labels to be returned.
Returns:
a list of label search result instances in order of their popularity.
See Also:
LabelSearchResult

getMostPopularLabelsWithRanks

public java.util.Set getMostPopularLabelsWithRanks(java.util.Comparator comparator)
Description copied from interface: LabelManager
Retrieve a set of the DEFAULT_LABEL_COUNT most popular labels within the system, including their ranks and ordered using the compartor provided.

Specified by:
getMostPopularLabelsWithRanks in interface LabelManager
Returns:
an ordered set of ranked label search result instances
See Also:
LabelManager.DEFAULT_LABEL_COUNT, RankedLabelSearchResult

getMostPopularLabelsWithRanks

public java.util.Set getMostPopularLabelsWithRanks(int maxResults,
                                                   java.util.Comparator comparator)
Description copied from interface: LabelManager
Retrieve the most popular labels within the system, including their ranks and ordered using the comparator provided. The number of labels returned can be specified through the count parameter. If the count value is greater than the number of labels, then all labels will be returned.

This function does not return the labels itself, but wrapped into a search result with a count!

Specified by:
getMostPopularLabelsWithRanks in interface LabelManager
Parameters:
maxResults - is the maximum number of labels to be returned.
Returns:
an ordered set of ranked label search result instances
See Also:
RankedLabelSearchResult

getMostPopularLabelsWithRanksInSpace

public java.util.Set getMostPopularLabelsWithRanksInSpace(java.lang.String key,
                                                          int maxResults,
                                                          java.util.Comparator comparator)
Description copied from interface: LabelManager
Retrieve a set of the 'n' most used labels in the specified space, ordered using the compartor given.

This function does not return the labels itself, but wrapped into a search result with a count!

Specified by:
getMostPopularLabelsWithRanksInSpace in interface LabelManager
Parameters:
key - is the space key
maxResults - is the maximum number of labels to be returned.
Returns:
an ordered set of rankded label search result instances
See Also:
RankedLabelSearchResult

getContent

public java.util.List getContent(Label label)
Description copied from interface: LabelManager
Get all content associated with a label Get all versions of content associated with a label and any space. Content in the trash WILL be returned.

Specified by:
getContent in interface LabelManager
Returns:
a list of Labelables

getContentCount

public int getContentCount(Label label)
Specified by:
getContentCount in interface LabelManager

createLabel

public Label createLabel(Label label)
Specified by:
createLabel in interface LabelManager

getRecentlyUsedLabellings

public java.util.List getRecentlyUsedLabellings(int maxResults)
Specified by:
getRecentlyUsedLabellings in interface LabelManager

getRecentlyUsedLabellingsInSpace

public java.util.List getRecentlyUsedLabellingsInSpace(java.lang.String spaceKey,
                                                       int maxResults)
Specified by:
getRecentlyUsedLabellingsInSpace in interface LabelManager


Copyright © 2003-2014 Atlassian. All Rights Reserved.