Package org.openiam.srvc.am
Class RoleDataWebServiceImpl
- java.lang.Object
-
- org.openiam.srvc.AbstractApiService
-
- org.openiam.srvc.am.RoleDataWebServiceImpl
-
- All Implemented Interfaces:
RoleDataWebService
@Service("roleWS") public class RoleDataWebServiceImpl extends AbstractApiService implements RoleDataWebService- Author:
- suneet
-
-
Field Summary
-
Fields inherited from class org.openiam.srvc.AbstractApiService
applicationContext, log, rabbitMQSender
-
-
Constructor Summary
Constructors Constructor Description RoleDataWebServiceImpl(RoleQueue queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseaddChildRole(String roleId, String childRoleId, Set<String> rights, Date startDate, Date endDate)Makes Role specified by childRoleId a child of Role specified by roleIdResponseaddGroupToRole(String roleId, String groupId, Set<String> rightIds, Date startDate, Date endDate)This method adds particular roleId to a particular group.ResponsecanAddChildRole(String roleId, String childRoleId, Set<String> rights, Date startDate, Date endDate)ResponsecanAddUserToRole(String userId, String roleId)Checks if User specified by userId can be added to the Role specified by roleId as a memberResponsecanRemoveUserFromRole(String userId, String roleId)Checks if User specified by userId can be removed from the Role specified by roleId as a memberintcountBeans(RoleSearchBean searchBean)Returns total number of Roles based on parameters, which are specified in RoleSearchBean objectRoleListResponsefindBeans(RoleSearchBean searchBean, EntitlementsCollection[] dependants, int from, int size)Return a paged List of Roles based on parameters, which are specified in RoleSearchBean objectvoidforceSweepUserCountCache()force refresh cache which holds count of users assigned to roles and max number limitList<String>getAllRoleIds()Gets all role IDsRoleListResponsegetDetachedForUser(String userId, String name, int from, int size)method is used to detect all user's role that are not linked with any resources.RolegetRole(String roleId)Returns a paged List of Role objects that are linked to a Group.List<RoleAttribute>getRoleAttributes(String roleId)RoleListResponsegetWithResources(String userId, RoleSearchBean searchBean, Set<String> resourceTypeIds, int from, int size)method is used to get user's roles with entitled resources, filtered by #resourceTypeIds.booleanhasChildEntities(String roleId)ResponsereindexRole(String id)ResponseremoveChildRole(String roleId, String childRoleId)Remove Role specified by childRoleId from the membership list of Group specified by roleIdResponseremoveGroupFromRole(String roleId, String groupId)Removes the association between a single group and role.ResponseremoveRole(String roleId)This method removes role from openIAM database for a particular roleID.ResponsesaveBulkRole(EntitlementBulkRequest entitlementBulkRequest)Bulk operation on Role objects, this method with save roles in bulkResponsesaveRole(Role role)This method creates a new role or update existed one.SaveTemplateProfileResponsesaveRoleRequest(RoleRequestModel model)RolesuggestById(String id)Find a resource in Elasticsearch.ResponsevalidateDelete(String roleId)ResponsevalidateEdit(Role role)ResponsevalidateGroup2RoleAddition(String roleId, String groupId)ResponsevalidateRoleRequest(RoleRequestModel model)-
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
-
RoleDataWebServiceImpl
@Autowired public RoleDataWebServiceImpl(RoleQueue queue)
-
-
Method Detail
-
validateEdit
public Response validateEdit(Role role)
- Specified by:
validateEditin interfaceRoleDataWebService
-
validateDelete
public Response validateDelete(String roleId)
- Specified by:
validateDeletein interfaceRoleDataWebService
-
getRoleAttributes
public List<RoleAttribute> getRoleAttributes(String roleId)
- Specified by:
getRoleAttributesin interfaceRoleDataWebService
-
saveRole
public Response saveRole(Role role)
Description copied from interface:RoleDataWebServiceThis method creates a new role or update existed one. For example:- Specified by:
saveRolein interfaceRoleDataWebService- Parameters:
role- - the Role object, which should be created or updated- Returns:
- - a Response Object. If operation succeed then Response object contains the primary key of saved role otherwise it contains error code.
-
removeRole
public Response removeRole(String roleId)
Description copied from interface:RoleDataWebServiceThis method removes role from openIAM database for a particular roleID.- Specified by:
removeRolein interfaceRoleDataWebService- Parameters:
roleId- - The Role ID to be removed.- Returns:
- - a Response Object which contains operation status.
-
getRole
public Role getRole(String roleId)
Description copied from interface:RoleDataWebServiceReturns a paged List of Role objects that are linked to a Group.- Specified by:
getRolein interfaceRoleDataWebService- Parameters:
roleId- - the Group ID- Returns:
- a paged List of Role objects that are linked to a Group. if no roles are found returns null
-
suggestById
public Role suggestById(String id)
Description copied from interface:RoleDataWebServiceFind a resource 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 interfaceRoleDataWebService- Parameters:
id- the role id- Returns:
- resource
-
addGroupToRole
public Response addGroupToRole(String roleId, String groupId, Set<String> rightIds, Date startDate, Date endDate)
Description copied from interface:RoleDataWebServiceThis method adds particular roleId to a particular group.- Specified by:
addGroupToRolein interfaceRoleDataWebService- Parameters:
roleId- The roleId which is to be added to the group.groupId- The group for which the roleId is to be added .- Returns:
- a Response Object, containing the status of this operation.
-
validateGroup2RoleAddition
public Response validateGroup2RoleAddition(String roleId, String groupId)
- Specified by:
validateGroup2RoleAdditionin interfaceRoleDataWebService
-
removeGroupFromRole
public Response removeGroupFromRole(String roleId, String groupId)
Description copied from interface:RoleDataWebServiceRemoves the association between a single group and role.- Specified by:
removeGroupFromRolein interfaceRoleDataWebService- Parameters:
roleId- The roleId which is to be deleted from the group.groupId- The group from which the roleId is to be deleted- Returns:
- a Response Object, containing the status of this operation.
-
findBeans
public RoleListResponse findBeans(RoleSearchBean searchBean, EntitlementsCollection[] dependants, int from, int size)
Description copied from interface:RoleDataWebServiceReturn a paged List of Roles based on parameters, which are specified in RoleSearchBean object- Specified by:
findBeansin interfaceRoleDataWebService- Parameters:
searchBean- - RoleSearchBean objectdependants- - collection instead of deep copy flagfrom- - where to start in the listsize- - how many to return- Returns:
- List of Roles objects. Returns null if no roles are found.
-
countBeans
public int countBeans(RoleSearchBean searchBean)
Description copied from interface:RoleDataWebServiceReturns total number of Roles based on parameters, which are specified in RoleSearchBean object- Specified by:
countBeansin interfaceRoleDataWebService- Parameters:
searchBean- - RoleSearchBean object- Returns:
- - Integer, total number of roles based on parameters, which are specified in RoleSearchBean object
-
addChildRole
public Response addChildRole(String roleId, String childRoleId, Set<String> rights, Date startDate, Date endDate)
Description copied from interface:RoleDataWebServiceMakes Role specified by childRoleId a child of Role specified by roleId- Specified by:
addChildRolein interfaceRoleDataWebService- Parameters:
roleId- - the Role ID to which another group specified by childRoleId will be addedchildRoleId- - - the Role ID which will be added to the group specified by roleId- Returns:
- a Response Object, containing the status of this operation.
-
canAddChildRole
public Response canAddChildRole(String roleId, String childRoleId, Set<String> rights, Date startDate, Date endDate)
- Specified by:
canAddChildRolein interfaceRoleDataWebService
-
removeChildRole
public Response removeChildRole(String roleId, String childRoleId)
Description copied from interface:RoleDataWebServiceRemove Role specified by childRoleId from the membership list of Group specified by roleId- Specified by:
removeChildRolein interfaceRoleDataWebService- Parameters:
roleId- - the Role ID from which another group specified by childRoleId will be deletedchildRoleId- - the Role ID which will be deleted from the group specified by roleId- Returns:
- a Response Object, containing the status of this operation.
-
canAddUserToRole
public Response canAddUserToRole(String userId, String roleId)
Description copied from interface:RoleDataWebServiceChecks if User specified by userId can be added to the Role specified by roleId as a member- Specified by:
canAddUserToRolein interfaceRoleDataWebService- Parameters:
userId- - the User IDroleId- - the Role ID- Returns:
- a Response Object, containing the status of this operation. if status is SUCCESS then the User can be added to this Role
-
canRemoveUserFromRole
public Response canRemoveUserFromRole(String userId, String roleId)
Description copied from interface:RoleDataWebServiceChecks if User specified by userId can be removed from the Role specified by roleId as a member- Specified by:
canRemoveUserFromRolein interfaceRoleDataWebService- Parameters:
userId- - the User IDroleId- - the Role ID- Returns:
- a Response Object, containing the status of this operation. if status is SUCCESS then the User can be removed from this Role
-
hasChildEntities
public boolean hasChildEntities(String roleId)
- Specified by:
hasChildEntitiesin interfaceRoleDataWebService
-
reindexRole
public Response reindexRole(String id)
- Specified by:
reindexRolein interfaceRoleDataWebService- Parameters:
id- - Role id for reindex- Returns:
-
saveRoleRequest
public SaveTemplateProfileResponse saveRoleRequest(RoleRequestModel model)
- Specified by:
saveRoleRequestin interfaceRoleDataWebService
-
validateRoleRequest
public Response validateRoleRequest(RoleRequestModel model)
- Specified by:
validateRoleRequestin interfaceRoleDataWebService
-
getAllRoleIds
public List<String> getAllRoleIds()
Description copied from interface:RoleDataWebServiceGets all role IDs- Specified by:
getAllRoleIdsin interfaceRoleDataWebService- Returns:
-
getDetachedForUser
public RoleListResponse getDetachedForUser(String userId, String name, int from, int size)
Description copied from interface:RoleDataWebServicemethod is used to detect all user's role that are not linked with any resources.- Specified by:
getDetachedForUserin interfaceRoleDataWebService- Parameters:
userId- - id of User to check detached rolesname- - name for case INSENSITIVE CONTAINS match search.from- - zero based very first result- Returns:
- -
RoleListResponse
-
getWithResources
public RoleListResponse getWithResources(String userId, RoleSearchBean searchBean, Set<String> resourceTypeIds, int from, int size)
Description copied from interface:RoleDataWebServicemethod is used to get user's roles with entitled resources, filtered by #resourceTypeIds. Resources are returned inRole#getResources()container (only ids).- Specified by:
getWithResourcesin interfaceRoleDataWebService- 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
-
saveBulkRole
public Response saveBulkRole(EntitlementBulkRequest entitlementBulkRequest)
Description copied from interface:RoleDataWebServiceBulk operation on Role objects, this method with save roles in bulk- Specified by:
saveBulkRolein interfaceRoleDataWebService- Parameters:
entitlementBulkRequest- - EntitlementBulkRequest object that will be saved.
-
forceSweepUserCountCache
public void forceSweepUserCountCache()
Description copied from interface:RoleDataWebServiceforce refresh cache which holds count of users assigned to roles and max number limit- Specified by:
forceSweepUserCountCachein interfaceRoleDataWebService
-
-