Class RSQLJPASupport

java.lang.Object
io.github.perplexhub.rsql.RSQLCommonSupport
io.github.perplexhub.rsql.RSQLJPASupport

public class RSQLJPASupport extends RSQLCommonSupport
  • Constructor Details

    • RSQLJPASupport

      public RSQLJPASupport()
    • RSQLJPASupport

      public RSQLJPASupport(Map<String,jakarta.persistence.EntityManager> entityManagerMap)
  • Method Details

    • rsql

      public static <T> org.springframework.data.jpa.domain.Specification<T> rsql(String rsqlQuery)
    • rsql

      public static <T> org.springframework.data.jpa.domain.Specification<T> rsql(String rsqlQuery, boolean distinct)
    • rsql

      public static <T> org.springframework.data.jpa.domain.Specification<T> rsql(String rsqlQuery, Map<String,String> propertyPathMapper)
    • rsql

      public static <T> org.springframework.data.jpa.domain.Specification<T> rsql(String rsqlQuery, boolean distinct, Map<String,String> propertyPathMapper)
    • rsql

      public static <T> org.springframework.data.jpa.domain.Specification<T> rsql(String rsqlQuery, List<RSQLCustomPredicate<?>> customPredicates)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, Map<String,String> propertyPathMapper)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, boolean distinct)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, boolean distinct, Map<String,String> propertyPathMapper)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, List<RSQLCustomPredicate<?>> customPredicates)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, Map<String,String> propertyPathMapper, Map<String,jakarta.persistence.criteria.JoinType> joinHints)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, boolean distinct, Map<String,String> propertyPathMapper, Map<String,jakarta.persistence.criteria.JoinType> joinHints)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, Map<String,String> propertyPathMapper, List<RSQLCustomPredicate<?>> customPredicates, Map<String,jakarta.persistence.criteria.JoinType> joinHints)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, boolean distinct, Map<String,String> propertyPathMapper, List<RSQLCustomPredicate<?>> customPredicates, Map<String,jakarta.persistence.criteria.JoinType> joinHints)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, Map<String,String> propertyPathMapper, List<RSQLCustomPredicate<?>> customPredicates, Map<String,jakarta.persistence.criteria.JoinType> joinHints, Map<Class<?>,List<String>> propertyWhitelist, Map<Class<?>,List<String>> propertyBlacklist)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(QuerySupport querySupport)
    • toSpecification

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSpecification(String rsqlQuery, boolean distinct, Map<String,String> propertyPathMapper, List<RSQLCustomPredicate<?>> customPredicates, Map<String,jakarta.persistence.criteria.JoinType> joinHints, Map<Class<?>,List<String>> propertyWhitelist, Map<Class<?>,List<String>> propertyBlacklist)
    • toSort

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSort(@Nullable String sortQuery)
    • toSort

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSort(@Nullable String sortQuery, Map<String,String> propertyPathMapper)
    • toSort

      public static <T> org.springframework.data.jpa.domain.Specification<T> toSort(SortSupport sortSupport)
      Add orderBy(s) to CriteriaQuery. Example: "field1,asc;field2,desc;field3.subfield1,asc"
      Type Parameters:
      T -
      Parameters:
      sortSupport - - sort support
      Returns:
      Specification with specified order by
    • findOne

      public static Optional<?> findOne(org.springframework.data.jpa.repository.JpaSpecificationExecutor<?> jpaSpecificationExecutor, @Nullable String rsqlQuery)
      Returns a single entity matching the given Specification or Optional.empty() if none found.
      Parameters:
      jpaSpecificationExecutor - JPA repository
      rsqlQuery - can be null.
      Returns:
      never null.
      Throws:
      org.springframework.dao.IncorrectResultSizeDataAccessException - if more than one entity found.
    • findAll

      public static List<?> findAll(org.springframework.data.jpa.repository.JpaSpecificationExecutor<?> jpaSpecificationExecutor, @Nullable String rsqlQuery)
      Returns all entities matching the given Specification.
      Parameters:
      jpaSpecificationExecutor - JPA repository
      rsqlQuery - can be null.
      Returns:
      never null.
    • findAll

      public static org.springframework.data.domain.Page<?> findAll(org.springframework.data.jpa.repository.JpaSpecificationExecutor<?> jpaSpecificationExecutor, @Nullable String rsqlQuery, org.springframework.data.domain.Pageable pageable)
      Returns a Page of entities matching the given Specification.
      Parameters:
      jpaSpecificationExecutor - JPA repository
      rsqlQuery - can be null.
      pageable - must not be null.
      Returns:
      never null.
    • findAll

      public static List<?> findAll(org.springframework.data.jpa.repository.JpaSpecificationExecutor<?> jpaSpecificationExecutor, @Nullable String rsqlQuery, org.springframework.data.domain.Sort sort)
      Returns all entities matching the given Specification and Sort.
      Parameters:
      jpaSpecificationExecutor - JPA repository
      rsqlQuery - can be null.
      sort - must not be null.
      Returns:
      never null.
    • findAll

      public static List<?> findAll(org.springframework.data.jpa.repository.JpaSpecificationExecutor<?> jpaSpecificationExecutor, @Nullable String rsqlQuery, @Nullable String sort)
      Returns all entities matching the given Specification and Sort.
      Parameters:
      jpaSpecificationExecutor - JPA repository
      rsqlQuery - can be null.
      sort - can be null, comma delimited.
      Returns:
      never null.
    • count

      public static long count(org.springframework.data.jpa.repository.JpaSpecificationExecutor<?> jpaSpecificationExecutor, @Nullable String rsqlQuery)
      Returns the number of instances that the given Specification will return.
      Parameters:
      jpaSpecificationExecutor - JPA repository
      rsqlQuery - the Specification to count instances for. Can be null.
      Returns:
      the number of instances.
    • getVersion

      protected String getVersion()
      Overrides:
      getVersion in class RSQLCommonSupport