Class CrudController<Entity,ID,Dto extends DataTransferObject<Entity>,Pageable extends PaginatedListRequest,Repository extends org.springframework.data.jpa.repository.JpaRepository<Entity,ID> & QuerydslFastPagingRepository<Entity,ID>,Service extends CrudService<Entity,ID,Dto,Pageable,Repository>>
java.lang.Object
biz.devstack.springframework.boot.jpa.crud.CrudController<Entity,ID,Dto,Pageable,Repository,Service>
- Type Parameters:
Entity- the entity type.ID- the identifier type for the entity.Dto- the DTO used to transfer entity data.Pageable- the pagination request type.Repository- the repository interface for entity persistence.Service- the service to handle business logic.
- Direct Known Subclasses:
ExtendedCrudController
public abstract class CrudController<Entity,ID,Dto extends DataTransferObject<Entity>,Pageable extends PaginatedListRequest,Repository extends org.springframework.data.jpa.repository.JpaRepository<Entity,ID> & QuerydslFastPagingRepository<Entity,ID>,Service extends CrudService<Entity,ID,Dto,Pageable,Repository>>
extends Object
Abstract controller to handle CRUD operations for entities.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ObjectconvertEntityToResponse(Entity entity) Abstract method to convert an entity to a response object.createEntityFromDto(Dto dto) voiddeleteEntity(ID id) fetchEntities(Pageable pageable) protected abstract StringAbstract method to get the authority suffix for role-based access control.readEntityById(ID id) updateEntityFromDto(ID id, Dto dto)
-
Field Details
-
service
-
authorizationService
-
-
Constructor Details
-
CrudController
public CrudController()
-
-
Method Details
-
fetchEntities
-
readEntityById
-
createEntityFromDto
-
updateEntityFromDto
-
deleteEntity
-
getAuthoritySuffix
Abstract method to get the authority suffix for role-based access control.- Returns:
- the authority suffix for the entity.
-
convertEntityToResponse
Abstract method to convert an entity to a response object.- Parameters:
entity- the entity to convert.- Returns:
- the response object corresponding to the entity.
-