public class GroupServiceImpl extends GroupServiceBase implements GroupService
Constructor and Description |
---|
GroupServiceImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
addGroupToGroup(String childId,
String parentId)
Adds the group with the id supplied in childId as a member of the group with the id supplied in parentId.
|
boolean |
addPrincipalToGroup(String principalId,
String groupId)
Add the principal with the given principalId as a member of the group with the given groupId.
|
Group |
createGroup(Group group)
Creates a new group using the given Group.
|
GroupMember |
createGroupMember(GroupMember groupMember)
Creates a new group using the given GroupMember.
|
List<String> |
findGroupIds(QueryByCriteria queryByCriteria)
Query for groups based on the given search criteria which is a Map of group field names to values.
|
GroupMemberQueryResults |
findGroupMembers(QueryByCriteria queryByCriteria)
Query for group members based on the given search criteria which is a Map of group member field names to values.
|
GroupQueryResults |
findGroups(QueryByCriteria queryByCriteria)
Query for groups based on the given search criteria which is a Map of group field names to values.
|
Map<String,String> |
getAttributes(String groupId)
Get all the attributes of the given group.
|
List<GroupMember> |
getCurrentAndFutureMembers(String groupId)
Returns the list of group members who are currently active and futureActive .
|
List<String> |
getDirectGroupIdsByPrincipalId(String principalId)
Get all the groups for the given principal.
|
protected Collection<Group> |
getDirectGroupsForPrincipal(String principalId) |
protected Collection<Group> |
getDirectGroupsForPrincipal(String principalId,
String namespaceCode,
org.joda.time.DateTime asOfDate) |
List<String> |
getDirectMemberGroupIds(String groupId)
Returns all group ids that are direct members of the given group id.
|
List<String> |
getDirectMemberGroupIdsWithDate(String groupId) |
List<String> |
getDirectMemberPrincipalIds(String groupId)
Returns all principal ids that are direct members of the given group id.
|
List<String> |
getDirectParentGroupIds(String groupId)
Returns all parent groups ids that the given group id is a member of.
|
List<String> |
getDirectParentGroupIdsWithDate(String groupId,
org.joda.time.DateTime asOfDate) |
protected List<Group> |
getDirectParentGroups(String groupId,
org.joda.time.DateTime asOfDate) |
Group |
getGroup(String groupId)
Lookup a Group based on the passed in id.
|
protected GroupBo |
getGroupBo(String groupId) |
Group |
getGroupByNamespaceCodeAndName(String namespaceCode,
String groupName)
Lookup a Group based on the passed in namespace and name.
|
List<String> |
getGroupIdsByPrincipalId(String principalId)
Get all the groups for the given principal.
|
List<String> |
getGroupIdsByPrincipalIdAndNamespaceCode(String principalId,
String namespaceCode)
Get all the groups for the given principal.
|
protected List<String> |
getGroupIdsByPrincipalIdAndNamespaceCodeInternal(String principalId,
String namespaceCode) |
protected GroupMemberBo |
getGroupMemberBo(String id) |
List<Group> |
getGroups(Collection<String> groupIds)
Gets all groups for the given collection of group ids.
|
List<Group> |
getGroupsByPrincipalId(String principalId)
Get all the groups for a given principal.
|
List<Group> |
getGroupsByPrincipalIdAndNamespaceCode(String principalId,
String namespaceCode)
Get all the groups within a namespace for a given principal.
|
protected List<Group> |
getGroupsByPrincipalIdAndNamespaceCodeInternal(String principalId,
String namespaceCode) |
protected List<GroupBo> |
getMemberGroupBos(String groupId) |
List<String> |
getMemberGroupIds(String groupId)
Returns all group ids that are members of the given group id.
|
protected void |
getMemberGroupsInternal(GroupBo group,
Set<GroupBo> groups) |
protected List<String> |
getMemberIdsByType(Collection<GroupMember> members,
MemberType memberType) |
List<String> |
getMemberPrincipalIds(String groupId)
Returns all principal ids that are members of the given group id.
|
protected List<String> |
getMemberPrincipalIdsInternal(String groupId,
Set<String> visitedGroupIds) |
List<GroupMember> |
getMembers(List<String> groupIds)
Get all GroupMembers all the groups with the given group ids.
|
List<GroupMember> |
getMembersOfGroup(String groupId)
Get all GroupMembers all the groups with a given group id.
|
List<GroupMember> |
getMembersOfGroupWithDate(String groupId,
org.joda.time.DateTime asOfDate)
Get all GroupMembers all the groups with a given group id and asOfDate.
|
List<GroupMember> |
getMembersWithDate(List<String> groupIds,
org.joda.time.DateTime asOfDate) |
List<String> |
getParentGroupIds(String groupId)
Returns all parent groups ids that the given group id is a member of.
|
protected List<Group> |
getParentGroups(String groupId) |
protected void |
getParentGroupsInternal(String groupId,
Set<Group> groups) |
boolean |
isDirectMemberOfGroup(String principalId,
String groupId)
Check whether the give principal is a member of the group.
|
boolean |
isGroupMemberOfGroup(String groupMemberId,
String groupId)
Check whether the group identified by groupMemberId is a member of the group
identified by groupId.
|
boolean |
isGroupMemberOfGroupWithDate(String groupMemberId,
String groupId,
org.joda.time.DateTime asOfDate) |
boolean |
isMemberOfGroup(String principalId,
String groupId)
Check whether the give principal is a member of the group.
|
protected boolean |
isMemberOfGroupInternal(String memberId,
String groupId,
Set<String> visitedGroupIds,
MemberType memberType,
org.joda.time.DateTime asOfDate) |
boolean |
isMemberOfGroupWithDate(String principalId,
String groupId,
org.joda.time.DateTime asOfDate) |
void |
removeAllMembers(String groupId)
Removes all members from the group with the given groupId.
|
boolean |
removeGroupFromGroup(String childId,
String parentId)
Removes the group with the id supplied in childId from the group with the id supplied in parentId.
|
boolean |
removePrincipalFromGroup(String principalId,
String groupId)
Removes the member principal with the given principalId from the group with the given groupId.
|
protected GroupBo |
saveGroup(GroupBo group) |
void |
setDataObjectService(DataObjectService dataObjectService) |
Group |
updateGroup(Group group)
Updates an existing group using the given Group.
|
Group |
updateGroup(String groupId,
Group group)
Updates a group using the given Group.
|
GroupMember |
updateGroupMember(GroupMember groupMember)
Updates an existing group using the given GroupMember.
|
public GroupServiceImpl()
public Group getGroup(String groupId) throws RiceIllegalArgumentException
GroupService
getGroup
in interface GroupService
groupId
- String that matches the desired Groups idRiceIllegalArgumentException
- if the groupId is null or blankpublic List<Group> getGroupsByPrincipalId(String principalId) throws RiceIllegalArgumentException
GroupService
This will include all groups directly assigned as well as those inferred by the fact that they are members of higher level groups.
getGroupsByPrincipalId
in interface GroupService
principalId
- The id of the PrincipalRiceIllegalArgumentException
- if the principalId is null or blankpublic List<Group> getGroupsByPrincipalIdAndNamespaceCode(String principalId, String namespaceCode) throws RiceIllegalArgumentException
GroupService
This will include all groups directly assigned as well as those inferred by the fact that they are members of higher level groups, and filtered by Group namespace.
getGroupsByPrincipalIdAndNamespaceCode
in interface GroupService
principalId
- The id of the PrincipalnamespaceCode
- The namespace code of the desired Groups to returnRiceIllegalArgumentException
- if the principalId, namespaceCode is null or blankprotected List<Group> getGroupsByPrincipalIdAndNamespaceCodeInternal(String principalId, String namespaceCode) throws RiceIllegalArgumentException
RiceIllegalArgumentException
public List<String> findGroupIds(QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException
GroupService
This method returns it's results as a List of group ids that match the given search criteria.
findGroupIds
in interface GroupService
queryByCriteria
- the criteria. Cannot be null.RiceIllegalArgumentException
- if the queryByCriteria is nullpublic boolean isDirectMemberOfGroup(String principalId, String groupId) throws RiceIllegalArgumentException
GroupService
This method does not recurse into contained groups.
isDirectMemberOfGroup
in interface GroupService
principalId
- Id of the principalgroupId
- Id string of groupRiceIllegalArgumentException
- if the principalId, groupId is null or blankpublic List<String> getGroupIdsByPrincipalId(String principalId) throws RiceIllegalArgumentException
GroupService
This returns id for all groups for a given principal id.
getGroupIdsByPrincipalId
in interface GroupService
principalId
- Id of a PrincipalRiceIllegalArgumentException
- if the principalId is null or blankpublic List<String> getGroupIdsByPrincipalIdAndNamespaceCode(String principalId, String namespaceCode) throws RiceIllegalArgumentException
GroupService
This returns id for all groups for a given principal id, limited to specific Group namespace.
getGroupIdsByPrincipalIdAndNamespaceCode
in interface GroupService
principalId
- Id of a PrincipalnamespaceCode
- Namspace code to limit group results toRiceIllegalArgumentException
- if the principalId, namespaceCode is null or blankprotected List<String> getGroupIdsByPrincipalIdAndNamespaceCodeInternal(String principalId, String namespaceCode) throws RiceIllegalArgumentException
RiceIllegalArgumentException
public List<String> getDirectGroupIdsByPrincipalId(String principalId) throws RiceIllegalArgumentException
GroupService
This returns id for all groups for a given principal id.
getDirectGroupIdsByPrincipalId
in interface GroupService
principalId
- Id of a PrincipalRiceIllegalArgumentException
- if the principalId is null or blankpublic List<String> getMemberPrincipalIds(String groupId) throws RiceIllegalArgumentException
GroupService
Will return a list of all principal ids for members this group.
getMemberPrincipalIds
in interface GroupService
groupId
- Id string of groupRiceIllegalArgumentException
- if the groupId is null or blankpublic List<String> getDirectMemberPrincipalIds(String groupId) throws RiceIllegalArgumentException
GroupService
Will return a list of all principal ids for direct members this group.
getDirectMemberPrincipalIds
in interface GroupService
groupId
- Id string of groupRiceIllegalArgumentException
- if the groupId is null or blankpublic List<String> getMemberGroupIds(String groupId) throws RiceIllegalArgumentException
GroupService
Will return a list of all group ids for members this group.
getMemberGroupIds
in interface GroupService
groupId
- Id string of groupRiceIllegalArgumentException
- if the groupId is null or blankprotected List<GroupBo> getMemberGroupBos(String groupId)
protected void getMemberGroupsInternal(GroupBo group, Set<GroupBo> groups)
public boolean isGroupMemberOfGroup(String groupMemberId, String groupId) throws RiceIllegalArgumentException
GroupService
Will return true if the group is a member of the group or a group assigned to this group.
isGroupMemberOfGroup
in interface GroupService
groupMemberId
- Id of the principalgroupId
- Id string of groupRiceIllegalArgumentException
- if the groupMemberId, groupId is null or blankpublic boolean isGroupMemberOfGroupWithDate(String groupMemberId, String groupId, org.joda.time.DateTime asOfDate) throws RiceIllegalArgumentException
isGroupMemberOfGroupWithDate
in interface GroupService
RiceIllegalArgumentException
public boolean isMemberOfGroup(String principalId, String groupId) throws RiceIllegalArgumentException
GroupService
Will return true if the principal is a member of the group or a group assigned to this group.
isMemberOfGroup
in interface GroupService
principalId
- Id of the principalgroupId
- Id string of groupRiceIllegalArgumentException
- if the principalId, groupId is null or blankpublic boolean isMemberOfGroupWithDate(String principalId, String groupId, org.joda.time.DateTime asOfDate) throws RiceIllegalArgumentException
isMemberOfGroupWithDate
in interface GroupService
RiceIllegalArgumentException
public List<String> getDirectMemberGroupIds(String groupId) throws RiceIllegalArgumentException
GroupService
Will return a list of all group ids for direct members this group.
getDirectMemberGroupIds
in interface GroupService
groupId
- Id string of groupRiceIllegalArgumentException
- if the groupId is null or blankpublic List<String> getDirectMemberGroupIdsWithDate(String groupId) throws RiceIllegalArgumentException
getDirectMemberGroupIdsWithDate
in interface GroupService
RiceIllegalArgumentException
public List<String> getParentGroupIds(String groupId) throws RiceIllegalArgumentException
GroupService
Will return a list of all group ids that the given group id is a member of.
getParentGroupIds
in interface GroupService
groupId
- Id string of groupRiceIllegalArgumentException
- if the groupId is null or blankpublic List<String> getDirectParentGroupIds(String groupId) throws RiceIllegalArgumentException
GroupService
Will return a list of all group ids that the given group id is a member of.
getDirectParentGroupIds
in interface GroupService
groupId
- Id string of groupRiceIllegalArgumentException
- if the groupId is null or blankpublic List<String> getDirectParentGroupIdsWithDate(String groupId, org.joda.time.DateTime asOfDate) throws RiceIllegalArgumentException
getDirectParentGroupIdsWithDate
in interface GroupService
RiceIllegalArgumentException
public Map<String,String> getAttributes(String groupId) throws RiceIllegalArgumentException
GroupService
getAttributes
in interface GroupService
RiceIllegalArgumentException
- if the groupId is null or blankpublic List<GroupMember> getMembers(List<String> groupIds) throws RiceIllegalArgumentException
GroupService
The collection of GroupMembers will contain members for all the groups in no defined order. The values returned may or may not be grouped by group id.
getMembers
in interface GroupService
groupIds
- Ids of groupsRiceIllegalArgumentException
- if the groupIds is null or emptypublic List<GroupMember> getMembersWithDate(List<String> groupIds, org.joda.time.DateTime asOfDate) throws RiceIllegalArgumentException
getMembersWithDate
in interface GroupService
RiceIllegalArgumentException
public List<Group> getGroups(Collection<String> groupIds) throws RiceIllegalArgumentException
GroupService
The result is a Map containing the group id as the key and the Group as the value.
getGroups
in interface GroupService
groupIds
- Collection that matches the desired Groups' idRiceIllegalArgumentException
- if the groupIds null or emptypublic Group getGroupByNamespaceCodeAndName(String namespaceCode, String groupName) throws RiceIllegalArgumentException
GroupService
getGroupByNamespaceCodeAndName
in interface GroupService
namespaceCode
- String that matches the desired Group's namespaceCodegroupName
- String that matches the desired Group's nameRiceIllegalArgumentException
- if the namespaceCode, groupName is null or blankpublic GroupQueryResults findGroups(QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException
GroupService
This method returns it's results as a List of Groups that match the given search criteria.
findGroups
in interface GroupService
queryByCriteria
- the criteria. Cannot be null.RiceIllegalArgumentException
- if the queryByCriteria is nullpublic GroupMemberQueryResults findGroupMembers(QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException
GroupService
This method returns it's results as a List of GroupMemberss that match the given search criteria.
findGroupMembers
in interface GroupService
queryByCriteria
- the criteria. Cannot be null.RiceIllegalArgumentException
- if the queryByCriteria is nullprotected boolean isMemberOfGroupInternal(String memberId, String groupId, Set<String> visitedGroupIds, MemberType memberType, org.joda.time.DateTime asOfDate)
protected void getParentGroupsInternal(String groupId, Set<Group> groups)
protected List<Group> getDirectParentGroups(String groupId, org.joda.time.DateTime asOfDate)
public List<GroupMember> getMembersOfGroup(String groupId) throws RiceIllegalArgumentException
GroupService
The collection of GroupMembers will contain members for a the group in no defined order.
getMembersOfGroup
in interface GroupService
groupId
- Id of groupRiceIllegalArgumentException
- if the groupId is null or blankpublic List<GroupMember> getMembersOfGroupWithDate(String groupId, org.joda.time.DateTime asOfDate) throws RiceIllegalArgumentException
GroupService
The collection of GroupMembers will contain members for a the group in no defined order. That were members at the specified time.
getMembersOfGroupWithDate
in interface GroupService
groupId
- Id of groupasOfDate
- Date for historical recordRiceIllegalArgumentException
- if the groupId is null or blankprotected List<String> getMemberIdsByType(Collection<GroupMember> members, MemberType memberType)
protected GroupBo getGroupBo(String groupId)
protected GroupMemberBo getGroupMemberBo(String id)
protected List<Group> getParentGroups(String groupId) throws RiceIllegalArgumentException
RiceIllegalArgumentException
protected List<String> getMemberPrincipalIdsInternal(String groupId, Set<String> visitedGroupIds)
protected Collection<Group> getDirectGroupsForPrincipal(String principalId)
protected Collection<Group> getDirectGroupsForPrincipal(String principalId, String namespaceCode, org.joda.time.DateTime asOfDate)
public boolean addGroupToGroup(String childId, String parentId) throws RiceIllegalArgumentException
GroupService
addGroupToGroup
in interface GroupService
childId
- Id of the Group to be added to the members of ParentparentId
- Id of the Group object to add the member toRiceIllegalArgumentException
- if the childId, parentId is null or blankpublic boolean addPrincipalToGroup(String principalId, String groupId) throws RiceIllegalArgumentException
GroupService
addPrincipalToGroup
in interface GroupService
principalId
- Id of the Principal to be added to the members of the Parent GroupgroupId
- Id of the Group object to add the member toRiceIllegalArgumentException
- if the principalId, groupId is null or blankpublic Group createGroup(Group group) throws RiceIllegalArgumentException
GroupService
This will attempt to create a new Group
createGroup
in interface GroupService
group
- The new group to be createdRiceIllegalArgumentException
- if the group is nullpublic Group updateGroup(Group group) throws RiceIllegalArgumentException
GroupService
This will attempt to update an existing Group. For this to return without exceptions, the passed in Group must have it's Id set and be a valid group that already exists.
updateGroup
in interface GroupService
group
- The group to be updatedRiceIllegalArgumentException
- if the group is nullpublic Group updateGroup(String groupId, Group group) throws RiceIllegalArgumentException
GroupService
This will attempt to update an existing group with data from the passed in group. If the passed in groupId and the group.id values are different this method will inactivate the old group and create a new group with the same members with the passed in groups properties.
updateGroup
in interface GroupService
groupId
- Id of the Group to be updatedgroup
- Group object to use for updateRiceIllegalArgumentException
- if the group is null or the groupId is null or blankpublic GroupMember createGroupMember(GroupMember groupMember) throws RiceIllegalArgumentException
GroupService
This will attempt to create a new GroupMember
createGroupMember
in interface GroupService
groupMember
- The new groupMember to be createdRiceIllegalArgumentException
- if the group is nullpublic GroupMember updateGroupMember(GroupMember groupMember) throws RiceIllegalArgumentException
GroupService
This will attempt to update an existing GroupMember. For this to return without exceptions, the passed in GroupMember must have it's Id set and be a valid groupMember that already exists.
updateGroupMember
in interface GroupService
groupMember
- The groupMember to be updatedRiceIllegalArgumentException
- if the groupMember is nullpublic void removeAllMembers(String groupId) throws RiceIllegalArgumentException
GroupService
removeAllMembers
in interface GroupService
groupId
- Id of the Group object to remove the members fromRiceIllegalArgumentException
- if the groupId is null or blankpublic boolean removeGroupFromGroup(String childId, String parentId) throws RiceIllegalArgumentException
GroupService
removeGroupFromGroup
in interface GroupService
childId
- Id of the Group to be removed from the members of ParentparentId
- Id of the Group object to remove the member fromRiceIllegalArgumentException
- if the childId, parentId is null or blankpublic boolean removePrincipalFromGroup(String principalId, String groupId) throws RiceIllegalArgumentException
GroupService
removePrincipalFromGroup
in interface GroupService
principalId
- Id of the Principal to be removed from the members of the Parent GroupgroupId
- Id of the Group object to remove the member fromRiceIllegalArgumentException
- if the principalId, groupId is null or blankpublic void setDataObjectService(DataObjectService dataObjectService)
public List<GroupMember> getCurrentAndFutureMembers(String groupId)
getCurrentAndFutureMembers
in interface GroupService
groupId
- Copyright © 2005–2016 The Kuali Foundation. All rights reserved.