Class DefaultOrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment,R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
java.lang.Object
com.broadleafcommerce.orderoperation.service.DefaultOrderHistoryService<O,F,R>
- All Implemented Interfaces:
OrderHistoryService<O,OrderWithFulfillmentsAndReturns>
public class DefaultOrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment,R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
extends Object
implements OrderHistoryService<O,OrderWithFulfillmentsAndReturns>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultOrderHistoryService(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, OrderProvider<O> orderProvider, FulfillmentProvider<F> fulfillmentProvider, ReturnAuthorizationProvider<R> returnAuthorizationProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected cz.jirutka.rsql.parser.ast.NodebuildAccountOrderHistoryFilters(boolean includeChildren, cz.jirutka.rsql.parser.ast.Node existingFilters, @NonNull String accountId, @NonNull String rootAccountId, String orderRef) BuildsNodefilters based on the account id, root account id, and order id or number.protected cz.jirutka.rsql.parser.ast.NodebuildOrderHistoryFilters(String customerId, Instant start, Instant end) protected org.springframework.data.domain.Page<OrderWithFulfillmentsAndReturns>buildOrderWithFulfillmentsAndReturns(@NonNull org.springframework.data.domain.Page<O> orders, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a page ofOrderWithFulfillmentsAndReturnsby retrieving theOrderFulfillmentandReturnAuthorizationfor the givenOrdersprotected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtilsprotected FulfillmentProvider<F>protected OrderProvider<O>protected ReturnAuthorizationProvider<R>protected com.broadleafcommerce.common.extension.TypeFactoryprotected voidreadFulfillmentsIntoOrderHistory(List<OrderWithFulfillmentsAndReturns> orderHistory, List<String> orderIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected org.springframework.data.domain.Page<O>readHistoricalOrdersForCustomer(Integer days, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) readOrderByIdOrNumber(String orderRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve the order with the given order reference (ID or order number) and its fulfillments and returns.readOrderByIdOrNumberForAccount(@NonNull String orderRef, boolean includeChildren, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve the order with the given order reference (ID or order number) and its fulfillments and returns.org.springframework.data.domain.Page<OrderWithFulfillmentsAndReturns>readOrderHistoryForAccount(boolean includeChildren, org.springframework.data.domain.Pageable page, @NonNull cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all orders with its fulfillments and returns for the currently authenticated account with or without including child accounts' ordersorg.springframework.data.domain.Page<OrderWithFulfillmentsAndReturns>readOrderHistoryForCustomer(Integer days, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all orders with its fulfillments and returns for the currently authenticated customer for the past number of days.protected voidreadReturnsIntoOrderHistory(List<OrderWithFulfillmentsAndReturns> orderHistory, List<String> orderIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
Field Details
-
CUSTOMER_ID
- See Also:
-
SUBMIT_DATE
- See Also:
-
ORDER_ID
- See Also:
-
ACCOUNT_HIERARCHY
- See Also:
-
ACCOUNT_ID
- See Also:
-
ROOT_ACCOUNT_ID
- See Also:
-
CONTEXT_ID
- See Also:
-
ORDER_NUMBER
- See Also:
-
-
Constructor Details
-
DefaultOrderHistoryService
public DefaultOrderHistoryService(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, OrderProvider<O> orderProvider, FulfillmentProvider<F> fulfillmentProvider, ReturnAuthorizationProvider<R> returnAuthorizationProvider)
-
-
Method Details
-
readOrderHistoryForCustomer
public org.springframework.data.domain.Page<OrderWithFulfillmentsAndReturns> readOrderHistoryForCustomer(@Nullable Integer days, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderHistoryServiceRead all orders with its fulfillments and returns for the currently authenticated customer for the past number of days.- Specified by:
readOrderHistoryForCustomerin interfaceOrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment> - Parameters:
days- The number of days to read order historypage- the requested page of results from the databasecontextInfo- The current context- Returns:
- The orders with the customer ID in the date range
-
readHistoricalOrdersForCustomer
-
buildOrderHistoryFilters
-
readFulfillmentsIntoOrderHistory
protected void readFulfillmentsIntoOrderHistory(List<OrderWithFulfillmentsAndReturns> orderHistory, List<String> orderIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
readReturnsIntoOrderHistory
protected void readReturnsIntoOrderHistory(List<OrderWithFulfillmentsAndReturns> orderHistory, List<String> orderIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
readOrderByIdOrNumber
public OrderWithFulfillmentsAndReturns readOrderByIdOrNumber(String orderRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderHistoryServiceRetrieve the order with the given order reference (ID or order number) and its fulfillments and returns.- Specified by:
readOrderByIdOrNumberin interfaceOrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment> - Parameters:
orderRef- The ID or number of the order to readcontextInfo- The current context- Returns:
- The order with the given ID and its fulfillments and returns.
-
readOrderHistoryForAccount
public org.springframework.data.domain.Page<OrderWithFulfillmentsAndReturns> readOrderHistoryForAccount(boolean includeChildren, @Nullable org.springframework.data.domain.Pageable page, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderHistoryServiceRead all orders with its fulfillments and returns for the currently authenticated account with or without including child accounts' orders- Specified by:
readOrderHistoryForAccountin interfaceOrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment> - Parameters:
includeChildren- whether to include child accounts' orderspage- the requested page of results from the databasefilters- custom filters to be appliedcontextInfo- The current context- Returns:
- The orders for the authenticated account and possibly child accounts
-
readOrderByIdOrNumberForAccount
public OrderWithFulfillmentsAndReturns readOrderByIdOrNumberForAccount(@NonNull @NonNull String orderRef, boolean includeChildren, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderHistoryServiceRetrieve the order with the given order reference (ID or order number) and its fulfillments and returns.- Specified by:
readOrderByIdOrNumberForAccountin interfaceOrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment> - Parameters:
orderRef- The ID or number of the order to readincludeChildren- whether to search in child accounts' orderscontextInfo- The current context- Returns:
- The order with the given ID and its fulfillments and returns.
-
buildOrderWithFulfillmentsAndReturns
protected org.springframework.data.domain.Page<OrderWithFulfillmentsAndReturns> buildOrderWithFulfillmentsAndReturns(@NonNull @NonNull org.springframework.data.domain.Page<O> orders, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a page ofOrderWithFulfillmentsAndReturnsby retrieving theOrderFulfillmentandReturnAuthorizationfor the givenOrders -
buildAccountOrderHistoryFilters
protected cz.jirutka.rsql.parser.ast.Node buildAccountOrderHistoryFilters(boolean includeChildren, @Nullable cz.jirutka.rsql.parser.ast.Node existingFilters, @NonNull @NonNull String accountId, @NonNull @NonNull String rootAccountId, @Nullable String orderRef) BuildsNodefilters based on the account id, root account id, and order id or number.- Parameters:
includeChildren- whether to include the sub-accounts' ordersexistingFilters- exising filters to build on top ofaccountId- the id of the accountrootAccountId- the id of the root accountorderRef- optional parameter to find by order id or number- Returns:
- the
Nodefilters based on the account id, root account id, and order id or number.
-
getAuthenticationUtils
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getOrderProvider
-
getFulfillmentProvider
-
getReturnAuthorizationProvider
-