Class GroupServiceImpl
java.lang.Object
ru.cg.webbpm.modules.security.api.impl.service.GroupServiceImpl
- All Implemented Interfaces:
GroupService
- Author:
- Tim Urmancheev
-
Constructor Summary
ConstructorsConstructorDescriptionGroupServiceImpl
(AccessLevelService accessLevelService, GroupRoleDao groupRoleDao, GroupDao groupDao) Group service constructor - creates new group service. -
Method Summary
Modifier and TypeMethodDescriptionInserts groups with minimal access level into database.void
delete
(Collection<String> groupIds) Removes groups from database according to collection of group ids.Gets group by group id.get
(Collection<String> groupIds) Gets groups by group ids.get
(LoadOptions options) Gets groups according to load options.Gets group by group name.getGroupRoleLinks
(String groupId, LoadOptions options) Gets roles by group id with binding timestamp according to load options.getRoles
(String groupId, LoadOptions options) Gets roles by group id according to load options.mapGroupsToIds
(Collection<Group> groups) void
update
(Collection<Group> groups) Updates groups in database.void
updateRoles
(String groupId, Collection<String> addedRoleIds, Collection<String> deletedRoleIds) Updates roles by group id, added role ids collection and deleted role ids collection.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.GroupService
create, delete, update
-
Constructor Details
-
GroupServiceImpl
@Autowired public GroupServiceImpl(AccessLevelService accessLevelService, GroupRoleDao groupRoleDao, GroupDao groupDao) Group service constructor - creates new group service.- Parameters:
accessLevelService
- access level service. Instance ofAccessLevelService
type.groupRoleDao
- link user group user role data access object. Instance ofGroupRoleDao
type.groupDao
- user group data access object. Instance ofGroupDao
type.
-
-
Method Details
-
get
Gets group by group id. Checks current user's access level to requested group.- Specified by:
get
in interfaceGroupService
- Parameters:
groupId
- id of group to receive. Instance ofString
type.- Returns:
- requested group or null if does not exist. Instance of
Group
type. - See Also:
-
get
Gets groups according to load options. Filters groups according to current user's access level.- Specified by:
get
in interfaceGroupService
- Parameters:
options
- indicates load option properties. Instance ofLoadOptions
type.- Returns:
- list of groups. Instance of
List
type. - See Also:
-
get
Gets groups by group ids. Checks current user's access level to requested groups.- Specified by:
get
in interfaceGroupService
- Parameters:
groupIds
- group ids of objects to receive. Instance ofCollection
type.- Returns:
- collection of groups. Instance of
Collection
type. - See Also:
-
getByName
Gets group by group name. Checks current user's access level to requested group.- Specified by:
getByName
in interfaceGroupService
- Parameters:
groupName
- name of group to receive. Instance ofString
type.- Returns:
- requested group or null if does not exist. Instance of
Group
type. - See Also:
-
create
Inserts groups with minimal access level into database. Group id will be generated if it is null.- Specified by:
create
in interfaceGroupService
- Parameters:
groups
- groups to add. Instance ofList
type.- Returns:
- list of group ids. Instance of
List
type. - Throws:
org.springframework.dao.DataAccessException
- if any of group names already exists.- See Also:
-
update
Updates groups in database. Checks current user's access level to updated groups.- Specified by:
update
in interfaceGroupService
- Parameters:
groups
- collection of groups to update. Instance ofCollection
type.- Throws:
org.springframework.dao.DataAccessException
- if any of group names already exists.- See Also:
-
mapGroupsToIds
-
delete
Removes groups from database according to collection of group ids. Checks current user's access level to removed groups.- Specified by:
delete
in interfaceGroupService
- Parameters:
groupIds
- ids of groups to remove. Instance ofCollection
type.- Throws:
org.springframework.dao.DataAccessException
- if any of groups is used in users.- See Also:
-
getRoles
Gets roles by group id according to load options.- Specified by:
getRoles
in interfaceGroupService
- Parameters:
groupId
- group id of roles to receive. Instance ofString
type.options
- indicates load options properties. Instance ofLoadOptions
type.- Returns:
- list of roles. Instance of
List
type. - See Also:
-
getGroupRoleLinks
Gets roles by group id with binding timestamp according to load options.- Specified by:
getGroupRoleLinks
in interfaceGroupService
- Parameters:
groupId
- group id of roles to receive. Instance ofString
type.options
- indicates load options properties. Instance ofLoadOptions
type.- Returns:
- list of group and role links. Instance of
List
type.
-
updateRoles
@Transactional public void updateRoles(String groupId, Collection<String> addedRoleIds, Collection<String> deletedRoleIds) Updates roles by group id, added role ids collection and deleted role ids collection. Checks current user's access level to updated group.- Specified by:
updateRoles
in interfaceGroupService
- Parameters:
groupId
- group id of object to update. Instance ofString
type.addedRoleIds
- collection of role ids to add. Instance ofCollection
type.deletedRoleIds
- collection of role ids to remove. Instance ofCollection
type.- Throws:
org.springframework.dao.DataAccessException
- if group already has any of roles.- See Also:
-