Class ItemChoice

java.lang.Object
com.broadleafcommerce.catalogbrowse.domain.ItemChoice
All Implemented Interfaces:
Priceable, Serializable

public class ItemChoice extends Object implements Serializable, Priceable
Configuration state for DefaultProductOptionType.ITEM_CHOICE.
Author:
Nathan Moore (nathandmoore)
See Also:
  • Constructor Details

    • ItemChoice

      public ItemChoice()
  • Method Details

    • 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 attribute
      value - 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.
    • getSpecificChoices

      public List<SpecificItemChoice> getSpecificChoices()
    • getChoiceKey

      public String getChoiceKey()
      The key used during the validation of cart item's configuration to relate this ItemChoice to one of the cart item's dependent items.
      Returns:
      The key used during the validation of cart item's configuration to relate this ItemChoice to one of the cart item's dependent items.
    • getPricingKey

      public String getPricingKey()
      System-wide unique identifier to configure specific pricing for the choice. Relevant if pricing data is managed in a separate system or data store, like the Broadleaf pricing services.
      Returns:
      a unique key to identify this choice
    • 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 DefaultItemChoiceTargetType of this item choice
      See Also:
    • getDefaultProductInCategory

      public Product getDefaultProductInCategory()
      The default product that can be used when driving customer selections if the targetType is DefaultItemChoiceTargetType.CATEGORY.
      Returns:
      the defaulted selection for this choice if the targetType is DefaultItemChoiceTargetType.CATEGORY, null otherwise or if there is no default selection
    • getDefaultProduct

      public Product getDefaultProduct()
      The default product that can be used when driving customer selections if the targetType is DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS. Can be null.
      Returns:
      the defaulted selection for this choice if the targetType is DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS, null otherwise or if there is no default selection
    • getDefaultVariant

      public Variant getDefaultVariant()
      The default variant that can be used when driving customer selections if the targetType is DefaultItemChoiceTargetType.SPECIFIC_VARIANTS. Can be null.
      Returns:
      the defaulted selection for this choice if the targetType is DefaultItemChoiceTargetType.SPECIFIC_VARIANTS, null otherwise or if there is no default selection
    • getCategory

      public ItemChoiceCategory getCategory()
      The ItemChoiceCategory which the choice will be chosen from by the customer if the getTargetType() is DefaultItemChoiceTargetType.CATEGORY. This will include the products in the category.
      Returns:
      the category from which the choice will be chosen from or {@link null} if getTargetType() is not DefaultItemChoiceTargetType.CATEGORY. This will include the products in the category.
    • getSpecificItemChoice

      public SpecificItemChoice getSpecificItemChoice()
      If the targetType is DefaultItemChoiceTargetType.SPECIFIC_PRODUCT or DefaultItemChoiceTargetType.SPECIFIC_VARIANT this holds the manually selected option that the customer can choose to add on. This also allows for specific override pricing.
      Returns:
      the explicit choice for DefaultItemChoiceTargetType.SPECIFIC_PRODUCT or DefaultItemChoiceTargetType.SPECIFIC_VARIANT value of the targetType
    • getPriceInfo

      public com.broadleafcommerce.pricing.client.domain.PriceInfo getPriceInfo()
      Summary of the pricing information related to the choice.
      Specified by:
      getPriceInfo in interface Priceable
      Returns:
      The PriceInfo on the entity.
    • 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 used during the validation of cart item's configuration to relate this ItemChoice to one of the cart item's dependent items.
      Parameters:
      choiceKey - The key used during the validation of cart item's configuration to relate this ItemChoice to one of the cart item's dependent items.
    • setPricingKey

      public void setPricingKey(String pricingKey)
      System-wide unique identifier to configure specific pricing for the choice. Relevant if pricing data is managed in a separate system or data store, like the Broadleaf pricing services.
      Parameters:
      pricingKey - a unique key to identify this choice (usually a UUID)
    • 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:
      targetType - the DefaultItemChoiceTargetType of this item choice
      See Also:
    • setDefaultProductInCategory

      public void setDefaultProductInCategory(Product defaultProductInCategory)
      The default product that can be used when driving customer selections if the targetType is DefaultItemChoiceTargetType.CATEGORY.
      Parameters:
      defaultProduct - the default product that is automatically selected when the targetType is DefaultItemChoiceTargetType.CATEGORY. Should come from within the category
    • setDefaultProduct

      public void setDefaultProduct(Product defaultProduct)
      The default product that can be used when driving customer selections if the targetType is DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS. Can be null.
      Parameters:
      defaultProduct - the default product that is automatically selected when the targetType is { DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS. Should come from the specific set of products in specificChoices
    • setDefaultVariant

      public void setDefaultVariant(Variant defaultVariant)
      The default variant that can be used when driving customer selections if the targetType is DefaultItemChoiceTargetType.SPECIFIC_VARIANTS. Can be null.
      Parameters:
      defaultVariant - the default variant that is automatically selected when the targetType is DefaultItemChoiceTargetType.SPECIFIC_VARIANTS. Should come from the explicit set of variants in specificChoices
    • setCategory

      public void setCategory(ItemChoiceCategory category)
      The ItemChoiceCategory which the choice will be chosen from by the customer if the getTargetType() is DefaultItemChoiceTargetType.CATEGORY. This will include the products in the category.
      Parameters:
      category - the category from which the choice will be chosen from
    • setSpecificChoices

      public void setSpecificChoices(List<SpecificItemChoice> specificChoices)
      If the targetType is DefaultItemChoiceTargetType.SPECIFIC_PRODUCTS or DefaultItemChoiceTargetType.SPECIFIC_VARIANTS this 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 choice
    • setSpecificItemChoice

      public void setSpecificItemChoice(SpecificItemChoice specificItemChoice)
      If the targetType is DefaultItemChoiceTargetType.SPECIFIC_PRODUCT or DefaultItemChoiceTargetType.SPECIFIC_VARIANT this holds the manually selected option that the customer can choose to add on. This also allows for specific override pricing.
      Parameters:
      specificChoice - manually selected option for the user to choose to add on
    • setPriceInfo

      public void setPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)
      Summary of the pricing information related to the choice.
      Specified by:
      setPriceInfo in interface Priceable
      Parameters:
      priceInfo - The PriceInfo to set.
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Map holding any additional attributes passed in the request not matching any defined properties.
    • equals

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

      protected boolean canEqual(Object other)
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object