public class UnitMeasureHandler extends DBUHandler
Modifier and Type | Class and Description |
---|---|
class |
UnitMeasureHandler.MultiPriceBreak
Inner class that defines multiple uom quantity price break data.
|
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
The class' serialization version id.
|
ivContext
Constructor and Description |
---|
UnitMeasureHandler()
Constructs a new instance of the unit of measure handler with a
null servlet or thread context. |
Modifier and Type | Method and Description |
---|---|
static void |
fillOrderAuditLine(OrderAuditLine oal,
CartLine cartline)
Fills an order audit line's values using values from the given cart line.
|
protected java.lang.String |
formatPrice(java.math.BigDecimal value)
Returns a formatted price string.
|
protected java.lang.String |
formatQuantity(int value)
Returns a formatted quantity string.
|
protected UnitMeasure |
getDefaultOrderUom(Product product)
Returns the default order unit of measure for the given product.
|
protected UnitMeasure |
getDefaultPriceUom(Product product)
Returns the default price unit of measure for the given product based on
the product's quantity price break data from the ERP system.
|
protected java.util.ArrayList<QuantityPriceBreak> |
getQuantityBreaks(Product product)
Returns a collection of quantity price breaks for the given product.
|
protected java.util.ArrayList<QuantityPriceBreak> |
getSortedPriceUoms(CartLine cartline,
boolean incldescr)
Returns a sorted list of unique price units of measure for the given cart
line.
|
protected java.util.ArrayList<QuantityPriceBreak> |
getSortedUniqueUoms(Product product,
java.lang.String uomtype,
boolean incldescr)
Returns a sorted list of unique units of measure for the given product and
unit of measure type (order, price).
|
protected Select |
getTemplateOrderUoms(Product product,
java.lang.String selectuom,
boolean showdescr)
Returns an HTML
Select object that contains the given product's
selectable order units of measure. |
protected Select |
getTemplatePriceUoms(CartLine cartline,
java.lang.String selectuom,
boolean showdescr,
boolean showprice)
Returns an HTML
Select object that contains the given cart line's
selectable price units of measure. |
protected Select |
getTemplatePriceUoms(Product product,
java.lang.String selectuom,
boolean showdescr,
boolean showprice)
Returns an HTML
Select object that contains the given product's
selectable price units of measure. |
protected void |
setCartLinePrices(CartLine cartline)
Sets the order and price unit of measure prices for the given cart line.
|
void |
setCartLineTemplateUoms(java.util.ArrayList<CartLine> cartlines)
Sets the unit of measure html template data for a group of cart lines.
|
void |
setCartLineUoms(java.util.ArrayList<CartLine> cartlines)
Sets the unit of measure and price values for a group of cart lines.
|
void |
setCartLineUoms(CartLine cartline)
Sets the unit of measure and price values for a given cart line.
|
void |
setCartLineUoms(CartLine cartline,
java.lang.String orderuom,
java.lang.String priceuom)
Sets the unit of measure and price values for a given cart line.
|
boolean |
setTemplateQuantityBreaks()
Sets the quantity price break html template data for the given product.
|
getContext, setContext
private static final long serialVersionUID
public UnitMeasureHandler()
null
servlet or thread context.
A CONTEXT MUST BE SET BEFORE INVOKING ANY OTHER METHODS.
.public static void fillOrderAuditLine(OrderAuditLine oal, CartLine cartline)
Invoked by the OrderAudit
class when adding a new order audit
line to the database. Nothing should be placed in this method that requires
use of the current servlet context.
oal
- (OrderAuditLine) The order audit line to be filled.cartline
- (CartLine) The cart line to use for filling the line.protected UnitMeasure getDefaultOrderUom(Product product)
product
- (Product) The product for the desired order unit of
measure.protected UnitMeasure getDefaultPriceUom(Product product)
product
- (Product) The product for the desired price unit of
measure.protected java.util.ArrayList<QuantityPriceBreak> getQuantityBreaks(Product product)
product
- (Product) The product for the desired qty price breaks.protected java.util.ArrayList<QuantityPriceBreak> getSortedPriceUoms(CartLine cartline, boolean incldescr)
cartline
- (CartLine) The cart line for the desired unit of
measure data.incldescr
- (boolean) true
if uom descriptions are to be
included, otherwise false
.protected java.util.ArrayList<QuantityPriceBreak> getSortedUniqueUoms(Product product, java.lang.String uomtype, boolean incldescr)
product
- (Product) The product for the desired unit of measure
data.uomtype
- (String) The type of units of measure to put in the list.
Valid values are "order" and "price".incldescr
- (boolean) true
if uom descriptions are to be
included, otherwise false
.protected Select getTemplateOrderUoms(Product product, java.lang.String selectuom, boolean showdescr)
Select
object that contains the given product's
selectable order units of measure. Invokers must assign a form field name
to the returned object via the setName
method before adding the
object to the velocity template data.product
- (Product) The product for the desired order unit of
measure data.selectuom
- (String) The code for the unit of measure that is to
be flagged as the selected unit of measure. null
indicates that the product's default order unit of measure is
to be flagged.showdescr
- (boolean) true
if uom descriptions are
to be shown, otherwise false
.Select
object..protected Select getTemplatePriceUoms(CartLine cartline, java.lang.String selectuom, boolean showdescr, boolean showprice)
Select
object that contains the given cart line's
selectable price units of measure. Invokers must assign a form field name
to the returned object via the setName
method before adding the
object to the velocity template data.cartline
- (Cartline) The cart line for the desired price unit of
measure data.selectuom
- (String) The code for the unit of measure that is to
be flagged as the selected unit of measure. null
indicates that the product's default price unit of measure is
to be flagged.showdescr
- (boolean) true
if uom descriptions are
to be shown, otherwise false
.showprice
- (boolean) true
if prices are to be shown,
otherwise false
.Select
object..protected Select getTemplatePriceUoms(Product product, java.lang.String selectuom, boolean showdescr, boolean showprice)
Select
object that contains the given product's
selectable price units of measure. Invokers must assign a form field name
to the returned object via the setName
method before adding the
object to the velocity template data.product
- (Product) The product for the desired price unit of
measure data.selectuom
- (String) The code for the unit of measure that is to
be flagged as the selected unit of measure. null
indicates that the product's default price unit of measure is
to be flagged.showdescr
- (boolean) true
if uom descriptions are
to be shown, otherwise false
.showprice
- (boolean) true
if prices are to be shown,
otherwise false
.Select
object..protected void setCartLinePrices(CartLine cartline)
Invoked by the setCartLineUoms
method below when setting
uom values for cart lines that are being processed for realtime info or
for cart lines that are being added or updated to a cart object.
cartline
- (CartLine) The cart line that is to have its values
set.public void setCartLineUoms(CartLine cartline)
Invoked by the setCartLineUoms
method below when setting
uom values for cart lines that are being processed for realtime info.
Invoked by the CartLine
class to set the uom values for cart
lines that are being added or updated to a cart object.
cartline
- (CartLine) The cart line that is to have its values
set.public void setCartLineUoms(CartLine cartline, java.lang.String orderuom, java.lang.String priceuom)
Invoked by the CartLine
class to set the uom values for cart
lines that are being retrieved from the database.
cartline
- (CartLine) The cart line that is to have its values
set.orderuom
- (String) The order unit of measure code from the cart
line's record in the database.priceuom
- (String) The price unit of measure code from the cart
line's record in the database.public void setCartLineUoms(java.util.ArrayList<CartLine> cartlines)
Invoked by the CartLine
class to set the uom values for cart
lines that are being processed for realtime info.
cartlines
- (ArrayList) The cart lines that are to have their
values set.public void setCartLineTemplateUoms(java.util.ArrayList<CartLine> cartlines)
Select
object for each
cart line product's selectable order and price units of measure.
Invoked by ReviewCart
and FavoriteItems
to set the uom
template data for cart lines that are being displayed on the page.
The Velocity variables used by the template should be:
cartlines
- (ArrayList) The cart lines that are to have their
html template data set.public boolean setTemplateQuantityBreaks()
Invoked by the ProductDetails
class to set html template data
for the product being displayed on the page.
The Velocity variables used by the template should be:
true
if the product has quantity breaks
and the template data is successfully set. false
if the product does not have quantity breaks or if the template
data could not be set.protected java.lang.String formatQuantity(int value)
value
- (int) The quantity to format.protected java.lang.String formatPrice(java.math.BigDecimal value)
value
- (BigDecimal) The price to format.