Class SpecificItemChoice

java.lang.Object
com.broadleafcommerce.subscriptionoperation.domain.SpecificItemChoice
All Implemented Interfaces:
Serializable

public class SpecificItemChoice extends Object implements Serializable
When a ItemChoice is determined to be a DefaultItemChoiceTargetType#SPECIFIC_PRODUCTS or DefaultItemChoiceTargetType#SPECIFIC_VARIANTS, this holds the relationship that the customer should select from
Author:
Phillip Verheyden (phillipuniverse)
See Also:
  • Constructor Details

    • SpecificItemChoice

      public SpecificItemChoice()
  • Method Details

    • getType

      public String getType()
      Whether or not this item holds a product or a variant that the customer can select from
      Returns:
      the type of this addon item
      See Also:
    • getProduct

      public Product getProduct()
      If the type is DefaultSpecificItemChoiceType.PRODUCT this holds the product for this choice
      Returns:
      the product representing this choice, or null if type is not DefaultSpecificItemChoiceType.PRODUCT
    • getVariant

      public Variant getVariant()
      If the type is DefaultSpecificItemChoiceType.VARIANT this holds the variant for this choice
      Returns:
      the variant representing this choice, or null if type is not DefaultSpecificItemChoiceType.VARIANT
      See Also:
      • variantParentProductId
    • getVariantParentProductId

      public String getVariantParentProductId()
      This field contains the id of the parent product of the specified variant if the type is DefaultSpecificItemChoiceType.VARIANT.

      This field is necessary because variants are a sub-resource of product and thus API callers cannot fetch them purely by variant id alone.

      Returns:
      the id of the parent product of the variant
      See Also:
      • variant
    • getNameOverride

      public String getNameOverride()
      When displaying this choice to a customer, an optional override for the display the customer should see. If {@link null}, the product or variant name is used for display
      Returns:
      the override of the display of the name to the customer. If null, the variant or product name should be used
    • 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
    • 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. Only relevant when ItemChoice.getOverridePrice() is null.
      Returns:
      a unique key to identify this choice, null if there is no external system this should be linked to for pricing data
    • setType

      public void setType(String type)
      Whether or not this item holds a product or a variant that the customer can select from
      Parameters:
      type - the type of item this is, usually from DefaultSpecificItemChoiceType
      See Also:
    • setProduct

      public void setProduct(Product product)
      If the type is DefaultSpecificItemChoiceType.PRODUCT this holds the product for this choice
      Parameters:
      product - the product representing this choice
    • setVariant

      public void setVariant(Variant variant)
      If the type is DefaultSpecificItemChoiceType.VARIANT this holds the variant for this choice
      Parameters:
      variant - the variant representing this choice
      See Also:
      • variantParentProductId
    • setVariantParentProductId

      public void setVariantParentProductId(String variantParentProductId)
      This field contains the id of the parent product of the specified variant if the type is DefaultSpecificItemChoiceType.VARIANT.

      This field is necessary because variants are a sub-resource of product and thus API callers cannot fetch them purely by variant id alone.

      Parameters:
      variantParentProductId - the id of the parent product of the variant
      See Also:
      • variant
    • setNameOverride

      public void setNameOverride(String nameOverride)
      When displaying this choice to a customer, an optional override for the display the customer should see. If {@link null}, the product or variant name is used for display
      Parameters:
      nameOverride - what the customer should see for this choice
    • 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
    • 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. Only relevant when ItemChoice.getOverridePrice() is null.
      Parameters:
      pricingKey - a unique key to identify this choice (usually a UUID)
    • 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