java.lang.Object | +--com.ibm.commerce.price.utils.UnitManager | +--com.ibm.commerce.price.utils.CurrencyManager
Currency manager. This singleton object allows you to retrieve many types of currency information for a store. To retrieve an instance of the CurrencyManager, use the getInstance() method.
Field Summary |
---|
Fields inherited from class com.ibm.commerce.price.utils. UnitManager |
ROUND_METHOD_ROUND,
ROUND_METHOD_TRUNCATION |
Fields inherited from interface com.ibm.commerce.registry. Registry |
COPYRIGHT |
Constructor Summary | |
---|---|
protected |
CurrencyManager() CurrencyManager constructor. |
Method Summary | |
---|---|
MonetaryAmount |
convert(MonetaryAmount aMonetaryAmount,
StoreAccessBean aStoreAccessBean,
java.lang.String toCurrency) Convert a monetary amount to a new currency. |
protected
java.lang.String |
getClassName() Get the class name. |
protected
java.lang.String |
getConverionRelationshipType() Gets the currency conversion relationship type. |
java.lang.String[] |
getCounterCurrencies(
StoreAccessBean aStoreAccessBean, java.lang.String aCurrency) Get the counter currencies that apply, to a particular currency, in the correct order. |
java.lang.String[] |
getCounterCurrenciesForStore(
StoreAccessBean aStoreAccessBean, java.lang.String aCurrency) Get the counter currencies that apply, to a particular currency, in the correct order. |
MonetaryAmount[] |
getCounterValues(
StoreAccessBean aStoreAccessBean,
MonetaryAmount aMonetaryAmount) Get the list of counter values in the appropriate order. |
java.lang.String |
getCurrency(
StoreAccessBean aStoreAccessBean, java.lang.String aPreferredCurrency,
java.lang.Integer aLanguageId) Calculate the negotiated shopping currency for the specified store based on the user's preferred currency. |
java.math.BigDecimal |
getCustomizedRoundingMultiple(
StoreAccessBean aStoreAccessBean, java.lang.String aUnit) Gets the unit to which rounding occurs. |
java.math.BigDecimal |
getCustomizedRoundingMultiple(
StoreAccessBean aStoreAccessBean, java.lang.String aUnit,
java.lang.String aNumberUsage) Gets the unit to which rounding occurs. |
java.lang.String |
getCustomizedString(
StoreAccessBean aStoreAccessBean, java.lang.String aCurrency,
java.lang.Integer aLanguageId) Get the customized string from the format table. |
java.lang.String |
getDefaultCurrency(
StoreAccessBean aStoreAccessBean) Get the store level default currency for a particular store. |
java.lang.String |
getDefaultCurrency(
StoreAccessBean aStoreAccessBean,
java.lang.Integer aLanguageId) Get the default currency for a particular store and language Id. |
java.lang.String |
getDescription(
StoreAccessBean aStoreAccessBean, java.lang.String aCurrency,
java.lang.Integer aLanguageId) Get the description of the specified currency. |
protected
java.lang.String |
getFormatRelationshipType() Gets the currency format relationship type. |
FormattedMonetaryAmount |
getFormattedMonetaryAmount(MonetaryAmount aMonetaryAmount,
StoreAccessBean aStoreAccessBean,
java.lang.Integer aLanguageId) Get a formatted monetary amount for display purposes based on the formatting rules defined in the database. |
FormattedMonetaryAmount |
getFormattedMonetaryAmount(MonetaryAmount aMonetaryAmount,
StoreAccessBean aStoreAccessBean,
java.lang.Integer aLanguageId, java.lang.String aNumberUsage) Get a formatted monetary amount for display purposes based on the formatting rules defined in the database. |
static
CurrencyManager |
getInstance() Get the instance of the currency manager. |
java.math.BigDecimal |
getMinApproveAmount(
StoreAccessBean aStoreAB, java.lang.String aCurrency) Get the minimum approved amount. |
java.math.BigDecimal |
getMinApproveAmount(
StoreAccessBean aStoreAB, java.lang.String aCurrency,
java.lang.String aNumberUsage) Get the minimum approved amount. |
java.math.BigDecimal |
getRoundingMultiple(
StoreAccessBean aStoreAccessBean, java.lang.String aUnit) Gets the unit to which rounding occurs. |
java.math.BigDecimal |
getRoundingMultiple(
StoreAccessBean aStoreAccessBean, java.lang.String aUnit,
java.lang.String aNumberUsage) Gets the unit to which rounding occurs. |
protected
java.lang.Integer |
getStoreIdForConverter(
StoreAccessBean aStoreAccessBean) Get the store Id to use for converters. |
java.lang.String[] |
getSupportedCurrencies(
StoreAccessBean aStoreAB) Get a list of the currencies supported by a store. |
java.lang.String |
getSymbol(
StoreAccessBean aStoreAccessBean, java.lang.String aCurrency,
java.lang.Integer aLanguageId) Get the currency symbol information from the currency format table. |
void |
initialize() Used by the registry manager to initialize the currency manager. |
boolean |
isSupportedCurrency(
StoreAccessBean aStoreAccessBean, java.lang.String aCurrency) Checks to see if a currency is supported in a store. |
java.math.BigDecimal |
parsePositiveAmount(java.lang.String anAmount,
java.lang.String theUnit,
StoreAccessBean aStoreAccessBean,
java.lang.Integer aLanguageId, java.lang.String aNumberUsage) Parses a string (representing a positive number) based on the formatting rules defined in the database. |
protected
void |
refreshExtension(Formatters theTempFormatters) Pass all NumberFormat objects to the tools runtime. |
protected
void |
refreshOthers(Converters aConverters) Refresh other containers not handles by the parent class. |
void |
round(MonetaryAmount aMonetaryAmount,
StoreAccessBean aStoreAccessBean) Round the monetary amount to the appropriate number of decimal places. |
void |
round(MonetaryAmount aMonetaryAmount,
StoreAccessBean aStoreAccessBean,
java.lang.String aNumberUsage) Round the monetary amount to the appropriate number of decimal places. |
void |
roundCustomized(MonetaryAmount aMonetaryAmount,
StoreAccessBean aStoreAccessBean) Perform customized rounding to the correct number of decimal places. |
void |
roundCustomized(MonetaryAmount aMonetaryAmount,
StoreAccessBean aStoreAccessBean,
java.lang.String aNumberUsage) Perform customized rounding to the correct number of decimal places. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll,
toString, wait, wait, wait |
Constructor Detail |
---|
protected CurrencyManager() throws ECSystemException
Method Detail |
---|
protected java.lang.String getConverionRelationshipType()
getConverionRelationshipType
in class
UnitManager
protected java.lang.String getFormatRelationshipType()
getFormatRelationshipType
in class
UnitManager
public MonetaryAmount convert(MonetaryAmount aMonetaryAmount, StoreAccessBean aStoreAccessBean, java.lang.String toCurrency) throws ECSystemException
convert
in class
UnitManager
aMonetaryAmount
- a monetary amount to be converted.aStoreAccessBean
- the store to use to choose the appropriate
conversion rules.toCurrency
- the currency to convert to.null
is returned.
ECSystemException
protected java.lang.String getClassName()
UnitManager
getClassName
in class
UnitManager
public java.lang.String[] getCounterCurrenciesForStore(StoreAccessBean aStoreAccessBean, java.lang.String aCurrency) throws ECSystemException
aStoreAccessBean
- a store.aCurrency
- the currency.
ECSystemException
public java.lang.String[] getCounterCurrencies(StoreAccessBean aStoreAccessBean, java.lang.String aCurrency) throws ECSystemException
aStoreAccessBean
- a store.aCurrency
- the currency.
ECSystemException
public MonetaryAmount[] getCounterValues(StoreAccessBean aStoreAccessBean, MonetaryAmount aMonetaryAmount) throws ECSystemException
aStoreAccessBean
- the store to use to choose the counter
values.aMonetaryAmount
- the monetary amount to find the counter
values for.
ECSystemException
public java.lang.String getCurrency(StoreAccessBean aStoreAccessBean, java.lang.String aPreferredCurrency, java.lang.Integer aLanguageId) throws ECSystemException
aStoreAccessBean
- the store for the currency.aPreferredCurrency
- the user's preferred currency.aLanguageId
- the language Id of the command context (to
choose the default currency)
ECSystemException
public java.math.BigDecimal getCustomizedRoundingMultiple(StoreAccessBean aStoreAccessBean, java.lang.String aUnit) throws ECSystemException
aStoreAccessBean
- the store for which the rounding
applies.aUnit
- the currency for which the rounding applies.
ECSystemException
public java.math.BigDecimal getCustomizedRoundingMultiple(StoreAccessBean aStoreAccessBean, java.lang.String aUnit, java.lang.String aNumberUsage) throws ECSystemException
aStoreAccessBean
- the store for which the rounding
applies.aUnit
- the currency for which the rounding applies.aNumberUsage
- the number usage code.
ECSystemException
public java.lang.String getCustomizedString(StoreAccessBean aStoreAccessBean, java.lang.String aCurrency, java.lang.Integer aLanguageId) throws ECSystemException
aStoreAccessBean
- the store for choosing the appropriate
customized string.aCurrency
- the currency for which to choose the customized
string.aLanguageId
- the language Id of the language for the
customized string.
ECSystemException
public java.lang.String getDefaultCurrency(StoreAccessBean aStoreAccessBean) throws ECSystemException
aStoreAccessBean
- a store access bean.
ECSystemException
public java.lang.String getDefaultCurrency(StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId) throws ECSystemException
aStoreAccessBean
- a store access bean.aLanguageId
- a language Id.
ECSystemException
public java.lang.String getDescription(StoreAccessBean aStoreAccessBean, java.lang.String aCurrency, java.lang.Integer aLanguageId) throws ECSystemException
aStoreAccessBean
- the store that the description applies
to.aCurrency
- the currency that the description is for.aLanguageId
- the language Id of the language for the
description.
ECSystemException
public FormattedMonetaryAmount getFormattedMonetaryAmount(MonetaryAmount aMonetaryAmount, StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId) throws ECSystemException
aMonetaryAmount
- the monetary amount to format.aStoreAccessBean
- a store.aLanguageId
- a language ID.
ECSystemException
public FormattedMonetaryAmount getFormattedMonetaryAmount(MonetaryAmount aMonetaryAmount, StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId, java.lang.String aNumberUsage) throws ECSystemException
aMonetaryAmount
- the monetary amount to format.aStoreAccessBean
- a store.aLanguageId
- a language ID.aNumberUsage
- the number usage code.
ECSystemException
public static CurrencyManager getInstance() throws ECSystemException
ECSystemException
public java.math.BigDecimal getMinApproveAmount(StoreAccessBean aStoreAB, java.lang.String aCurrency) throws ECSystemException
aStoreAB
- the store access bean.aCurrency
- the currency.
ECSystemException
public java.math.BigDecimal getMinApproveAmount(StoreAccessBean aStoreAB, java.lang.String aCurrency, java.lang.String aNumberUsage) throws ECSystemException
aStoreAB
- the store access bean.aCurrency
- the currency.aNumberUsage
- the number usage code.
ECSystemException
public java.math.BigDecimal getRoundingMultiple(StoreAccessBean aStoreAccessBean, java.lang.String aUnit) throws ECSystemException
aStoreAccessBean
- the store for which the rounding
applies.aUnit
- the currency for which the rounding applies.
ECSystemException
public java.math.BigDecimal getRoundingMultiple(StoreAccessBean aStoreAccessBean, java.lang.String aUnit, java.lang.String aNumberUsage) throws ECSystemException
aStoreAccessBean
- the store for which the rounding
applies.aUnit
- the currency for which the rounding applies.aNumberUsage
- the number usage code.
ECSystemException
protected java.lang.Integer getStoreIdForConverter(StoreAccessBean aStoreAccessBean) throws ECSystemException
getStoreIdForConverter
in class
UnitManager
aStoreAccessBean
- The store access bean.
ECSystemException
public java.lang.String[] getSupportedCurrencies(StoreAccessBean aStoreAB) throws ECSystemException
aStoreAB
- the store access bean for which the currencies are
to be found.
ECSystemException
public java.lang.String getSymbol(StoreAccessBean aStoreAccessBean, java.lang.String aCurrency, java.lang.Integer aLanguageId) throws ECSystemException
aStoreAccessBean
- the store.aCurrency
- the currency.aLanguageId
- the language Id of the language for the
symbol.
ECSystemException
public void initialize() throws java.lang.Exception
java.lang.Exception
public boolean isSupportedCurrency(StoreAccessBean aStoreAccessBean, java.lang.String aCurrency) throws ECSystemException
aStoreAccessBean
- The store access bean.aCurrency
- The currency to check.
ECSystemException
protected void refreshExtension(Formatters theTempFormatters) throws ECSystemException
refreshExtension
in class
UnitManager
theTempFormatters
-
com.ibm.commerce.price.utils.Formatters
ECSystemException
protected void refreshOthers(Converters aConverters) throws ECSystemException
refreshOthers
in class
UnitManager
aConverters
- The currency converters.
ECSystemException
public void round(MonetaryAmount aMonetaryAmount, StoreAccessBean aStoreAccessBean) throws ECSystemException
aMonetaryAmount
- the monetary amount to round.aStoreAccessBean
- the store.
ECSystemException
public void round(MonetaryAmount aMonetaryAmount, StoreAccessBean aStoreAccessBean, java.lang.String aNumberUsage) throws ECSystemException
round
in class
UnitManager
aMonetaryAmount
- the monetary amount to round.aStoreAccessBean
- the store.aNumberUsage
- the number usage code.
ECSystemException
public void roundCustomized(MonetaryAmount aMonetaryAmount, StoreAccessBean aStoreAccessBean) throws ECSystemException
aMonetaryAmount
- the monetary amount to round.aStoreAccessBean
- the store.
ECSystemException
public void roundCustomized(MonetaryAmount aMonetaryAmount, StoreAccessBean aStoreAccessBean, java.lang.String aNumberUsage) throws ECSystemException
roundCustomized
in class
UnitManager
aMonetaryAmount
- the monetary amount to round.aStoreAccessBean
- the store.aNumberUsage
- the number usage code.
ECSystemException
public java.math.BigDecimal parsePositiveAmount(java.lang.String anAmount, java.lang.String theUnit, StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId, java.lang.String aNumberUsage) throws ECSystemException, java.text.ParseException
anAmount
- the amount to parse.theUnit
- the unit of the value.aStoreAccessBean
- a store access bean.aLanguageId
- a language ID.aNumberUsage
- The number usage code to use.
ECSystemException
java.text.ParseException