Class JpaCustomizedOrderFulfillmentRepository<D extends JpaOrderFulfillment>
- All Implemented Interfaces:
CustomizedOrderFulfillmentRepository<D>
- Author:
- Dima Myroniuk (dmyroniuk)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJpaCustomizedOrderFulfillmentRepository
(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) jakarta.persistence.criteria.Predicate
buildOrderIdIsEqualToFilter
(String orderId, Map<String, Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity) jakarta.persistence.criteria.Predicate
buildStatusIsEqualToFilter
(String status, Map<String, Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity) findAllByOrderIdAndMatchingTenant
(String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the order fulfillment matching the provided ID and the tenant fromContextInfo
if present.findAllByOrderIdAndStatusAndMatchingTenant
(String orderId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all of the orderOrderFulfillments
which are associated with the givenorderId
, and the tenant fromContextInfo
if present.findAllByOrderIdInAndExcludeFulfillmentItems
(List<String> orderIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the order fulfillments for the providedorderIds
.findAllDistinctContextIds
(int page, cz.jirutka.rsql.parser.ast.Node filters) Retrieves a list of unique order fulfillment context IDs no larger than page.org.springframework.data.domain.Page<D>
findAllMatchingTenant
(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the order fulfillment matching the query and the tenant fromContextInfo
if present.findByContextIdAndMatchingTenant
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the order fulfillment matching the provided ID and the tenant fromContextInfo
if present.findByContextIdAndStatusAndMatchingTenant
(String contextId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads theOrderFulfillment
for the givenid
andstatus
, and the tenant fromContextInfo
if present.org.springframework.data.domain.Page<D>
findPageByOrderIdAndMatchingTenant
(String orderId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves the order fulfillment matching the provided ID and the tenant fromContextInfo
if present.protected jakarta.persistence.EntityManager
protected OrderFulfillmentRepository<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
(OrderFulfillmentRepository<D> repository) void
validate()
-
Field Details
-
CONTEXT_ID
- See Also:
-
ORDER_ID
- See Also:
-
STATUS
- See Also:
-
-
Constructor Details
-
JpaCustomizedOrderFulfillmentRepository
public JpaCustomizedOrderFulfillmentRepository(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:CustomizedOrderFulfillmentRepository
Retrieves a list of unique order fulfillment context IDs no larger than page. It is expected that any appropriate offset is achieved through criteria designated infilters
.- Specified by:
findAllDistinctContextIds
in interfaceCustomizedOrderFulfillmentRepository<D extends JpaOrderFulfillment>
- 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 fulfillment IDs
-
applyRsqlCriteria
-
findByContextIdAndMatchingTenant
public Optional<D> findByContextIdAndMatchingTenant(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedOrderFulfillmentRepository
Retrieves the order fulfillment 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 interfaceCustomizedOrderFulfillmentRepository<D extends JpaOrderFulfillment>
- Parameters:
id
- the id of the order fulfillment to findcontextInfo
- context information surrounding multitenant state.- Returns:
- an
Optional
containing the requested order fulfillment if found within the tenant, orOptional.empty()
otherwise
-
findAllByOrderIdAndMatchingTenant
public List<D> findAllByOrderIdAndMatchingTenant(String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedOrderFulfillmentRepository
Retrieves the order fulfillment matching the provided ID and the tenant fromContextInfo
if present.Differs from the standard narrowing behavior of
OrderFulfillmentRepository.findAllByOrderId(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:
findAllByOrderIdAndMatchingTenant
in interfaceCustomizedOrderFulfillmentRepository<D extends JpaOrderFulfillment>
- Parameters:
orderId
- The ID of the order to find fulfillments forcontextInfo
- context information surrounding multitenant state- Returns:
- the fulfillments that are associated with the given
orderId
-
buildOrderIdIsEqualToFilter
-
buildStatusIsEqualToFilter
-
findPageByOrderIdAndMatchingTenant
public org.springframework.data.domain.Page<D> findPageByOrderIdAndMatchingTenant(String orderId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedOrderFulfillmentRepository
Retrieves the order fulfillment matching the provided ID and the tenant fromContextInfo
if present.Differs from the standard narrowing behavior of
OrderFulfillmentRepository.findAllByOrderId(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:
findPageByOrderIdAndMatchingTenant
in interfaceCustomizedOrderFulfillmentRepository<D extends JpaOrderFulfillment>
- Parameters:
orderId
- The ID of the order to find fulfillments forcontextInfo
- context information surrounding multitenant state- Returns:
- the fulfillments that are associated with the given
orderId
-
findAllMatchingTenant
public org.springframework.data.domain.Page<D> findAllMatchingTenant(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedOrderFulfillmentRepository
Retrieves the order fulfillment matching the query and the tenant fromContextInfo
if present.Differs from the standard narrowing behavior of
TrackableRsqlFilterExecutor.findAll(Node, Pageable, 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:
findAllMatchingTenant
in interfaceCustomizedOrderFulfillmentRepository<D extends JpaOrderFulfillment>
- Parameters:
filters
- the RSQLNode
used to restrict result, must not be nullpageable
- may bePageable.unpaged()
, must not be null.contextInfo
- context information surrounding multitenant state.- Returns:
- The subset (page) of narrowed entities
-
findAllByOrderIdInAndExcludeFulfillmentItems
public List<D> findAllByOrderIdInAndExcludeFulfillmentItems(List<String> orderIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedOrderFulfillmentRepository
Retrieves the order fulfillments for the providedorderIds
. This method avoids eagerly fetching the associatedOrderFulfillmentItems
.- Specified by:
findAllByOrderIdInAndExcludeFulfillmentItems
in interfaceCustomizedOrderFulfillmentRepository<D extends JpaOrderFulfillment>
- Parameters:
orderIds
- the order idscontextInfo
- context information surrounding multitenant state- Returns:
- the fulfillments that are associated with the given
orderIds
-
findAllByOrderIdAndStatusAndMatchingTenant
public List<D> findAllByOrderIdAndStatusAndMatchingTenant(String orderId, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedOrderFulfillmentRepository
Reads all of the orderOrderFulfillments
which are associated with the givenorderId
, and the tenant fromContextInfo
if present.Differs from the standard narrowing behavior of
OrderFulfillmentRepository.findAllByOrderIdAndStatus(String, 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:
findAllByOrderIdAndStatusAndMatchingTenant
in interfaceCustomizedOrderFulfillmentRepository<D extends JpaOrderFulfillment>
- Parameters:
orderId
- The ID of the parentOrder
status
- TheOrderFulfillment.getStatus()
contextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the
OrderFulfillments
which are associated with the givenorderId
-
findByContextIdAndStatusAndMatchingTenant
public Optional<D> findByContextIdAndStatusAndMatchingTenant(String contextId, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedOrderFulfillmentRepository
Reads theOrderFulfillment
for the givenid
andstatus
, and the tenant fromContextInfo
if present.Differs from the standard narrowing behavior of
OrderFulfillmentRepository.findByContextIdAndStatus(String, 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:
findByContextIdAndStatusAndMatchingTenant
in interfaceCustomizedOrderFulfillmentRepository<D extends JpaOrderFulfillment>
- Parameters:
contextId
- The ID of theOrderFulfillment
status
- TheOrderFulfillment.getStatus()
contextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- Reads the
OrderFulfillment
for the givenid
andstatus
.
-
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
-