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 Link icon

    • findAll Link icon

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

      @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 Link icon

      @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 Link icon

      @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 Link icon

      @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 Link icon

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

      @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 Link icon

      @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