Class RoleServiceImpl
java.lang.Object
ru.cg.webbpm.modules.security.api.impl.service.RoleServiceImpl
- All Implemented Interfaces:
RoleService
- Author:
- Tim Urmancheev
-
Constructor Summary
ConstructorsConstructorDescriptionRoleServiceImpl
(GroupRoleDao groupRoleDao, RoleAuthorityDao roleAuthorityDao, RoleDao roleDao) Role service constructor - creates new role service. -
Method Summary
Modifier and TypeMethodDescriptionbindAuthority
(String roleId, String authorityId) Binds authority to role by role id and authority id.Inserts roles into database.void
delete
(Collection<String> roleIds) Removes roles from database according to collection of role ids.void
deleteRoleAuthorities
(Collection<String> roleAuthorityIds) Removes role authority links according to collection of link ids.Gets role by role id.get
(Collection<String> roleIds) Gets roles by role ids.get
(LoadOptions options) Gets roles according to load options.Gets role by role name.getGroups
(String roleId, LoadOptions options) Gets groups by role id according to load options.mapRolesToIds
(Collection<Role> groups) roleAuthorityIdsToRoleIds
(Collection<String> roleAuthorityIds) void
update
(Collection<Role> roles) Updates roles in database.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ru.cg.webbpm.modules.security.api.service.RoleService
create, delete, update
-
Constructor Details
-
RoleServiceImpl
@Autowired public RoleServiceImpl(GroupRoleDao groupRoleDao, RoleAuthorityDao roleAuthorityDao, RoleDao roleDao) Role service constructor - creates new role service.- Parameters:
groupRoleDao
- link user group user role data access object. Instance ofGroupRoleDao
type.roleAuthorityDao
- link user role authority data access object. Instance ofRoleAuthorityDao
type.roleDao
- user role data access object. Instance ofRoleDao
type.
-
-
Method Details
-
get
Gets role by role id.- Specified by:
get
in interfaceRoleService
- Parameters:
roleId
- id of role to receive. Instance ofString
type.- Returns:
- requested role or null if does not exist. Instance of
Role
type. - See Also:
-
get
Gets roles according to load options.- Specified by:
get
in interfaceRoleService
- Parameters:
options
- indicates load option properties. Instance ofLoadOptions
type.- Returns:
- list of roles. Instance of
List
type. - See Also:
-
get
Gets roles by role ids.- Specified by:
get
in interfaceRoleService
- Parameters:
roleIds
- role ids of objects to receive. Instance ofCollection
type.- Returns:
- collection of roles. Instance of
Collection
type. - See Also:
-
getByName
Gets role by role name.- Specified by:
getByName
in interfaceRoleService
- Parameters:
roleName
- name of role to receive. Instance ofString
type.- Returns:
- requested role or null if does not exist. Instance of
Role
type. - See Also:
-
create
Inserts roles into database. Role id will be generated if it is null.- Specified by:
create
in interfaceRoleService
- Parameters:
roles
- roles to add. Instance ofList
type.- Returns:
- ids of added roles. Instance of
List
type. - Throws:
org.springframework.dao.DataAccessException
- if any of role names already exists.- See Also:
-
update
Updates roles in database.- Specified by:
update
in interfaceRoleService
- Parameters:
roles
- collection of roles to update. Instance ofCollection
type.- Throws:
org.springframework.dao.DataAccessException
- if any of role names already exists.- See Also:
-
mapRolesToIds
-
delete
Removes roles from database according to collection of role ids.- Specified by:
delete
in interfaceRoleService
- Parameters:
roleIds
- ids of roles to remove. Instance ofCollection
type.- Throws:
org.springframework.dao.DataAccessException
- if any of roles is used in groups.- See Also:
-
getGroups
Gets groups by role id according to load options.- Specified by:
getGroups
in interfaceRoleService
- Parameters:
roleId
- role id of groups to receive. Instance ofString
type.options
- indicates load options properties. Instance ofLoadOptions
type.- Returns:
- list of groups. Instance of
List
type. - See Also:
-
bindAuthority
Binds authority to role by role id and authority id.- Specified by:
bindAuthority
in interfaceRoleService
- Parameters:
roleId
- role id of role to bind. Instance ofString
type.authorityId
- authority id of binding authority. Instance ofString
type.- Returns:
- id of role authority link. Instance of
String
type. - Throws:
org.springframework.dao.DataAccessException
- if role already has any of authorities.- See Also:
-
deleteRoleAuthorities
Removes role authority links according to collection of link ids.- Specified by:
deleteRoleAuthorities
in interfaceRoleService
- Parameters:
roleAuthorityIds
- ids collection of role authority links to remove. Instance ofList
type.- See Also:
-
roleAuthorityIdsToRoleIds
-