Package br.com.trajy.architecture.base
Class AbstractPanacheController<D,E extends io.quarkus.hibernate.orm.panache.PanacheEntity,S extends AbstractPanacheService<E>,A extends AbstractPanacheAssembly<D,E>>
java.lang.Object
br.com.trajy.architecture.base.AbstractPanacheController<D,E,S,A>
- Type Parameters:
D
- Data Transfer Object Type (DTO)E
- Entity TypeS
- Service TypeA
- Assembly Type
public abstract class AbstractPanacheController<D,E extends io.quarkus.hibernate.orm.panache.PanacheEntity,S extends AbstractPanacheService<E>,A extends AbstractPanacheAssembly<D,E>>
extends Object
Abstract Class that contains boilerplate code to implement GET, CREATE, UPDATE and DELETE rest end-points
using Hibernate panache entity reactive
- Author:
- Trajy
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Override this method to handle request after createprotected void
Override this method to handle request after deleteprotected void
Override this method to handle request after findprotected void
Override this method to handle request after updateprotected void
beforeCreate
(D d) Override this method to handle request before createprotected void
beforeDelete
(Long id) Override this method to handle request before deleteprotected void
Override this method to handle request before findprotected void
beforeUpdate
(Long id, D d) Override this method to handle request before updatejakarta.ws.rs.core.Response
Boilerplate code implementation to handle POST requestsjakarta.ws.rs.core.Response
Boilerplate code implementation to handle DELETE requestsfind()
Boilerplate code implementation to handle GET requestsjakarta.ws.rs.core.Response
Boilerplate code implementation to handle PUT requests
-
Field Details
-
service
-
assembly
-
-
Constructor Details
-
AbstractPanacheController
public AbstractPanacheController()
-
-
Method Details
-
find
Boilerplate code implementation to handle GET requests- Returns:
- List of found objects
-
create
@POST @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response create(D d) Boilerplate code implementation to handle POST requests- Parameters:
d
- data from request body- Returns:
- no content 204 response
-
update
@PUT @Path("/{id}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response update(@PathParam("id") Long id, D d) Boilerplate code implementation to handle PUT requests- Parameters:
id
- id from rul path paramd
- data from request body- Returns:
- no content 204 response
-
delete
@DELETE @Path("/{id}") @Produces("application/json") public jakarta.ws.rs.core.Response delete(@PathParam("id") Long id) Boilerplate code implementation to handle DELETE requests- Parameters:
id
- id from request path param- Returns:
- no content 204 response
-
beforeFind
protected void beforeFind()Override this method to handle request before find -
afterFind
Override this method to handle request after find- Parameters:
es
- List of found results
-
beforeCreate
Override this method to handle request before create- Parameters:
d
- data received from request body
-
afterCreate
protected void afterCreate()Override this method to handle request after create -
beforeUpdate
Override this method to handle request before update- Parameters:
id
- received from path urld
- data received from request body
-
afterUpdate
protected void afterUpdate()Override this method to handle request after update -
beforeDelete
Override this method to handle request before delete- Parameters:
id
- id received from path url
-
afterDelete
protected void afterDelete()Override this method to handle request after delete
-