Class RoleServiceImpl

java.lang.Object
org.openwms.core.uaa.impl.RoleServiceImpl
All Implemented Interfaces:
RoleService

@TxService class RoleServiceImpl extends Object implements RoleService
A RoleServiceImpl is a Spring managed transactional service that deals with Roles.
Author:
Heiko Scherrer
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • repository

      private final RoleRepository repository
    • userService

      private final UserService userService
    • mapper

      private final RoleMapper 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

      @Measured @NotNull public @NotNull List<RoleVO> findAll()
      Find and return all existing Roles.
      Specified by:
      findAll in interface RoleService
      Returns:
      All Roles or an empty collection type, never null
    • findByPKey

      @Measured @NotNull public @NotNull RoleVO findByPKey(@NotBlank @NotBlank String pKey)
      Find and return a Role.
      Specified by:
      findByPKey in interface RoleService
      Parameters:
      pKey - The persistent key of the existing Role
      Returns:
      The instance
    • findByNames

      @Measured @NotNull public @NotNull List<Role> findByNames(@NotNull @NotNull List<String> roleNames)
      Find and return all existing Roles.
      Specified by:
      findByNames in interface RoleService
      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 interface RoleService
      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 interface RoleService
      Parameters:
      pKey - The persistent key of the existing Role
      role - The Role to update
      Returns:
      The updated instance
    • findByPKeyInternal

      private Role findByPKeyInternal(String pKey)
    • delete

      @Measured public void delete(@NotBlank @NotBlank String pKey)
      Delete a Role.
      Specified by:
      delete in interface RoleService
      Parameters:
      pKey - The identifiable persistent key
    • assignUser

      @Measured @NotNull public @NotNull RoleVO assignUser(@NotBlank @NotBlank String pKey, @NotBlank @NotBlank String userPKey)
      Assign an User to a Role.
      Specified by:
      assignUser in interface RoleService
      Parameters:
      pKey - The persistent key of the existing Role
      userPKey - 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 assigned User from a Role.
      Specified by:
      unassignUser in interface RoleService
      Parameters:
      pKey - The persistent key of the existing Role
      userPKey - The persistent key of the existing User
      Returns:
      The updated Role instance