Interface RoleService

All Known Implementing Classes:
RoleServiceImpl

public interface RoleService
A RoleService provides business functionality regarding the handling with Roles. The service deals directly with business objects, even those are currently acting as entities as well. But this may change in future and should not influence the interface.
Author:
Heiko Scherrer
See Also:
  • Method Details

    • findAll

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

      @NotNull @NotNull RoleVO findByPKey(@NotBlank @NotBlank String pKey)
      Find and return a Role.
      Parameters:
      pKey - The persistent key of the existing Role
      Returns:
      The instance
      Throws:
      org.ameba.exception.NotFoundException - If the Role does not exist
    • findByNames

      @NotNull @NotNull List<Role> findByNames(@NotNull @NotNull List<String> roleNames)
      Find and return all existing Roles.
      Parameters:
      roleNames - A list with all the names
      Returns:
      A list with Roles, never null
    • create

      @NotNull @NotNull RoleVO create(@NotNull(groups=Create.class) @Valid @NotNull(groups=Create.class) @Valid RoleVO role)
      Create a Role that does not exist so far.
      Parameters:
      role - The Role to be created
      Returns:
      The created Role instance
      Throws:
      org.ameba.exception.ResourceExistsException - If the role already exists
    • save

      @NotNull @NotNull RoleVO save(@NotBlank @NotBlank String pKey, @NotNull(groups=Modify.class) @Valid @NotNull(groups=Modify.class) @Valid RoleVO role)
      Update an existing Role.
      Parameters:
      pKey - The persistent key of the existing Role
      role - The Role to update
      Returns:
      The updated instance
      Throws:
      org.ameba.exception.NotFoundException - If the role does not exist
    • delete

      void delete(@NotBlank @NotBlank String pKey)
      Delete a Role.
      Parameters:
      pKey - The identifiable persistent key
    • assignUser

      @NotNull @NotNull RoleVO assignUser(@NotBlank @NotBlank String pKey, @NotBlank @NotBlank String userPKey)
      Assign an User to a Role.
      Parameters:
      pKey - The persistent key of the existing Role
      userPKey - The persistent key of the existing User
      Returns:
      The updated Role instance
    • unassignUser

      @NotNull @NotNull RoleVO unassignUser(@NotBlank @NotBlank String pKey, @NotBlank @NotBlank String userPKey)
      Unassign an assigned User from a Role.
      Parameters:
      pKey - The persistent key of the existing Role
      userPKey - The persistent key of the existing User
      Returns:
      The updated Role instance