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
-
-
Constructor Summary
Constructors Constructor Description ExternalItemListProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalCartProperties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pcreate(P itemList, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Creates an item list.voiddelete(@NonNull String listId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Deletes an item list by ID.voiddelete(@NonNull Set<String> listIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Deletes multiple item lists by IDs.protected org.springframework.web.util.UriComponentsBuildergetBaseUri()Gets the base URI common to all requests this provider will make.protected org.springframework.core.ParameterizedTypeReference<ResponsePageGenerator<P>>getListType()Gets the type reference for a list of item lists.protected ExternalCartPropertiesgetProperties()protected StringgetServiceClient()protected org.springframework.core.ParameterizedTypeReference<P>getType()Gets the type reference for item lists.PreadById(@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.PreadById(@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.Preplace(P itemList, @NonNull String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Replaces an item list.Pupdate(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
executeRequest, getHeaders, getObjectMapper, getTypeFactory, getWebClient, pageableToParams, uriVars
-
-
-
-
Constructor Detail
-
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 Detail
-
readById
public P readById(@NonNull @NonNull String listId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Description copied from interface:ItemListProviderReads a specific item list by its ID.- Specified by:
readByIdin 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:ItemListProviderReads a specific item list by its ID and optionally hydrates the items.- Specified by:
readByIdin 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:ItemListProviderReads specific item lists by their IDs.- Specified by:
readByIdsin 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:ItemListProviderCreates an item list.- Specified by:
createin 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:ItemListProviderReplaces an item list.- Specified by:
replacein 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:ItemListProviderUpdates an item list.- Specified by:
updatein 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:ItemListProviderDeletes an item list by ID.- Specified by:
deletein 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:ItemListProviderDeletes multiple item lists by IDs.- Specified by:
deletein 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
protected org.springframework.core.ParameterizedTypeReference<P> 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
protected String getServiceClient()
-
getProperties
protected ExternalCartProperties getProperties()
-
-