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 aPriceContext
. These criteria include:- a date range for when this price list should be active,
- a currency code
- a set of specific
UserTarget
s - 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 individualPriceableTarget
s or use a broader, generalizedPriceModifier
that operates on base priceable fields or prices provided by other price lists. (For example, aPriceListType.SALE
price list can modify the price provided by aPriceListType.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PriceList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
int
compareTo(PriceList o)
Compares first by priority then by id if equal.boolean
equals(Object o)
Instant
getActiveEndDate()
Defines the ending time for which this price list is activeInstant
getActiveStartDate()
Defines the beginning time for which this price list is active.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
getContextState()
A subset ofTracking
information to expose the context state for this object.javax.money.CurrencyUnit
getCurrency()
The currency to which this price list applies.String
getId()
Set<String>
getModifiableFields()
Fields that modifiers can modify for this price list.String
getName()
String
getPriceContextCriteria()
String expression used to determine whether a price list applies to aPriceContext
.PriceModifier
getPriceModifier()
Optionally describes how this price list will modify existing prices.Integer
getPriority()
When multiple price lists match aPriceContext
, the price list with the higher priority wins out, where smaller integer values represent higher priorities.String
getStoreRef()
Key to external system indicating that this PriceList is specific to a store.String
getType()
Set<UserTarget>
getUserTargets()
Specific users that this price list targets.String
getVendorRef()
Key to external system indicating that this PriceList is specific to a vendor.int
hashCode()
boolean
isAllowVendorsToAddPriceData()
A flag determining whether vendors are allowed to view this price list or add vendor price data to it.boolean
isUseModifier()
Whether this price list uses a price modifier instead of price datavoid
setActiveEndDate(Instant activeEndDate)
Defines the ending time for which this price list is activevoid
setActiveStartDate(Instant activeStartDate)
Defines the beginning time for which this price list is active.void
setAllowVendorsToAddPriceData(boolean allowVendorsToAddPriceData)
A flag determining whether vendors are allowed to view this price list or add vendor price data to it.void
setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
A subset ofTracking
information to expose the context state for this object.void
setCurrency(javax.money.CurrencyUnit currency)
The currency to which this price list applies.void
setId(String id)
void
setModifiableFields(Set<String> modifiableFields)
Fields that modifiers can modify for this price list.void
setName(String name)
void
setPriceContextCriteria(String priceContextCriteria)
String expression used to determine whether a price list applies to aPriceContext
.void
setPriceModifier(PriceModifier priceModifier)
Optionally describes how this price list will modify existing prices.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.void
setStoreRef(String storeRef)
Key to external system indicating that this PriceList is specific to a store.void
setType(String type)
void
setUseModifier(boolean useModifier)
Whether this price list uses a price modifier instead of price datavoid
setUserTargets(Set<UserTarget> userTargets)
Specific users that this price list targets.void
setVendorRef(String vendorRef)
Key to external system indicating that this PriceList is specific to a vendor.String
toString()
-
-
-
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:
compareTo
in 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.basePrice
PriceableFieldProperties.baseCost
- Standard Price List price (standardPrice)
-
Contract Price Lists:
PriceableFieldProperties.basePrice
PriceableFieldProperties.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 ofTracking
information to expose the context state for this object.- Specified by:
getContextState
in interfacecom.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:
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.basePrice
PriceableFieldProperties.baseCost
- Standard Price List price (standardPrice)
-
Contract Price Lists:
PriceableFieldProperties.basePrice
PriceableFieldProperties.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 ofTracking
information to expose the context state for this object.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- a subset ofTracking
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.
-
canEqual
protected boolean canEqual(Object other)
-
-