com.atlassian.confluence.pages.persistence.dao.hibernate
Class HibernateDraftDao

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.pages.persistence.dao.hibernate.HibernateDraftDao
All Implemented Interfaces:
ObjectDao, DraftDao, org.springframework.beans.factory.InitializingBean

public class HibernateDraftDao
extends HibernateObjectDao
implements DraftDao

Database storage for drafts. Does not permit anonymous drafts (i.e. those with a null username), which should be stored in non-permanent storage like the HTTP session.

See Also:
SessionDraftDao

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Fields inherited from interface bucket.core.persistence.ObjectDao
NON_CACHEABLE
 
Constructor Summary
HibernateDraftDao()
           
 
Method Summary
 int countDrafts(String creatorName)
           
 List<Draft> findByCreatorName(String creatorName)
          Returns the drafts stored against the given username.
 List<Draft> getAllDraftsForSpace(String spaceKey)
          Deprecated. 
protected  Draft getByClassId(long id)
          Retrieve the object with a particular id from the database.
 Draft getDraft(long draftId)
          Returns the draft with the given ID, or null if no draft is found with that ID.
 Draft getDraft(Long pageId, String creatorName, String draftType, String spaceKey)
          Deprecated. 
 Draft getDraft(String pageId, ConfluenceUser creator, String draftType, String spaceKey)
          Finds and returns a draft object with all the specified properties or null if none is found.
 Draft getDraft(String pageId, String creatorName, String draftType, String spaceKey)
          Deprecated. 
 Class getPersistentClass()
           
 void remove(Draft draft)
          Removes a draft based on its page ID, owner and type.
 void remove(long id)
          Deprecated. 
 void removeAll()
          Deprecated. 
 void saveOrUpdate(Draft draft)
          Saves the draft.
 void setConfluenceUserDao(ConfluenceUserDao confluenceUserDao)
           
 void setSharedDraftsDarkFeatureHelper(SharedDraftsDarkFeatureHelper sharedDraftsDarkFeatureHelper)
           
 void updateSpaceKey(String newSpaceKey, String oldSpaceKey)
          Deprecated. 
 
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, 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 com.atlassian.confluence.pages.persistence.dao.DraftDao
findAll
 

Constructor Detail

HibernateDraftDao

public HibernateDraftDao()
Method Detail

getPersistentClass

public Class getPersistentClass()
Specified by:
getPersistentClass in interface ObjectDao

getByClassId

protected Draft getByClassId(long id)
Description copied from class: HibernateObjectDao
Retrieve the object with a particular id from the database. The object must be of the same class as the DAO's getPersistentClass() method returns.

Overrides:
getByClassId in class HibernateObjectDao
Parameters:
id - the id of the object to look up
Returns:
the corresponding object, or null if the object does not exist with the appropriate class and id.

saveOrUpdate

public void saveOrUpdate(Draft draft)
                  throws IllegalArgumentException
Description copied from interface: DraftDao
Saves the draft.

Specified by:
saveOrUpdate in interface DraftDao
Throws:
IllegalArgumentException - if the draft has no page ID, owner or type.

getDraft

public Draft getDraft(String pageId,
                      ConfluenceUser creator,
                      String draftType,
                      String spaceKey)
Description copied from interface: DraftDao
Finds and returns a draft object with all the specified properties or null if none is found.

Specified by:
getDraft in interface DraftDao
Parameters:
pageId - the id of the page which this draft is associated with
creator - the owner of the draft
draftType - the type of draft, which is usually the result of calling ContentEntityObject.getType()
spaceKey - space key, if relevant for the draft. This is used to enable NEW page drafts across multiple spaces
Returns:
a draft object with all the specified properties or null if no valid draft could be found

getDraft

@Deprecated
public Draft getDraft(String pageId,
                                 String creatorName,
                                 String draftType,
                                 String spaceKey)
Deprecated. 

Specified by:
getDraft in interface DraftDao

getDraft

@Deprecated
public Draft getDraft(Long pageId,
                                 String creatorName,
                                 String draftType,
                                 String spaceKey)
Deprecated. 

Specified by:
getDraft in interface DraftDao

getAllDraftsForSpace

@Deprecated
public List<Draft> getAllDraftsForSpace(String spaceKey)
Deprecated. 

Specified by:
getAllDraftsForSpace in interface DraftDao
Returns:
all the drafts in the space identified.

getDraft

public Draft getDraft(long draftId)
Description copied from interface: DraftDao
Returns the draft with the given ID, or null if no draft is found with that ID.

Specified by:
getDraft in interface DraftDao

remove

public void remove(Draft draft)
Description copied from interface: DraftDao
Removes a draft based on its page ID, owner and type. Does nothing if such a draft is not found in the data store.

Specified by:
remove in interface DraftDao

remove

@Deprecated
public void remove(long id)
Deprecated. 

Description copied from interface: DraftDao
Remove a draft based on its ID. Does nothing if such a draft is not found in the data store.

Specified by:
remove in interface DraftDao

findByCreatorName

public List<Draft> findByCreatorName(String creatorName)
Description copied from interface: DraftDao
Returns the drafts stored against the given username.

Specified by:
findByCreatorName in interface DraftDao

updateSpaceKey

@Deprecated
public void updateSpaceKey(String newSpaceKey,
                                      String oldSpaceKey)
Deprecated. 

Description copied from interface: DraftDao
Changes all drafts with a space key of oldSpaceKey to have newSpaceKey.

Specified by:
updateSpaceKey in interface DraftDao
Parameters:
newSpaceKey - the new space key
oldSpaceKey - the old space key

removeAll

@Deprecated
public void removeAll()
Deprecated. 

Description copied from interface: DraftDao
Removes all drafts in the data store.

Specified by:
removeAll in interface DraftDao

countDrafts

public int countDrafts(String creatorName)
Specified by:
countDrafts in interface DraftDao
Returns:
count of number of drafts for this daos owner

setConfluenceUserDao

public void setConfluenceUserDao(ConfluenceUserDao confluenceUserDao)

setSharedDraftsDarkFeatureHelper

public void setSharedDraftsDarkFeatureHelper(SharedDraftsDarkFeatureHelper sharedDraftsDarkFeatureHelper)


Copyright © 2003–2015 Atlassian. All rights reserved.