Class ItemChoice
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.domain.ItemChoice
-
- All Implemented Interfaces:
Serializable
public class ItemChoice extends Object implements Serializable
Configuration state forProductOptionType.ITEM_CHOICE.- Author:
- Chad Harchar (charchar)
- See Also:
ProductOption, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ItemChoice()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(String name, Object value)Takes in any additional attributes passed in the request not matching any defined properties.protected booleancanEqual(Object other)booleanequals(Object o)com.broadleafcommerce.cart.client.domain.AdditionalItemPricinggetAdditionalItemPricing()Map<String,Object>getAttribute()Return any additional attributes passed in the request not matching any defined properties.Map<String,Object>getAttributes()Map holding any additional attributes passed in the request not matching any defined properties.CategorygetCategory()TheCategorywhich the add-on will be chosen from by the customer if theselectionisItemChoiceTargetType.CATEGORY.StringgetChoiceKey()The key to use to relate to thisItemChoicewhen configuring cart items.IntegergetMaximumQuantity()The maximum amount of this item that a customer can purchase at a time.IntegergetMinimumQuantity()The minimum amount of the item that a customer must purchase.javax.money.MonetaryAmountgetOverridePrice()StringgetPricingKey()StringgetPricingTargetType()StringgetSelectionType()Describes restrictions placed on the customer's ability to select items from the targeted set.List<SpecificItemChoice>getSpecificChoices()If theselectionTypeisItemChoiceTargetType.SPECIFIC_PRODUCTSorItemChoiceTargetType.SPECIFIC_VARIANTSthis holds the manually-curated options that the customer can choose from.SpecificItemChoicegetSpecificItemChoice()StringgetTargetType()Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.inthashCode()booleanisDiscountAllowed()Dictates whether or not discounts are allowed to be applied to this add-on.voidsetAdditionalItemPricing(com.broadleafcommerce.cart.client.domain.AdditionalItemPricing additionalItemPricing)voidsetAttributes(Map<String,Object> attributes)Map holding any additional attributes passed in the request not matching any defined properties.voidsetCategory(Category category)TheCategorywhich the add-on will be chosen from by the customer if theselectionisItemChoiceTargetType.CATEGORY.voidsetChoiceKey(String choiceKey)The key to use to relate to thisItemChoicewhen configuring cart items.voidsetDiscountAllowed(boolean discountAllowed)Dictates whether or not discounts are allowed to be applied to this add-on.voidsetMaximumQuantity(Integer maximumQuantity)The maximum amount of this item that a customer can purchase at a time.voidsetMinimumQuantity(Integer minimumQuantity)The minimum amount of the item that a customer must purchase.voidsetOverridePrice(javax.money.MonetaryAmount overridePrice)voidsetPricingKey(String pricingKey)voidsetPricingTargetType(String pricingTargetType)voidsetSelectionType(String selectionType)Describes restrictions placed on the customer's ability to select items from the targeted set.voidsetSpecificChoices(List<SpecificItemChoice> specificChoices)If theselectionTypeisItemChoiceTargetType.SPECIFIC_PRODUCTSorItemChoiceTargetType.SPECIFIC_VARIANTSthis holds the manually-curated options that the customer can choose from.voidsetSpecificItemChoice(SpecificItemChoice specificItemChoice)voidsetTargetType(String targetType)Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.StringtoString()
-
-
-
Method Detail
-
addAttribute
public void addAttribute(String name, Object value)
Takes in any additional attributes passed in the request not matching any defined properties.- Parameters:
name- Name of the additional attributevalue- Value of the additional attribute
-
getAttribute
public Map<String,Object> getAttribute()
Return any additional attributes passed in the request not matching any defined properties.- Returns:
- any additional attributes passed in the request not matching any defined properties.
-
getChoiceKey
public String getChoiceKey()
The key to use to relate to thisItemChoicewhen configuring cart items.- Returns:
- The key to use to relate to this
ItemChoicewhen configuring cart items.
-
getTargetType
public String getTargetType()
Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.- Returns:
- the
ItemChoiceTargetTypeof this add-on - See Also:
ItemChoiceTargetType
-
getSelectionType
public String getSelectionType()
Describes restrictions placed on the customer's ability to select items from the targeted set. Generally, this is a restriction on how many choices can be selected for a single add-to-cart request and, potentially, how quantity is distributed among multiple selected choices.- Returns:
- the
ItemChoiceSelectionTypeof this item choice - See Also:
ItemChoiceSelectionType
-
getMaximumQuantity
public Integer getMaximumQuantity()
The maximum amount of this item that a customer can purchase at a time. If null, this would allow a customer to specify their own quantity for how many of these items they can add to the cart.- Returns:
- the maximum quantity of the add-on's target product(s) that can be added
-
getMinimumQuantity
public Integer getMinimumQuantity()
The minimum amount of the item that a customer must purchase. The minimum and maximum should never be the same as this domain would be better represented as anIncludedProduct.- Returns:
- the minimum quantity of the add-on's target product(s)
-
isDiscountAllowed
public boolean isDiscountAllowed()
Dictates whether or not discounts are allowed to be applied to this add-on.- Returns:
- true if discounts are allowed to be applied to this add-on, false otherwise
-
getAdditionalItemPricing
public com.broadleafcommerce.cart.client.domain.AdditionalItemPricing getAdditionalItemPricing()
-
getCategory
public Category getCategory()
TheCategorywhich the add-on will be chosen from by the customer if theselectionisItemChoiceTargetType.CATEGORY.- Returns:
- the category from which the add-on will be chosen from or {@link null} if
getSelectionType()is notItemChoiceTargetType.CATEGORY
-
getSpecificChoices
public List<SpecificItemChoice> getSpecificChoices()
If theselectionTypeisItemChoiceTargetType.SPECIFIC_PRODUCTSorItemChoiceTargetType.SPECIFIC_VARIANTSthis holds the manually-curated options that the customer can choose from. This also allows for specific override pricing on an item-by-item basis- Returns:
- the explicit choices for
ItemChoiceTargetType.SPECIFIC_PRODUCTSorItemChoiceTargetType.SPECIFIC_VARIANTSvalue of theselectionType
-
getSpecificItemChoice
public SpecificItemChoice getSpecificItemChoice()
-
getAttributes
public Map<String,Object> getAttributes()
Map holding any additional attributes passed in the request not matching any defined properties.
-
setChoiceKey
public void setChoiceKey(String choiceKey)
The key to use to relate to thisItemChoicewhen configuring cart items.- Parameters:
choiceKey- The key to use to relate to thisItemChoicewhen configuring cart items.
-
setTargetType
public void setTargetType(String targetType)
Identifies the type of items that a customer can choose from, whether specific products, specific variants, or products from a specific category.- Parameters:
type- theItemChoiceTargetTypeof this add-on- See Also:
ItemChoiceTargetType
-
setSelectionType
public void setSelectionType(String selectionType)
Describes restrictions placed on the customer's ability to select items from the targeted set. Generally, this is a restriction on how many choices can be selected for a single add-to-cart request and, potentially, how quantity is distributed among multiple selected choices.- Parameters:
selectionType- theItemChoiceSelectionTypeof this item choice- See Also:
ItemChoiceSelectionType
-
setMaximumQuantity
public void setMaximumQuantity(Integer maximumQuantity)
The maximum amount of this item that a customer can purchase at a time. If null, this would allow a customer to specify their own quantity for how many of these items they can add to the cart.- Parameters:
maximumQuantity- the maximum quantity of the add-on's target product(s) that can be added
-
setMinimumQuantity
public void setMinimumQuantity(Integer minimumQuantity)
The minimum amount of the item that a customer must purchase. The minimum and maximum should never be the same as this domain would be better represented as anIncludedProduct.- Parameters:
minimumQuantity- the minimum quantity of the add-on's target product(s)
-
setDiscountAllowed
public void setDiscountAllowed(boolean discountAllowed)
Dictates whether or not discounts are allowed to be applied to this add-on.- Parameters:
discountAllowed- true if discounts are allowed to be applied to this add-on, false otherwise
-
setAdditionalItemPricing
public void setAdditionalItemPricing(com.broadleafcommerce.cart.client.domain.AdditionalItemPricing additionalItemPricing)
-
setCategory
public void setCategory(Category category)
TheCategorywhich the add-on will be chosen from by the customer if theselectionisItemChoiceTargetType.CATEGORY.- Parameters:
category- the category from which the add-on will be chosen from
-
setSpecificChoices
public void setSpecificChoices(List<SpecificItemChoice> specificChoices)
If theselectionTypeisItemChoiceTargetType.SPECIFIC_PRODUCTSorItemChoiceTargetType.SPECIFIC_VARIANTSthis holds the manually-curated options that the customer can choose from. This also allows for specific override pricing on an item-by-item basis- Parameters:
specificChoices- manually-curated options for the user to choose from for this addon
-
setSpecificItemChoice
public void setSpecificItemChoice(SpecificItemChoice specificItemChoice)
-
setAttributes
public void setAttributes(Map<String,Object> attributes)
Map holding any additional attributes passed in the request not matching any defined properties.
-
canEqual
protected boolean canEqual(Object other)
-
getOverridePrice
public javax.money.MonetaryAmount getOverridePrice()
-
getPricingKey
public String getPricingKey()
-
getPricingTargetType
public String getPricingTargetType()
-
setOverridePrice
public void setOverridePrice(javax.money.MonetaryAmount overridePrice)
-
setPricingKey
public void setPricingKey(String pricingKey)
-
setPricingTargetType
public void setPricingTargetType(String pricingTargetType)
-
-