Package org.openiam.esb.core.service
Interface RoleDataService
-
- All Superinterfaces:
GetBeansElasticsearchService<Role,RoleEntity,String,RoleSearchBean>
,GetBeansService<Role,RoleEntity,String,RoleSearchBean>
,GetDetachedEntitlementsService<Role,RoleSearchBean>
,GetEntitlementBeansService<Role,RoleEntity,String,RoleSearchBean>
- All Known Implementing Classes:
RoleDataServiceImpl
public interface RoleDataService extends GetEntitlementBeansService<Role,RoleEntity,String,RoleSearchBean>, GetDetachedEntitlementsService<Role,RoleSearchBean>
Interface permitting the management of Roles and related objects such as groups and users.- Version:
- 1
- Author:
- Suneet Shah
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAttribute(RoleAttributeEntity attribute)
Saves RoleAttributeEntity.void
addChildRole(String roleId, String childRoleId, Set<String> rights, Date startDate, Date endDate)
Adds child role to role.void
addGroupToRole(String roleId, String groupId, Set<String> rightIds, Date startDate, Date endDate)
This method adds particular groupId to a particular role.
For example:List<Role>
findBeans(SynchronizationRequestSearchBean searchBean)
List<String>
getAllRoleIds()
Gets all Role IDs in the databaseRoleEntity
getRole(String roleId)
Gets Role Entity for given role id.List<RoleAttribute>
getRoleAttributes(String roleId)
Returns list of RoleAttribute objects associated with role with given role id.RoleEntity
getRoleByNameAndManagedSysId(String roleName, String managedSysId)
Gets Role Entity that matches given parameters.Role
getRoleDTO(String roleId, EntitlementsCollection[] dependants)
Gets RoleDTO object for given role id.boolean
hasChildEntities(String roleId)
Checks if given role has children.void
reindexRole(String id)
Force reindex of a role.void
removeChildRole(String roleId, String childRoleId)
Removes child role from parrent.void
removeGroupFromRole(String roleId, String groupId)
Removes the association between a single group and role.Response
removeRole(String roleId)
Deletes role with given role id.void
saveBulkRole(EntitlementBulkRequest entitlementBulkRequest)
Bulk operation on Role objects, this method with save roles in bulkRole
saveRole(Role role)
Saves Role object.void
saveRoleRequest(RoleRequestModel request)
void
updateAttribute(RoleAttributeEntity attribute)
Updates RoleAttributeEntity.boolean
validateDelete(String roleId)
Returns true if valid and can be deleted or throws exception otherwise.boolean
validateEdit(Role role)
Validates role entityvoid
validateGroup2RoleAddition(String roleId, String groupId)
Checks if groupd and role with given ids exist.void
validateRoleRequest(RoleRequestModel request)
void
validateRoleToRoleAddition(String parentId, String memberId, Date startDate, Date endDate)
Checks if role can be added as child to parent role.void
validateUserAndRoleExist(String userId, String roleId)
Checks if user with given id exist and if role with given id exist.-
Methods inherited from interface org.openiam.esb.core.service.GetBeansElasticsearchService
reindex, reindex, suggestById
-
Methods inherited from interface org.openiam.esb.core.service.GetBeansService
countBeans, find, findBeans, findBeans, get
-
Methods inherited from interface org.openiam.esb.core.service.GetDetachedEntitlementsService
getDetached, getWithResources
-
Methods inherited from interface org.openiam.esb.core.service.GetEntitlementBeansService
findBeans
-
-
-
-
Method Detail
-
getRole
RoleEntity getRole(String roleId)
Gets Role Entity for given role id.- Parameters:
roleId
- role id.- Returns:
- Role if found otherwise null.
-
getRoleByNameAndManagedSysId
RoleEntity getRoleByNameAndManagedSysId(String roleName, String managedSysId)
Gets Role Entity that matches given parameters.- Parameters:
roleName
- role name.managedSysId
- managed system id.- Returns:
-
addGroupToRole
void addGroupToRole(String roleId, String groupId, Set<String> rightIds, Date startDate, Date endDate) throws BasicDataServiceException
This method adds particular groupId to a particular role.
For example:roleService.addGroupToRole(roleId, groupId, rightIds, startDate, endDate);
- Parameters:
groupId
- The group for which the roleId is to be added .roleId
- The roleId which is to be added to the group.rightIds
- rights ids. Access rights with given ids will be set for group.startDate
- start date.endDate
- end date.- Throws:
BasicDataServiceException
-
validateGroup2RoleAddition
void validateGroup2RoleAddition(String roleId, String groupId) throws BasicDataServiceException
Checks if groupd and role with given ids exist.- Parameters:
roleId
- role id.groupId
- group id.- Throws:
BasicDataServiceException
-
removeGroupFromRole
void removeGroupFromRole(String roleId, String groupId) throws BasicDataServiceException
Removes the association between a single group and role.- Parameters:
roleId
- role id.groupId
- group id.- Throws:
BasicDataServiceException
-
validateUserAndRoleExist
void validateUserAndRoleExist(String userId, String roleId) throws BasicDataServiceException
Checks if user with given id exist and if role with given id exist.- Parameters:
userId
- user id.roleId
- role id.- Throws:
BasicDataServiceException
-
validateEdit
boolean validateEdit(Role role) throws BasicDataServiceException
Validates role entity- Parameters:
role
- role entity- Returns:
- true if it is valid, otherwise false.
- Throws:
BasicDataServiceException
-
addChildRole
void addChildRole(String roleId, String childRoleId, Set<String> rights, Date startDate, Date endDate) throws BasicDataServiceException
Adds child role to role.- Parameters:
roleId
- parent role.childRoleId
- child rolerights
- set of rights for child role.startDate
- start date.endDate
- end date.- Throws:
BasicDataServiceException
-
removeChildRole
void removeChildRole(String roleId, String childRoleId) throws BasicDataServiceException
Removes child role from parrent.- Parameters:
roleId
- parent role id.childRoleId
- child role id.- Throws:
BasicDataServiceException
-
validateRoleToRoleAddition
void validateRoleToRoleAddition(String parentId, String memberId, Date startDate, Date endDate) throws BasicDataServiceException
Checks if role can be added as child to parent role.- Parameters:
parentId
- parent role id.memberId
- child role id.startDate
- start date.endDate
- end date.- Throws:
BasicDataServiceException
-
getRoleDTO
Role getRoleDTO(String roleId, EntitlementsCollection[] dependants)
Gets RoleDTO object for given role id.- Parameters:
roleId
- role id used for search criteria.dependants
- dozer param EntitlementsCollection instead of deepCopy flag- Returns:
- Role object or null if not found.
-
getRoleAttributes
List<RoleAttribute> getRoleAttributes(String roleId)
Returns list of RoleAttribute objects associated with role with given role id.- Parameters:
roleId
- role id.- Returns:
- list of RoleAttribute objects associated with role with given role id.
-
addAttribute
void addAttribute(RoleAttributeEntity attribute) throws BasicDataServiceException
Saves RoleAttributeEntity.- Parameters:
attribute
- role attribute entity.- Throws:
BasicDataServiceException
-
updateAttribute
void updateAttribute(RoleAttributeEntity attribute) throws BasicDataServiceException
Updates RoleAttributeEntity.- Parameters:
attribute
- role attribute entity.- Throws:
BasicDataServiceException
-
hasChildEntities
boolean hasChildEntities(String roleId)
Checks if given role has children.- Parameters:
roleId
- role id used for search criteria.- Returns:
- true if it has children otherwise false.
-
removeRole
Response removeRole(String roleId) throws BasicDataServiceException
Deletes role with given role id.- Parameters:
roleId
- role id.- Returns:
- Response object with success status if removed.
- Throws:
BasicDataServiceException
-
saveRole
Role saveRole(Role role) throws BasicDataServiceException
Saves Role object.- Parameters:
role
- Role.- Returns:
- saved Role id.
- Throws:
BasicDataServiceException
-
validateDelete
boolean validateDelete(String roleId) throws BasicDataServiceException
Returns true if valid and can be deleted or throws exception otherwise.- Parameters:
roleId
- id of role that is candidate for deletion.- Returns:
- true
- Throws:
BasicDataServiceException
-
reindexRole
void reindexRole(String id)
Force reindex of a role. Should NOT be called by production code. Exists for test purposes only- Parameters:
id
-
-
saveRoleRequest
void saveRoleRequest(RoleRequestModel request) throws BasicDataServiceException
- Throws:
BasicDataServiceException
-
validateRoleRequest
void validateRoleRequest(RoleRequestModel request) throws BasicDataServiceException
- Throws:
BasicDataServiceException
-
findBeans
List<Role> findBeans(SynchronizationRequestSearchBean searchBean)
-
saveBulkRole
void saveBulkRole(EntitlementBulkRequest entitlementBulkRequest) throws BasicDataServiceException
Bulk operation on Role objects, this method with save roles in bulk- Parameters:
entitlementBulkRequest
- EntitlementBulkRequest object that will be saved.- Throws:
BasicDataServiceException
-
-