Class JpaCustomizedOrderRepository<D extends JpaOrder>
java.lang.Object
com.broadleafcommerce.order.provider.jpa.repository.JpaCustomizedOrderRepository<D>
- All Implemented Interfaces:
CustomizedOrderRepository<D>
public class JpaCustomizedOrderRepository<D extends JpaOrder>
extends Object
implements CustomizedOrderRepository<D>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJpaCustomizedOrderRepository
(List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor rsqlVisitor, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager, JpaOrderTenantQueryHelper tenantQueryHelper) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyRsqlCriteria
(cz.jirutka.rsql.parser.ast.Node filters, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.CriteriaQuery<?> nativeQuery, Map<String, Object> nativeQueryParams, List<jakarta.persistence.criteria.Predicate> nativePredicates) findAllByContextIdAndMatchingTenant
(Iterable<String> contextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the orders matching the provided IDs and the tenant fromContextInfo
if present.findAllDistinctContextIds
(int page, cz.jirutka.rsql.parser.ast.Node filters) Retrieves a list of unique order context IDs no larger than page.findByContextIdAndMatchingTenant
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the order matching the provided ID and the tenant fromContextInfo
if present.protected jakarta.persistence.EntityManager
protected OrderRepository<D>
protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager
protected List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer>
protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor
protected JpaOrderTenantQueryHelper
void
setRepository
(OrderRepository<D> repository) void
validate()
-
Field Details
-
CONTEXT_ID
- See Also:
-
-
Constructor Details
-
JpaCustomizedOrderRepository
public JpaCustomizedOrderRepository(List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor rsqlVisitor, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager, JpaOrderTenantQueryHelper tenantQueryHelper)
-
-
Method Details
-
validate
@PostConstruct public void validate() -
findAllDistinctContextIds
Description copied from interface:CustomizedOrderRepository
Retrieves a list of unique order context IDs no larger than page. It is expected that any appropriate offset is achieved through criteria designated infilters
.- Specified by:
findAllDistinctContextIds
in interfaceCustomizedOrderRepository<D extends JpaOrder>
- Parameters:
page
- the requested amount of results from the database. -1 indicates no limit.filters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.- Returns:
- unique order IDs
-
applyRsqlCriteria
-
findByContextIdAndMatchingTenant
public Optional<D> findByContextIdAndMatchingTenant(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedOrderRepository
Retrieves the order matching the provided ID and the tenant fromContextInfo
if present.Differs from the standard narrowing behavior of
TrackableRepository.findByContextId(String, ContextInfo)
, which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation finds all records within the tenant regardless of whether they're associated to an application.- Specified by:
findByContextIdAndMatchingTenant
in interfaceCustomizedOrderRepository<D extends JpaOrder>
- Parameters:
id
- the id of the order fulfillment to findcontextInfo
- context information surrounding multitenant state.- Returns:
- an
Optional
containing the requested order if found within the tenant, orOptional.empty()
otherwise
-
findAllByContextIdAndMatchingTenant
public List<D> findAllByContextIdAndMatchingTenant(Iterable<String> contextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedOrderRepository
Retrieves the orders matching the provided IDs and the tenant fromContextInfo
if present.Differs from the standard narrowing behavior of
TrackableRepository.findByContextId(String, ContextInfo)
, which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation finds all records within the tenant regardless of whether they're associated to an application.- Specified by:
findAllByContextIdAndMatchingTenant
in interfaceCustomizedOrderRepository<D extends JpaOrder>
- Parameters:
contextIds
- the ids of the orders to findcontextInfo
- context information surrounding multitenant state.- Returns:
- The list of narrowed orders
-
getManagedType
-
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager() -
getRsqlQueryTransformers
protected List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> getRsqlQueryTransformers() -
getRsqlVisitor
protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor getRsqlVisitor() -
getRepositoryEntityTypeManager
protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager getRepositoryEntityTypeManager() -
getTenantQueryHelper
-
getRepository
-
setRepository
-