Class ExternalOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>
java.lang.Object
com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
com.broadleafcommerce.orderoperation.service.provider.external.ExternalOrderProvider<O>
- All Implemented Interfaces:
OrderProvider<O>
public class ExternalOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>
extends AbstractExternalProvider
implements OrderProvider<O>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringDeprecated.protected static final Stringprotected static final StringFields inherited from class com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
ENTITY_NOT_FOUND, RSQL_FILTER_PARAM -
Constructor Summary
ConstructorsConstructorDescriptionExternalOrderProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalOrderProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionCreates aOrder.voidDeletes aOrderwith the given ID.protected org.springframework.web.util.UriComponentsBuilderGets the base URI common to all requests this provider will make.protected org.springframework.web.util.UriComponentsBuilderGets the base URI for requesting an order matching tenantprotected ExternalOrderPropertiesprotected Stringorg.springframework.data.domain.Page<O>readAll(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve allOrders.readByCartId(@NonNull String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrderwith the given cart ID.readById(@NonNull String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrderwith the given ID.readByIdMatchingTenant(@NonNull String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrderwith the given ID, ignoring its application as long as it's in the current tenant context.readByOrderLink(@NonNull String orderLink, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrderusing the provided API URL.readByOrderNumber(@NonNull String orderNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrderwith the given order number.org.springframework.data.domain.Page<CustomerOrderInfo>readCustomerOrderInfo(ReadCustomerOrdersRequest request, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the Orders and additional related data for theReadCustomerOrdersRequest.readOwnedById(@NonNull String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrderwith the given ID, validating ownership if necessary.update(O order, String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update theOrderwith the given ID.Methods inherited from class com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
buildNotFoundException, executeRequest, getHeaders, getObjectMapper, getTypeFactory, getWebClient, isEntityNotFound, pageableToParams
-
Field Details
-
READ_BY_CART_ID_SEGMENT
- See Also:
-
READ_BY_ORDER_NUMBER_SEGMENT
- See Also:
-
ORDER_CLIENT_ID
Deprecated.- See Also:
-
-
Constructor Details
-
ExternalOrderProvider
public ExternalOrderProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalOrderProperties properties)
-
-
Method Details
-
readAll
public org.springframework.data.domain.Page<O> readAll(cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderRetrieve allOrders.- Specified by:
readAllin interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
filters- the list of filters to apply to this querypage- the requested page of results from the databasecontextInfo- context information around sandbox and multitenant state.- Returns:
- the order with the given ID
-
readCustomerOrderInfo
public org.springframework.data.domain.Page<CustomerOrderInfo> readCustomerOrderInfo(ReadCustomerOrdersRequest request, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderReads the Orders and additional related data for theReadCustomerOrdersRequest.- Specified by:
readCustomerOrderInfoin interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
request- the request to read the Orders and the related datapage- the requested page of results from the databasecontextInfo- context information related to multitenancy- Returns:
- the page of the
CustomerOrderInfowith the additional requested data if any
-
readById
public O readById(@NonNull @NonNull String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderRetrieve theOrderwith the given ID.- Specified by:
readByIdin interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
orderId- the ID of the order to retrievecontextInfo- context information around sandbox and multitenant state.- Returns:
- the order with the given ID
-
readByOrderLink
public O readByOrderLink(@NonNull @NonNull String orderLink, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderRetrieve theOrderusing the provided API URL.- Specified by:
readByOrderLinkin interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
orderLink- the API URL to read the OrdercontextInfo- context information around sandbox and multitenant state.- Returns:
- the
Orderfor the provided API URL
-
readByIdMatchingTenant
public O readByIdMatchingTenant(@NonNull @NonNull String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderRetrieve theOrderwith the given ID, ignoring its application as long as it's in the current tenant context.- Specified by:
readByIdMatchingTenantin interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
orderId- the ID of the order to retrievecontextInfo- context information around sandbox and multitenant state.- Returns:
- the order with the given ID
-
readOwnedById
@Policy(identityTypes={OWNER,ADMIN}, operationTypes=READ) public O readOwnedById(@NonNull @NonNull String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderRetrieve theOrderwith the given ID, validating ownership if necessary.- Specified by:
readOwnedByIdin interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
orderId- the ID of the order to retrievecontextInfo- context information around sandbox and multitenant state.- Returns:
- the order with the given ID
-
readByCartId
public Optional<O> readByCartId(@NonNull @NonNull String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderRetrieve theOrderwith the given cart ID.- Specified by:
readByCartIdin interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
cartId- the cart ID of the order to retrievecontextInfo- context information around sandbox and multitenant state.- Returns:
- the order with the given cart ID
-
readByOrderNumber
public O readByOrderNumber(@NonNull @NonNull String orderNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderRetrieve theOrderwith the given order number.- Specified by:
readByOrderNumberin interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
orderNumber- the order number of the order to retrievecontextInfo- context information around sandbox and multitenant state.- Returns:
- the order with the given order number
-
update
public O update(O order, String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderUpdate theOrderwith the given ID.- Specified by:
updatein interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
order- the order to update withorderId- the ID of the order to retrievecontextInfo- context information around sandbox and multitenant state.- Returns:
- the updated order with the given ID
-
create
public O create(O order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderCreates aOrder.- Specified by:
createin interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
order- the order to replace withcontextInfo- context information around sandbox and multitenant state.- Returns:
- the created order
-
delete
public void delete(String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProviderDeletes aOrderwith the given ID.- Specified by:
deletein interfaceOrderProvider<O extends com.broadleafcommerce.order.client.domain.Order>- Parameters:
orderId- the ID of the order to deletecontextInfo- context information around sandbox and multitenant state.
-
getBaseUri
protected org.springframework.web.util.UriComponentsBuilder getBaseUri()Gets the base URI common to all requests this provider will make.- Returns:
- a URI components builder with the base URI set up
-
getMatchingTenantUri
protected org.springframework.web.util.UriComponentsBuilder getMatchingTenantUri()Gets the base URI for requesting an order matching tenant- Returns:
- a URI components builder with the order matching tenant URI
-
getServiceClient
-
getProperties
-
getServiceClient()