@Entity public class OrderItemImpl extends Object implements OrderItem, Cloneable, AdminMainEntity, CurrencyCodeIdentifiable
| Modifier and Type | Class and Description |
|---|---|
static class |
OrderItemImpl.Presentation |
| Modifier and Type | Field and Description |
|---|---|
protected List<CandidateItemOffer> |
candidateItemOffers |
protected Category |
category |
protected Boolean |
discountsAllowed |
protected GiftWrapOrderItem |
giftWrapOrderItem |
protected Long |
id |
protected Boolean |
itemTaxable |
protected String |
name |
protected Order |
order |
protected List<OrderItemAdjustment> |
orderItemAdjustments |
protected Map<String,OrderItemAttribute> |
orderItemAttributeMap |
protected List<OrderItemPriceDetail> |
orderItemPriceDetails |
protected List<OrderItemQualifier> |
orderItemQualifiers |
protected String |
orderItemType |
protected PersonalMessage |
personalMessage |
protected BigDecimal |
price |
protected int |
quantity |
protected BigDecimal |
retailPrice |
protected Boolean |
retailPriceOverride |
protected BigDecimal |
salePrice |
protected Boolean |
salePriceOverride |
protected BigDecimal |
totalTax |
MAIN_ENTITY_NAME_PROPERTY| Constructor and Description |
|---|
OrderItemImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCandidateItemOffer(CandidateItemOffer candidateItemOffer)
Used by the promotion engine to add offers that might apply to this orderItem.
|
void |
assignFinalPrice()
Used to set the final price of the item and corresponding details.
|
void |
checkCloneable(OrderItem orderItem) |
OrderItem |
clone() |
protected OrderItemType |
convertOrderItemType(String type) |
protected Money |
convertToMoney(BigDecimal amount) |
boolean |
equals(Object obj) |
void |
finalizePrice()
Called by the pricing engine after prices have been computed.
|
Money |
getAdjustmentValue() |
Money |
getAverageAdjustmentValue()
Returns the average unit item adjustments.
|
Money |
getAveragePrice()
Returns the average unit display price for the item.
|
List<CandidateItemOffer> |
getCandidateItemOffers() |
Category |
getCategory() |
String |
getCurrencyCode() |
GiftWrapOrderItem |
getGiftWrapOrderItem() |
Long |
getId()
The unique identifier of this OrderItem
|
boolean |
getIsDiscounted()
Returns true if this item received a discount.
|
boolean |
getIsOnSale()
Default implementation uses
OrderItem.getSalePrice() < OrderItem.getRetailPrice() |
String |
getMainEntityName() |
String |
getName()
Generally copied from the Sku.getName()
|
Order |
getOrder()
Reference back to the containing order.
|
List<OrderItemAdjustment> |
getOrderItemAdjustments()
Returns item level adjustment for versions of Broadleaf Commerce prior to 2.3.0 which replaced
this concept with OrderItemPriceDetail adjustments.
|
Map<String,OrderItemAttribute> |
getOrderItemAttributes()
A list of arbitrary attributes added to this item.
|
List<OrderItemPriceDetail> |
getOrderItemPriceDetails()
Collection of priceDetails for this orderItem.
|
List<OrderItemQualifier> |
getOrderItemQualifiers()
If any quantity of this item was used to qualify for an offer, then this returned list
will indicate the offer and the relevant quantity.
|
OrderItemType |
getOrderItemType() |
PersonalMessage |
getPersonalMessage() |
Money |
getPrice() |
Money |
getPriceBeforeAdjustments(boolean allowSalesPrice)
Returns the unit price of this item.
|
int |
getQuantity()
The quantity of this
OrderItem. |
Money |
getRetailPrice()
The retail price of the item that was added to the
Order at the time that this was added. |
Money |
getSalePrice()
Returns the salePrice for this item.
|
Money |
getTaxablePrice() |
Money |
getTotalAdjustmentValue()
Returns the total for all item level adjustments.
|
Money |
getTotalPrice()
Returns the total price to be paid for this order item including item-level adjustments.
|
Money |
getTotalPriceBeforeAdjustments(boolean allowSalesPrice)
Returns the total price to be paid before adjustments.
|
int |
hashCode() |
boolean |
isDiscountingAllowed()
If true, this item can be discounted..
|
boolean |
isInCategory(String categoryName) |
boolean |
isRetailPriceOverride()
Returns true if the retail price was manually set.
|
boolean |
isSalePriceOverride()
Returns true if the sale price was manually set.
|
boolean |
isSkuActive()
Returns a boolean indicating whether this sku is active.
|
Boolean |
isTaxable()
Returns whether or not this item is taxable.
|
int |
removeAllAdjustments()
Removes all adjustment for this order item and reset the adjustment price.
|
void |
removeAllCandidateItemOffers()
Removes all candidate offers.
|
void |
setCandidateItemOffers(List<CandidateItemOffer> candidateItemOffers) |
void |
setCategory(Category category) |
void |
setDiscountingAllowed(boolean discountsAllowed)
Turns off discount processing for this line item.
|
void |
setGiftWrapOrderItem(GiftWrapOrderItem giftWrapOrderItem) |
void |
setId(Long id)
Sets the unique id of the OrderItem.
|
void |
setName(String name)
Sets the name of this order item.
|
void |
setOrder(Order order)
Sets the order for this orderItem.
|
void |
setOrderItemAdjustments(List<OrderItemAdjustment> orderItemAdjustments) |
void |
setOrderItemAttributes(Map<String,OrderItemAttribute> orderItemAttributes)
Sets the map of order item attributes.
|
void |
setOrderItemPriceDetails(List<OrderItemPriceDetail> orderItemPriceDetails)
Returns the list of orderItem price details.
|
void |
setOrderItemQualifiers(List<OrderItemQualifier> orderItemQualifiers)
Sets the list of OrderItemQualifiers
|
void |
setOrderItemType(OrderItemType orderItemType) |
void |
setPersonalMessage(PersonalMessage personalMessage) |
void |
setPrice(Money finalPrice) |
void |
setQuantity(int quantity)
Sets the quantity of this item
|
void |
setRetailPrice(Money retailPrice)
Calling this method will manually set the retailPrice.
|
void |
setRetailPriceOverride(boolean override)
Indicates that the retail price was manually set.
|
void |
setSalePrice(Money salePrice)
Calling this method will manually set the salePrice.
|
void |
setSalePriceOverride(boolean override)
Indicates that the sale price was manually set.
|
void |
setTaxable(Boolean taxable)
Sets whether or not this item is taxable.
|
boolean |
updateSaleAndRetailPrices()
Used to reset the base price of the item that the pricing engine uses.
|
protected Long id
protected Category category
protected Order order
protected BigDecimal price
protected int quantity
protected BigDecimal retailPrice
protected BigDecimal salePrice
protected String name
protected PersonalMessage personalMessage
protected GiftWrapOrderItem giftWrapOrderItem
protected List<OrderItemAdjustment> orderItemAdjustments
protected List<OrderItemQualifier> orderItemQualifiers
protected List<CandidateItemOffer> candidateItemOffers
protected List<OrderItemPriceDetail> orderItemPriceDetails
protected String orderItemType
protected Boolean itemTaxable
protected Boolean retailPriceOverride
protected Boolean salePriceOverride
protected Boolean discountsAllowed
protected Map<String,OrderItemAttribute> orderItemAttributeMap
protected BigDecimal totalTax
public Money getRetailPrice()
OrderItemOrder at the time that this was added. This is preferable
to use as opposed to checking the price of the item that was added from the catalog domain (like in
DiscreteOrderItem, using DiscreteOrderItem.getSku()'s retail price) since the price in the catalog
domain could have changed since the item was added to the Order.getRetailPrice in interface OrderItempublic void setRetailPrice(Money retailPrice)
OrderItem#setRetailPriceOverride(true)
Consider also calling OrderItem.setDiscountingAllowed(boolean) with a value of false to restrict
discounts after manually setting the retail price.setRetailPrice in interface OrderItempublic Money getSalePrice()
OrderItemOrderItem.updateSaleAndRetailPrices() will ensure that the
retailPrice being used is current.getSalePrice in interface OrderItempublic void setSalePrice(Money salePrice)
OrderItem#setSalePriceSetManually(true)
To avoid the pricing engine resetting this price, you should also make a call to
#setSalePriceOverride(true)
Typically for DiscreteOrderItems, the prices will be set with a call to OrderItem.updateSaleAndRetailPrices()
which will use the Broadleaf dynamic pricing engine or the values directly tied to the SKU.setSalePrice in interface OrderItempublic Money getTaxablePrice()
getTaxablePrice in interface OrderItempublic int getQuantity()
OrderItemOrderItem.getQuantity in interface OrderItempublic void setQuantity(int quantity)
OrderItemsetQuantity in interface OrderItempublic Category getCategory()
getCategory in interface OrderItempublic void setCategory(Category category)
setCategory in interface OrderItempublic List<CandidateItemOffer> getCandidateItemOffers()
getCandidateItemOffers in interface OrderItempublic void setCandidateItemOffers(List<CandidateItemOffer> candidateItemOffers)
setCandidateItemOffers in interface OrderItempublic PersonalMessage getPersonalMessage()
getPersonalMessage in interface OrderItempublic void setPersonalMessage(PersonalMessage personalMessage)
setPersonalMessage in interface OrderItempublic Order getOrder()
OrderItempublic void setOrder(Order order)
OrderItempublic Long getId()
OrderItempublic void setId(Long id)
OrderItempublic String getName()
OrderItempublic void setName(String name)
OrderItempublic boolean isInCategory(String categoryName)
isInCategory in interface OrderItempublic List<OrderItemQualifier> getOrderItemQualifiers()
OrderItemgetOrderItemQualifiers in interface OrderItempublic void setOrderItemQualifiers(List<OrderItemQualifier> orderItemQualifiers)
OrderItemsetOrderItemQualifiers in interface OrderItempublic List<OrderItemAdjustment> getOrderItemAdjustments()
OrderItemgetOrderItemAdjustments in interface OrderItempublic void setOrderItemAdjustments(List<OrderItemAdjustment> orderItemAdjustments)
setOrderItemAdjustments in interface OrderItempublic Money getAdjustmentValue()
getAdjustmentValue in interface OrderItempublic GiftWrapOrderItem getGiftWrapOrderItem()
getGiftWrapOrderItem in interface OrderItempublic void setGiftWrapOrderItem(GiftWrapOrderItem giftWrapOrderItem)
setGiftWrapOrderItem in interface OrderItempublic OrderItemType getOrderItemType()
getOrderItemType in interface OrderItempublic void setOrderItemType(OrderItemType orderItemType)
setOrderItemType in interface OrderItempublic boolean getIsOnSale()
OrderItemOrderItem.getSalePrice() < OrderItem.getRetailPrice()getIsOnSale in interface OrderItempublic boolean getIsDiscounted()
OrderItemgetIsDiscounted in interface OrderItempublic boolean updateSaleAndRetailPrices()
OrderItemupdateSaleAndRetailPrices in interface OrderItempublic void finalizePrice()
OrderItemfinalizePrice in interface OrderItempublic void assignFinalPrice()
OrderItemassignFinalPrice in interface OrderItempublic Money getPriceBeforeAdjustments(boolean allowSalesPrice)
OrderItemgetPriceBeforeAdjustments in interface OrderItempublic void addCandidateItemOffer(CandidateItemOffer candidateItemOffer)
OrderItemaddCandidateItemOffer in interface OrderItempublic void removeAllCandidateItemOffers()
OrderItemremoveAllCandidateItemOffers in interface OrderItempublic int removeAllAdjustments()
OrderItemremoveAllAdjustments in interface OrderItempublic Map<String,OrderItemAttribute> getOrderItemAttributes()
getOrderItemAttributes in interface OrderItempublic void setOrderItemAttributes(Map<String,OrderItemAttribute> orderItemAttributes)
setOrderItemAttributes in interface OrderItemorderItemAttributes - public Boolean isTaxable()
OrderItempublic void setTaxable(Boolean taxable)
OrderItemsetTaxable in interface OrderItempublic void setOrderItemPriceDetails(List<OrderItemPriceDetail> orderItemPriceDetails)
OrderItemsetOrderItemPriceDetails in interface OrderItem#getOrderItemPriceDetails()}public boolean isDiscountingAllowed()
OrderItemisDiscountingAllowed in interface OrderItempublic void setDiscountingAllowed(boolean discountsAllowed)
OrderItemsetDiscountingAllowed in interface OrderItempublic Money getAveragePrice()
OrderItemgetAveragePrice in interface OrderItempublic Money getAverageAdjustmentValue()
OrderItemOrderItem.getAveragePrice()
for an example of this.
Implementations wishing to show unit prices may choose instead to show the individual OrderItemPriceDetails
instead of this value to avoid the rounding problem. This would result in multiple cart item
display rows for each OrderItem.
Alternatively, the cart display should use OrderItem.getTotalAdjustmentValue().getAverageAdjustmentValue in interface OrderItempublic Money getTotalAdjustmentValue()
OrderItemgetTotalAdjustmentValue in interface OrderItempublic Money getTotalPrice()
OrderItemgetTotalPrice in interface OrderItempublic Money getTotalPriceBeforeAdjustments(boolean allowSalesPrice)
OrderItemgetTotalPriceBeforeAdjustments in interface OrderItempublic void setRetailPriceOverride(boolean override)
OrderItemOrderItem.setRetailPrice(Money)setRetailPriceOverride in interface OrderItempublic boolean isRetailPriceOverride()
OrderItemisRetailPriceOverride in interface OrderItempublic void setSalePriceOverride(boolean override)
OrderItemOrderItem.setDiscountingAllowed(boolean) with a value of false to restrict
discounts after manually setting the retail price.
If the salePrice is not lower than the retailPrice, the system will return the retailPrice when
a call to OrderItem.getSalePrice() is made.setSalePriceOverride in interface OrderItempublic boolean isSalePriceOverride()
OrderItemisSalePriceOverride in interface OrderItempublic List<OrderItemPriceDetail> getOrderItemPriceDetails()
OrderItemgetOrderItemPriceDetails in interface OrderItempublic String getMainEntityName()
getMainEntityName in interface AdminMainEntitypublic String getCurrencyCode()
getCurrencyCode in interface CurrencyCodeIdentifiablepublic void checkCloneable(OrderItem orderItem) throws CloneNotSupportedException, SecurityException, NoSuchMethodException
protected Money convertToMoney(BigDecimal amount)
protected OrderItemType convertOrderItemType(String type)
public OrderItem clone()
public boolean isSkuActive()
OrderItemisSkuActive in interface OrderItemCopyright © 2014. All Rights Reserved.