Class AbstractSelectService<Entity,Model,SelectOption extends AbstractSelectOption,SelectRepository extends org.springframework.data.repository.CrudRepository<Entity,Long>>

java.lang.Object
fr.tiogars.architecture.select.services.AbstractSelectService<Entity,Model,SelectOption,SelectRepository>
Type Parameters:
Entity - the type of entity
Model - the type of model
SelectOption - the type of select option
SelectRepository - the type of repository

public abstract class AbstractSelectService<Entity,Model,SelectOption extends AbstractSelectOption,SelectRepository extends org.springframework.data.repository.CrudRepository<Entity,Long>> extends Object
Abstract class for select services that provides a common structure for selecting entities and converting them to models.
  • Field Details

    • repository

      public SelectRepository extends org.springframework.data.repository.CrudRepository<Entity,Long> repository
      The repository used for pagination and sorting operations.
  • Constructor Details

    • AbstractSelectService

      public AbstractSelectService(SelectRepository repository)
      Constructor to initialize the repository.
      Parameters:
      repository - the repository used for pagination and sorting operations
  • Method Details

    • toModel

      public abstract Model toModel(Entity entity)
      Convert an entity to a model.
      Parameters:
      entity - the entity to convert
      Returns:
      the converted model
    • toSelectOptions

      public abstract SelectOption toSelectOptions(Model model)
      Convert a model to a select option.
      Parameters:
      model - the model to convert
      Returns:
      the converted select option
    • select

      public SelectResponse<SelectOption> select(SelectRequest request)
      Select entities based on the provided request and convert them to select options.
      Parameters:
      request - the select request containing search criteria
      Returns:
      a select response containing the list of select options