Class AbstractPanacheService<E extends io.quarkus.hibernate.orm.panache.PanacheEntity>

java.lang.Object
br.com.trajy.architecture.base.AbstractPanacheService<E>
Type Parameters:
E - Entity type

public abstract class AbstractPanacheService<E extends io.quarkus.hibernate.orm.panache.PanacheEntity> extends Object
Abstract Class that contains boilerplate code to implement find, create, update and delete operations with your respective business rules using Hibernate panache entity reactive
Author:
Trajy
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Override this method to handle business logic after delete feature
    protected void
    Override this method to handle business logic after find feature
    protected void
    Override this method to handle business logic after find by id feature
    protected void
    afterUpdate(Long id, E e)
    Override this method to handle business logic after update feature
    protected void
    Override this method to handle business logic before create feature
    protected void
    Override this method to handle business logic before delete feature
    protected void
    Override this method to handle business logic before find feature
    protected void
    Override this method to handle business logic before find by id feature
    protected void
    Override this method to handle business logic before update feature
    void
    create(E e)
    Boilerplate code implementation to handle create feature
    void
    Boilerplate code implementation to handle delete feature
    protected abstract void
    Override this method to call static implementation of delete method from Entity that extends PanacheEntity
    Boilerplate code implementation to handle find feature
    Boilerplate code implementation to handle find by id feature
    protected abstract E
    Override this method to call static implementation of find by id method from Entity that extends PanacheEntity
    protected abstract List<E>
    Override this method to call static implementation of find method from Entity that extends PanacheEntity
    void
    update(Long id, E e)
    Boilerplate code implementation to handle update feature

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractPanacheService

      public AbstractPanacheService()
  • Method Details

    • find

      public List<E> find()
      Boilerplate code implementation to handle find feature
      Returns:
      found results
    • findById

      public E findById(Long id)
      Boilerplate code implementation to handle find by id feature
      Parameters:
      id - id to search
      Returns:
      found entity
    • create

      public void create(E e)
      Boilerplate code implementation to handle create feature
      Parameters:
      e - entity with data to persist
    • update

      public void update(Long id, E e)
      Boilerplate code implementation to handle update feature
      Parameters:
      id - id of object to update
      e - entity with data to update
    • delete

      public void delete(Long id)
      Boilerplate code implementation to handle delete feature
      Parameters:
      id - id to delete
    • findStaticMethod

      protected abstract List<E> findStaticMethod()
      Override this method to call static implementation of find method from Entity that extends PanacheEntity
      Returns:
      results from static implementation
    • findByIdStatidMethod

      protected abstract E findByIdStatidMethod(Long id)
      Override this method to call static implementation of find by id method from Entity that extends PanacheEntity
      Parameters:
      id - id to search
      Returns:
      result from static implementation
    • deleteByIdStaticMethod

      protected abstract void deleteByIdStaticMethod(Long id)
      Override this method to call static implementation of delete method from Entity that extends PanacheEntity
      Parameters:
      id - id to delete
    • beforeFind

      protected void beforeFind()
      Override this method to handle business logic before find feature
    • afterFind

      protected void afterFind(List<E> es)
      Override this method to handle business logic after find feature
      Parameters:
      es - found entities
    • beforeFindById

      protected void beforeFindById(Long id)
      Override this method to handle business logic before find by id feature
      Parameters:
      id - id that will be searched
    • afterFindById

      protected void afterFindById(E e)
      Override this method to handle business logic after find by id feature
      Parameters:
      e - found entity
    • beforeCreate

      protected void beforeCreate(E e)
      Override this method to handle business logic before create feature
      Parameters:
      e - entity that will be persisted
    • beforeUpdate

      protected void beforeUpdate(Long id, E e)
      Override this method to handle business logic before update feature
      Parameters:
      id - id that will be updated
      e - entity with new data to update
    • afterUpdate

      protected void afterUpdate(Long id, E e)
      Override this method to handle business logic after update feature
      Parameters:
      id - id that has searched
      e - entity that has persisted
    • beforeDelete

      protected void beforeDelete(Long id)
      Override this method to handle business logic before delete feature
      Parameters:
      id - id ta will be deleted
    • afterDelete

      protected void afterDelete(Long id)
      Override this method to handle business logic after delete feature
      Parameters:
      id - id that has deleted