Interface CartRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
- All Superinterfaces:
CustomizedCartRepository<D>
,com.broadleafcommerce.common.extension.DomainTypeAware
,com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
,org.springframework.data.repository.Repository<D,
,String> com.broadleafcommerce.data.tracking.core.TrackableRepository<D>
,com.broadleafcommerce.data.tracking.core.TrackableRsqlFilterExecutor<D>
- All Known Subinterfaces:
JpaCartRepository<D>
Repository
for persistent counter-parts of Cart
.- Author:
- Chad Harchar (charchar)
-
Method Summary
Modifier and TypeMethodDescriptionfindAllByStatusAndCustomerIdAndAccountIdAndName
(String status, String customerId, String accountId, String name, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a list of carts with the given status for the customer ID, account ID, and name provided.org.springframework.data.domain.Page<D>
findByAccountHierarchyContaining
(String accountId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts where the account hierarchy contains the given account id.org.springframework.data.domain.Page<D>
findByAccountHierarchyContainingAndStatusIn
(String accountId, Iterable<String> statuses, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts where the account hierarchy contains the given account id and has the matching status.findByContextIdAndCustomerIdAndStatusIn
(String cartId, String customerId, Iterable<String> statuses, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart (if it exists) bycartId
,customerId
, &statuses
.findByContextIdAndEmailAddressAndCustomerIdNullAndStatusIn
(String cartId, String emailAddress, Iterable<String> statuses, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart (if it exists) bycartId
andemailAddress
excluding the customer owned carts.org.springframework.data.domain.Page<D>
findByCustomerId
(String customerId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given customer id.org.springframework.data.domain.Page<D>
findByCustomerIdAndAccountId
(String customerId, String accountId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given customer id and account id.org.springframework.data.domain.Page<D>
findByCustomerIdAndAccountId
(String customerId, String accountId, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given customer id and account id.findByCustomerIdAndOrderNumber
(String customerId, String orderNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the cart (if it exists) for the provided customer id and order number.default org.springframework.data.domain.Page<D>
findByCustomerRefCustomerId
(String customerId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.findByCustomerRefCustomerIdAndOrderNumber
(String customerId, String orderNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.findByEmailAddressAndOrderNumberAndStatusIn
(String emailAddress, String orderNumber, Iterable<String> statuses, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart (if it exists) byemailAddress
andorderNumber
that is in list of givenstatuses
.findByEmailAddressAndOrderNumberAndStatusNotIn
(String emailAddress, String orderNumber, Iterable<String> statuses, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart (if it exists) byemailAddress
andorderNumber
that is not in list of givenstatuses
.findByNameAndCustomerId
(String cartName, String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the cart for the given name and customer id.findByNameAndCustomerRefCustomerId
(String cartName, String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.org.springframework.data.domain.Page<D>
findByRootAccountId
(String rootAccountId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given root account id.org.springframework.data.domain.Page<D>
findByRootAccountIdAndStatusIn
(String rootAccountId, Iterable<String> statuses, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given root account id and statuses.findByStatus
(String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all of the carts with the given status.findByStatusAndCustomerIdAndAccountIdAndName
(String status, String customerId, String accountId, String name, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart with the given status for the customer ID, account ID, and name provided.Methods inherited from interface com.broadleafcommerce.cart.repository.CustomizedCartRepository
deleteAbandonedAnonymousCarts, findAllByStatusesAndCustomerId, findAllByStatusesAndCustomerIdAndAccountId, findAllByStatusesAndCustomerRefCustomerId, findAllMatchingTenantByIds, findAllQuotesByExpirationDateBeforeAndStatusNotIn, findByStatusAndCustomerId, findByStatusAndCustomerIdAndAccountId, findByStatusAndCustomerRefCustomerId, findHistoricalByCustomerIdAndDates, findHistoricalByCustomerRefCustomerIdAndDates, findPageMatchingTenantByStatus
Methods inherited from interface com.broadleafcommerce.common.messaging.notification.NotificationStateRepository
findNotificationReadyMembers, setFailedNotificationAttempt, setNotificationAcknowledged
Methods inherited from interface com.broadleafcommerce.data.tracking.core.TrackableRepository
archive, existsByContextId, findAll, findAll, findAll, findAll, findAll, findAll, findAllByContextId, findByContextId, findByContextIdAndCatalog, findByNativeId, findDeployable, findMaxSortMember, findMinSortMember, findOriginal, findPromotable, findPromoteOrientedItems, findRebasable, findRejectable, findRevertable, findTarget, getDomainType, getEntityInformation, getTrackableBehaviorUtil, getTypesToRegisterInMappingContext, pruneChangeDetails, pruneRestingNotificationStates, purgeObsoleteSandboxData, save, saveAll, setTrackableBehaviorUtil
Methods inherited from interface com.broadleafcommerce.data.tracking.core.TrackableRsqlFilterExecutor
exists, findAll, findAll, findAll, findAll
-
Method Details
-
findByCustomerId
@Policy(operationTypes=READ) org.springframework.data.domain.Page<D> findByCustomerId(String customerId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given customer id.- Parameters:
customerId
- the id of the customer who owns the cartpage
- the requested page of results from the databasecontextInfo
- context information related to multitenancy- Returns:
- all carts for the given customer id
-
findByCustomerIdAndAccountId
@Policy(operationTypes=READ) org.springframework.data.domain.Page<D> findByCustomerIdAndAccountId(String customerId, @Nullable String accountId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given customer id and account id. Account id can be null to find customer's personal non-account carts.- Parameters:
customerId
- the id of the customer who owns the cartaccountId
- the id of the account that the cart belongs topage
- the requested page of results from the databasecontextInfo
- context information related to multitenancy- Returns:
- all carts for the given customer id and account id
-
findByCustomerIdAndAccountId
@Policy(operationTypes=READ) org.springframework.data.domain.Page<D> findByCustomerIdAndAccountId(String customerId, @Nullable String accountId, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given customer id and account id. Account id can be null to find customer's personal non-account carts.- Parameters:
customerId
- the id of the customer who owns the cartaccountId
- the id of the account that the cart belongs topage
- the requested page of results from the databasefilters
- RSQL filterscontextInfo
- context information related to multitenancy- Returns:
- all carts for the given customer id and account id
-
findByRootAccountId
@Policy(operationTypes=READ) org.springframework.data.domain.Page<D> findByRootAccountId(String rootAccountId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given root account id.This is useful to query all the carts that belongs to the same root account.
For example, if we have this account setup, rootAcct -> subAcct (child of rootAcct) -> subSubAcct (child of subAcct), this query is useful to query all the carts that belong to the root account and its sub-accounts.
- Parameters:
rootAccountId
- the root account id of the cartpage
- the requested page of results from the databasecontextInfo
- context information related to multitenancy- Returns:
- all carts for the given root account id
-
findByRootAccountIdAndStatusIn
@Policy(operationTypes=READ) org.springframework.data.domain.Page<D> findByRootAccountIdAndStatusIn(String rootAccountId, Iterable<String> statuses, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts for the given root account id and statuses.- Parameters:
rootAccountId
- the root account id of the cartstatuses
- thestatuses
to matchpage
- the requested page of results from the databasecontextInfo
- context information related to multitenancy- Returns:
- all carts for the given root account id
-
findByAccountHierarchyContaining
@Policy(operationTypes=READ) org.springframework.data.domain.Page<D> findByAccountHierarchyContaining(String accountId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts where the account hierarchy contains the given account id.This is useful to query all the carts that belongs to the same non-root account and its sub-accounts.
For example, if we have this account setup, rootAcct -> subAcct (child of rootAcct) -> subSubAcct (child of subAcct), this query is useful to query all the carts that belong to the subAcct and its sub-accounts (subSubAcct in this case).
- Parameters:
accountId
- the account id to filter the account hierarchy bypage
- the requested page of results from the databasecontextInfo
- context information related to multitenancy- Returns:
- all carts where the account hierarchy contains the given account id
-
findByAccountHierarchyContainingAndStatusIn
@Policy(operationTypes=READ) org.springframework.data.domain.Page<D> findByAccountHierarchyContainingAndStatusIn(String accountId, Iterable<String> statuses, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all carts where the account hierarchy contains the given account id and has the matching status.This is useful to query all the carts that belongs to the same non-root account and its sub-accounts based on the status
For example, if we have this account setup, rootAcct -> subAcct (child of rootAcct) -> subSubAcct (child of subAcct), this query is useful to query all the carts that belong to the subAcct and its sub-accounts (subSubAcct in this case) and has the
DefaultCartStatuses.REQUIRES_APPROVAL
.- Parameters:
accountId
- the account id to filter the account hierarchy bystatuses
- thestatuses
to matchpage
- the requested page of results from the databasecontextInfo
- context information related to multitenancy- Returns:
- all carts where the account hierarchy contains the given account id
-
findByCustomerRefCustomerId
@Deprecated @Policy(operationTypes=READ) default org.springframework.data.domain.Page<D> findByCustomerRefCustomerId(String customerId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.in favor offindByCustomerId(String, Pageable, ContextInfo)
Find all carts for the given customer id.- Parameters:
customerId
- the id of the customer who owns the cartpage
- the requested page of results from the databasecontextInfo
- context information related to multitenancy- Returns:
- all carts for the given customer id
-
findByNameAndCustomerId
@Policy(operationTypes=READ) Optional<D> findByNameAndCustomerId(String cartName, String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the cart for the given name and customer id. There should only be one result, as cart names are unique per customer.- Parameters:
cartName
- the name of the cart to retrievecustomerId
- the id of the customer who owns the cartcontextInfo
- context information related to multitenancy- Returns:
- an optional cart with the name and customer provided
-
findByNameAndCustomerRefCustomerId
@Deprecated @Policy(operationTypes=READ) default Optional<D> findByNameAndCustomerRefCustomerId(String cartName, String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Find the cart for the given name and customer id. There should only be one result, as cart names are unique per customer.- Parameters:
cartName
- the name of the cart to retrievecustomerId
- the id of the customer who owns the cartcontextInfo
- context information related to multitenancy- Returns:
- an optional cart with the name and customer provided
-
findByCustomerIdAndOrderNumber
@Policy(operationTypes=READ) Optional<D> findByCustomerIdAndOrderNumber(String customerId, String orderNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the cart (if it exists) for the provided customer id and order number.- Parameters:
customerId
- the id of the customer who owns the cartorderNumber
- the order number for the cartcontextInfo
- context information related to multitenancy- Returns:
- a cart (if it exists) with the given order number that belongs to the provided customer.
-
findByCustomerRefCustomerIdAndOrderNumber
@Deprecated @Policy(operationTypes=READ) default Optional<D> findByCustomerRefCustomerIdAndOrderNumber(String customerId, String orderNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Find the cart (if it exists) for the provided customer id and order number.- Parameters:
customerId
- the id of the customer who owns the cartorderNumber
- the order number for the cartcontextInfo
- context information related to multitenancy- Returns:
- a cart (if it exists) with the given order number that belongs to the provided customer.
-
findByEmailAddressAndOrderNumberAndStatusNotIn
@Policy(operationTypes=READ) Optional<D> findByEmailAddressAndOrderNumberAndStatusNotIn(String emailAddress, String orderNumber, Iterable<String> statuses, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart (if it exists) byemailAddress
andorderNumber
that is not in list of givenstatuses
.- Parameters:
emailAddress
- Theemail address associated with the cart
orderNumber
- Thecart's order number
statuses
- Thestatuses
to not matchcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- A cart (if it exists) matching the
emailAddress
andorderNumber
and not matching the list of givenstatuses
-
findByEmailAddressAndOrderNumberAndStatusIn
@Policy(operationTypes=READ) Optional<D> findByEmailAddressAndOrderNumberAndStatusIn(String emailAddress, String orderNumber, Iterable<String> statuses, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart (if it exists) byemailAddress
andorderNumber
that is in list of givenstatuses
. This is usually used to find historical carts for an anonymous or not authenticated customer.- Parameters:
emailAddress
- Theemail address associated with the cart
orderNumber
- Thecart's order number
statuses
- Thestatuses
to not matchcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- A cart (if it exists) matching the
emailAddress
andorderNumber
and matching the list of givenstatuses
-
findByContextIdAndEmailAddressAndCustomerIdNullAndStatusIn
@Policy(operationTypes=READ) Optional<D> findByContextIdAndEmailAddressAndCustomerIdNullAndStatusIn(String cartId, String emailAddress, Iterable<String> statuses, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart (if it exists) bycartId
andemailAddress
excluding the customer owned carts. This is usually used to find carts for an anonymous customer.- Parameters:
cartId
- The cart idemailAddress
- Theemail address associated with the cart
statuses
- Thestatuses
to not matchcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- A cart (if it exists) matching
cartId
andemailAddress
-
findByContextIdAndCustomerIdAndStatusIn
@Policy(operationTypes=READ) Optional<D> findByContextIdAndCustomerIdAndStatusIn(String cartId, String customerId, Iterable<String> statuses, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart (if it exists) bycartId
,customerId
, &statuses
.- Parameters:
cartId
- The cart idcustomerId
- The customer id associated with the cartstatuses
- Thestatuses
to not matchcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- A cart (if it exists) matching
cartId
andcustomerId
-
findByStatus
@Policy(operationTypes=READ) List<D> findByStatus(String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all of the carts with the given status.- Parameters:
status
- TheCartStatus
to filter bycontextInfo
- Context information around sandbox and multitenant state.- Returns:
- All of the carts with the given status.
-
findByStatusAndCustomerIdAndAccountIdAndName
@Policy(operationTypes=READ) Optional<D> findByStatusAndCustomerIdAndAccountIdAndName(String status, String customerId, @Nullable String accountId, @Nullable String name, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a cart with the given status for the customer ID, account ID, and name provided. By default, if multiple are found, this selects the cart with the latestcreateDate
.- Parameters:
status
- the status to find carts ofcustomerId
- the customer ID to find carts withaccountId
- the account ID to find carts withname
- The name of the cart, or, if null, then a cart with no namecontextInfo
- the context to use for filtering the results- Returns:
- the cart with requested details, or empty if none was found.
-
findAllByStatusAndCustomerIdAndAccountIdAndName
@Policy(operationTypes=READ) List<D> findAllByStatusAndCustomerIdAndAccountIdAndName(String status, String customerId, @Nullable String accountId, @Nullable String name, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a list of carts with the given status for the customer ID, account ID, and name provided. By default, if multiple are found, this selects the cart with the latestcreateDate
. Note: having multiple carts with the same status, customer id, account id, & name is considered an invalid/unexpected state. Therefore, this method is used to identify & clean up these situations.- Parameters:
status
- the status to find carts ofcustomerId
- the customer ID to find carts withaccountId
- the account ID to find carts withname
- The name of the cart, or, if null, then a cart with no namecontextInfo
- the context to use for filtering the results- Returns:
- a list of carts with requested details
-
findByCustomerId(String, Pageable, ContextInfo)