Package org.openiam.srvc.am
Class GroupDataWebServiceImpl
- java.lang.Object
-
- org.openiam.srvc.AbstractApiService
-
- org.openiam.srvc.am.GroupDataWebServiceImpl
-
- All Implemented Interfaces:
GroupDataWebService
@Service("groupWS") public class GroupDataWebServiceImpl extends AbstractApiService implements GroupDataWebServiceGroupDataServiceImplprovides a service to manage groups as well as related objects such as Users. Groups are stored in an hierarchical relationship. A user belongs to one or more groups.
Groups are often modeled after an organizations structure.- Version:
- 2.0
- Author:
- Suneet Shah
-
-
Field Summary
-
Fields inherited from class org.openiam.srvc.AbstractApiService
applicationContext, log, rabbitMQSender
-
-
Constructor Summary
Constructors Constructor Description GroupDataWebServiceImpl(GroupQueue queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseaddChildGroup(String groupId, String childGroupId, Set<String> rights, Date startDate, Date endDate)Makes Group specified by childGroupId a child of Group specified by groupIdResponsecanAddUserToGroup(String userId, String groupId)Checks if User specified by userId can be added to the Group specified by groupId as a memberResponsecanRemoveUserFromGroup(String userId, String groupId)Checks if User specified by userId can be removed from the Group specified by groupId as a memberintcountBeans(GroupSearchBean searchBean)Returns total number of Groups based on parameters, which are specified in GroupSearchBean objectintcountGroupsForOwner(GroupSearchBean searchBean, String ownerId)Returns total number of Groups for given groupOwner based on parameters, which are specified in GroupSearchBean objectResponsedeleteGroup(String groupId)This method removes group from openIAM database for a particular groupId.GroupListResponsefindBeans(GroupSearchBean searchBean, EntitlementsCollection[] dependants, int from, int size)Return a paged List of Groups based on parameters, which are specified in GroupSearchBean objectList<Group>findGroupsForOwner(GroupSearchBean searchBean, String ownerId, int from, int size)Return a paged List of Groups for given groupOwner based on parameters, which are specified in GroupSearchBean objectvoidforceSweepUserCountCache()force refresh cache which holds count of users assigned to groups and max number limitList<String>getAllGroupIds()Method to get all Group IDs This method should not be called at run-time.GroupListResponsegetDetachedForUser(String userId, String name, int from, int size)method is used to detect all user's groups that are not linked with any resources.GroupgetGroup(String groupId)This method retrieves an existing group object.List<String>getPossibleAttributeNames()GroupListResponsegetWithResources(String userId, GroupSearchBean searchBean, Set<String> resourceTypeIds, int from, int size)method is used to get user's groups with entitled resources, filtered by #resourceTypeIds.booleanhasAttachedEntities(String groupId)Does this group have any children?ResponsereindexGroup(String id)ResponseremoveChildGroup(String groupId, String childGroupId)Remove Group specified by childGroupId from the membership list of Group specified by groupIdResponseremoveRoleFromGroup(String roleId, String groupId)ResponsesaveBulkGroup(EntitlementBulkRequest entitlementBulkRequest)Bulk operation on Group objects, this method with save groups in bulkResponsesaveGroup(Group group)This method creates a new group or update existed one.SaveTemplateProfileResponsesaveGroupRequest(GroupRequestModel request)GroupsuggestById(String id)Find a group in Elasticsearch.ResponsevalidateDelete(String groupId)ResponsevalidateEdit(Group group)SaveTemplateProfileResponsevalidateGroupRequest(GroupRequestModel request)ResponsevalidateGroupToGroupAddition(String groupId, String childGroupId, Set<String> rights, Date startDate, Date endDate)-
Methods inherited from class org.openiam.srvc.AbstractApiService
broadcast, crudRequest, getBooleanValue, getIntValue, getIntValue, getRabbitMqQueue, getResponse, getResponse, getValue, getValue, getValueList, getValueList, idRequest, manageApiRequest, manageApiRequest, manageCrudApiRequest, manageCrudApiRequest, manageCrudApiRequest, manageCrudApiRequest, membershipRequestProcessing, membershipRequestProcessing, publish, publish, sendAsync, sendAsync
-
-
-
-
Constructor Detail
-
GroupDataWebServiceImpl
@Autowired public GroupDataWebServiceImpl(GroupQueue queue)
-
-
Method Detail
-
validateEdit
public Response validateEdit(Group group)
- Specified by:
validateEditin interfaceGroupDataWebService
-
validateDelete
public Response validateDelete(String groupId)
- Specified by:
validateDeletein interfaceGroupDataWebService
-
saveGroup
public Response saveGroup(Group group)
Description copied from interface:GroupDataWebServiceThis method creates a new group or update existed one. For example:Group grp = new Group(); grp.setGrpId(groupId); grp.setGrpName("Test Group"); grpManager.addGroup(grpValue);
- Specified by:
saveGroupin interfaceGroupDataWebService- Parameters:
group- - the Group object, which should be created or updated- Returns:
- - a Response Object. If operation succeed then Response object contains the primary key of saved group otherwise it contains error code.
-
getGroup
public Group getGroup(String groupId)
Description copied from interface:GroupDataWebServiceThis method retrieves an existing group object. Dependent objects such as users are not retrieved. Null is returned if the groupId is not found.- Specified by:
getGroupin interfaceGroupDataWebService- Parameters:
groupId- - the Group ID- Returns:
- - a Group Object if it is found, otherwise null will be returned.
-
suggestById
public Group suggestById(String id)
Description copied from interface:GroupDataWebServiceFind a group in Elasticsearch. Significantly faster than going to the database. Use this method when performance is important and/or data integrity is not 100% required, as the database and ES may be out of sync for a period of time- Specified by:
suggestByIdin interfaceGroupDataWebService- Parameters:
id- the role id- Returns:
- group
-
deleteGroup
public Response deleteGroup(String groupId)
Description copied from interface:GroupDataWebServiceThis method removes group from openIAM database for a particular groupId.- Specified by:
deleteGroupin interfaceGroupDataWebService- Parameters:
groupId- The id to be removed.- Returns:
- - a Response Object which contains operation status.
-
findBeans
public GroupListResponse findBeans(GroupSearchBean searchBean, EntitlementsCollection[] dependants, int from, int size)
Description copied from interface:GroupDataWebServiceReturn a paged List of Groups based on parameters, which are specified in GroupSearchBean object- Specified by:
findBeansin interfaceGroupDataWebService- Parameters:
searchBean- - GroupSearchBean objectdependants- - collection instead of deep copy flag for AccessRights processorfrom- - where to start in the listsize- - how many to return- Returns:
- List of Group objects. Returns null if no groups are found.
-
countBeans
public int countBeans(GroupSearchBean searchBean)
Description copied from interface:GroupDataWebServiceReturns total number of Groups based on parameters, which are specified in GroupSearchBean object- Specified by:
countBeansin interfaceGroupDataWebService- Parameters:
searchBean- - GroupSearchBean object- Returns:
- - Integer, total number of groups based on parameters, which are specified in GroupSearchBean object
-
findGroupsForOwner
public List<Group> findGroupsForOwner(GroupSearchBean searchBean, String ownerId, int from, int size)
Description copied from interface:GroupDataWebServiceReturn a paged List of Groups for given groupOwner based on parameters, which are specified in GroupSearchBean object- Specified by:
findGroupsForOwnerin interfaceGroupDataWebService- Parameters:
searchBean- - GroupSearchBean objectownerId- - the User ID who is the owner for the searching groupsfrom- - where to start in the listsize- - how many to return- Returns:
- List of Group objects. Returns null if no groups are found.
-
countGroupsForOwner
public int countGroupsForOwner(GroupSearchBean searchBean, String ownerId)
Description copied from interface:GroupDataWebServiceReturns total number of Groups for given groupOwner based on parameters, which are specified in GroupSearchBean object- Specified by:
countGroupsForOwnerin interfaceGroupDataWebService- Parameters:
searchBean- - GroupSearchBean objectownerId- - the User ID who is the owner for the searching groups- Returns:
- - Integer, total number of groups based on parameters, which are specified in GroupSearchBean object
-
addChildGroup
public Response addChildGroup(String groupId, String childGroupId, Set<String> rights, Date startDate, Date endDate)
Description copied from interface:GroupDataWebServiceMakes Group specified by childGroupId a child of Group specified by groupId- Specified by:
addChildGroupin interfaceGroupDataWebService- Parameters:
groupId- - the Group ID to which another group specified by childGroupId will be addedchildGroupId- - the Group ID which will be added to the group specified by groupId- Returns:
- a Response Object, containing the status of this operation.
-
removeChildGroup
public Response removeChildGroup(String groupId, String childGroupId)
Description copied from interface:GroupDataWebServiceRemove Group specified by childGroupId from the membership list of Group specified by groupId- Specified by:
removeChildGroupin interfaceGroupDataWebService- Parameters:
groupId- - the Group ID from which another group specified by childGroupId will be deletedchildGroupId- - the Group ID which will be deleted from the group specified by groupId- Returns:
- a Response Object, containing the status of this operation.
-
canAddUserToGroup
public Response canAddUserToGroup(String userId, String groupId)
Description copied from interface:GroupDataWebServiceChecks if User specified by userId can be added to the Group specified by groupId as a member- Specified by:
canAddUserToGroupin interfaceGroupDataWebService- Parameters:
userId- - the User IDgroupId- - the Group ID- Returns:
- a Response Object, containing the status of this operation. if status is SUCCESS then the User can be added to this Croup
-
canRemoveUserFromGroup
public Response canRemoveUserFromGroup(String userId, String groupId)
Description copied from interface:GroupDataWebServiceChecks if User specified by userId can be removed from the Group specified by groupId as a member- Specified by:
canRemoveUserFromGroupin interfaceGroupDataWebService- Parameters:
userId- - the User IDgroupId- - the Group ID- Returns:
- a Response Object, containing the status of this operation. if status is SUCCESS then the User can be removed from this Group
-
validateGroupToGroupAddition
public Response validateGroupToGroupAddition(String groupId, String childGroupId, Set<String> rights, Date startDate, Date endDate)
- Specified by:
validateGroupToGroupAdditionin interfaceGroupDataWebService
-
hasAttachedEntities
public boolean hasAttachedEntities(String groupId)
Description copied from interface:GroupDataWebServiceDoes this group have any children?- Specified by:
hasAttachedEntitiesin interfaceGroupDataWebService- Returns:
-
removeRoleFromGroup
public Response removeRoleFromGroup(String roleId, String groupId)
- Specified by:
removeRoleFromGroupin interfaceGroupDataWebService
-
saveGroupRequest
public SaveTemplateProfileResponse saveGroupRequest(GroupRequestModel request)
- Specified by:
saveGroupRequestin interfaceGroupDataWebService
-
validateGroupRequest
public SaveTemplateProfileResponse validateGroupRequest(GroupRequestModel request)
- Specified by:
validateGroupRequestin interfaceGroupDataWebService
-
getAllGroupIds
public List<String> getAllGroupIds()
Description copied from interface:GroupDataWebServiceMethod to get all Group IDs This method should not be called at run-time. It is here only for testing purpose.At the time of writing, this method is called by the ui-test/stress-test module.
- Specified by:
getAllGroupIdsin interfaceGroupDataWebService- Returns:
-
reindexGroup
public Response reindexGroup(String id)
- Specified by:
reindexGroupin interfaceGroupDataWebService- Parameters:
id- - Group id for reindex- Returns:
-
getDetachedForUser
public GroupListResponse getDetachedForUser(String userId, String name, int from, int size)
Description copied from interface:GroupDataWebServicemethod is used to detect all user's groups that are not linked with any resources.- Specified by:
getDetachedForUserin interfaceGroupDataWebService- Parameters:
userId- - id of User to check detached groupsname- - name for case INSENSITIVE CONTAINS match search.from- - zero based very first result- Returns:
- -
GroupListResponse
-
getWithResources
public GroupListResponse getWithResources(String userId, GroupSearchBean searchBean, Set<String> resourceTypeIds, int from, int size)
Description copied from interface:GroupDataWebServicemethod is used to get user's groups with entitled resources, filtered by #resourceTypeIds. Resources are returned inGroup#getResources()container (only ids).- Specified by:
getWithResourcesin interfaceGroupDataWebService- Parameters:
userId- - user idsearchBean- - searchBean for objectsresourceTypeIds- - types of resources to fetchfrom- - zero based very first resultsize- - total size of page.- Returns:
GroupListResponsewith requested objects
-
getPossibleAttributeNames
public List<String> getPossibleAttributeNames()
- Specified by:
getPossibleAttributeNamesin interfaceGroupDataWebService
-
saveBulkGroup
public Response saveBulkGroup(EntitlementBulkRequest entitlementBulkRequest)
Description copied from interface:GroupDataWebServiceBulk operation on Group objects, this method with save groups in bulk- Specified by:
saveBulkGroupin interfaceGroupDataWebService- Parameters:
entitlementBulkRequest- - EntitlementBulkRequest object that will be processed.
-
forceSweepUserCountCache
public void forceSweepUserCountCache()
Description copied from interface:GroupDataWebServiceforce refresh cache which holds count of users assigned to groups and max number limit- Specified by:
forceSweepUserCountCachein interfaceGroupDataWebService
-
-