Class AddItemRequest
- 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 throughCartOperationService.addItemToCart(Cart, AddItemRequest, boolean, ContextInfo)
and is used to inform the creation of aCartItem
.- Author:
- Chad Harchar (charchar)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AddItemRequest()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
Map<String,Object>
getAdditionalAttributes()
Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem
.Map<String,Object>
getCartAttributes()
Attributes that should be copied to theCart.getAttributes()
for this request.javax.money.CurrencyUnit
getCurrency()
Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.List<AddItemRequest>
getDependentCartItems()
A list of additionalAddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.Map<String,String>
getItemAttributeChoices()
Attribute choices that should be copied toCartItem.getAttributeChoices()
for this request.Map<String,Object>
getItemAttributes()
Miscellaneous attributes that should be copied to theCartItem.getAttributes()
for this request.String
getItemChoiceKey()
If thisAddItemRequest
is one withingetDependentCartItems()
, this is the key to use to relate to thisCartItem
to a configured product item choice.Map<String,Object>
getItemInternalAttributes()
Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()
for this request.Locale
getLocale()
Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.String
getMerchandisingContext()
The value that should be mapped toCartItem.getMerchandisingContext()
.String
getProductId()
The id of the product for this add item request.int
getQuantity()
The amount of this item to be added to theCart
.String
getSku()
The SKU code for the item (e.g., Product or Variant).String
getVariantId()
The id of the variant for this add item request.int
hashCode()
void
setAdditionalAttributes(Map<String,Object> additionalAttributes)
Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem
.void
setCartAttributes(Map<String,Object> cartAttributes)
Attributes that should be copied to theCart.getAttributes()
for this request.void
setCurrency(javax.money.CurrencyUnit currency)
Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.void
setDependentCartItems(List<AddItemRequest> dependentCartItems)
A list of additionalAddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.void
setItemAttributeChoices(Map<String,String> itemAttributeChoices)
Attribute choices that should be copied toCartItem.getAttributeChoices()
for this request.void
setItemAttributes(Map<String,Object> itemAttributes)
Miscellaneous attributes that should be copied to theCartItem.getAttributes()
for this request.void
setItemChoiceKey(String itemChoiceKey)
If thisAddItemRequest
is one withingetDependentCartItems()
, this is the key to use to relate to thisCartItem
to a configured product item choice.void
setItemInternalAttributes(Map<String,Object> itemInternalAttributes)
Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()
for this request.void
setLocale(Locale locale)
Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.void
setMerchandisingContext(String merchandisingContext)
The value that should be mapped toCartItem.getMerchandisingContext()
.void
setProductId(String productId)
The id of the product for this add item request.void
setQuantity(int quantity)
The amount of this item to be added to theCart
.void
setSku(String sku)
The SKU code for the item (e.g., Product or Variant).void
setVariantId(String variantId)
The id of the variant for this add item request.String
toString()
-
Methods inherited from class com.broadleafcommerce.cartoperation.web.endpoint.domain.CartModifyingRequest
getCartVersion, getVersion, setCartVersion, setVersion
-
-
-
-
Method Detail
-
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 theCart
.- Returns:
- The amount of this item to be added to the
Cart
.
-
getCurrency
@Deprecated public javax.money.CurrencyUnit getCurrency()
Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.
-
getLocale
@Deprecated public Locale getLocale()
Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.
-
getItemAttributes
public Map<String,Object> getItemAttributes()
Miscellaneous attributes that should be copied to theCartItem.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 theCartItem.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 toCartItem.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 theCart.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 additionalAddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.- Returns:
- A list of additional
AddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.
-
getItemChoiceKey
public String getItemChoiceKey()
If thisAddItemRequest
is one withingetDependentCartItems()
, this is the key to use to relate to thisCartItem
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 toCartItem.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 aCartItem
.- 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 theCart
.- Parameters:
quantity
- The amount of this item to be added to theCart
.
-
setCurrency
@Deprecated public void setCurrency(javax.money.CurrencyUnit currency)
Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.
-
setLocale
@Deprecated public void setLocale(Locale locale)
Deprecated.in favor of usingPriceCartRequest
for creating or pricing a cart.
-
setItemAttributes
public void setItemAttributes(Map<String,Object> itemAttributes)
Miscellaneous attributes that should be copied to theCartItem.getAttributes()
for this request.- Parameters:
itemAttributes
- Miscellaneous attributes that should be copied to theCartItem.getAttributes()
for this request.
-
setItemInternalAttributes
public void setItemInternalAttributes(Map<String,Object> itemInternalAttributes)
Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()
for this request.- Parameters:
itemAttributes
- Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()
for this request.
-
setItemAttributeChoices
public void setItemAttributeChoices(Map<String,String> itemAttributeChoices)
Attribute choices that should be copied toCartItem.getAttributeChoices()
for this request.- Parameters:
itemAttributeChoices
- Attribute choices that should be copied toCartItem.getAttributeChoices()
for this request.
-
setCartAttributes
public void setCartAttributes(Map<String,Object> cartAttributes)
Attributes that should be copied to theCart.getAttributes()
for this request.- Parameters:
cartAttributes
- Attributes that should be copied to theCart.getAttributes()
for this request.
-
setDependentCartItems
public void setDependentCartItems(List<AddItemRequest> dependentCartItems)
A list of additionalAddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.- Parameters:
dependentCartItems
- A list of additionalAddItemRequests
that should be processed as dependent items of the resulting parent item of this currentAddItemRequest
.
-
setItemChoiceKey
public void setItemChoiceKey(String itemChoiceKey)
If thisAddItemRequest
is one withingetDependentCartItems()
, this is the key to use to relate to thisCartItem
to a configured product item choice.- Parameters:
itemChoiceKey
- The key to use to relate to thisCartItem
to a configured product item choice.
-
setMerchandisingContext
public void setMerchandisingContext(String merchandisingContext)
The value that should be mapped toCartItem.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 aCartItem
.- Parameters:
additionalAttributes
- Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem
.
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classCartModifyingRequest
-
canEqual
protected boolean canEqual(Object other)
- Overrides:
canEqual
in classCartModifyingRequest
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classCartModifyingRequest
-
toString
public String toString()
- Overrides:
toString
in classCartModifyingRequest
-
-