com.atlassian.crowd.dao.group
Class GroupDAOHibernate

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by com.atlassian.crowd.util.persistence.hibernate.HibernateDao
              extended by com.atlassian.crowd.dao.group.GroupDAOHibernate
All Implemented Interfaces:
InternalGroupDao, GroupDao, org.springframework.beans.factory.InitializingBean

public class GroupDAOHibernate
extends HibernateDao
implements InternalGroupDao, GroupDao


Field Summary
 
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
batchFinder, batchProcessor, logger
 
Constructor Summary
GroupDAOHibernate()
           
 
Method Summary
 InternalGroup add(Group group)
          Adds a new group.
 BatchResultWithIdReferences<Group> addAll(Collection<InternalGroupWithAttributes> groups)
          Bulk add of groups and their attributes.
 BatchResult<Group> addAll(Set<? extends Group> groups)
          Bulk add of groups.
 InternalGroup addLocal(Group group)
          Add a new local group.
 InternalGroup findByName(long directoryId, String groupName)
          Finds internal group by directory id and group name.
 Collection<InternalGroup> findByNames(long directoryID, Collection<String> groupnames)
          Bulk find of groups using SQL disjunction.
 InternalGroupWithAttributes findByNameWithAttributes(long directoryId, String groupName)
          Finds group by name.
 Set<InternalGroupAttribute> findGroupAttributes(long groupId)
          Finds group attributes of the given group identified by group id.
 Class getPersistentClass()
          All subclasses of HibernateDao must implement this method for HibernateDao.load(long) to work correctly
 void remove(Group group)
          Removes group.
 void removeAll(long directoryId)
          Removes all groups from a directory.
 void removeAllGroups(long directoryId, Set<String> groupNames)
          Removes all the given groups.
 void removeAttribute(Group group, String attributeName)
          Remove attributes from group.
 InternalGroup rename(Group group, String newName)
          Renames group.
<T> List<T>
search(long directoryId, EntityQuery<T> query)
          Searches for group based on the given criteria.
 void setDirectoryDao(DirectoryDao directoryDao)
           
 void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)
           
 void setInternalAttributesHelper(InternalAttributesHelper internalAttributesHelper)
           
 void setMembershipDAO(InternalMembershipDao internalMembershipDao)
           
 void storeAttributes(Group group, Map<String,Set<String>> attributes)
          Stores attributes into group.
 InternalGroup update(Group group)
          Updates group.
 
Methods inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
load, load, loadReference, loadReference, remove, save, saveOrUpdate, setBatchFinder, setBatchProcessor, update
 
Methods inherited from class org.springframework.orm.hibernate3.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
 

Constructor Detail

GroupDAOHibernate

public GroupDAOHibernate()
Method Detail

getPersistentClass

public Class getPersistentClass()
Description copied from class: HibernateDao
All subclasses of HibernateDao must implement this method for HibernateDao.load(long) to work correctly

Specified by:
getPersistentClass in class HibernateDao
Returns:
Class

findByName

public InternalGroup findByName(long directoryId,
                                String groupName)
                         throws GroupNotFoundException
Description copied from interface: InternalGroupDao
Finds internal group by directory id and group name.

Specified by:
findByName in interface InternalGroupDao
Specified by:
findByName in interface GroupDao
Parameters:
directoryId - Directory id.
groupName - Group name.
Returns:
An internal group.
Throws:
GroupNotFoundException - If the group cannot be found.

findByNameWithAttributes

public InternalGroupWithAttributes findByNameWithAttributes(long directoryId,
                                                            String groupName)
                                                     throws GroupNotFoundException
Description copied from interface: GroupDao
Finds group by name. This is different from GroupDao.findByName(long, String) in that it also returns the group attributes associated with the retrieved group.

Specified by:
findByNameWithAttributes in interface GroupDao
Parameters:
directoryId - the ID of the directory to look for group
groupName - group name
Returns:
group with attributes
Throws:
GroupNotFoundException - if the group does not exist

findGroupAttributes

public Set<InternalGroupAttribute> findGroupAttributes(long groupId)
Description copied from interface: InternalGroupDao
Finds group attributes of the given group identified by group id.

Specified by:
findGroupAttributes in interface InternalGroupDao
Parameters:
groupId - Group id.
Returns:
Set of group attributes.

add

public InternalGroup add(Group group)
                  throws DirectoryNotFoundException
Description copied from interface: GroupDao
Adds a new group.

Specified by:
add in interface GroupDao
Parameters:
group - group
Returns:
the added group
Throws:
DirectoryNotFoundException - if the directory specified in group object does not exist

addLocal

public InternalGroup addLocal(Group group)
                       throws DirectoryNotFoundException
Description copied from interface: GroupDao
Add a new local group. A local group is a group that does not exist in the remote directory. The implementation must take into account and also persist the fact that the group is only local.

Specified by:
addLocal in interface GroupDao
Parameters:
group - group
Returns:
the added group
Throws:
DirectoryNotFoundException - if the directory specified in group object does not exist

update

public InternalGroup update(Group group)
                     throws GroupNotFoundException
Description copied from interface: GroupDao
Updates group.

Specified by:
update in interface GroupDao
Parameters:
group - group
Returns:
the updated group
Throws:
GroupNotFoundException - if the group does not exist

rename

public InternalGroup rename(Group group,
                            String newName)
                     throws GroupNotFoundException
Description copied from interface: GroupDao
Renames group.

Specified by:
rename in interface GroupDao
Parameters:
group - group
newName - the new name
Returns:
group with new name
Throws:
GroupNotFoundException - if the group does not exist

storeAttributes

public void storeAttributes(Group group,
                            Map<String,Set<String>> attributes)
                     throws GroupNotFoundException
Description copied from interface: GroupDao
Stores attributes into group. Any existing attributes matching the supplied attribute keys will be replaced.

Specified by:
storeAttributes in interface GroupDao
Parameters:
group - group
attributes - attributes
Throws:
GroupNotFoundException - if the group does not exist

removeAttribute

public void removeAttribute(Group group,
                            String attributeName)
                     throws GroupNotFoundException
Description copied from interface: GroupDao
Remove attributes from group.

Specified by:
removeAttribute in interface GroupDao
Parameters:
group - group
attributeName - attribute to be removed
Throws:
GroupNotFoundException - if the group does not exist

remove

public void remove(Group group)
            throws GroupNotFoundException
Description copied from interface: GroupDao
Removes group.

Specified by:
remove in interface GroupDao
Parameters:
group - group
Throws:
GroupNotFoundException - if the group does not exist

removeAllGroups

public void removeAllGroups(long directoryId,
                            Set<String> groupNames)
Description copied from interface: GroupDao
Removes all the given groups.

Specified by:
removeAllGroups in interface GroupDao
Parameters:
directoryId - directory to perform the operation
groupNames - groups to be removed

removeAll

public void removeAll(long directoryId)
Description copied from interface: InternalGroupDao
Removes all groups from a directory.

Specified by:
removeAll in interface InternalGroupDao
Parameters:
directoryId - Directory Id.

search

public <T> List<T> search(long directoryId,
                          EntityQuery<T> query)
Description copied from interface: GroupDao
Searches for group based on the given criteria.

Specified by:
search in interface GroupDao
Parameters:
directoryId - directory to perform the search operation on
query - criteria
Returns:
list (could be empty) of groups which match the criteria

addAll

public BatchResult<Group> addAll(Set<? extends Group> groups)
                          throws DirectoryNotFoundException
Description copied from interface: GroupDao
Bulk add of groups. Will only add remote groups (ie. isLocal=false)

Specified by:
addAll in interface GroupDao
Parameters:
groups - to be added
Returns:
a list of Groups that failed to be added
Throws:
DirectoryNotFoundException - if the directory cannot be found

addAll

public BatchResultWithIdReferences<Group> addAll(Collection<InternalGroupWithAttributes> groups)
Description copied from interface: InternalGroupDao
Bulk add of groups and their attributes.

Specified by:
addAll in interface InternalGroupDao
Parameters:
groups - Groups with attributes.
Returns:
Batch result.

findByNames

public Collection<InternalGroup> findByNames(long directoryID,
                                             Collection<String> groupnames)
Description copied from interface: InternalGroupDao
Bulk find of groups using SQL disjunction.

Specified by:
findByNames in interface InternalGroupDao
Parameters:
directoryID - the directory to search for the groups.
groupnames - names of groups to find
Returns:
collection of found groups.

setDirectoryDao

public void setDirectoryDao(DirectoryDao directoryDao)

setMembershipDAO

public void setMembershipDAO(InternalMembershipDao internalMembershipDao)

setHqlQueryTranslater

public void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)

setInternalAttributesHelper

public void setInternalAttributesHelper(InternalAttributesHelper internalAttributesHelper)


Copyright © 2013 Atlassian. All Rights Reserved.