Class JpaCustomizedProductTagRepository<D extends JpaProductTag>

java.lang.Object
com.broadleafcommerce.catalog.provider.jpa.repository.tag.JpaCustomizedProductTagRepository<D>
All Implemented Interfaces:
CustomizedProductTagRepository<D>, org.springframework.beans.factory.InitializingBean

public class JpaCustomizedProductTagRepository<D extends JpaProductTag> extends Object implements CustomizedProductTagRepository<D>, org.springframework.beans.factory.InitializingBean
Author:
Nathan Moore (nathandmoore)
  • Constructor Summary

    Constructors
    Constructor
    Description
    JpaCustomizedProductTagRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, cz.jirutka.rsql.parser.ast.RSQLVisitor<javax.persistence.criteria.Predicate,Class<?>> rsqlVisitor, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder catalogFilterRuleCriteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    applyRsqlCriteria(cz.jirutka.rsql.parser.ast.Node filters, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, javax.persistence.criteria.CriteriaQuery<D> nativeQuery, Map<String,Object> nativeQueryParams, List<javax.persistence.criteria.Predicate> nativePredicates)
    Processes the given filters to build and apply the necessary Predicate for RSQL.
    protected javax.persistence.criteria.Predicate
    buildProductContextIdFilter(javax.persistence.criteria.Root<D> productTagEntity, String productContextId, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
     
    org.springframework.data.domain.Page<D>
    findAllByProductContextIdAndIsSorted(String productContextId, boolean isSorted, @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns all ProductTags for the given productContextId that are either all sorted or not sorted (e.g., sorted is where ProductTag.getSorting() is not Sortable.DEFAULT_VALUE or null).
    org.springframework.data.domain.Page<D>
    findAllByProductContextIdAndIsSortedAndVariantIdIsNull(String productContextId, boolean isSorted, @NonNull cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns all ProductTags for the given productContextId that are either all sorted or not sorted (e.g., sorted is where ProductTag.getSorting() is not Sortable.DEFAULT_VALUE or null).
    org.springframework.data.domain.Page<D>
    findAllByVariantIdAndSorted(String variantId, boolean isSorted, @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns all ProductTags for the given productContextId and variantId that are either all sorted or not sorted (e.g., sorted is where ProductTag.getSorting() is not Sortable.DEFAULT_VALUE or null).
    void
     
    protected javax.persistence.criteria.Predicate
    variantIdEquals(javax.persistence.criteria.Root<D> productTagEntity, String variantId, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
     
    protected javax.persistence.criteria.Predicate
    variantIdIsNull(javax.persistence.criteria.Root<D> productTagEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JpaCustomizedProductTagRepository

      public JpaCustomizedProductTagRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, cz.jirutka.rsql.parser.ast.RSQLVisitor<javax.persistence.criteria.Predicate,Class<?>> rsqlVisitor, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder catalogFilterRuleCriteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager)
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • setRepository

      @Autowired @Lazy public void setRepository(ProductTagRepository<D> repository)
    • findAllByProductContextIdAndIsSorted

      @Policy(operationTypes=READ) public org.springframework.data.domain.Page<D> findAllByProductContextIdAndIsSorted(String productContextId, boolean isSorted, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CustomizedProductTagRepository
      Returns all ProductTags for the given productContextId that are either all sorted or not sorted (e.g., sorted is where ProductTag.getSorting() is not Sortable.DEFAULT_VALUE or null).
      Specified by:
      findAllByProductContextIdAndIsSorted in interface CustomizedProductTagRepository<D extends JpaProductTag>
      Parameters:
      productContextId - Id of the product to match
      isSorted - Whether to fetch only the sorted or only the unsorted tags
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      page - the requested page of results from the database
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      all ProductTags for the given productContextId that are either all sorted or not sorted depending on isSorted.
    • findAllByProductContextIdAndIsSortedAndVariantIdIsNull

      @Policy(operationTypes=READ) public org.springframework.data.domain.Page<D> findAllByProductContextIdAndIsSortedAndVariantIdIsNull(String productContextId, boolean isSorted, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CustomizedProductTagRepository
      Returns all ProductTags for the given productContextId that are either all sorted or not sorted (e.g., sorted is where ProductTag.getSorting() is not Sortable.DEFAULT_VALUE or null).
      Specified by:
      findAllByProductContextIdAndIsSortedAndVariantIdIsNull in interface CustomizedProductTagRepository<D extends JpaProductTag>
      Parameters:
      productContextId - Id of the product to match
      isSorted - Whether to fetch only the sorted or only the unsorted tags
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      page - the requested page of results from the database
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      all ProductTags for the given productContextId that are either all sorted or not sorted depending on isSorted.
    • findAllByVariantIdAndSorted

      @Policy(operationTypes=READ) public org.springframework.data.domain.Page<D> findAllByVariantIdAndSorted(String variantId, boolean isSorted, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CustomizedProductTagRepository
      Returns all ProductTags for the given productContextId and variantId that are either all sorted or not sorted (e.g., sorted is where ProductTag.getSorting() is not Sortable.DEFAULT_VALUE or null).
      Specified by:
      findAllByVariantIdAndSorted in interface CustomizedProductTagRepository<D extends JpaProductTag>
      isSorted - Whether to fetch only the sorted or only the unsorted tags
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      page - the requested page of results from the database
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      all ProductTags for the given productContextId that are either all sorted or not sorted depending on isSorted.
    • buildProductContextIdFilter

      protected javax.persistence.criteria.Predicate buildProductContextIdFilter(javax.persistence.criteria.Root<D> productTagEntity, String productContextId, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
    • variantIdEquals

      protected javax.persistence.criteria.Predicate variantIdEquals(javax.persistence.criteria.Root<D> productTagEntity, String variantId, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
    • variantIdIsNull

      protected javax.persistence.criteria.Predicate variantIdIsNull(javax.persistence.criteria.Root<D> productTagEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder)
    • applyRsqlCriteria

      protected LinkedRSQLQueryDetails applyRsqlCriteria(cz.jirutka.rsql.parser.ast.Node filters, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, javax.persistence.criteria.CriteriaQuery<D> nativeQuery, Map<String,Object> nativeQueryParams, List<javax.persistence.criteria.Predicate> nativePredicates)
      Processes the given filters to build and apply the necessary Predicate for RSQL.
      Parameters:
      filters - RSQL filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      criteriaBuilder - the criteria builder used to generate parameters/predicates. Only used as an argument to populate the CriteriaContext in CriteriaContext.withBuilder(CriteriaBuilder).
      nativeQuery - the native query for the original request. Only used as an argument to populate the CriteriaContext in CriteriaContext.withCriteriaQuery(AbstractQuery).
      nativeQueryParams - the parameter values for the nativeQuery. Only used as an argument to populate the CriteriaContext in CriteriaContext.withNarrowingParams(Map).
      nativePredicates - the list of predicates that will be applied on nativeQuery. If the filters are not for linked fields, then the Predicate will be added to this list.
      Returns:
      the CriteriaContext.getLinkedQuery() and CriteriaContext.getLinkedNarrowingParams() that were produced during processing. While the wrapper object will not be null, any/all of its fields can be (for example, if the filters were not on linked fields). These values are useful for ultimately being supplied to JpaCriterias.