Class ExternalItemListItemProvider<P extends com.broadleafcommerce.cart.client.domain.ItemListItem>
java.lang.Object
com.broadleafcommerce.cartoperation.service.provider.external.AbstractExternalProvider
com.broadleafcommerce.cartoperation.service.provider.external.ExternalItemListItemProvider<P>
- All Implemented Interfaces:
ItemListItemProvider<P>
public class ExternalItemListItemProvider<P extends com.broadleafcommerce.cart.client.domain.ItemListItem>
extends AbstractExternalProvider
implements ItemListItemProvider<P>
External (HTTP) implementation of an item list item provider.
- Author:
- Jacob Mitash
-
Field Summary
Fields inherited from class com.broadleafcommerce.cartoperation.service.provider.external.AbstractExternalProvider
ENTITY_NOT_FOUND
-
Constructor Summary
ConstructorDescriptionExternalItemListItemProvider
(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalCartProperties properties) -
Method Summary
Modifier and TypeMethodDescriptioncreateItems
(String listId, @NonNull Collection<P> items, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Creates items within a specific list.void
deleteItems
(String listId, @NonNull Collection<String> itemIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deletes items within a specific listprotected org.springframework.web.util.UriComponentsBuilder
getBaseUri
(String listId) Gets the base URI common to all requests this provider will make.org.springframework.data.domain.Page<P>
getItemPage
(String listId, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Gets a page of items belonging to a specific item list.getItems
(String listId, @NonNull Collection<String> itemIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Gets specific items of a list by their IDs.Gets the type reference for a list of item list items.protected org.springframework.core.ParameterizedTypeReference<ResponsePageGenerator<P>>
Gets the type reference for a page generator of item list items.protected ExternalCartProperties
protected String
replaceItems
(String listId, @NonNull Collection<P> items, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Replaces items within a specific list.updateItems
(String listId, @NonNull Collection<P> items, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates items within a specific list.Methods inherited from class com.broadleafcommerce.cartoperation.service.provider.external.AbstractExternalProvider
buildNotFoundException, executeRequest, getHeaders, getObjectMapper, getTypeFactory, getWebClient, isEntityNotFound, pageableToParams, uriVars
-
Constructor Details
-
ExternalItemListItemProvider
public ExternalItemListItemProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalCartProperties properties)
-
-
Method Details
-
getItemPage
public org.springframework.data.domain.Page<P> getItemPage(String listId, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListItemProvider
Gets a page of items belonging to a specific item list.- Specified by:
getItemPage
in interfaceItemListItemProvider<P extends com.broadleafcommerce.cart.client.domain.ItemListItem>
- Parameters:
listId
- the ID of the item list to get items frompageable
- the details of the page of items to includecontext
- the context of the request- Returns:
- a page of items
-
getItems
public List<P> getItems(String listId, @NonNull @NonNull Collection<String> itemIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListItemProvider
Gets specific items of a list by their IDs.- Specified by:
getItems
in interfaceItemListItemProvider<P extends com.broadleafcommerce.cart.client.domain.ItemListItem>
- Parameters:
listId
- the ID of the item list to get items fromitemIds
- the IDs of the items to getcontext
- the context of the request- Returns:
- a list of items
-
createItems
public List<P> createItems(String listId, @NonNull @NonNull Collection<P> items, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListItemProvider
Creates items within a specific list.- Specified by:
createItems
in interfaceItemListItemProvider<P extends com.broadleafcommerce.cart.client.domain.ItemListItem>
- Parameters:
listId
- the ID of the item list to create items initems
- the items to createcontext
- the context of the request- Returns:
- a list of the created items
-
replaceItems
public List<P> replaceItems(String listId, @NonNull @NonNull Collection<P> items, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListItemProvider
Replaces items within a specific list.- Specified by:
replaceItems
in interfaceItemListItemProvider<P extends com.broadleafcommerce.cart.client.domain.ItemListItem>
- Parameters:
listId
- the ID of the item list to replace items initems
- the items to replace and their corresponding data (item ID included)context
- the context of the request- Returns:
- a list of the replaced items
-
updateItems
public List<P> updateItems(String listId, @NonNull @NonNull Collection<P> items, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListItemProvider
Updates items within a specific list.- Specified by:
updateItems
in interfaceItemListItemProvider<P extends com.broadleafcommerce.cart.client.domain.ItemListItem>
- Parameters:
listId
- the ID of the item list to update items initems
- the items to update and their corresponding data (item ID included)context
- the context of the request- Returns:
- a list of the updated items
-
deleteItems
public void deleteItems(String listId, @NonNull @NonNull Collection<String> itemIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListItemProvider
Deletes items within a specific list- Specified by:
deleteItems
in interfaceItemListItemProvider<P extends com.broadleafcommerce.cart.client.domain.ItemListItem>
- Parameters:
listId
- the ID of the item list to delete items fromitemIds
- the IDs of the items to deletecontext
- the context of the request
-
getBaseUri
Gets the base URI common to all requests this provider will make.- Returns:
- a URI components builder with the base URI set up
-
getListType
Gets the type reference for a list of item list items.- Returns:
- type reference for a list of item list items
-
getPageType
protected org.springframework.core.ParameterizedTypeReference<ResponsePageGenerator<P>> getPageType()Gets the type reference for a page generator of item list items.- Returns:
- type reference for a page generator of item list items
-
getServiceClient
-
getProperties
-