Class PriceList

java.lang.Object
com.broadleafcommerce.pricing.domain.PriceList
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware, Serializable, Comparable<PriceList>

public class PriceList extends Object implements Comparable<PriceList>, Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware

Abstraction of an aggregation of prices for PriceableTargets the applicability of which is determined by a set of criteria targeting information provided in a PriceContext. These criteria include:

  • a date range for when this price list should be active,
  • a currency code
  • a set of specific UserTargets
  • Expressions targeting the web request
  • Expressions targeting general user (e.g., customer or account) attributes
  • Generic expression targeting PriceContext fields

Price lists can either aggregate PriceData for individual PriceableTargets or use a broader, generalized PriceModifier that operates on base priceable fields or prices provided by other price lists. (For example, a PriceListType.SALE price list can modify the price provided by a PriceListType.STANDARD price list.)

Some price lists can also be given priority over others of the same price list type. This allows ties to be broken when more than one price list applies to a given price context, primarily used with PriceListType.STANDARD price lists.

Author:
Nathan Moore (nathanmoore)
See Also:
  • Constructor Details

    • PriceList

      public PriceList()
  • Method Details

    • compareTo

      public int compareTo(@NonNull PriceList o)
      Compares first by priority then by id if equal. Null is greater than not null.
      Specified by:
      compareTo in interface Comparable<PriceList>
    • getId

      public String getId()
    • getName

      public String getName()
    • getActiveStartDate

      public Instant getActiveStartDate()
      Defines the beginning time for which this price list is active.
    • getActiveEndDate

      public Instant getActiveEndDate()
      Defines the ending time for which this price list is active
    • getCurrency

      public javax.money.CurrencyUnit getCurrency()
      The currency to which this price list applies.
    • getType

      public String getType()
      See Also:
    • getPriority

      public Integer getPriority()
      When multiple price lists match a PriceContext, the price list with the higher priority wins out, where smaller integer values represent higher priorities. Nulls are implicitly given lower precedence than any other value - they will appear last.
    • getPriceContextCriteria

      public String getPriceContextCriteria()
      String expression used to determine whether a price list applies to a PriceContext. This could be a string representation of a SpelExpression, e.g., name == 'some-name' || id == '1', or that of some other expression language.
    • getUserTargets

      public Set<UserTarget> getUserTargets()
      Specific users that this price list targets. Expects an ID and a type of user. This could include such types as "customer" or "account".
    • isUseModifier

      public boolean isUseModifier()
      Whether this price list uses a price modifier instead of price data
    • getPriceModifier

      public PriceModifier getPriceModifier()
      Optionally describes how this price list will modify existing prices.
    • getModifiableFields

      public Set<String> getModifiableFields()

      Fields that modifiers can modify for this price list.

      Modifiable fields for each type:

    • getContextState

      public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object
    • getVendorRef

      public String getVendorRef()
      Key to external system indicating that this PriceList is specific to a vendor. This can be populated to support security controls based on a vendor based claim.
      Returns:
      the vendor reference
    • getStoreRef

      public String getStoreRef()
      Key to external system indicating that this PriceList is specific to a store. This can be populated to support security controls based on a store based claim.
      Returns:
      the store reference
    • isAllowVendorsToAddPriceData

      public boolean isAllowVendorsToAddPriceData()
      A flag determining whether vendors are allowed to view this price list or add vendor price data to it. This is most relevant to price lists which are themselves not in a vendor but want to control whether vendors can contribute to them.
    • setId

      public void setId(String id)
    • setName

      public void setName(String name)
    • setActiveStartDate

      public void setActiveStartDate(Instant activeStartDate)
      Defines the beginning time for which this price list is active.
    • setActiveEndDate

      public void setActiveEndDate(Instant activeEndDate)
      Defines the ending time for which this price list is active
    • setCurrency

      public void setCurrency(javax.money.CurrencyUnit currency)
      The currency to which this price list applies.
    • setType

      public void setType(String type)
      See Also:
    • setPriority

      public void setPriority(Integer priority)
      When multiple price lists match a PriceContext, the price list with the higher priority wins out, where smaller integer values represent higher priorities. Nulls are implicitly given lower precedence than any other value - they will appear last.
    • setPriceContextCriteria

      public void setPriceContextCriteria(String priceContextCriteria)
      String expression used to determine whether a price list applies to a PriceContext. This could be a string representation of a SpelExpression, e.g., name == 'some-name' || id == '1', or that of some other expression language.
    • setUserTargets

      public void setUserTargets(Set<UserTarget> userTargets)
      Specific users that this price list targets. Expects an ID and a type of user. This could include such types as "customer" or "account".
    • setUseModifier

      public void setUseModifier(boolean useModifier)
      Whether this price list uses a price modifier instead of price data
    • setPriceModifier

      public void setPriceModifier(PriceModifier priceModifier)
      Optionally describes how this price list will modify existing prices.
    • setModifiableFields

      public void setModifiableFields(Set<String> modifiableFields)

      Fields that modifiers can modify for this price list.

      Modifiable fields for each type:

    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this object
    • setVendorRef

      public void setVendorRef(String vendorRef)
      Key to external system indicating that this PriceList is specific to a vendor. This can be populated to support security controls based on a vendor based claim.
      Parameters:
      vendorRef - a reference to a vendor (e.g. vendorId or vendorCode)
    • setStoreRef

      public void setStoreRef(String storeRef)
      Key to external system indicating that this PriceList is specific to a store. This can be populated to support security controls based on a store based claim.
      Parameters:
      storeRef - a reference to a store (e.g. storeId or storeCode)
    • setAllowVendorsToAddPriceData

      public void setAllowVendorsToAddPriceData(boolean allowVendorsToAddPriceData)
      A flag determining whether vendors are allowed to view this price list or add vendor price data to it. This is most relevant to price lists which are themselves not in a vendor but want to control whether vendors can contribute to them.
    • 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