Quote Class

com.bea.commerce.ebusiness.price.quote
Quote Class

public class Quote

    extends Object
    implements Serializable

The Quote class provides a framework for building a price quote for a collection of LineItems. The LineItems may be adjusted within the framework such that any sub-quantity of a LineItem maybe assigned a new unit price. Each LineAdjustment represents a subquantity of a LineItem and include a new unit price. Each LineAdjustment must have exactly one AdjustmentDetail object describing the adjustment. The quantities of a set of LineAdjustments for a LineItem may not exceed the quantity of the LineItem. The subtotal of the quote is the sum of the values of the LineItems. OrderAdjustments may also be added to the Quote. The OrderAdjustments change the total for the Quote. The total is computed by adding any OrderAdjustments to the subtotal for the object.

Related Topics

LineItem
LineAdjustment
OrderAdjustment
AdjustmentDetail
AdjustmentType
QuoteFactory
Money


Hierarchy
Object
  Quote
All Implemented Interfaces

Serializable

Field Summary

public static final String
INPUT
String
public static final double
MIN_PRICE
double
public static final double
ONE_HUNDRED
double
public static final String
STATE
String
public static final int
STATE_I_DISC
int
public static final int
STATE_I_END
int
public static final int
STATE_I_ERROR
int
public static final int
STATE_I_NO_ADJ
int
public static final int
STATE_I_SHIPPING
int
public static final int
STATE_I_TAX
int
public static final String
STATE_S_DISC
String
public static final String
STATE_S_END
String
public static final String
STATE_S_ERROR
String
public static final String
STATE_S_NO_ADJ
String
public static final String
STATE_S_SHIPPING
String
public static final String
STATE_S_TAX
String
 

Constructor Summary

Quote()

Constructs a Quote object with no LineItems and no associated QuoteFactory.
Quote(QuoteFactory factory, List lineItems)

Constructs a Quote object with the specified QuoteFactory and LineItem objects.
 

Method Summary

public void
addLineAdjustment(LineItem item, int qty, AdjustmentDetail aDetail)
Add a new LineAdjustment based on the specified input values and with the specified AdjustmentDetail.
public void
addLineAdjustment(int itemNumber, int qty, AdjustmentDetail aDetail)
Add a new LineAdjustment based on the specified input values and with the specified AdjustmentDetail.
public void
addOrderDetail(AdjustmentDetail aDetail)
Create a new OrderAdjustment object with the specified AdjustmentDetail object.
public static final boolean
checkMinPrice(Money value)
Returns true if the Money value is greater than or equal to the minimum price of zero.
public final Money
getBaseShipping()
Returns the Money value for the base shipping cost.
public final String
getCurrency()
Returns the currency for this Quote object.
public final QuoteFactory
getFactory()
Get the QuoteFactory used to create other Quote package objects as needed by this Quote object.
public final int
getLineCnt()
Return the number of LineItems in this Quote.
public LineItem
getLineItem(int itemNumber)
Returns the LineItem associated with the index supplied.
public List
getLineItems()
Returns an unmodifiable List of the LineItem objects of this object.
public List
getOrderAdjustments()
Returns the full list of OrderAdjustment objects associated with this Quote.
public List
getOrderDiscountAdjustments()
Returns only the list of order discount adjustments from the list of OrderAdjustments.
public List
getShippingOrderAdjustments()
Returns only the list of shipping adjustments from the list of OrderAdjustments.
public final Money
getSubtotal()
Returns the current subtotal of the Quote.
public final Money
getTotal()
Returns the current total of the Quote.
public String
getUID()
Return the unique string identifier for this Quote
public final int
incrementSeqNumber()
Used to order and associate adjustments made to the Quote object.
public static final MutableMoney
round(MutableMoney value)
Rounds the amount of the MutableMoney specified to two digits and returns the modified MutableMoney
public static final double
round(Money value)
Returns a new double that is equivalent to the amount of Money specified rounded to two digits to the right of the decimal point.
public static final double
round(double value)
Returns a new double that is equivalent to the value specified rounded to two digits to the right of the decimal point.
public void
set(QuoteFactory factory, List lineItems)
Use this method to reinitialize a Quote object for reuse.
public final void
setBaseShipping(Money shippingBase)
Sets the base shipping cost for the Quote.
public final String
toString()
Provides a view of the current state of the object.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
   

Field Detail

INPUT

public static final String INPUT


MIN_PRICE

public static final double MIN_PRICE


ONE_HUNDRED

public static final double ONE_HUNDRED


STATE

public static final String STATE


STATE_I_DISC

public static final int STATE_I_DISC


STATE_I_END

public static final int STATE_I_END


STATE_I_ERROR

public static final int STATE_I_ERROR


STATE_I_NO_ADJ

public static final int STATE_I_NO_ADJ


STATE_I_SHIPPING

public static final int STATE_I_SHIPPING


STATE_I_TAX

public static final int STATE_I_TAX


STATE_S_DISC

public static final String STATE_S_DISC


STATE_S_END

public static final String STATE_S_END


STATE_S_ERROR

public static final String STATE_S_ERROR


STATE_S_NO_ADJ

public static final String STATE_S_NO_ADJ


STATE_S_SHIPPING

public static final String STATE_S_SHIPPING


STATE_S_TAX

public static final String STATE_S_TAX

 

Constructor Detail

Quote

public Quote()
Constructs a Quote object with no LineItems and no associated QuoteFactory. The set() method can be used to set those properties

Quote

public Quote(QuoteFactory factory, 
             List lineItems)
Constructs a Quote object with the specified QuoteFactory and LineItem objects.

Related Topics

QuoteFactory
LineItem

 

Method Detail

addLineAdjustment(LineItem, int, AdjustmentDetail) Method

public void addLineAdjustment(LineItem item, 
                              int qty, 
                              AdjustmentDetail aDetail)
throws QuoteException
Add a new LineAdjustment based on the specified input values and with the specified AdjustmentDetail.

Parameters

item
the LineItem to associate the adjustment with.
qty
the quantity of objects of the specified LineItem to adjust.
aDetail
the AdjustmentDetail to associate with the new LineAdjustment.

Returns

void

Exceptions

QuoteException

Related Topics

LineAdjustment
LineItem
AdjustmentDetail


addLineAdjustment(int, int, AdjustmentDetail) Method

public void addLineAdjustment(int itemNumber, 
                              int qty, 
                              AdjustmentDetail aDetail)
throws QuoteException
Add a new LineAdjustment based on the specified input values and with the specified AdjustmentDetail.

Parameters

itemNumber
the number of the LineItem to associate the adjustment with.
qty
the quantity of objects of the specified LineItem to adjust.
aDetail
the AdjustmentDetail to associate with the new LineAdjustment.

Returns

void

Exceptions

QuoteException

Related Topics

LineAdjustment
LineItem
AdjustmentDetail


addOrderDetail(AdjustmentDetail) Method

public void addOrderDetail(AdjustmentDetail aDetail)
throws QuoteException
Create a new OrderAdjustment object with the specified AdjustmentDetail object. Add the newly created OrderAdjustment to the list of adjustments. Adding of OrderAdjustments effects the total price for the Quote but does not effect the subtotal of the Quote. OrderAdjustments must be added after all LineAdjustments have been added and before shipping adjustments are added. Failure to follow this order will cause a QuoteException to be thrown.

Parameters

aDetail
an AdjustmentDetail object.

Returns

void

Exceptions

QuoteException

Related Topics

AdjustmentDetail
OrderAdjustment
LineAdjustment


checkMinPrice(Money) Method

public static final boolean checkMinPrice(Money value)
Returns true if the Money value is greater than or equal to the minimum price of zero.

Parameters

value
the Money object to compare against the minimum price

getBaseShipping() Method

public final Money getBaseShipping()
Returns the Money value for the base shipping cost. If the base shipping cost has not been explicitly set with the setShippingbase() mehtod the Money object returned will have a value of zero and the currency will match the currency of the Quote object

Returns

the Money object for the base shipping price

Related Topics

Money


getCurrency() Method

public final String getCurrency()
Returns the currency for this Quote object. The value is derived from the LineItems used to construct or set the Quote.

Returns

String representing the currency for this Quote object.

Related Topics

Money


getFactory() Method

public final QuoteFactory getFactory()
Get the QuoteFactory used to create other Quote package objects as needed by this Quote object.

Returns

the QuoteFactory object used by this Quote.

Related Topics

QuoteFactory


getLineCnt() Method

public final int getLineCnt()
Return the number of LineItems in this Quote.


getLineItem(int) Method

public LineItem getLineItem(int itemNumber)
Returns the LineItem associated with the index supplied.

Returns

a LineItem object.

Related Topics

LineItem


getLineItems() Method

public List getLineItems()
Returns an unmodifiable List of the LineItem objects of this object.

Returns

an unmodifiable List of LineItem objects.

Related Topics

LineItem
Collections


getOrderAdjustments() Method

public List getOrderAdjustments()
Returns the full list of OrderAdjustment objects associated with this Quote. The full list of adjustments includes order discounts and shipping adjustments. Use getOrderDiscountAdjustments() to obtain only the order discounts and use getShippingOrderAdjustments() to obtain shipping adjustments.

Returns

a List of OrderAdjustment objects. An empty List may be returned if no order adjustments are present.

Related Topics

OrderAdjustment
AdjustmentType


getOrderDiscountAdjustments() Method

public List getOrderDiscountAdjustments()
Returns only the list of order discount adjustments from the list of OrderAdjustments. Use getOrderAdjustments() to obtain all the order OrderAdjustment objects and use getShippingOrderAdjustments() to obtain just the shipping adjustments. All of the OrderAdjustment objects returned will have an AdjustmentType of AdjustmentType.ORDER_DISCOUNT.

Returns

a List of OrderAdjustment objects that represent the order discounts for the Quote. Null will be returned if no order discount adjustments exist.

Related Topics

OrderAdjustment
AdjustmentType


getShippingOrderAdjustments() Method

public List getShippingOrderAdjustments()
Returns only the list of shipping adjustments from the list of OrderAdjustments. Use getOrderAdjustments() to obtain all the order OrderAdjustment objects and use getOrderDiscountAdjustments() to obtain just the order discount adjustments. All of the OrderAdjustment objects returned will have an AdjustmentType of AdjustmentType.SHIPPING_BASE_PRICE.

Returns

a List of OrderAdjustment objects that represent the shipping adjustment for the Quote. Null will be returned if no order discount adjustments exist.

Related Topics

OrderAdjustment
AdjustmentType


getSubtotal() Method

public final Money getSubtotal()
Returns the current subtotal of the Quote. The subtotal is the sum of the total values of the LineItems. After any order adjustments are added the subtotal will not change.

Returns

the Money object for the Quote subtotal

Related Topics

LineItem


getTotal() Method

public final Money getTotal()
Returns the current total of the Quote. The total is the subtotal plus all order adjustments.

Returns

the Money object for the Quote total

Related Topics

OrderAdjustment


getUID() Method

public String getUID()
Return the unique string identifier for this Quote


incrementSeqNumber() Method

public final int incrementSeqNumber()
Used to order and associate adjustments made to the Quote object. The user of the object should use this method to increment the sequence number. The incremented sequence number will then be used to decorate all adjustments until the number is incremented again. The first call to this method after constructing or setting this object will return 0.

Returns

the incremented sequence number beginning at zero.

round(MutableMoney) Method

public static final MutableMoney round(MutableMoney value)
Rounds the amount of the MutableMoney specified to two digits and returns the modified MutableMoney

Parameters

value
a MutableMoney value to round.

Returns

the rounded MutableMoney.

round(Money) Method

public static final double round(Money value)
Returns a new double that is equivalent to the amount of Money specified rounded to two digits to the right of the decimal point.

Parameters

value
a Money value to round

round(double) Method

public static final double round(double value)
Returns a new double that is equivalent to the value specified rounded to two digits to the right of the decimal point.

Parameters

value
a double value to round

set(QuoteFactory, List) Method

public void set(QuoteFactory factory, 
                List lineItems)
throws QuoteException, CurrencyMismatchException
Use this method to reinitialize a Quote object for reuse. After calling this method the Quote object will represent the new line items and factory specified and will have no line or order adjustments.

Parameters

factory
the QuoteFactory to use when generating other objects from the Quote package.
lineItems
a List of LineItem objects

Exceptions

QuoteException
CurrencyMismatchException

Related Topics

QuoteFactory
LineItem


setBaseShipping(Money) Method

public final void setBaseShipping(Money shippingBase)
throws QuoteException, CurrencyMismatchException
Sets the base shipping cost for the Quote.

Returns

the Money object for the base shipping price.

Exceptions

QuoteException
if the value passed in is null.
CurrencyMismatchException
if the currency of the Money object specified does not match the Quotes currency.

Related Topics

OrderAdjustment


toString() Method

public final String toString()
Provides a view of the current state of the object. This method is intended for debugging and may change at anytime.

Overrides
Object.toString()

Returns

string showing the current state of the object.