Class SpringDataLazyDataModel<T,ID,R extends CrudRepository<T,ID> & PagingAndSortingRepository<T,ID>>

java.lang.Object
jakarta.faces.model.DataModel<E>
jakarta.faces.model.ListDataModel<T>
org.primefaces.model.LazyDataModel<T>
org.joinfaces.primefaces.SpringDataLazyDataModel<T,ID,R>
Type Parameters:
T - the domain type the repository manages
ID - the type of the id of the entity the repository manages
R - the type of the repository interface
All Implemented Interfaces:
Serializable, Iterable<T>, org.primefaces.model.SelectableDataModel<T>
Direct Known Subclasses:
SpringDataJpaLazyDataModel

public class SpringDataLazyDataModel<T,ID,R extends CrudRepository<T,ID> & PagingAndSortingRepository<T,ID>> extends org.primefaces.model.LazyDataModel<T>
Primefaces LazyDataModel implementation which wraps a Spring Data Repository.
See Also:
  • Constructor Details

    • SpringDataLazyDataModel

      public SpringDataLazyDataModel(R repository)
  • Method Details

    • load

      public List<T> load(int first, int pageSize, Map<String,org.primefaces.model.SortMeta> sortBy, Map<String,org.primefaces.model.FilterMeta> filterBy)
      Specified by:
      load in class org.primefaces.model.LazyDataModel<T>
    • count

      public int count(Map<String,org.primefaces.model.FilterMeta> filterBy)
      Specified by:
      count in class org.primefaces.model.LazyDataModel<T>
    • registerResult

      protected void registerResult(Page<T> page)
    • getPageable

      protected Pageable getPageable(int first, int pageSize, Map<String,org.primefaces.model.SortMeta> sortBy)
    • getPageable

      protected Pageable getPageable(int first, int pageSize, Sort sort)
    • getSort

      protected Sort getSort(Map<String,org.primefaces.model.SortMeta> sortBy)
    • getRowKey

      public String getRowKey(T object)
      Specified by:
      getRowKey in interface org.primefaces.model.SelectableDataModel<T>
      Overrides:
      getRowKey in class org.primefaces.model.LazyDataModel<T>
    • getRowData

      public T getRowData(String rowKey)
      Specified by:
      getRowData in interface org.primefaces.model.SelectableDataModel<T>
      Overrides:
      getRowData in class org.primefaces.model.LazyDataModel<T>
    • getPrimaryKey

      protected ID getPrimaryKey(T entity)
    • getEntityInformation

      public EntityInformation<T,ID> getEntityInformation()
    • setEntityInformation

      public void setEntityInformation(EntityInformation<T,ID> entityInformation)
    • getEntityConverter

      public Converter<T> getEntityConverter()
    • setEntityConverter

      public void setEntityConverter(Converter<T> entityConverter)
    • getIdClass

      public Class<ID> getIdClass()
    • setIdClass

      public void setIdClass(Class<ID> idClass)
    • setPrimaryKeyDeserializer

      public void setPrimaryKeyDeserializer(Function<String,ID> primaryKeyDeserializer)
    • setPrimaryKeySerializer

      public void setPrimaryKeySerializer(Function<ID,String> primaryKeySerializer)