com.atlassian.confluence.labels.persistence.dao.hibernate
Class HibernateLabelDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.hibernate.HibernateObjectDao
              extended by com.atlassian.confluence.labels.persistence.dao.hibernate.HibernateLabelDao
All Implemented Interfaces:
ObjectDao, LabelDao, org.springframework.beans.factory.InitializingBean

public class HibernateLabelDao
extends HibernateObjectDao
implements LabelDao


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Fields inherited from interface com.atlassian.confluence.labels.persistence.dao.LabelDao
UNLIMITED
 
Constructor Summary
HibernateLabelDao()
           
 
Method Summary
 void deleteLabellingBySpace(java.lang.String key)
           
 PartialList<ContentEntityObject> findAllContentForAllLabels(int offset, int maxResults, Label... labels)
          Retrieve all ContentEntityObjects which are labelled with ALL provided labels.
 java.util.List<? extends EditableLabelable> findAllUserLabelledContent(java.lang.String username)
           
 java.util.List findByDetails(java.lang.String name, java.lang.String namespace, java.lang.String owner)
          Find all labels based on the details passed in.
 java.util.List findByDetailsInSpace(java.lang.String name, java.lang.String namespace, java.lang.String owner, java.lang.String spaceKey)
          Find all labels for a specific space, based on the details passed in.
 java.util.List<Label> findByDetailsInSpaces(java.lang.String name, java.lang.String namespace, java.lang.String owner, java.util.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)
           
 java.util.List findBySingleDegreeSeparation(EditableLabelable content, int maxResults)
          Find the labels that are a single degree of separation away from the specified content.
 java.util.List findBySingleDegreeSeparation(EditableLabelable content, java.lang.String spaceKey, int maxResults)
           
 java.util.List findBySingleDegreeSeparation(Label label, int maxResults)
          Find the labels that are a single degree of separation away from the specified label.
 java.util.List findBySingleDegreeSeparation(Label label, java.lang.String spaceKey, int maxResults)
           
 java.util.List findBySpace(java.lang.String spaceKey, java.lang.String namespace)
          Find the labels used to label the content with the specified space.
 int findContentCountForLabel(Label label)
           
 java.util.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, java.lang.String spaceKey, Label... labels)
          Retrieve current ContentEntityObjects in the space which are labelled with ALL provided labels.
 PartialList<ContentEntityObject> findContentInSpacesForAllLabels(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<? extends EditableLabelable> findCurrentContentForLabel(Label label)
          Returns current content with the specified label, sorted by last modification date.
 java.util.List<? extends EditableLabelable> findCurrentContentForLabelAndSpace(Label label, java.lang.String spaceKey)
          Returns current content with the specified label and spaceKey.
<T extends EditableLabelable>
PartialList<T>
findForAllLabels(java.lang.Class<T> labelableClass, int offset, int maxResults, Label... labels)
          Retrieve current EditableLabelables which are labelled with ALL provided labels.
 PartialList<EditableLabelable> findForAllLabels(int offset, int maxResults, Label... labelsArray)
          Retrieve EditableLabelables which are labelled with ALL provided labels.
 Labelling findLabellingByContentAndLabel(EditableLabelable content, Label label)
           
 Labelling findLabellingById(long id)
           
 java.util.List findMostPopular(java.lang.String namespace, int maxResults)
          Find the most popular labels.
 java.util.List findMostPopularBySpace(java.lang.String namespace, java.lang.String spaceKey, int maxResults)
          Find the most popular labels in the specified space.
 java.util.List findRecentlyUsed(int maxResults)
           
 java.util.List findRecentlyUsedBySpace(java.lang.String spaceKey, int maxResults)
           
 java.util.List findRecentlyUsedLabelling(int maxResults)
           
 java.util.List findRecentlyUsedLabellingsBySpace(java.lang.String spaceKey, int maxResults)
           
 java.util.List findRecentlyUsedUserLabellings(java.lang.String username, int maxResults)
           
 java.util.List findRecentlyUsedUserLabels(java.lang.String username, int maxResults)
           
 java.util.List findSpacesContainingContentWithLabel(Label label)
           
 java.util.List findSpacesWithLabel(Label label)
           
 java.util.List findUnusedLabels()
           
 java.util.List getFavouriteSpaces(java.lang.String username)
           
 java.lang.Class getPersistentClass()
           
 void setAttachmentManager(AttachmentManager attachmentManager)
           
 void setConfluenceUserDao(ConfluenceUserDao confluenceUserDao)
           
 void setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)
           
 void setForceSQL(boolean forceSQL)
           
 void setPageTemplateDao(PageTemplateDao pageTemplateDao)
           
 
Methods inherited from class com.atlassian.hibernate.HibernateObjectDao
findAll, findAllSorted, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, getCountResult, index, refresh, reIndex, remove, replicate, save, saveRaw, setIndexer, unIndex, uniqueResult, updateModificationData
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, findAllSorted, refresh, remove, replicate, save, saveRaw
 

Constructor Detail

HibernateLabelDao

public HibernateLabelDao()
Method Detail

setForceSQL

public void setForceSQL(boolean forceSQL)

getPersistentClass

public java.lang.Class getPersistentClass()
Specified by:
getPersistentClass in interface ObjectDao

findById

public Label findById(long id)
Description copied from interface: LabelDao
Find the label by its id.

Specified by:
findById in interface LabelDao
Parameters:
id - ID of the label
Returns:
a label instance, or null if the label does not exist.

findByLabel

public Label findByLabel(Label label)
Specified by:
findByLabel in interface LabelDao

findByDetails

public java.util.List findByDetails(java.lang.String name,
                                    java.lang.String namespace,
                                    java.lang.String owner)
Description copied from interface: LabelDao
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.

Specified by:
findByDetails in interface LabelDao
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 java.util.List findByDetailsInSpace(java.lang.String name,
                                           java.lang.String namespace,
                                           java.lang.String owner,
                                           java.lang.String spaceKey)
Description copied from interface: LabelDao
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.

Specified by:
findByDetailsInSpace in interface LabelDao
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

public java.util.List<Label> findByDetailsInSpaces(java.lang.String name,
                                                   java.lang.String namespace,
                                                   java.lang.String owner,
                                                   java.util.Collection<Space> spaces)
Description copied from interface: LabelDao
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.

Specified by:
findByDetailsInSpaces in interface LabelDao
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 java.util.List findBySpace(java.lang.String spaceKey,
                                  java.lang.String namespace)
Description copied from interface: LabelDao
Find the labels used to label the content with the specified space.

Specified by:
findBySpace in interface LabelDao
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 java.util.List findRecentlyUsedBySpace(java.lang.String spaceKey,
                                              int maxResults)
Specified by:
findRecentlyUsedBySpace in interface LabelDao

findRecentlyUsed

public java.util.List findRecentlyUsed(int maxResults)
Specified by:
findRecentlyUsed in interface LabelDao

findRecentlyUsedLabelling

public java.util.List findRecentlyUsedLabelling(int maxResults)
Specified by:
findRecentlyUsedLabelling in interface LabelDao

findRecentlyUsedLabellingsBySpace

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

findRecentlyUsedUserLabels

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

findRecentlyUsedUserLabellings

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

findMostPopular

public java.util.List findMostPopular(java.lang.String namespace,
                                      int maxResults)
Description copied from interface: LabelDao
Find the most popular labels. Label popularity is defined by the number of times a label has been used / applied to content.

Specified by:
findMostPopular in interface LabelDao
maxResults - Maximum size of list to return
Returns:
a list of label instances, or an empty list if non exist.

findMostPopularBySpace

public java.util.List findMostPopularBySpace(java.lang.String namespace,
                                             java.lang.String spaceKey,
                                             int maxResults)
Description copied from interface: LabelDao
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.

Specified by:
findMostPopularBySpace in interface LabelDao
spaceKey - of the space whose content must have the returned labels
maxResults - 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 java.util.List findBySingleDegreeSeparation(EditableLabelable content,
                                                   int maxResults)
Description copied from interface: LabelDao
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.

Specified by:
findBySingleDegreeSeparation in interface LabelDao
Parameters:
content - the content object used to search for related labels
maxResults - specifies the number of labels to be returned.
Returns:
a list of labels, ordered by their frequency of occurance.

findBySingleDegreeSeparation

public java.util.List findBySingleDegreeSeparation(EditableLabelable content,
                                                   java.lang.String spaceKey,
                                                   int maxResults)
Specified by:
findBySingleDegreeSeparation in interface LabelDao

findBySingleDegreeSeparation

public java.util.List findBySingleDegreeSeparation(Label label,
                                                   int maxResults)
Description copied from interface: LabelDao
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)

Specified by:
findBySingleDegreeSeparation in interface LabelDao
Parameters:
label - the label to look for on pages
maxResults - the maximum number of results to return
Returns:
a list of labels, ordered by their frequency of occurance.

findBySingleDegreeSeparation

public java.util.List findBySingleDegreeSeparation(Label label,
                                                   java.lang.String spaceKey,
                                                   int maxResults)
Specified by:
findBySingleDegreeSeparation in interface LabelDao

findAllUserLabelledContent

public java.util.List<? extends EditableLabelable> findAllUserLabelledContent(java.lang.String username)
Specified by:
findAllUserLabelledContent in interface LabelDao

findCurrentContentForLabel

public java.util.List<? extends EditableLabelable> findCurrentContentForLabel(Label label)
Description copied from interface: LabelDao
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).

Specified by:
findCurrentContentForLabel in interface LabelDao
Parameters:
label - search for content with this label
Returns:
current content with the specified label, sorted by last modification date.

findContentForLabel

public java.util.List<? extends EditableLabelable> findContentForLabel(Label label,
                                                                       int maxResults)
Description copied from interface: LabelDao
Returns content with the specified label, ordered by content id. Items in the trash are included - for only current items use LabelDao.findCurrentContentForLabel(Label).

Specified by:
findContentForLabel in interface LabelDao
Parameters:
label - search for content with this label
maxResults - 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(java.lang.Class<T> labelableClass,
                                                                     int offset,
                                                                     int maxResults,
                                                                     Label... labels)
Description copied from interface: LabelDao
Retrieve current EditableLabelables which are labelled with ALL provided labels.

Specified by:
findForAllLabels in interface LabelDao
Parameters:
labelableClass - the type of EditableLabelable to return
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

findForAllLabels

public PartialList<EditableLabelable> findForAllLabels(int offset,
                                                       int maxResults,
                                                       Label... labelsArray)
Description copied from interface: LabelDao
Retrieve 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:
findForAllLabels in interface LabelDao
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
labelsArray - 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,
                                                                       java.lang.String spaceKey,
                                                                       Label... labels)
Description copied from interface: LabelDao
Retrieve current ContentEntityObjects in the space which are labelled with ALL provided labels.

Specified by:
findContentInSpaceForAllLabels in interface LabelDao
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
spaceKey - the key of the space to search in
labels - 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,
                                                                        java.util.Set<java.lang.String> spaceKeys,
                                                                        Label... labels)
Description copied from interface: LabelDao
Retrieve current ContentEntityObjects in the given spaces which are labelled with ALL provided labels.

Specified by:
findContentInSpacesForAllLabels in interface LabelDao
Parameters:
offset - the offset into the results
maxResults - the maximum number of results to return
spaceKeys - the keys of the spaces to search in
labels - 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: LabelDao
Retrieve all ContentEntityObjects which are labelled with ALL provided labels. Includes content in the Trash.

Specified by:
findAllContentForAllLabels in interface LabelDao
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

findContentCountForLabel

public int findContentCountForLabel(Label label)
Specified by:
findContentCountForLabel in interface LabelDao

findCurrentContentForLabelAndSpace

public java.util.List<? extends EditableLabelable> findCurrentContentForLabelAndSpace(Label label,
                                                                                      java.lang.String spaceKey)
Description copied from interface: LabelDao
Returns current content with the specified label and spaceKey. If no spaceKey is specified, a search will be performed against the label only.

Specified by:
findCurrentContentForLabelAndSpace in interface LabelDao
Parameters:
label - search for content with this label
spaceKey - (optional) search for content belonging to the space with this spaceKey
Returns:
current content with the specified label and spaceKey.

findSpacesContainingContentWithLabel

public java.util.List findSpacesContainingContentWithLabel(Label label)
Specified by:
findSpacesContainingContentWithLabel in interface LabelDao

findSpacesWithLabel

public java.util.List findSpacesWithLabel(Label label)
Specified by:
findSpacesWithLabel in interface LabelDao

findLabellingByContentAndLabel

public Labelling findLabellingByContentAndLabel(EditableLabelable content,
                                                Label label)
Specified by:
findLabellingByContentAndLabel in interface LabelDao

findLabellingById

public Labelling findLabellingById(long id)
Specified by:
findLabellingById in interface LabelDao

deleteLabellingBySpace

public void deleteLabellingBySpace(java.lang.String key)
Specified by:
deleteLabellingBySpace in interface LabelDao

getFavouriteSpaces

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

findUnusedLabels

public java.util.List findUnusedLabels()
Specified by:
findUnusedLabels in interface LabelDao

setConfluenceUserDao

public void setConfluenceUserDao(ConfluenceUserDao confluenceUserDao)

setPageTemplateDao

public void setPageTemplateDao(PageTemplateDao pageTemplateDao)

setContentEntityObjectDao

public void setContentEntityObjectDao(ContentEntityObjectDao contentEntityObjectDao)

setAttachmentManager

public void setAttachmentManager(AttachmentManager attachmentManager)


Copyright © 2003-2014 Atlassian. All Rights Reserved.