Class JpaCustomizedCategoryAssetRepository<D extends JpaCategoryAsset>

java.lang.Object
com.broadleafcommerce.catalog.provider.jpa.repository.asset.JpaCustomizedCategoryAssetRepository<D>
All Implemented Interfaces:
CustomizedCategoryAssetRepository<D>, org.springframework.beans.factory.InitializingBean

public class JpaCustomizedCategoryAssetRepository<D extends JpaCategoryAsset> extends Object implements CustomizedCategoryAssetRepository<D>, org.springframework.beans.factory.InitializingBean
Author:
Samarth Dhruva (samarthd)
  • Constructor Summary

    Constructors
    Constructor
    Description
    JpaCustomizedCategoryAssetRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor 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
    buildCategoryContextIdFilter(String categoryContextId, javax.persistence.criteria.Root<D> categoryAssetEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
     
    findByCategoryContextId(String categoryContextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Finds all of the CategoryAssets for a Category by ID.
    protected javax.persistence.EntityManager
     
    protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper
     
     
    protected List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer>
     
    protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor
     
    org.springframework.data.domain.Page<D>
    searchAllWithCategoryContextId(String categoryContextId, Boolean isSorted, String searchString, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Finds all CategoryAssets for the given category context ID, optionally filtering by additional search/filter arguments.
    void
     

    Methods inherited from class java.lang.Object

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

    • JpaCustomizedCategoryAssetRepository

      public JpaCustomizedCategoryAssetRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor 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(CategoryAssetRepository<D> repository)
    • searchAllWithCategoryContextId

      @NonNull @Policy(operationTypes=READ) public org.springframework.data.domain.Page<D> searchAllWithCategoryContextId(@NonNull String categoryContextId, @Nullable Boolean isSorted, @Nullable String searchString, @NonNull cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CustomizedCategoryAssetRepository
      Finds all CategoryAssets for the given category context ID, optionally filtering by additional search/filter arguments.

      If searchString is provided, then this method will search for assets whose EntityAsset.url, EntityAsset.title, EntityAsset.altText, or EntityAsset.tags contain it.

      If no searchString is provided, then this method will simply return all assets for the given category.

      This method also supports RSQL filtration via filters.

      Specified by:
      searchAllWithCategoryContextId in interface CustomizedCategoryAssetRepository<D extends JpaCategoryAsset>
      Parameters:
      categoryContextId - the value which the category context ID should match against
      isSorted - (optional) if not-null, will restrict results to only include CategoryAssets where CategoryAsset.sorted has the given value
      searchString - (optional) a string which should be found in EntityAsset.url, EntityAsset.title, EntityAsset.altText, or EntityAsset.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 - the context to query within
      Returns:
      the assets in the database with the given category context ID, optionally filtered by the given search/filter arguments (if provided)
    • buildCategoryContextIdFilter

      protected javax.persistence.criteria.Predicate buildCategoryContextIdFilter(String categoryContextId, javax.persistence.criteria.Root<D> categoryAssetEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
    • 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 JpaNarrowingHelper.JpaCriterias.
    • findByCategoryContextId

      @Policy(operationTypes=READ) public Stream<D> findByCategoryContextId(String categoryContextId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CustomizedCategoryAssetRepository
      Finds all of the CategoryAssets for a Category by ID.
      Specified by:
      findByCategoryContextId in interface CustomizedCategoryAssetRepository<D extends JpaCategoryAsset>
      Parameters:
      categoryContextId - Id of the category which's assets to read
      contextInfo - context information around sandboxing and multitenant state
      Returns:
      all of the CategoryAssets for a Category by ID.
    • getRepository

      protected CategoryAssetRepository<D> getRepository()
    • getNarrowingHelper

      protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper getNarrowingHelper()
    • getRsqlQueryTransformers

      @NonNull protected List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> getRsqlQueryTransformers()
    • getRsqlVisitor

      @NonNull protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor getRsqlVisitor()
    • getEntityManager

      protected javax.persistence.EntityManager getEntityManager()