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.voiddelete(Collection<String> roleIds) Removes roles from database according to collection of role ids.voiddeleteRoleAuthorities(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) voidupdate(Collection<Role> roles) Updates roles in database.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 ofGroupRoleDaotype.roleAuthorityDao- link user role authority data access object. Instance ofRoleAuthorityDaotype.roleDao- user role data access object. Instance ofRoleDaotype.
-
-
Method Details
-
get
Gets role by role id.- Specified by:
getin interfaceRoleService- Parameters:
roleId- id of role to receive. Instance ofStringtype.- Returns:
- requested role or null if does not exist. Instance of
Roletype. - See Also:
-
get
Gets roles according to load options.- Specified by:
getin interfaceRoleService- Parameters:
options- indicates load option properties. Instance ofLoadOptionstype.- Returns:
- list of roles. Instance of
Listtype. - See Also:
-
get
Gets roles by role ids.- Specified by:
getin interfaceRoleService- Parameters:
roleIds- role ids of objects to receive. Instance ofCollectiontype.- Returns:
- collection of roles. Instance of
Collectiontype. - See Also:
-
getByName
Gets role by role name.- Specified by:
getByNamein interfaceRoleService- Parameters:
roleName- name of role to receive. Instance ofStringtype.- Returns:
- requested role or null if does not exist. Instance of
Roletype. - See Also:
-
create
Inserts roles into database. Role id will be generated if it is null.- Specified by:
createin interfaceRoleService- Parameters:
roles- roles to add. Instance ofListtype.- Returns:
- ids of added roles. Instance of
Listtype. - Throws:
org.springframework.dao.DataAccessException- if any of role names already exists.- See Also:
-
update
Updates roles in database.- Specified by:
updatein interfaceRoleService- Parameters:
roles- collection of roles to update. Instance ofCollectiontype.- 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:
deletein interfaceRoleService- Parameters:
roleIds- ids of roles to remove. Instance ofCollectiontype.- 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:
getGroupsin interfaceRoleService- Parameters:
roleId- role id of groups to receive. Instance ofStringtype.options- indicates load options properties. Instance ofLoadOptionstype.- Returns:
- list of groups. Instance of
Listtype. - See Also:
-
bindAuthority
Binds authority to role by role id and authority id.- Specified by:
bindAuthorityin interfaceRoleService- Parameters:
roleId- role id of role to bind. Instance ofStringtype.authorityId- authority id of binding authority. Instance ofStringtype.- Returns:
- id of role authority link. Instance of
Stringtype. - 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:
deleteRoleAuthoritiesin interfaceRoleService- Parameters:
roleAuthorityIds- ids collection of role authority links to remove. Instance ofListtype.- See Also:
-
roleAuthorityIdsToRoleIds
-