com.atlassian.crowd.embedded.spi
Interface MembershipDao


public interface MembershipDao


Method Summary
 BatchResult<java.lang.String> addAllUsersToGroup(long directoryId, java.util.Collection<java.lang.String> userNames, java.lang.String groupName)
          Adds all the given users into the given group.
 void addGroupToGroup(long directoryId, java.lang.String childGroup, java.lang.String parentGroup)
          Adds group as a child of the (supposedly) parent group.
 void addUserToGroup(long directoryId, java.lang.String userName, java.lang.String groupName)
          Adds user as a member of group.
 boolean isGroupDirectMember(long directoryId, java.lang.String childGroup, java.lang.String parentGroup)
          Determines whether the group is a direct member of the (supposedly) parent group.
 boolean isUserDirectMember(long directoryId, java.lang.String userName, java.lang.String groupName)
          Determines whether the user is a direct member of the group.
 void removeGroupFromGroup(long directoryId, java.lang.String childGroup, java.lang.String parentGroup)
          Removes group from the parent group.
 void removeUserFromGroup(long directoryId, java.lang.String userName, java.lang.String groupName)
          Removes user as a member of the given group.
<T> java.util.List<T>
search(long directoryId, MembershipQuery<T> query)
          Search for memberships by the given criteria.
 

Method Detail

isUserDirectMember

boolean isUserDirectMember(long directoryId,
                           java.lang.String userName,
                           java.lang.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,
                            java.lang.String childGroup,
                            java.lang.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,
                    java.lang.String userName,
                    java.lang.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<java.lang.String> addAllUsersToGroup(long directoryId,
                                                 java.util.Collection<java.lang.String> userNames,
                                                 java.lang.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,
                     java.lang.String childGroup,
                     java.lang.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,
                         java.lang.String userName,
                         java.lang.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,
                          java.lang.String childGroup,
                          java.lang.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> java.util.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.