java.lang.Object
com.broadleafcommerce.datafeed.provider.jpa.repository.support.JpaDataFeedQueryHelper

public class JpaDataFeedQueryHelper extends Object
Provides commonly useful query functionality.
  • Constructor Details

    • JpaDataFeedQueryHelper

      public JpaDataFeedQueryHelper()
  • Method Details

    • buildTenantTrackingAndArchivedFilter

      public Optional<javax.persistence.criteria.Predicate> buildTenantTrackingAndArchivedFilter(javax.persistence.criteria.Root<?> trackableRootEntity, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String,Object> parameterValues, String trackingTenantIdParamName, javax.persistence.EntityManager entityManager)
      Similar to logic in JpaNarrowExecutor. This is useful for queries that can't use JpaNarrowingHelper due to special configuration requirements such as needing to set TypedQuery.setLockMode(LockModeType).
      Parameters:
      trackableRootEntity - the query root
      contextInfo - the context to build the criteria from
      parameterValues - a map of query parameters and their values. Any new parameter will be added to this map.
      trackingTenantIdParamName - if a filter is added on tracking tenant ID, this is the name of the parameter that will be used for it and added to parameterValues
      entityManager - the entity manager to use for building criteria
      Returns:
      an Optional containing any tenant criteria that needs to be applied if applicable
    • createQueryAndGetResultList

      public <R> List<R> createQueryAndGetResultList(javax.persistence.criteria.CriteriaQuery<R> criteria, @Nullable javax.persistence.LockModeType lockModeType, Map<String,Object> parameterValues, javax.persistence.EntityManager entityManager)
      Simplifies the process of creating a TypedQuery, setting parameters, and getting the results.
      Type Parameters:
      R - the result element type
      Parameters:
      criteria - the criteria to build the query from
      lockModeType - (optional) the lock mode to set on the query
      parameterValues - query parameter values to set on the query
      entityManager - the entity manager to use
      Returns:
      the result list of the query