|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.crowd.util.persistence.hibernate.HibernateDao com.atlassian.crowd.dao.membership.MembershipDAOHibernate
public class MembershipDAOHibernate
Field Summary |
---|
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao |
---|
batchFinder, batchProcessor, logger, sessionFactory |
Constructor Summary | |
---|---|
MembershipDAOHibernate()
|
Method Summary | ||
---|---|---|
BatchResult<InternalMembership> |
addAll(Set<InternalMembership> memberships)
Bulk add of memberships. |
|
BatchResult<String> |
addAllUsersToGroup(long directoryId,
Collection<String> userNames,
String groupName)
Bulk adds all the given users into the given group. |
|
void |
addGroupToGroup(long directoryId,
String childGroup,
String parentGroup)
Adds group as a child of the (supposedly) parent group. |
|
void |
addUserToGroup(long directoryId,
String username,
String groupName)
Adds user as a member of group. |
|
protected org.hibernate.Query |
createHibernateSearchQuery(long directoryId,
MembershipQuery<?> query)
Builds a Hibernate query from a MembershipQuery . |
|
List<InternalMembership> |
findAll(Collection<Directory> directories)
|
|
List<InternalMembership> |
findAllLocal(Collection<Directory> directories)
|
|
Class |
getPersistentClass()
All subclasses of HibernateDao must implement this method for HibernateDao.load(long) to work correctly. |
|
boolean |
isGroupDirectMember(long directoryId,
String childGroup,
String parentGroup)
Determines whether the group is a direct member of the (supposedly) parent group. |
|
boolean |
isUserDirectMember(long directoryId,
String username,
String groupName)
Determines whether the user is a direct member of the group. |
|
void |
removeAllRelationships(long directoryId)
Removes all relationships the the given directory identified by directory id. |
|
void |
removeAllUserRelationships(long directoryId)
Removes all user relationships the the given directory identified by directory id. |
|
void |
removeGroupFromGroup(long directoryId,
String childGroup,
String parentGroup)
Removes group from the parent group. |
|
void |
removeGroupMembers(long directoryId,
String groupName)
Removes all members of the given group name. |
|
void |
removeGroupMemberships(long directoryId,
String groupName)
Removes all relationships from parent groups to the given group name. |
|
void |
removeUserFromGroup(long directoryId,
String username,
String groupName)
Removes user as a member of the given group. |
|
void |
removeUserMemberships(long directoryId,
String username)
Removes all MembershipType.GROUP_USER relationships
from parent groups to the given username. |
|
void |
renameGroupRelationships(long directoryId,
String oldName,
String newName)
Renames group name in all relationships. |
|
void |
renameUserRelationships(long directoryId,
String oldName,
String newName)
Renames username in all relationships. |
|
|
search(long directoryId,
MembershipQuery<T> query)
Search for memberships by the given criteria. |
|
void |
setGroupDao(InternalGroupDao groupDao)
|
|
void |
setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)
|
|
void |
setUserDao(InternalUserDao userDao)
|
Methods inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao |
---|
createHibernateQuery, load, load, loadReference, loadReference, remove, save, saveOrUpdate, session, setBatchFinder, setBatchProcessor, setSessionFactory, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MembershipDAOHibernate()
Method Detail |
---|
public BatchResult<InternalMembership> addAll(Set<InternalMembership> memberships)
InternalMembershipDao
addAll
in interface InternalMembershipDao
memberships
- Set of memberships.
public BatchResult<String> addAllUsersToGroup(long directoryId, Collection<String> userNames, String groupName) throws GroupNotFoundException
MembershipDao
addAllUsersToGroup
in interface MembershipDao
directoryId
- the directory to perform the operationuserNames
- the collection of usersgroupName
- name of the group
GroupNotFoundException
- if the group does not existpublic void addGroupToGroup(long directoryId, String childGroup, String parentGroup) throws GroupNotFoundException, MembershipAlreadyExistsException
MembershipDao
addGroupToGroup
in interface MembershipDao
directoryId
- the directory to perform the operationchildGroup
- the (supposedly) child groupparentGroup
- parent group
GroupNotFoundException
- if either child or parent group is not found
MembershipAlreadyExistsException
- if the child group is already a child of the parent grouppublic void addUserToGroup(long directoryId, String username, String groupName) throws UserNotFoundException, GroupNotFoundException, MembershipAlreadyExistsException
MembershipDao
addUserToGroup
in interface MembershipDao
directoryId
- the directory to perform the operationusername
- usergroupName
- group
UserNotFoundException
- if the user does not exist
GroupNotFoundException
- if the group does not exist
MembershipAlreadyExistsException
- if the user is already a direct member of the grouppublic List<InternalMembership> findAll(Collection<Directory> directories)
directories
- directories to search for memberships
public List<InternalMembership> findAllLocal(Collection<Directory> directories)
directories
- directories to search for memberships
public Class getPersistentClass()
HibernateDao
HibernateDao.load(long)
to work correctly.
getPersistentClass
in class HibernateDao
public boolean isGroupDirectMember(long directoryId, String childGroup, String parentGroup)
MembershipDao
isGroupDirectMember
in interface MembershipDao
directoryId
- the directory to perform the operationchildGroup
- child groupparentGroup
- parent group
public boolean isUserDirectMember(long directoryId, String username, String groupName)
MembershipDao
isUserDirectMember
in interface MembershipDao
directoryId
- the directory to perform the operationusername
- usergroupName
- group
public void removeAllRelationships(long directoryId)
InternalMembershipDao
removeAllRelationships
in interface InternalMembershipDao
directoryId
- Directory id.public void removeAllUserRelationships(long directoryId)
InternalMembershipDao
removeAllUserRelationships
in interface InternalMembershipDao
directoryId
- Directory id.public void removeGroupFromGroup(long directoryId, String childGroup, String parentGroup) throws MembershipNotFoundException
MembershipDao
removeGroupFromGroup
in interface MembershipDao
directoryId
- the directory to perform the operationchildGroup
- child groupparentGroup
- parent group
MembershipNotFoundException
- if the membership relationship between the child and parent group does not existpublic void removeGroupMembers(long directoryId, String groupName)
InternalMembershipDao
removeGroupMembers
in interface InternalMembershipDao
directoryId
- Directory id.groupName
- Group name.public void removeGroupMemberships(long directoryId, String groupName)
InternalMembershipDao
removeGroupMemberships
in interface InternalMembershipDao
directoryId
- Directory id.groupName
- Group name.public void removeUserFromGroup(long directoryId, String username, String groupName) throws UserNotFoundException, GroupNotFoundException, MembershipNotFoundException
MembershipDao
removeUserFromGroup
in interface MembershipDao
directoryId
- the directory to perform the operationusername
- usergroupName
- group
UserNotFoundException
- if the user does not exist
GroupNotFoundException
- if the group does not exist
MembershipNotFoundException
- if the user is not a member of the said grouppublic void removeUserMemberships(long directoryId, String username)
InternalMembershipDao
MembershipType.GROUP_USER
relationships
from parent groups to the given username.
removeUserMemberships
in interface InternalMembershipDao
directoryId
- Directory id.username
- Username.public void renameGroupRelationships(long directoryId, String oldName, String newName)
InternalMembershipDao
renameGroupRelationships
in interface InternalMembershipDao
directoryId
- Directory id.oldName
- Old group name.newName
- New group name.public void renameUserRelationships(long directoryId, String oldName, String newName)
InternalMembershipDao
renameUserRelationships
in interface InternalMembershipDao
directoryId
- Directory id.oldName
- Old username.newName
- New username.public <T> List<T> search(long directoryId, MembershipQuery<T> query)
MembershipDao
search
in interface MembershipDao
directoryId
- the directory to perform the operationquery
- criteria
@Autowired public void setGroupDao(InternalGroupDao groupDao)
@Autowired public void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)
@Autowired public void setUserDao(InternalUserDao userDao)
protected org.hibernate.Query createHibernateSearchQuery(long directoryId, MembershipQuery<?> query)
query
from a MembershipQuery
. This method is protected to allow
subclasses to override it, for instance to configure query caching.
directoryId
- the directory being queriedquery
- the query
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |