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 Details

  • Constructor Details

    • CrudController

      public CrudController()
  • Method Details

    • fetchEntities

      @GetMapping("") public PaginatedList<?> fetchEntities(@Valid Pageable pageable)
    • readEntityById

      @GetMapping("/{id}") public Object readEntityById(@PathVariable ID id)
    • createEntityFromDto

      @PostMapping("") public Object createEntityFromDto(@Valid @RequestBody Dto dto)
    • updateEntityFromDto

      @PutMapping("/{id}") public Object updateEntityFromDto(@PathVariable ID id, @Valid @RequestBody Dto dto)
    • deleteEntity

      @DeleteMapping("/{id}") public void deleteEntity(@PathVariable ID id)
    • getAuthoritySuffix

      protected abstract String getAuthoritySuffix()
      Abstract method to get the authority suffix for role-based access control.
      Returns:
      the authority suffix for the entity.
    • convertEntityToResponse

      protected abstract Object convertEntityToResponse(Entity entity)
      Abstract method to convert an entity to a response object.
      Parameters:
      entity - the entity to convert.
      Returns:
      the response object corresponding to the entity.