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
Modifier and TypeFieldDescriptionprotected static final String
Deprecated.protected static final String
protected static final String
Fields inherited from class com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
ENTITY_NOT_FOUND, RSQL_FILTER_PARAM
-
Constructor Summary
ConstructorDescriptionExternalOrderProvider
(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
.void
Deletes aOrder
with the given ID.protected org.springframework.web.util.UriComponentsBuilder
Gets the base URI common to all requests this provider will make.protected org.springframework.web.util.UriComponentsBuilder
Gets the base URI for requesting an order matching tenantprotected ExternalOrderProperties
protected String
org.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 theOrder
with the given cart ID.readById
(@NonNull String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrder
with the given ID.readByIdMatchingTenant
(@NonNull String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrder
with the given ID, ignoring its application as long as it's in the current tenant context.readByOrderNumber
(@NonNull String orderNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrder
with the given order number.readOwnedById
(@NonNull String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve theOrder
with the given ID, validating ownership if necessary.update
(O order, String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update theOrder
with 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:OrderProvider
Retrieve allOrders
.- Specified by:
readAll
in 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
-
readById
public O readById(@NonNull @NonNull String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProvider
Retrieve theOrder
with the given ID.- Specified by:
readById
in 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
-
readByIdMatchingTenant
public O readByIdMatchingTenant(@NonNull @NonNull String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:OrderProvider
Retrieve theOrder
with the given ID, ignoring its application as long as it's in the current tenant context.- Specified by:
readByIdMatchingTenant
in 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:OrderProvider
Retrieve theOrder
with the given ID, validating ownership if necessary.- Specified by:
readOwnedById
in 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:OrderProvider
Retrieve theOrder
with the given cart ID.- Specified by:
readByCartId
in 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:OrderProvider
Retrieve theOrder
with the given order number.- Specified by:
readByOrderNumber
in 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:OrderProvider
Update theOrder
with the given ID.- Specified by:
update
in 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:OrderProvider
Creates aOrder
.- Specified by:
create
in 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:OrderProvider
Deletes aOrder
with the given ID.- Specified by:
delete
in 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()