com.atlassian.crowd.embedded.spi
Interface MembershipDao

All Known Subinterfaces:
InternalMembershipDao
All Known Implementing Classes:
MembershipDAOHibernate

public interface MembershipDao


Method Summary
 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.
 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 removeGroupFromGroup(long directoryId, String childGroup, String parentGroup)
          Removes group from the parent group.
 void removeUserFromGroup(long directoryId, String userName, String groupName)
          Removes user as a member of the given group.
<T> List<T>
search(long directoryId, MembershipQuery<T> query)
          Search for memberships by the given criteria.
 

Method Detail

isUserDirectMember

boolean isUserDirectMember(long directoryId,
                           String userName,
                           String groupName)
Determines whether the user is a direct member of the group.

Parameters:
directoryId - the directory to perform the operation
userName - user
groupName - group
Returns:
true if the user is a direct member of the group

isGroupDirectMember

boolean isGroupDirectMember(long directoryId,
                            String childGroup,
                            String parentGroup)
Determines whether the group is a direct member of the (supposedly) parent group.

Parameters:
directoryId - the directory to perform the operation
childGroup - child group
parentGroup - parent group
Returns:
true if the group is a direct member of the (supposedly) parent group

addUserToGroup

void addUserToGroup(long directoryId,
                    String userName,
                    String groupName)
                    throws UserNotFoundException,
                           GroupNotFoundException
Adds user as a member of group.

Parameters:
directoryId - the directory to perform the operation
userName - user
groupName - group
Throws:
UserNotFoundException - if the user does not exist
GroupNotFoundException - if the group does not exist

addAllUsersToGroup

BatchResult<String> addAllUsersToGroup(long directoryId,
                                       Collection<String> userNames,
                                       String groupName)
                                       throws GroupNotFoundException
Adds all the given users into the given group.

Parameters:
directoryId - the directory to perform the operation
userNames - the collection of users
groupName - group
Returns:
result containing both successful and failed users
Throws:
GroupNotFoundException - if the group does not exist

addGroupToGroup

void addGroupToGroup(long directoryId,
                     String childGroup,
                     String parentGroup)
                     throws GroupNotFoundException
Adds group as a child of the (supposedly) parent group.

Parameters:
directoryId - the directory to perform the operation
childGroup - the (supposedly) child group
parentGroup - parent group
Throws:
GroupNotFoundException - if either child or parent group is not found

removeUserFromGroup

void removeUserFromGroup(long directoryId,
                         String userName,
                         String groupName)
                         throws UserNotFoundException,
                                GroupNotFoundException,
                                MembershipNotFoundException
Removes user as a member of the given group.

Parameters:
directoryId - the directory to perform the operation
userName - user
groupName - group
Throws:
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 group

removeGroupFromGroup

void removeGroupFromGroup(long directoryId,
                          String childGroup,
                          String parentGroup)
                          throws GroupNotFoundException,
                                 MembershipNotFoundException
Removes group from the parent group.

Parameters:
directoryId - the directory to perform the operation
childGroup - child group
parentGroup - parent group
Throws:
GroupNotFoundException - if either child or parent group does not exist
MembershipNotFoundException - if the membership relationship between the child and parent group does not exist

search

<T> List<T> search(long directoryId,
                   MembershipQuery<T> query)
Search for memberships by the given criteria.

Parameters:
directoryId - the directory to perform the operation
query - criteria
Returns:
list (can be empty but never null) of memberships which match the given criteria


Copyright © 2012 Atlassian. All Rights Reserved.