Interface JpaFiltersCriteriaBuilder
-
- All Known Implementing Classes:
DefaultJpaRsqlFilterRulesCriteriaBuilder
public interface JpaFiltersCriteriaBuilder
Converts theCatalogRef.getInclusionFilters()
andCatalogRef.getExclusionFilters()
into Criteria that Jpa can interpret and apply with the rest of the criteria. Can also create filters based on RSQL expression included inContextInfo.getQueryHints()
.- Author:
- Phillip Verheyden (phillipuniverse), Jeff Fischer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<javax.persistence.criteria.Predicate>
buildCatalogCriteria(com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines hierarchy, Class<?> typeToRead, Map<String,Object> narrowingParams, javax.persistence.criteria.CriteriaBuilder builder, javax.persistence.criteria.AbstractQuery<?> criteriaQuery)
Builds filter rule criteria based on a catalog hierarchy.javax.persistence.criteria.Predicate
buildContextCriteria(String filters, Class<?> typeToRead, Map<String,Object> narrowingParams, javax.persistence.criteria.CriteriaBuilder builder, javax.persistence.criteria.AbstractQuery<?> criteriaQuery)
Builds filter rule criteria based on a generic rsql expression included on theContextInfo
.
-
-
-
Method Detail
-
buildCatalogCriteria
Optional<javax.persistence.criteria.Predicate> buildCatalogCriteria(@Nullable com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines hierarchy, @NonNull Class<?> typeToRead, @NonNull Map<String,Object> narrowingParams, javax.persistence.criteria.CriteriaBuilder builder, javax.persistence.criteria.AbstractQuery<?> criteriaQuery)
Builds filter rule criteria based on a catalog hierarchy. Allows for more fine grained control for applying criteria within different levels of the hierarchy or differentiations for each member. If there is a single rule then the result will be non-empty and contain all of the catalogs applied as discriminated. If there are no inclusion or exclusion rules then this will return an empty optional- Parameters:
hierarchy
- the hierarchy being queried for. Can be null if this is not available in which case this will return an empty criteriatypeToRead
- java domain currently being queriednarrowingParams
- The key/value map of actual value to apply to the resulting parameterized query.builder
- The jpa criteria query buildercriteriaQuery
- The current query being built up- Returns:
- a single Criteria representing the filter rules that should be applied at each level in the hierarchy. This should include both rule-based catalog criteria along with catalog relationships that do not have any criteria
-
buildContextCriteria
javax.persistence.criteria.Predicate buildContextCriteria(@NonNull String filters, @NonNull Class<?> typeToRead, @NonNull Map<String,Object> narrowingParams, javax.persistence.criteria.CriteriaBuilder builder, javax.persistence.criteria.AbstractQuery<?> criteriaQuery)
Builds filter rule criteria based on a generic rsql expression included on theContextInfo
. Refer toContextInfoCustomizer
for more information on how to include one or more filter items on ContextInfo.- Parameters:
filters
- One or more valid RSQL expressions against the targettypeToRead
, delimited by a semicolon character.typeToRead
- java domain currently being queriednarrowingParams
- The key/value map of actual value to apply to the resulting parameterized query.builder
- The jpa criteria query buildercriteriaQuery
- The current query being built up- Returns:
- a single Criteria representing the filters that should be applied
-
-