Interface LabelDao
-
- All Superinterfaces:
ObjectDao
- All Known Subinterfaces:
LabelDaoInternal
- All Known Implementing Classes:
HibernateLabelDao
public interface LabelDao extends ObjectDao
-
-
Field Summary
Fields Modifier and Type Field Description static int
UNLIMITED
Specify no limit on the number of results returned by the dao.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
deleteLabellingBySpace(String key)
PartialList<ContentEntityObject>
findAllContentForAllLabels(int offset, int maxResults, Label... labels)
Retrieve all ContentEntityObjects which are labelled with ALL provided labels.List<? extends EditableLabelable>
findAllUserLabelledContent(String username)
List<Label>
findByDetails(String name, String namespace, String owner)
Find all labels based on the details passed in.List<Label>
findByDetailsInSpace(String name, String namespace, String owner, String spaceKey)
Find all labels for a specific space, based on the details passed in.List<Label>
findByDetailsInSpaces(String name, String namespace, String owner, Collection<Space> spaces)
Find all labels for a specific space, based on the details passed in.Label
findById(long id)
Find the label by its id.Label
findByLabel(Label label)
List<Label>
findBySingleDegreeSeparation(EditableLabelable content, int maxResults)
Find the labels that are a single degree of separation away from the specified content.List<Label>
findBySingleDegreeSeparation(EditableLabelable content, String spaceKey, int maxResults)
List<Label>
findBySingleDegreeSeparation(Label label, int maxResults)
Find the labels that are a single degree of separation away from the specified label.List<Label>
findBySingleDegreeSeparation(Label label, String spaceKey, int maxResults)
List<Label>
findBySpace(String spaceKey, String namespace)
Find the labels used to label the content with the specified space.int
findContentCountForLabel(Label label)
List<? extends EditableLabelable>
findContentForLabel(Label label, int maxResults)
Deprecated.since 5.3.PartialList<ContentEntityObject>
findContentInSpaceForAllLabels(int offset, int maxResults, String spaceKey, Label... labels)
Retrieve current ContentEntityObjects in the space which are labelled with ALL provided labels.PartialList<ContentEntityObject>
findContentInSpacesForAllLabels(int offset, int maxResults, Set<String> spaceKeys, Label... labels)
Retrieve current ContentEntityObjects in the given spaces which are labelled with ALL provided labels.List<? extends EditableLabelable>
findCurrentContentForLabel(Label label)
Deprecated.since 5.3.List<? extends EditableLabelable>
findCurrentContentForLabelAndSpace(Label label, String spaceKey)
Deprecated.Since 5.3.PartialList<EditableLabelable>
findForAllLabels(int offset, int maxResults, Label... labels)
Retrieve EditableLabelables which are labelled with ALL provided labels.<T extends EditableLabelable>
PartialList<T>findForAllLabels(Class<T> labelableClass, int offset, int maxResults, Label... labels)
Retrieve current EditableLabelables which are labelled with ALL provided labels.PageResponse<Label>
findGlobalLabelsByNamePrefix(String namePrefix, LimitedRequest pageRequest)
Returns global-namespaced labels starting with the given string.Labelling
findLabellingByContentAndLabel(EditableLabelable content, Label label)
Labelling
findLabellingById(long id)
List<LabelSearchResult>
findMostPopular(String namespace, int maxResults)
Find the most popular labels.List<LabelSearchResult>
findMostPopularBySpace(String namespace, String key, int maxResults)
Find the most popular labels in the specified space.List<Label>
findRecentlyUsed(int maxResults)
List<Label>
findRecentlyUsedBySpace(String key, int maxResults)
List<Labelling>
findRecentlyUsedLabelling(int maxResults)
List<Labelling>
findRecentlyUsedLabellingsBySpace(String spaceKey, int maxResults)
List<Labelling>
findRecentlyUsedUserLabellings(String username, int maxResults)
List<Label>
findRecentlyUsedUserLabels(String username, int maxResults)
List<Space>
findSpacesContainingContentWithLabel(Label label)
List<Space>
findSpacesWithLabel(Label label)
default PageResponse<Label>
findTeamLabelsByNamePrefix(String namePrefix, LimitedRequest pageRequest)
Returns team-namespaced labels starting with the given string.List<Label>
findUnusedLabels()
List<Labelling>
getFavouriteLabellingsByContentIds(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey)
List<Space>
getFavouriteSpaces(String username)
void
remove(Label label)
void
remove(Labelling labelling)
-
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, findAllSorted, findByClassIds, getPersistentClass, refresh, remove, replicate, save, saveRaw
-
-
-
-
Field Detail
-
UNLIMITED
static final int UNLIMITED
Specify no limit on the number of results returned by the dao.- See Also:
- Constant Field Values
-
-
Method Detail
-
findById
Label findById(long id)
Find the label by its id.- Parameters:
id
- ID of the label- Returns:
- a label instance, or null if the label does not exist.
-
findByDetails
List<Label> findByDetails(String name, String namespace, String owner)
Find all labels based on the details passed in. If a parameter is null, it will not be considered in the search.The list of labels returned will be ordered by name.
- Parameters:
name
- Label name (can be null)namespace
- Namespace of the label (can be null)owner
- Owner of the label (can be null)- Returns:
- List The list of labels matching the given criteria
-
findByDetailsInSpace
List<Label> findByDetailsInSpace(String name, String namespace, String owner, String spaceKey)
Find all labels for a specific space, based on the details passed in. If a parameter is null, it will not be considered in the search.The list of labels returned will be ordered by name.
- Parameters:
name
- Label name (can be null)namespace
- Namespace of the label (can be null)owner
- Owner of the label (can be null)spaceKey
- Key of the space whose content must have the returned labels (can be null)- Returns:
- List The list of labels matching the given criteria
-
findByDetailsInSpaces
List<Label> findByDetailsInSpaces(String name, String namespace, String owner, Collection<Space> spaces)
Find all labels for a specific space, based on the details passed in. If a parameter is null, it will not be considered in the search.The list of labels returned will be ordered by name.
- Parameters:
name
- Label name (can be null)namespace
- Namespace of the label (can be null)owner
- Owner of the label (can be null)spaces
- Collection of spaces whose content must have the returned labels (can be null)- Returns:
- List The list of labels matching the given criteria
-
findBySpace
List<Label> findBySpace(String spaceKey, String namespace)
Find the labels used to label the content with the specified space.- Parameters:
spaceKey
- Key of the space whose content must have the returned labels (can be null)namespace
- Namespace of the label (can be null)- Returns:
- a list of labels, or an empty list if none exist.
-
findMostPopular
List<LabelSearchResult> findMostPopular(String namespace, int maxResults)
Find the most popular labels.Label popularity is defined by the number of times a label has been used / applied to content.
- Parameters:
maxResults
- Maximum size of list to return- Returns:
- a list of label instances, or an empty list if non exist.
-
findMostPopularBySpace
List<LabelSearchResult> findMostPopularBySpace(String namespace, String key, int maxResults)
Find the most popular labels in the specified space. You can restrict the number of results returned by this query by setting the maxResults parameter.- Parameters:
key
- of the space whose content must have the returned labelsmaxResults
- allows you to specify the maximum number of results returned by this method. Leaving max results at zero will return all of the results.- Returns:
- a list of LabelSearchResult objects that map the label to the number of times it appears in the space.
-
findRecentlyUsedLabellingsBySpace
List<Labelling> findRecentlyUsedLabellingsBySpace(String spaceKey, int maxResults)
-
findRecentlyUsedUserLabellings
List<Labelling> findRecentlyUsedUserLabellings(String username, int maxResults)
-
findBySingleDegreeSeparation
List<Label> findBySingleDegreeSeparation(EditableLabelable content, int maxResults)
Find the labels that are a single degree of separation away from the specified content.This query will retrieve the labels on the given content object and find any content with those labels. The labels that are used on the second "level" of content will be returned.
e.g. Page H is passed in as the content object, which is labelled with A and B. All pages labelled with A and B are retrieved (J, K, L, M), and the labels on those four pages are returned in order of frequency.
- Parameters:
content
- the content object used to search for related labelsmaxResults
- specifies the number of labels to be returned.- Returns:
- a list of labels, ordered by their frequency of occurance.
-
findBySingleDegreeSeparation
List<Label> findBySingleDegreeSeparation(EditableLabelable content, String spaceKey, int maxResults)
-
findBySingleDegreeSeparation
List<Label> findBySingleDegreeSeparation(Label label, int maxResults)
Find the labels that are a single degree of separation away from the specified label.This query will return the labels located on the same pages with the given label, in order of frequency
e.g. Page A has labels ABCX, Page B has labels ABX. A query for X will return A (2 uses) then B (1 use)
- Parameters:
label
- the label to look for on pagesmaxResults
- the maximum number of results to return- Returns:
- a list of labels, ordered by their frequency of occurance.
-
findBySingleDegreeSeparation
List<Label> findBySingleDegreeSeparation(Label label, String spaceKey, int maxResults)
-
findCurrentContentForLabel
@Deprecated List<? extends EditableLabelable> findCurrentContentForLabel(Label label)
Deprecated.since 5.3. UsefindForAllLabels(Class, int, int, Label...)
Returns current content with the specified label, sorted by last modification date. Items in the trash are not included - for those items use#findContentForLabel(Label)
.- Parameters:
label
- search for content with this label- Returns:
- current content with the specified label, sorted by last modification date.
-
findCurrentContentForLabelAndSpace
@Deprecated List<? extends EditableLabelable> findCurrentContentForLabelAndSpace(Label label, String spaceKey)
Deprecated.Since 5.3. UsefindContentInSpaceForAllLabels(int, int, String, Label...)
.Returns current content with the specified label and spaceKey. If no spaceKey is specified, a search will be performed against the label only.- Parameters:
label
- search for content with this labelspaceKey
- (optional) search for content belonging to the space with this spaceKey- Returns:
- current content with the specified label and spaceKey.
-
findContentCountForLabel
int findContentCountForLabel(Label label)
-
findLabellingByContentAndLabel
Labelling findLabellingByContentAndLabel(EditableLabelable content, Label label)
-
findLabellingById
Labelling findLabellingById(long id)
-
deleteLabellingBySpace
void deleteLabellingBySpace(String key)
-
getFavouriteSpaces
List<Space> getFavouriteSpaces(String username)
- Parameters:
username
- username of label owner
-
findAllUserLabelledContent
List<? extends EditableLabelable> findAllUserLabelledContent(String username)
-
findContentForLabel
@Deprecated List<? extends EditableLabelable> findContentForLabel(Label label, int maxResults)
Deprecated.since 5.3. Use a findContentForAllLabels variant with an offset and maxResults.Returns content with the specified label, ordered by content id. Items in the trash are included - for only current items usefindCurrentContentForLabel(Label)
.- Parameters:
label
- search for content with this labelmaxResults
- the number of results to return; use -1 to get all results- Returns:
- content with the specified label
-
findForAllLabels
<T extends EditableLabelable> PartialList<T> findForAllLabels(Class<T> labelableClass, int offset, int maxResults, Label... labels)
Retrieve current EditableLabelables which are labelled with ALL provided labels.- Parameters:
labelableClass
- the type of EditableLabelable to return. Use one of these values:- ContentEntityObject.class - all CEO labelings except Attachments
- Attachment.class - all attachment labellings
- PageTemplate.class - all page template labellings
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabels
- labels which must appear on ContentEntityObjects- Returns:
- a partial list of ContentEntityObjects labelled with the labels provided
-
findForAllLabels
PartialList<EditableLabelable> findForAllLabels(int offset, int maxResults, Label... labels)
Retrieve EditableLabelables which are labelled with ALL provided labels.If
ContentEntityObject
s are returned in the list they may be current or in the trash.- Parameters:
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabels
- labels which must appear on ContentEntityObjects- Returns:
- a partial list of ContentEntityObjects labelled with the labels provided
-
findContentInSpaceForAllLabels
PartialList<ContentEntityObject> findContentInSpaceForAllLabels(int offset, int maxResults, String spaceKey, Label... labels)
Retrieve current ContentEntityObjects in the space which are labelled with ALL provided labels. Does NOT include Attachments- Parameters:
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnspaceKey
- the key of the space to search inlabels
- labels which must appear on ContentEntityObjects- Returns:
- a partial list of ContentEntityObjects labelled with the labels provided
-
findContentInSpacesForAllLabels
PartialList<ContentEntityObject> findContentInSpacesForAllLabels(int offset, int maxResults, Set<String> spaceKeys, Label... labels)
Retrieve current ContentEntityObjects in the given spaces which are labelled with ALL provided labels. Does NOT include Attachments- Parameters:
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnspaceKeys
- the keys of the spaces to search inlabels
- labels which must appear on ContentEntityObjects- Returns:
- a partial list of ContentEntityObjects labelled with the labels provided
-
findAllContentForAllLabels
PartialList<ContentEntityObject> findAllContentForAllLabels(int offset, int maxResults, Label... labels)
Retrieve all ContentEntityObjects which are labelled with ALL provided labels. Includes content in the Trash. Does NOT include Attachments- Parameters:
offset
- the offset into the resultsmaxResults
- the maximum number of results to returnlabels
- labels which must appear on ContentEntityObjects- Returns:
- a partial list of ContentEntityObjects labelled with the labels provided
-
findGlobalLabelsByNamePrefix
PageResponse<Label> findGlobalLabelsByNamePrefix(String namePrefix, LimitedRequest pageRequest)
Returns global-namespaced labels starting with the given string.
-
findTeamLabelsByNamePrefix
default PageResponse<Label> findTeamLabelsByNamePrefix(String namePrefix, LimitedRequest pageRequest)
Returns team-namespaced labels starting with the given string.
-
getFavouriteLabellingsByContentIds
List<Labelling> getFavouriteLabellingsByContentIds(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey)
-
remove
void remove(Labelling labelling)
- Since:
- 8.9
-
remove
void remove(Label label)
- Since:
- 8.9
-
-