adds RbacRoleControllerRestTest + RbacRoleRepositoryIntegrationTest + fix duplicate key
This commit is contained in:
@ -1,9 +1,6 @@
|
||||
package net.hostsharing.hsadminng.rbac.rbacrole;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.Formula;
|
||||
import org.springframework.data.annotation.Immutable;
|
||||
|
||||
@ -14,6 +11,7 @@ import java.util.UUID;
|
||||
@Table(name = "rbacrole_rv")
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Immutable
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ -25,16 +23,16 @@ public class RbacRoleEntity {
|
||||
@Column(name="objectuuid")
|
||||
private UUID objectUuid;
|
||||
|
||||
@Column(name="roletype")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private RbacRoleType roleType;
|
||||
|
||||
@Column(name="objecttable")
|
||||
private String objectTable;
|
||||
|
||||
@Column(name="objectidname")
|
||||
private String objectIdName;
|
||||
|
||||
@Column(name="roletype")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private RbacRoleType roleType;
|
||||
|
||||
@Formula("objectTable||'#'||objectIdName||'.'||roleType")
|
||||
private String roleName;
|
||||
}
|
||||
|
@ -1,58 +1,17 @@
|
||||
package net.hostsharing.hsadminng.rbac.rbacrole;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.repository.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface RbacRoleRepository extends Repository<RbacRoleEntity, UUID> {
|
||||
|
||||
/**
|
||||
* Retrieves an entity by its id.
|
||||
*
|
||||
* @param id must not be {@literal null}.
|
||||
* @return the entity with the given id or {@literal Optional#empty()} if none found.
|
||||
* @throws IllegalArgumentException if {@literal id} is {@literal null}.
|
||||
*/
|
||||
Optional<RbacRoleEntity> findByUuid(UUID id);
|
||||
|
||||
/**
|
||||
* Returns whether an entity with the given id exists.
|
||||
*
|
||||
* @param id must not be {@literal null}.
|
||||
* @return {@literal true} if an entity with the given id exists, {@literal false} otherwise.
|
||||
* @throws IllegalArgumentException if {@literal id} is {@literal null}.
|
||||
*/
|
||||
boolean existsByUuid(RbacRoleEntity id);
|
||||
|
||||
/**
|
||||
* Returns all instances of the type.
|
||||
*
|
||||
* @return all entities
|
||||
*/
|
||||
Iterable<RbacRoleEntity> findAll();
|
||||
|
||||
/**
|
||||
* Returns all entities sorted by the given options.
|
||||
*
|
||||
* @param sort the {@link Sort} specification to sort the results by, can be {@link Sort#unsorted()}, must not be
|
||||
* {@literal null}.
|
||||
* @return all entities sorted by the given options
|
||||
*/
|
||||
List<RbacRoleEntity> findAll(Sort sort);
|
||||
|
||||
/**
|
||||
* Returns a {@link Page} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
||||
*
|
||||
* @param pageable the pageable to request a paged result, can be {@link Pageable#unpaged()}, must not be
|
||||
* {@literal null}.
|
||||
* @return a page of entities
|
||||
*/
|
||||
Page<RbacRoleEntity> findAll(Pageable pageable);
|
||||
|
||||
List<RbacRoleEntity> findAll();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user