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
Fields Modifier and Type Field Description protected static String
ORDER_CLIENT_ID
Deprecated.protected static String
READ_BY_CART_ID_SEGMENT
protected static String
READ_BY_ORDER_NUMBER_SEGMENT
-
Fields inherited from class com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
RSQL_FILTER_PARAM
-
-
Constructor Summary
Constructors Constructor Description ExternalOrderProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalOrderProperties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description O
create(O order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Creates aOrder
.void
delete(String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Deletes aOrder
with the given ID.protected org.springframework.web.util.UriComponentsBuilder
getBaseUri()
Gets the base URI common to all requests this provider will make.protected org.springframework.web.util.UriComponentsBuilder
getMatchingTenantUri()
Gets the base URI for requesting an order matching tenantprotected ExternalOrderProperties
getProperties()
protected String
getServiceClient()
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
.Optional<O>
readByCartId(@NonNull String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve theOrder
with the given cart ID.O
readById(@NonNull String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve theOrder
with the given ID.O
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.O
readByOrderNumber(@NonNull String orderNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve theOrder
with the given order number.O
readOwnedById(@NonNull String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve theOrder
with the given ID, validating ownership if necessary.O
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
executeRequest, getHeaders, getObjectMapper, getTypeFactory, getWebClient, pageableToParams
-
-
-
-
Field Detail
-
READ_BY_CART_ID_SEGMENT
protected static final String READ_BY_CART_ID_SEGMENT
- See Also:
- Constant Field Values
-
READ_BY_ORDER_NUMBER_SEGMENT
protected static final String READ_BY_ORDER_NUMBER_SEGMENT
- See Also:
- Constant Field Values
-
ORDER_CLIENT_ID
@Deprecated protected static final String ORDER_CLIENT_ID
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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
protected String getServiceClient()
-
getProperties
protected ExternalOrderProperties getProperties()
-
-