Class ExternalItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
java.lang.Object
com.broadleafcommerce.cartoperation.service.provider.external.AbstractExternalProvider
com.broadleafcommerce.cartoperation.service.provider.external.ExternalItemListProvider<P>
- All Implemented Interfaces:
ItemListProvider<P>
public class ExternalItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
extends AbstractExternalProvider
implements ItemListProvider<P>
External (HTTP) implementation of an item list provider.
- Author:
- Jacob Mitash
-
Field Summary
Fields inherited from class com.broadleafcommerce.cartoperation.service.provider.external.AbstractExternalProvider
ENTITY_NOT_FOUND
-
Constructor Summary
ConstructorDescriptionExternalItemListProvider
(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 TypeMethodDescriptionCreates an item list.void
delete
(@NonNull String listId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deletes an item list by ID.void
delete
(@NonNull Set<String> listIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deletes multiple item lists by IDs.protected org.springframework.web.util.UriComponentsBuilder
Gets the base URI common to all requests this provider will make.protected org.springframework.core.ParameterizedTypeReference<ResponsePageGenerator<P>>
Gets the type reference for a list of item lists.protected ExternalCartProperties
protected String
protected org.springframework.core.ParameterizedTypeReference<P>
getType()
Gets the type reference for item lists.readById
(@NonNull String listId, boolean hydrate, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a specific item list by its ID and optionally hydrates the items.readById
(@NonNull String listId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a specific item list by its ID.org.springframework.data.domain.Page<P>
readByIds
(@NonNull Set<String> listIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads specific item lists by their IDs.replace
(P itemList, @NonNull String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Replaces an item list.update
(P itemList, @NonNull String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates an item list.Methods inherited from class com.broadleafcommerce.cartoperation.service.provider.external.AbstractExternalProvider
buildNotFoundException, executeRequest, getHeaders, getObjectMapper, getTypeFactory, getWebClient, isEntityNotFound, pageableToParams, uriVars
-
Constructor Details
-
ExternalItemListProvider
public ExternalItemListProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalCartProperties properties)
-
-
Method Details
-
readById
public P readById(@NonNull @NonNull String listId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListProvider
Reads a specific item list by its ID.- Specified by:
readById
in interfaceItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
- Parameters:
listId
- the ID of the item list to retrievecontext
- the context of the request- Returns:
- the item list with the given ID
-
readById
public P readById(@NonNull @NonNull String listId, boolean hydrate, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListProvider
Reads a specific item list by its ID and optionally hydrates the items.- Specified by:
readById
in interfaceItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
- Parameters:
listId
- the ID of the item list to retrievehydrate
- if true, causes the items to by hydratedcontext
- the context of the request- Returns:
- the item list with the given ID
-
readByIds
public org.springframework.data.domain.Page<P> readByIds(@NonNull @NonNull Set<String> listIds, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListProvider
Reads specific item lists by their IDs.- Specified by:
readByIds
in interfaceItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
- Parameters:
listIds
- the IDs of the item lists to retrievefilters
- additional filters to apply in the query.page
- the requested page of results from the databasecontext
- the context of the request- Returns:
- the item lists with the given IDs
-
create
public P create(@NonNull P itemList, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListProvider
Creates an item list.- Specified by:
create
in interfaceItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
- Parameters:
itemList
- the item list to createcontext
- the context of the request- Returns:
- the created item list
-
replace
public P replace(@NonNull P itemList, @NonNull @NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListProvider
Replaces an item list.- Specified by:
replace
in interfaceItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
- Parameters:
itemList
- the item list to replace withid
- the ID of the item listcontext
- the context of the request- Returns:
- the replaced item list
-
update
public P update(@NonNull P itemList, @NonNull @NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListProvider
Updates an item list.- Specified by:
update
in interfaceItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
- Parameters:
itemList
- the item list to update withid
- the ID of the item listcontext
- the context of the request- Returns:
- the updated item list
-
delete
public void delete(@NonNull @NonNull String listId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListProvider
Deletes an item list by ID.- Specified by:
delete
in interfaceItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
- Parameters:
listId
- the ID of the item list to deletecontext
- the context of the request
-
delete
public void delete(@NonNull @NonNull Set<String> listIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListProvider
Deletes multiple item lists by IDs.- Specified by:
delete
in interfaceItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
- Parameters:
listIds
- the list of IDs of the item lists to deletecontext
- the context of the request
-
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
-
getType
Gets the type reference for item lists.- Returns:
- type reference for item lists
-
getListType
protected org.springframework.core.ParameterizedTypeReference<ResponsePageGenerator<P>> getListType()Gets the type reference for a list of item lists.- Returns:
- type reference for a list of item lists
-
getServiceClient
-
getProperties
-