Package org.openwms.core.uaa.impl
Class RoleServiceImpl
java.lang.Object
org.openwms.core.uaa.impl.RoleServiceImpl
- All Implemented Interfaces:
RoleService
A RoleServiceImpl is a Spring managed transactional service that deals with
Role
s.- Author:
- Heiko Scherrer
-
Field Summary
Modifier and TypeFieldDescriptionprivate final org.springframework.context.ApplicationEventPublisher
private static final org.slf4j.Logger
private final RoleMapper
private final RoleRepository
private final org.ameba.i18n.Translator
private final UserService
-
Constructor Summary
ConstructorDescriptionRoleServiceImpl
(RoleRepository repository, UserService userService, RoleMapper mapper, org.ameba.i18n.Translator translator, org.springframework.context.ApplicationEventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescription@NotNull RoleVO
assignUser
(@NotBlank String pKey, @NotBlank String userPKey) Assign anUser
to aRole
.@NotNull RoleVO
create
(@NotNull(groups=Create.class) @Valid RoleVO role) Create a Role that does not exist so far.void
Delete aRole
.findAll()
Find and return all existing Roles.findByNames
(@NotNull List<String> roleNames) Find and return all existingRole
s.@NotNull RoleVO
findByPKey
(@NotBlank String pKey) Find and return aRole
.private Role
findByPKeyInternal
(String pKey) @NotNull RoleVO
save
(@NotBlank String pKey, @NotNull(groups=Modify.class) @Valid RoleVO role) Update an existing Role.@NotNull RoleVO
unassignUser
(@NotBlank String pKey, @NotBlank String userPKey) Unassign an assignedUser
from aRole
.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
repository
-
userService
-
mapper
-
translator
private final org.ameba.i18n.Translator translator -
eventPublisher
private final org.springframework.context.ApplicationEventPublisher eventPublisher
-
-
Constructor Details
-
RoleServiceImpl
RoleServiceImpl(RoleRepository repository, UserService userService, RoleMapper mapper, org.ameba.i18n.Translator translator, org.springframework.context.ApplicationEventPublisher eventPublisher)
-
-
Method Details
-
findAll
Find and return all existing Roles.- Specified by:
findAll
in interfaceRoleService
- Returns:
- All Roles or an empty collection type, never null
-
findByPKey
Find and return aRole
.- Specified by:
findByPKey
in interfaceRoleService
- Parameters:
pKey
- The persistent key of the existing Role- Returns:
- The instance
-
findByNames
Find and return all existingRole
s.- Specified by:
findByNames
in interfaceRoleService
- Parameters:
roleNames
- A list with all the names- Returns:
- A list with Roles, never null
-
create
@Measured @Validated(Create.class) @NotNull public @NotNull RoleVO create(@NotNull(groups=Create.class) @Valid @NotNull(groups=Create.class) @Valid RoleVO role) Create a Role that does not exist so far.- Specified by:
create
in interfaceRoleService
- Parameters:
role
- The Role to be created- Returns:
- The created Role instance
-
save
@Measured @Validated(Modify.class) @NotNull public @NotNull RoleVO save(@NotBlank @NotBlank String pKey, @NotNull(groups=Modify.class) @Valid @NotNull(groups=Modify.class) @Valid RoleVO role) Update an existing Role.- Specified by:
save
in interfaceRoleService
- Parameters:
pKey
- The persistent key of the existing Rolerole
- The Role to update- Returns:
- The updated instance
-
findByPKeyInternal
-
delete
Delete aRole
.- Specified by:
delete
in interfaceRoleService
- Parameters:
pKey
- The identifiable persistent key
-
assignUser
@Measured @NotNull public @NotNull RoleVO assignUser(@NotBlank @NotBlank String pKey, @NotBlank @NotBlank String userPKey) Assign anUser
to aRole
.- Specified by:
assignUser
in interfaceRoleService
- Parameters:
pKey
- The persistent key of the existing RoleuserPKey
- The persistent key of the existing User- Returns:
- The updated Role instance
-
unassignUser
@Measured @NotNull public @NotNull RoleVO unassignUser(@NotBlank @NotBlank String pKey, @NotBlank @NotBlank String userPKey) Unassign an assignedUser
from aRole
.- Specified by:
unassignUser
in interfaceRoleService
- Parameters:
pKey
- The persistent key of the existing RoleuserPKey
- The persistent key of the existing User- Returns:
- The updated Role instance
-