public class MembershipDAOHibernate extends HibernateDao implements MembershipDao, InternalMembershipDao
batchFinder, batchProcessor, logger
Constructor and Description |
---|
MembershipDAOHibernate() |
Modifier and Type | Method and Description |
---|---|
BatchResult<InternalMembership> |
addAll(Set<InternalMembership> memberships)
Bulk add of memberships.
|
BatchResult<String> |
addAllUsersToGroup(long directoryId,
Collection<String> userNames,
String groupName)
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.
|
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.
|
<T> List<T> |
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) |
load, load, loadReference, loadReference, remove, save, saveOrUpdate, setBatchFinder, setBatchProcessor, update
public Class getPersistentClass()
HibernateDao
HibernateDao.load(long)
to
work correctlygetPersistentClass
in class HibernateDao
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
- groupGroupNotFoundException
- if the group does not existpublic boolean isUserDirectMember(long directoryId, String username, String groupName)
MembershipDao
isUserDirectMember
in interface MembershipDao
directoryId
- the directory to perform the operationusername
- usergroupName
- grouppublic boolean isGroupDirectMember(long directoryId, String childGroup, String parentGroup)
MembershipDao
isGroupDirectMember
in interface MembershipDao
directoryId
- the directory to perform the operationchildGroup
- child groupparentGroup
- parent grouppublic void addUserToGroup(long directoryId, String username, String groupName) throws UserNotFoundException, GroupNotFoundException
MembershipDao
addUserToGroup
in interface MembershipDao
directoryId
- the directory to perform the operationusername
- usergroupName
- groupUserNotFoundException
- if the user does not existGroupNotFoundException
- if the group does not existpublic 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
- groupUserNotFoundException
- if the user does not existGroupNotFoundException
- if the group does not existMembershipNotFoundException
- if the user is not a member of the said grouppublic void addGroupToGroup(long directoryId, String childGroup, String parentGroup) throws GroupNotFoundException
MembershipDao
addGroupToGroup
in interface MembershipDao
directoryId
- the directory to perform the operationchildGroup
- the (supposedly) child groupparentGroup
- parent groupGroupNotFoundException
- if either child or parent group is not foundpublic 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 groupMembershipNotFoundException
- 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 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 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 <T> List<T> search(long directoryId, MembershipQuery<T> query)
MembershipDao
search
in interface MembershipDao
directoryId
- the directory to perform the operationquery
- criteriapublic void renameUserRelationships(long directoryId, String oldName, String newName)
InternalMembershipDao
renameUserRelationships
in interface InternalMembershipDao
directoryId
- Directory id.oldName
- Old username.newName
- New 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 List<InternalMembership> findAll(Collection<Directory> directories)
directories
- directories to search for membershipspublic List<InternalMembership> findAllLocal(Collection<Directory> directories)
directories
- directories to search for membershipspublic BatchResult<InternalMembership> addAll(Set<InternalMembership> memberships)
InternalMembershipDao
addAll
in interface InternalMembershipDao
memberships
- Set of memberships.public void setUserDao(InternalUserDao userDao)
public void setGroupDao(InternalGroupDao groupDao)
public void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)
Copyright © 2013 Atlassian. All Rights Reserved.