Class SpringDataLazyDataModel<T,ID,R extends org.springframework.data.repository.CrudRepository<T,ID> & org.springframework.data.repository.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 -
All Implemented Interfaces:
Serializable, Iterable<T>, org.primefaces.model.SelectableDataModel<T>
Direct Known Subclasses:
SpringDataJpaLazyDataModel

public class SpringDataLazyDataModel<T,ID,R extends org.springframework.data.repository.CrudRepository<T,ID> & org.springframework.data.repository.PagingAndSortingRepository<T,ID>> extends org.primefaces.model.LazyDataModel<T>
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(org.springframework.data.domain.Page<T> page)
    • getPageable

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

      protected org.springframework.data.domain.Pageable getPageable(int first, int pageSize, org.springframework.data.domain.Sort sort)
    • getSort

      protected org.springframework.data.domain.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 org.springframework.data.repository.core.EntityInformation<T,ID> getEntityInformation()
    • setEntityInformation

      public void setEntityInformation(org.springframework.data.repository.core.EntityInformation<T,ID> entityInformation)
    • getEntityConverter

      public jakarta.faces.convert.Converter<T> getEntityConverter()
    • setEntityConverter

      public void setEntityConverter(jakarta.faces.convert.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)