java.lang.Object
com.broadleafcommerce.cartoperation.web.endpoint.domain.CartModifyingRequest
com.broadleafcommerce.cartoperation.web.endpoint.domain.AddItemRequest
All Implemented Interfaces:
CartVersionedRequest, Serializable

public class AddItemRequest extends CartModifyingRequest implements Serializable
A request DTO for adding an item to a cart. This is passed through CartOperationService.addItemToCart(Cart, AddItemRequest, boolean, ContextInfo) and is used to inform the creation of a CartItem.
Author:
Chad Harchar (charchar)
See Also:
  • Constructor Details

    • AddItemRequest

      public AddItemRequest()
  • Method Details

    • getVariantId

      public String getVariantId()
      The id of the variant for this add item request. Used to retrieve variant information for the cart item.
      Returns:
      The id of the variant for this add item request. Used to retrieve variant information for the cart item.
    • getProductId

      public String getProductId()
      The id of the product for this add item request. Used to retrieve product information for the cart item.
      Returns:
      The id of the product for this add item request. Used to retrieve product information for the cart item.
    • getSku

      public String getSku()
      The SKU code for the item (e.g., Product or Variant).
      Returns:
      SKU code for the item
    • getQuantity

      public int getQuantity()
      The amount of this item to be added to the Cart.
      Returns:
      The amount of this item to be added to the Cart.
    • getCurrency

      @Deprecated public javax.money.CurrencyUnit getCurrency()
      Deprecated.
      in favor of using PriceCartRequest for creating or pricing a cart.
    • getLocale

      @Deprecated public Locale getLocale()
      Deprecated.
      in favor of using PriceCartRequest for creating or pricing a cart.
    • getItemAttributes

      public Map<String,Object> getItemAttributes()
      Miscellaneous attributes that should be copied to the CartItem.getAttributes() for this request.
      Returns:
      Miscellaneous attributes that should be copied to the CartItem.getAttributes() for this request.
    • getItemInternalAttributes

      public Map<String,Object> getItemInternalAttributes()
      Miscellaneous internal attributes that should be copied to the CartItem.getInternalAttributes() for this request.
      Returns:
      Miscellaneous internal attributes that should be copied to the CartItem.getInternalAttributes() for this request.
    • getItemAttributeChoices

      public Map<String,String> getItemAttributeChoices()
      Attribute choices that should be copied to CartItem.getAttributeChoices() for this request.
      Returns:
      Attribute choices that should be copied to CartItem.getAttributeChoices() for this request.
    • getCartAttributes

      public Map<String,Object> getCartAttributes()
      Attributes that should be copied to the Cart.getAttributes() for this request.
      Returns:
      Attributes that should be copied to the Cart.getAttributes() for this request.
    • getDependentCartItems

      public List<AddItemRequest> getDependentCartItems()
      A list of additional AddItemRequests that should be processed as dependent items of the resulting parent item of this current AddItemRequest.
      Returns:
      A list of additional AddItemRequests that should be processed as dependent items of the resulting parent item of this current AddItemRequest.
    • getItemChoiceKey

      public String getItemChoiceKey()
      If this AddItemRequest is one within getDependentCartItems(), this is the key to use to relate to this CartItem to a configured product item choice.
      Returns:
      The key to use to relate to this CartItem to a configured product item choice.
    • getMerchandisingContext

      public String getMerchandisingContext()
      The value that should be mapped to CartItem.getMerchandisingContext(). This holds the selector or merchandising product's id.
      Returns:
      The context of the item signifying where it's added from
    • getAdditionalAttributes

      public Map<String,Object> getAdditionalAttributes()
      Miscellaneous attributes that can be set to this request in order to inform business logic for adding a CartItem.
      Returns:
      Miscellaneous attributes that can be set to this request in order to inform business logic for adding a CartItem.
    • setVariantId

      public void setVariantId(String variantId)
      The id of the variant for this add item request. Used to retrieve variant information for the cart item.
      Parameters:
      variantId - The id of the variant for this add item request. Used to retrieve variant information for the cart item.
    • setProductId

      public void setProductId(String productId)
      The id of the product for this add item request. Used to retrieve product information for the cart item.
      Parameters:
      productId - The id of the product for this add item request. Used to retrieve product information for the cart item.
    • setSku

      public void setSku(String sku)
      The SKU code for the item (e.g., Product or Variant).
      Parameters:
      sku - SKU code for the item
    • setQuantity

      public void setQuantity(int quantity)
      The amount of this item to be added to the Cart.
      Parameters:
      quantity - The amount of this item to be added to the Cart.
    • setCurrency

      @Deprecated public void setCurrency(javax.money.CurrencyUnit currency)
      Deprecated.
      in favor of using PriceCartRequest for creating or pricing a cart.
    • setLocale

      @Deprecated public void setLocale(Locale locale)
      Deprecated.
      in favor of using PriceCartRequest for creating or pricing a cart.
    • setItemAttributes

      public void setItemAttributes(Map<String,Object> itemAttributes)
      Miscellaneous attributes that should be copied to the CartItem.getAttributes() for this request.
      Parameters:
      itemAttributes - Miscellaneous attributes that should be copied to the CartItem.getAttributes() for this request.
    • setItemInternalAttributes

      public void setItemInternalAttributes(Map<String,Object> itemInternalAttributes)
      Miscellaneous internal attributes that should be copied to the CartItem.getInternalAttributes() for this request.
      Parameters:
      itemAttributes - Miscellaneous internal attributes that should be copied to the CartItem.getInternalAttributes() for this request.
    • setItemAttributeChoices

      public void setItemAttributeChoices(Map<String,String> itemAttributeChoices)
      Attribute choices that should be copied to CartItem.getAttributeChoices() for this request.
      Parameters:
      itemAttributeChoices - Attribute choices that should be copied to CartItem.getAttributeChoices() for this request.
    • setCartAttributes

      public void setCartAttributes(Map<String,Object> cartAttributes)
      Attributes that should be copied to the Cart.getAttributes() for this request.
      Parameters:
      cartAttributes - Attributes that should be copied to the Cart.getAttributes() for this request.
    • setDependentCartItems

      public void setDependentCartItems(List<AddItemRequest> dependentCartItems)
      A list of additional AddItemRequests that should be processed as dependent items of the resulting parent item of this current AddItemRequest.
      Parameters:
      dependentCartItems - A list of additional AddItemRequests that should be processed as dependent items of the resulting parent item of this current AddItemRequest.
    • setItemChoiceKey

      public void setItemChoiceKey(String itemChoiceKey)
      If this AddItemRequest is one within getDependentCartItems(), this is the key to use to relate to this CartItem to a configured product item choice.
      Parameters:
      itemChoiceKey - The key to use to relate to this CartItem to a configured product item choice.
    • setMerchandisingContext

      public void setMerchandisingContext(String merchandisingContext)
      The value that should be mapped to CartItem.getMerchandisingContext(). This holds the selector or merchandising product's id.
      Parameters:
      merchandisingContext - The context of the item signifying where it's added from
    • setAdditionalAttributes

      public void setAdditionalAttributes(Map<String,Object> additionalAttributes)
      Miscellaneous attributes that can be set to this request in order to inform business logic for adding a CartItem.
      Parameters:
      additionalAttributes - Miscellaneous attributes that can be set to this request in order to inform business logic for adding a CartItem.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class CartModifyingRequest
    • canEqual

      protected boolean canEqual(Object other)
      Overrides:
      canEqual in class CartModifyingRequest
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class CartModifyingRequest
    • toString

      public String toString()
      Overrides:
      toString in class CartModifyingRequest