com.atlassian.confluence.user.persistence.dao
Class CachingPersonalInformationDao

java.lang.Object
  extended by com.atlassian.confluence.user.persistence.dao.CachingPersonalInformationDao
All Implemented Interfaces:
ObjectDao, PersonalInformationDao

public class CachingPersonalInformationDao
extends java.lang.Object
implements PersonalInformationDao

Caches personal information IDs by username to improve performance by using the Hibernate second-level cache more effectively.

There is a potential race condition in the cache, where creating two personal information objects at approximately the same time will lead to this cache returning the


Constructor Summary
CachingPersonalInformationDao(PersonalInformationDao delegate, com.atlassian.cache.CacheFactory cacheFactory)
           
 
Method Summary
 java.util.List findAll()
          Find all objects currently persisted of a particular type.
 java.util.List findAllSorted(java.lang.String s)
          Find all objects currently persisted of a particular type and sort results by named property.
 java.util.List findAllSorted(java.lang.String s, boolean cached, int firstRow, int maxRows)
          Find all objects currently persisted of a particular type and sort results by named property.
 PersonalInformation getById(long id)
          Returns the personal information object with the given ID.
 PersonalInformation getByUser(ConfluenceUser user)
          Fetches the personal information object for this user.
 PersonalInformation getByUsername(java.lang.String username)
          Deprecated. 
 java.lang.Class getPersistentClass()
           
 void refresh(com.atlassian.core.bean.EntityObject objectToRrfresh)
          Refreshes the object again with the fresh data from db.
 void remove(com.atlassian.core.bean.EntityObject object)
          Remove object from persistence.
 void replicate(java.lang.Object objectToReplicate)
          Replicate the object.
 void save(com.atlassian.core.bean.EntityObject objectToSave)
           
 void saveRaw(com.atlassian.core.bean.EntityObject objectToSave)
          saves the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingPersonalInformationDao

public CachingPersonalInformationDao(PersonalInformationDao delegate,
                                     com.atlassian.cache.CacheFactory cacheFactory)
Method Detail

getByUser

public PersonalInformation getByUser(ConfluenceUser user)
Description copied from interface: PersonalInformationDao
Fetches the personal information object for this user.

Specified by:
getByUser in interface PersonalInformationDao

getByUsername

@Deprecated
public PersonalInformation getByUsername(java.lang.String username)
Deprecated. 

Specified by:
getByUsername in interface PersonalInformationDao

getById

public PersonalInformation getById(long id)
Description copied from interface: PersonalInformationDao
Returns the personal information object with the given ID.

Specified by:
getById in interface PersonalInformationDao

remove

public void remove(com.atlassian.core.bean.EntityObject object)
Description copied from interface: ObjectDao
Remove object from persistence.

Specified by:
remove in interface ObjectDao

refresh

public void refresh(com.atlassian.core.bean.EntityObject objectToRrfresh)
Description copied from interface: ObjectDao
Refreshes the object again with the fresh data from db.

Specified by:
refresh in interface ObjectDao

replicate

public void replicate(java.lang.Object objectToReplicate)
Description copied from interface: ObjectDao
Replicate the object. Replication does not generate a new id if the object does not exist in database and it overwrites the database row if the object already exists in database.

Specified by:
replicate in interface ObjectDao

findAll

public java.util.List findAll()
Description copied from interface: ObjectDao
Find all objects currently persisted of a particular type.

Specified by:
findAll in interface ObjectDao

findAllSorted

public java.util.List findAllSorted(java.lang.String s)
Description copied from interface: ObjectDao
Find all objects currently persisted of a particular type and sort results by named property.

Specified by:
findAllSorted in interface ObjectDao
Parameters:
s - the name of the property to be sorted on. This should be null if no sorting is required.

findAllSorted

public java.util.List findAllSorted(java.lang.String s,
                                    boolean cached,
                                    int firstRow,
                                    int maxRows)
Description copied from interface: ObjectDao
Find all objects currently persisted of a particular type and sort results by named property. This version of the method allows more control over the query.

Specified by:
findAllSorted in interface ObjectDao
Parameters:
s - the name of the property to be sorted on. This should be null if no sorting is required.
cached - control whether the results should be cached
firstRow - the index of the first result to be returned
maxRows - the maximum number of results required. Use -1 to specify no limit.

save

public void save(com.atlassian.core.bean.EntityObject objectToSave)
Specified by:
save in interface ObjectDao

getPersistentClass

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

saveRaw

public void saveRaw(com.atlassian.core.bean.EntityObject objectToSave)
Description copied from interface: ObjectDao
saves the object. if the object is new, this won't set the creation date on the object. if it already exists, then it won't set the date that it was updated.

Specified by:
saveRaw in interface ObjectDao


Copyright © 2003-2014 Atlassian. All Rights Reserved.