Class ExternalReturnAuthorizationProvider<R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
- java.lang.Object
-
- com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
-
- com.broadleafcommerce.orderoperation.service.provider.external.ExternalReturnAuthorizationProvider<R>
-
- All Implemented Interfaces:
ReturnAuthorizationProvider<R>
public class ExternalReturnAuthorizationProvider<R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization> extends AbstractExternalProvider implements ReturnAuthorizationProvider<R>
Interacts with an external system forReturnAuthorization
s.- Author:
- Kelly Tisdell (ktisdell)
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
BULK_REPLACE_CREATE_SEGMENT
protected static String
ORDER_IDS_PARAM_NAME
-
Fields inherited from class com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
RSQL_FILTER_PARAM
-
-
Constructor Summary
Constructors Constructor Description ExternalReturnAuthorizationProvider(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 R
create(R returnAuthorization, String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Creates aReturnAuthorization
.void
delete(String returnAuthorizationId, String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Deletes aReturnAuthorization
with the given ID.protected org.springframework.web.util.UriComponentsBuilder
getBaseUri()
Gets the base URI common to all direct requests forReturnAuthorization
s.protected org.springframework.util.MultiValueMap<String,String>
getOrderIdsParams(Set<String> orderIds)
Formats Order ids into a query parameter.protected org.springframework.web.util.UriComponentsBuilder
getOrderOwnedBaseUri(String orderId)
Gets the base URI common to all requests for return authorizations within an order.protected ExternalOrderProperties
getProperties()
protected String
getServiceClient()
List<R>
readAllByOrderId(String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve all of theReturnAuthorizations
with the given order ID.R
readById(String returnAuthorizationId, String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve theReturnAuthorization
with the given ID.@NonNull Map<String,List<R>>
readByOrderIds(Set<String> orderIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
FetchesReturnAuthorization
s for a Set of order ids.R
replace(R returnAuthorization, String returnAuthorizationId, String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Replace theReturnAuthorization
with the given ID.List<R>
replaceOrCreateAll(Collection<R> returnAuthorizations, String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Replace all of the givenReturnAuthorizations
which already exist, or create them.-
Methods inherited from class com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
executeRequest, getHeaders, getObjectMapper, getTypeFactory, getWebClient, pageableToParams
-
-
-
-
Field Detail
-
BULK_REPLACE_CREATE_SEGMENT
protected static final String BULK_REPLACE_CREATE_SEGMENT
- See Also:
- Constant Field Values
-
ORDER_IDS_PARAM_NAME
protected static final String ORDER_IDS_PARAM_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExternalReturnAuthorizationProvider
public ExternalReturnAuthorizationProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalOrderProperties properties)
-
-
Method Detail
-
readAllByOrderId
public List<R> readAllByOrderId(String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:ReturnAuthorizationProvider
Retrieve all of theReturnAuthorizations
with the given order ID.- Specified by:
readAllByOrderId
in interfaceReturnAuthorizationProvider<R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
- Parameters:
orderId
- the order ID of the return authorizations to retrievecontextInfo
- context information around sandbox and multitenant state.- Returns:
- the return authorizations with the given order ID
-
readById
public R readById(String returnAuthorizationId, String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:ReturnAuthorizationProvider
Retrieve theReturnAuthorization
with the given ID.- Specified by:
readById
in interfaceReturnAuthorizationProvider<R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
- Parameters:
returnAuthorizationId
- the ID of the return authorization to retrieveorderId
- the ID of the order containing the return authorizationcontextInfo
- context information around sandbox and multitenant state.- Returns:
- the return authorization with the given ID
-
create
public R create(R returnAuthorization, String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:ReturnAuthorizationProvider
Creates aReturnAuthorization
.- Specified by:
create
in interfaceReturnAuthorizationProvider<R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
- Parameters:
returnAuthorization
- the return authorization to replace withorderId
- the ID of the order containing the return authorizationcontextInfo
- context information around sandbox and multitenant state.- Returns:
- the return authorization with the given ID
-
replace
public R replace(R returnAuthorization, String returnAuthorizationId, String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:ReturnAuthorizationProvider
Replace theReturnAuthorization
with the given ID.- Specified by:
replace
in interfaceReturnAuthorizationProvider<R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
- Parameters:
returnAuthorization
- the return authorization to createreturnAuthorizationId
- the ID of the return authorization to retrieveorderId
- the ID of the order containing the return authorizationcontextInfo
- context information around sandbox and multitenant state.- Returns:
- the return authorization with the given ID
-
delete
public void delete(String returnAuthorizationId, String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:ReturnAuthorizationProvider
Deletes aReturnAuthorization
with the given ID.- Specified by:
delete
in interfaceReturnAuthorizationProvider<R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
- Parameters:
returnAuthorizationId
- the ID of the return authorization to deleteorderId
- the ID of the order containing the return authorizationcontextInfo
- context information around sandbox and multitenant state.
-
replaceOrCreateAll
public List<R> replaceOrCreateAll(Collection<R> returnAuthorizations, String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:ReturnAuthorizationProvider
Replace all of the givenReturnAuthorizations
which already exist, or create them.- Specified by:
replaceOrCreateAll
in interfaceReturnAuthorizationProvider<R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
- Parameters:
returnAuthorizations
- the return authorizations to replace or createorderId
- the ID of the order containing the return authorizationcontextInfo
- context information around sandbox and multitenant state.- Returns:
- the replaced and created return authorizations
-
readByOrderIds
@NonNull public @NonNull Map<String,List<R>> readByOrderIds(Set<String> orderIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:ReturnAuthorizationProvider
FetchesReturnAuthorization
s for a Set of order ids. Returns a map with the order id as the key and a list ofReturnAuthorization
s as the value.- Specified by:
readByOrderIds
in interfaceReturnAuthorizationProvider<R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>
- Parameters:
orderIds
- Set of Order IDs.contextInfo
- Optional ContextInfo.- Returns:
- A map with Order ID as the key and a list of return authorizations as the value.
-
getOrderOwnedBaseUri
protected org.springframework.web.util.UriComponentsBuilder getOrderOwnedBaseUri(String orderId)
Gets the base URI common to all requests for return authorizations within an order.- Parameters:
orderId
- the order to manage return authorizations within- Returns:
- a URI components builder with the base URI set up
-
getBaseUri
protected org.springframework.web.util.UriComponentsBuilder getBaseUri()
Gets the base URI common to all direct requests forReturnAuthorization
s.- Returns:
- a URI components builder with the base URI set up
-
getOrderIdsParams
protected org.springframework.util.MultiValueMap<String,String> getOrderIdsParams(Set<String> orderIds)
Formats Order ids into a query parameter.- Parameters:
orderIds
- Order IDs for which we are looking for Return Authorizations.- Returns:
-
getServiceClient
protected String getServiceClient()
-
getProperties
protected ExternalOrderProperties getProperties()
-
-