Class HibernateLabelDao
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao<Label>
-
- com.atlassian.confluence.labels.persistence.dao.hibernate.HibernateLabelDao
-
- All Implemented Interfaces:
ObjectDao,LabelDaoInternal,ObjectDaoInternal<Label>,LabelDao,org.springframework.beans.factory.InitializingBean
public class HibernateLabelDao extends HibernateObjectDao<Label> implements LabelDaoInternal
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
HibernateObjectDao.Cacheability
-
-
Constructor Summary
Constructors Constructor Description HibernateLabelDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteLabellingBySpace(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>findByDetailsInSpace(String name, String namespace, String owner, String spaceKey, LimitedRequest limitedRequest)Allow to find detail in Space with paginationList<Label>findByDetailsInSpaces(String name, String namespace, String owner, Collection<Space> spaces)Find all labels for a specific space, based on the details passed in.LabelfindById(long id)Find the label by its id.LabelfindByLabel(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.intfindContentCountForLabel(Label label)List<? extends EditableLabelable>findContentForLabel(Label label, int maxResults)Returns content with the specified label, ordered by content id.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)Returns current content with the specified label, sorted by last modification date.List<? extends EditableLabelable>findCurrentContentForLabelAndSpace(Label label, String spaceKey)Returns current content with the specified label and spaceKey.PartialList<EditableLabelable>findForAllLabels(int offset, int maxResults, Label... labelsArray)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.LabellingfindLabellingByContentAndLabel(EditableLabelable content, Label label)LabellingfindLabellingById(long id)List<LabelSearchResult>findMostPopular(String namespace, int maxResults)Find the most popular labels.List<LabelSearchResult>findMostPopularBySpace(String namespace, String spaceKey, int maxResults)Find the most popular labels in the specified space.List<Label>findRecentlyUsed(int maxResults)List<Label>findRecentlyUsedBySpace(String spaceKey, 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)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)Class<Label>getPersistentClass()Gets the type ofEntityObjectthis Dao works with.longgetTotalLabelInSpace(String name, String namespace, String owner, String spaceKey)Count total number of label in spacevoidsetAttachmentManager(AttachmentManager attachmentManager)voidsetConfluenceUserDao(ConfluenceUserDao confluenceUserDao)voidsetContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)voidsetPageTemplateDao(PageTemplateDao pageTemplateDao)-
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao
applyTransactionTimeout, applyTransactionTimeout, checkDaoConfig, createHibernateTemplate, findAll, findAllSorted, findAllSorted, findByClassIds, findByClassIdsFiltered, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, getCountResult, getHibernateTemplate, getSessionFactory, index, indexEntity, refresh, refreshEntity, reIndex, reIndexEntity, remove, removeEntity, replicate, replicateEntity, save, saveEntity, saveRaw, saveRawEntity, setEventPublisher, setHibernateTemplate, setIndexer, setSessionFactory, unIndex, unIndexEntity, uniqueResult, updateEntityModificationData, updateModificationData
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.internal.persistence.ObjectDaoInternal
findAll, findAllSorted, findAllSorted, findByClassIds, findByClassIdsFiltered, refresh, refreshEntity, remove, removeEntity, replicate, replicateEntity, save, saveEntity, saveRaw, saveRawEntity
-
-
-
-
Method Detail
-
getPersistentClass
public Class<Label> getPersistentClass()
Description copied from interface:ObjectDaoInternalGets the type ofEntityObjectthis Dao works with.- Specified by:
getPersistentClassin interfaceObjectDao- Specified by:
getPersistentClassin interfaceObjectDaoInternal<Label>- Returns:
- the type
-
findById
public Label findById(long id)
Description copied from interface:LabelDaoFind the label by its id.
-
findByLabel
public Label findByLabel(Label label)
- Specified by:
findByLabelin interfaceLabelDao
-
findByDetails
public List<Label> findByDetails(String name, String namespace, String owner)
Description copied from interface:LabelDaoFind 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.
- Specified by:
findByDetailsin interfaceLabelDao- 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
public List<Label> findByDetailsInSpace(String name, String namespace, String owner, String spaceKey)
Description copied from interface:LabelDaoFind 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.
- Specified by:
findByDetailsInSpacein interfaceLabelDao- 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
-
findByDetailsInSpace
public List<Label> findByDetailsInSpace(String name, String namespace, String owner, String spaceKey, LimitedRequest limitedRequest)
Description copied from interface:LabelDaoInternalAllow to find detail in Space with pagination- Specified by:
findByDetailsInSpacein interfaceLabelDaoInternal- Returns:
-
getTotalLabelInSpace
public long getTotalLabelInSpace(String name, String namespace, String owner, String spaceKey)
Description copied from interface:LabelDaoInternalCount total number of label in space- Specified by:
getTotalLabelInSpacein interfaceLabelDaoInternal- Returns:
-
findByDetailsInSpaces
public List<Label> findByDetailsInSpaces(String name, String namespace, String owner, Collection<Space> spaces)
Description copied from interface:LabelDaoFind 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.
- Specified by:
findByDetailsInSpacesin interfaceLabelDao- 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
public List<Label> findBySpace(String spaceKey, String namespace)
Description copied from interface:LabelDaoFind the labels used to label the content with the specified space.- Specified by:
findBySpacein interfaceLabelDao- 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.
-
findRecentlyUsedBySpace
public List<Label> findRecentlyUsedBySpace(String spaceKey, int maxResults)
- Specified by:
findRecentlyUsedBySpacein interfaceLabelDao
-
findRecentlyUsed
public List<Label> findRecentlyUsed(int maxResults)
- Specified by:
findRecentlyUsedin interfaceLabelDao
-
findRecentlyUsedLabelling
public List<Labelling> findRecentlyUsedLabelling(int maxResults)
- Specified by:
findRecentlyUsedLabellingin interfaceLabelDao
-
findRecentlyUsedLabellingsBySpace
public List<Labelling> findRecentlyUsedLabellingsBySpace(String spaceKey, int maxResults)
- Specified by:
findRecentlyUsedLabellingsBySpacein interfaceLabelDao
-
findRecentlyUsedUserLabels
public List<Label> findRecentlyUsedUserLabels(String username, int maxResults)
- Specified by:
findRecentlyUsedUserLabelsin interfaceLabelDao
-
findRecentlyUsedUserLabellings
public List<Labelling> findRecentlyUsedUserLabellings(String username, int maxResults)
- Specified by:
findRecentlyUsedUserLabellingsin interfaceLabelDao
-
findMostPopular
public List<LabelSearchResult> findMostPopular(String namespace, int maxResults)
Description copied from interface:LabelDaoFind the most popular labels.Label popularity is defined by the number of times a label has been used / applied to content.
- Specified by:
findMostPopularin interfaceLabelDaomaxResults- Maximum size of list to return- Returns:
- a list of label instances, or an empty list if non exist.
-
findMostPopularBySpace
public List<LabelSearchResult> findMostPopularBySpace(String namespace, String spaceKey, int maxResults)
Description copied from interface:LabelDaoFind the most popular labels in the specified space. You can restrict the number of results returned by this query by setting the maxResults parameter.- Specified by:
findMostPopularBySpacein interfaceLabelDaospaceKey- 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.
-
findBySingleDegreeSeparation
public List<Label> findBySingleDegreeSeparation(EditableLabelable content, int maxResults)
Description copied from interface:LabelDaoFind 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.
- Specified by:
findBySingleDegreeSeparationin interfaceLabelDao- 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
public List<Label> findBySingleDegreeSeparation(EditableLabelable content, String spaceKey, int maxResults)
- Specified by:
findBySingleDegreeSeparationin interfaceLabelDao
-
findBySingleDegreeSeparation
public List<Label> findBySingleDegreeSeparation(Label label, int maxResults)
Description copied from interface:LabelDaoFind 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)
- Specified by:
findBySingleDegreeSeparationin interfaceLabelDao- 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
public List<Label> findBySingleDegreeSeparation(Label label, String spaceKey, int maxResults)
- Specified by:
findBySingleDegreeSeparationin interfaceLabelDao
-
findAllUserLabelledContent
public List<? extends EditableLabelable> findAllUserLabelledContent(String username)
- Specified by:
findAllUserLabelledContentin interfaceLabelDao
-
findCurrentContentForLabel
public List<? extends EditableLabelable> findCurrentContentForLabel(Label label)
Description copied from interface:LabelDaoReturns current content with the specified label, sorted by last modification date. Items in the trash are not included - for those items use#findContentForLabel(Label).- Specified by:
findCurrentContentForLabelin interfaceLabelDao- Parameters:
label- search for content with this label- Returns:
- current content with the specified label, sorted by last modification date.
-
findContentForLabel
public List<? extends EditableLabelable> findContentForLabel(Label label, int maxResults)
Description copied from interface:LabelDaoReturns content with the specified label, ordered by content id. Items in the trash are included - for only current items useLabelDao.findCurrentContentForLabel(Label).- Specified by:
findContentForLabelin interfaceLabelDao- 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
public <T extends EditableLabelable> PartialList<T> findForAllLabels(Class<T> labelableClass, int offset, int maxResults, Label... labels)
Description copied from interface:LabelDaoRetrieve current EditableLabelables which are labelled with ALL provided labels.- Specified by:
findForAllLabelsin interfaceLabelDao- 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
public PartialList<EditableLabelable> findForAllLabels(int offset, int maxResults, Label... labelsArray)
Description copied from interface:LabelDaoRetrieve EditableLabelables which are labelled with ALL provided labels.If
ContentEntityObjects are returned in the list they may be current or in the trash.- Specified by:
findForAllLabelsin interfaceLabelDao- Parameters:
offset- the offset into the resultsmaxResults- the maximum number of results to returnlabelsArray- labels which must appear on ContentEntityObjects- Returns:
- a partial list of ContentEntityObjects labelled with the labels provided
-
findContentInSpaceForAllLabels
public PartialList<ContentEntityObject> findContentInSpaceForAllLabels(int offset, int maxResults, String spaceKey, Label... labels)
Description copied from interface:LabelDaoRetrieve current ContentEntityObjects in the space which are labelled with ALL provided labels. Does NOT include Attachments- Specified by:
findContentInSpaceForAllLabelsin interfaceLabelDao- 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
public PartialList<ContentEntityObject> findContentInSpacesForAllLabels(int offset, int maxResults, Set<String> spaceKeys, Label... labels)
Description copied from interface:LabelDaoRetrieve current ContentEntityObjects in the given spaces which are labelled with ALL provided labels. Does NOT include Attachments- Specified by:
findContentInSpacesForAllLabelsin interfaceLabelDao- 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
public PartialList<ContentEntityObject> findAllContentForAllLabels(int offset, int maxResults, Label... labels)
Description copied from interface:LabelDaoRetrieve all ContentEntityObjects which are labelled with ALL provided labels. Includes content in the Trash. Does NOT include Attachments- Specified by:
findAllContentForAllLabelsin interfaceLabelDao- 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
-
findContentCountForLabel
public int findContentCountForLabel(Label label)
- Specified by:
findContentCountForLabelin interfaceLabelDao
-
findCurrentContentForLabelAndSpace
public List<? extends EditableLabelable> findCurrentContentForLabelAndSpace(Label label, String spaceKey)
Description copied from interface:LabelDaoReturns current content with the specified label and spaceKey. If no spaceKey is specified, a search will be performed against the label only.- Specified by:
findCurrentContentForLabelAndSpacein interfaceLabelDao- 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.
-
findSpacesContainingContentWithLabel
public List<Space> findSpacesContainingContentWithLabel(Label label)
- Specified by:
findSpacesContainingContentWithLabelin interfaceLabelDao
-
findSpacesWithLabel
public List<Space> findSpacesWithLabel(Label label)
- Specified by:
findSpacesWithLabelin interfaceLabelDao
-
findLabellingByContentAndLabel
public Labelling findLabellingByContentAndLabel(EditableLabelable content, Label label)
- Specified by:
findLabellingByContentAndLabelin interfaceLabelDao
-
findLabellingById
public Labelling findLabellingById(long id)
- Specified by:
findLabellingByIdin interfaceLabelDao
-
deleteLabellingBySpace
public void deleteLabellingBySpace(String key)
- Specified by:
deleteLabellingBySpacein interfaceLabelDao
-
getFavouriteSpaces
public List<Space> getFavouriteSpaces(String username)
- Specified by:
getFavouriteSpacesin interfaceLabelDao- Parameters:
username- username of label owner
-
findUnusedLabels
public List<Label> findUnusedLabels()
- Specified by:
findUnusedLabelsin interfaceLabelDao
-
getFavouriteLabellingsByContentIds
public List<Labelling> getFavouriteLabellingsByContentIds(Collection<Long> contentIds, com.atlassian.sal.api.user.UserKey userKey)
- Specified by:
getFavouriteLabellingsByContentIdsin interfaceLabelDao
-
findGlobalLabelsByNamePrefix
public PageResponse<Label> findGlobalLabelsByNamePrefix(String namePrefix, LimitedRequest pageRequest)
Description copied from interface:LabelDaoReturns global-namespaced labels starting with the given string.- Specified by:
findGlobalLabelsByNamePrefixin interfaceLabelDao
-
findTeamLabelsByNamePrefix
public PageResponse<Label> findTeamLabelsByNamePrefix(String namePrefix, LimitedRequest pageRequest)
Description copied from interface:LabelDaoReturns team-namespaced labels starting with the given string.- Specified by:
findTeamLabelsByNamePrefixin interfaceLabelDao
-
setConfluenceUserDao
public void setConfluenceUserDao(ConfluenceUserDao confluenceUserDao)
-
setPageTemplateDao
public void setPageTemplateDao(PageTemplateDao pageTemplateDao)
-
setContentEntityObjectDao
public void setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)
-
setAttachmentManager
public void setAttachmentManager(AttachmentManager attachmentManager)
-
-