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

    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

    Modifier and Type
    Method
    Description
    create(P itemList, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Creates 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 String
     
    protected org.springframework.core.ParameterizedTypeReference<P>
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 interface ItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
      Parameters:
      listId - the ID of the item list to retrieve
      context - 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 interface ItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
      Parameters:
      listId - the ID of the item list to retrieve
      hydrate - if true, causes the items to by hydrated
      context - 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 interface ItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
      Parameters:
      listIds - the IDs of the item lists to retrieve
      filters - additional filters to apply in the query.
      page - the requested page of results from the database
      context - 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 interface ItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
      Parameters:
      itemList - the item list to create
      context - 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 interface ItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
      Parameters:
      itemList - the item list to replace with
      id - the ID of the item list
      context - 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 interface ItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
      Parameters:
      itemList - the item list to update with
      id - the ID of the item list
      context - 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 interface ItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
      Parameters:
      listId - the ID of the item list to delete
      context - 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 interface ItemListProvider<P extends com.broadleafcommerce.cart.client.domain.ItemList>
      Parameters:
      listIds - the list of IDs of the item lists to delete
      context - 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()