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
PriceableTargetsthe applicability of which is determined by a set of criteria targeting information provided in aPriceContext. 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
PriceContextfields
Price lists can either aggregate
PriceDatafor individualPriceableTargets or use a broader, generalizedPriceModifierthat operates on base priceable fields or prices provided by other price lists. (For example, aPriceListType.SALEprice list can modify the price provided by aPriceListType.STANDARDprice 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.STANDARDprice lists.- Author:
- Nathan Moore (nathanmoore)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PriceList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)intcompareTo(PriceList o)Compares first by priority then by id if equal.booleanequals(Object o)InstantgetActiveEndDate()Defines the ending time for which this price list is activeInstantgetActiveStartDate()Defines the beginning time for which this price list is active.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStategetContextState()A subset ofTrackinginformation to expose the context state for this object.javax.money.CurrencyUnitgetCurrency()The currency to which this price list applies.StringgetId()Set<String>getModifiableFields()Fields that modifiers can modify for this price list.StringgetName()StringgetPriceContextCriteria()String expression used to determine whether a price list applies to aPriceContext.PriceModifiergetPriceModifier()Optionally describes how this price list will modify existing prices.IntegergetPriority()When multiple price lists match aPriceContext, the price list with the higher priority wins out, where smaller integer values represent higher priorities.StringgetStoreRef()Key to external system indicating that this PriceList is specific to a store.StringgetType()Set<UserTarget>getUserTargets()Specific users that this price list targets.StringgetVendorRef()Key to external system indicating that this PriceList is specific to a vendor.inthashCode()booleanisAllowVendorsToAddPriceData()A flag determining whether vendors are allowed to view this price list or add vendor price data to it.booleanisUseModifier()Whether this price list uses a price modifier instead of price datavoidsetActiveEndDate(Instant activeEndDate)Defines the ending time for which this price list is activevoidsetActiveStartDate(Instant activeStartDate)Defines the beginning time for which this price list is active.voidsetAllowVendorsToAddPriceData(boolean allowVendorsToAddPriceData)A flag determining whether vendors are allowed to view this price list or add vendor price data to it.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)A subset ofTrackinginformation to expose the context state for this object.voidsetCurrency(javax.money.CurrencyUnit currency)The currency to which this price list applies.voidsetId(String id)voidsetModifiableFields(Set<String> modifiableFields)Fields that modifiers can modify for this price list.voidsetName(String name)voidsetPriceContextCriteria(String priceContextCriteria)String expression used to determine whether a price list applies to aPriceContext.voidsetPriceModifier(PriceModifier priceModifier)Optionally describes how this price list will modify existing prices.voidsetPriority(Integer priority)When multiple price lists match aPriceContext, the price list with the higher priority wins out, where smaller integer values represent higher priorities.voidsetStoreRef(String storeRef)Key to external system indicating that this PriceList is specific to a store.voidsetType(String type)voidsetUseModifier(boolean useModifier)Whether this price list uses a price modifier instead of price datavoidsetUserTargets(Set<UserTarget> userTargets)Specific users that this price list targets.voidsetVendorRef(String vendorRef)Key to external system indicating that this PriceList is specific to a vendor.StringtoString()
-
-
-
Method Detail
-
compareTo
public int compareTo(@NonNull PriceList o)Compares first by priority then by id if equal. Null is greater than not null.- Specified by:
compareToin interfaceComparable<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:
for examples
-
getPriority
public Integer getPriority()
When multiple price lists match aPriceContext, 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 aPriceContext. This could be a string representation of aSpelExpression, 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:
- Standard Price Lists:
-
Sale Price Lists:
PriceableFieldProperties.basePricePriceableFieldProperties.baseCost- Standard Price List price (standardPrice)
-
Contract Price Lists:
PriceableFieldProperties.basePricePriceableFieldProperties.baseCost- Standard Price List price (standardPrice)
- Sale Price List price (salePrice)
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
A subset ofTrackinginformation to expose the context state for this object.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
- a subset of
Trackinginformation 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:
for examples
-
setPriority
public void setPriority(Integer priority)
When multiple price lists match aPriceContext, 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 aPriceContext. This could be a string representation of aSpelExpression, 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:
- Standard Price Lists:
-
Sale Price Lists:
PriceableFieldProperties.basePricePriceableFieldProperties.baseCost- Standard Price List price (standardPrice)
-
Contract Price Lists:
PriceableFieldProperties.basePricePriceableFieldProperties.baseCost- Standard Price List price (standardPrice)
- Sale Price List price (salePrice)
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
A subset ofTrackinginformation to expose the context state for this object.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
contextState- a subset ofTrackinginformation 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.
-
canEqual
protected boolean canEqual(Object other)
-
-