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

java.lang.Object
  extended byorg.springframework.orm.hibernate.support.HibernateDaoSupport
      extended bycom.atlassian.hibernate.HibernateObjectDao
          extended bybucket.core.persistence.hibernate.CachableHibernateObjectDao
              extended bycom.atlassian.confluence.labels.persistence.dao.hibernate.HibernateLabelDao
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, LabelDao, ObjectDao

public class HibernateLabelDao
extends CachableHibernateObjectDao
implements LabelDao


Field Summary
 
Fields inherited from class bucket.core.persistence.hibernate.CachableHibernateObjectDao
cacheManager
 
Fields inherited from class com.atlassian.hibernate.HibernateObjectDao
log
 
Fields inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
logger
 
Fields inherited from interface com.atlassian.confluence.labels.persistence.dao.LabelDao
UNLIMITED
 
Constructor Summary
HibernateLabelDao()
           
 
Method Summary
 void deleteLabellingBySpace(String key)
           
 List findAllUserLabelledContent(String username)
           
 List findByDetails(String name, String namespace, String owner)
          Find all labels based on the details passed in.
 List findByDetailsInSpace(String name, String namespace, String owner, String spaceKey)
          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 findBySingleDegreeSeparation(ContentEntityObject content, int maxResults)
          Find the labels that are a single degree of separation away from the specified content.
 List findBySingleDegreeSeparation(ContentEntityObject content, String spaceKey, int maxResults)
           
 List findBySingleDegreeSeparation(Label label, int maxResults)
          Find the labels that are a single degree of separation away from the specified label.
 List findBySingleDegreeSeparation(Label label, String spaceKey, int maxResults)
           
 List findBySpace(String spaceKey, String namespace)
          Find the labels used to label the content with the specified space.
 List findContentByLabel(Label label)
           
 int findContentCountForLabel(Label label)
           
 List findContentForLabel(Label label)
           
 List findCurrentContentForLabel(Label label)
           
 List findCurrentContentForLabelAndSpace(Label label, String spaceKey)
           
 Labelling findLabellingByContentAndLabel(ContentEntityObject content, Label label)
           
 Labelling findLabellingById(long id)
           
 List findMostPopular(String namespace, int maxResults)
          Find the most popular labels.
 List findMostPopularBySpace(String namespace, String spaceKey, int maxResults)
          Find the most popular labels in the specified space.
 List findRecentlyUsed(int maxResults)
           
 List findRecentlyUsedBySpace(String spaceKey, int maxResults)
           
 List findRecentlyUsedLabelling(int maxResults)
           
 List findRecentlyUsedLabellingsBySpace(String spaceKey, int maxResults)
           
 List findRecentlyUsedUserLabellings(String username, int maxResults)
           
 List findRecentlyUsedUserLabels(String username, int maxResults)
           
 List findSpacesContainingContentWithLabel(Label label)
           
 List findSpacesWithLabel(Label label)
           
 List findUnusedLabels()
           
 List getFavouriteSpaces(String username)
           
 Class getPersistentClass()
           
 boolean isDB2()
           
 
Methods inherited from class bucket.core.persistence.hibernate.CachableHibernateObjectDao
setCacheManager
 
Methods inherited from class com.atlassian.hibernate.HibernateObjectDao
findAll, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, index, refresh, reIndex, remove, replicate, save, saveRaw, setIndexer, unIndex, updateModificationData
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
afterPropertiesSet, closeSessionIfNecessary, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, initDao, setHibernateTemplate, setSessionFactory
 
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, refresh, remove, replicate, save, saveRaw
 

Constructor Detail

HibernateLabelDao

public HibernateLabelDao()
Method Detail

isDB2

public boolean isDB2()

getPersistentClass

public 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 -
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 List findByDetails(String name,
                          String namespace,
                          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 -
namespace -
owner -
Returns:
List

findByDetailsInSpace

public List findByDetailsInSpace(String name,
                                 String namespace,
                                 String owner,
                                 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 -
namespace -
owner -
Returns:
List

findBySpace

public List findBySpace(String spaceKey,
                        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 -
namespace -
Returns:
a list of labels, or an empty list if non exist.

findRecentlyUsedBySpace

public List findRecentlyUsedBySpace(String spaceKey,
                                    int maxResults)
Specified by:
findRecentlyUsedBySpace in interface LabelDao

findRecentlyUsed

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

findRecentlyUsedLabelling

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

findRecentlyUsedLabellingsBySpace

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

findRecentlyUsedUserLabels

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

findRecentlyUsedUserLabellings

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

findMostPopular

public List findMostPopular(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
Parameters:
maxResults -
Returns:
a list of label instances, or an empty list if non exist.

findMostPopularBySpace

public List findMostPopularBySpace(String namespace,
                                   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
Parameters:
spaceKey -
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 List findBySingleDegreeSeparation(ContentEntityObject 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 List findBySingleDegreeSeparation(ContentEntityObject content,
                                         String spaceKey,
                                         int maxResults)
Specified by:
findBySingleDegreeSeparation in interface LabelDao

findBySingleDegreeSeparation

public 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 List findBySingleDegreeSeparation(Label label,
                                         String spaceKey,
                                         int maxResults)
Specified by:
findBySingleDegreeSeparation in interface LabelDao

findContentForLabel

public List findContentForLabel(Label label)

findAllUserLabelledContent

public List findAllUserLabelledContent(String username)
Specified by:
findAllUserLabelledContent in interface LabelDao

findCurrentContentForLabel

public List findCurrentContentForLabel(Label label)
Specified by:
findCurrentContentForLabel in interface LabelDao

findContentCountForLabel

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

findCurrentContentForLabelAndSpace

public List findCurrentContentForLabelAndSpace(Label label,
                                               String spaceKey)
Specified by:
findCurrentContentForLabelAndSpace in interface LabelDao

findSpacesContainingContentWithLabel

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

findSpacesWithLabel

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

findLabellingByContentAndLabel

public Labelling findLabellingByContentAndLabel(ContentEntityObject 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(String key)
Specified by:
deleteLabellingBySpace in interface LabelDao

getFavouriteSpaces

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

findUnusedLabels

public List findUnusedLabels()
Specified by:
findUnusedLabels in interface LabelDao

findContentByLabel

public List findContentByLabel(Label label)


Confluence is developed by Atlassian.