public class CurrencyManager extends UnitManager
ROUND_METHOD_FLOOR, ROUND_METHOD_ROUND, ROUND_METHOD_TRUNCATION
Modifier and Type | Method and Description |
---|---|
MonetaryAmount |
convert(MonetaryAmount aMonetaryAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String toCurrency)
Convert a monetary amount to a new currency.
|
java.lang.String[] |
getCounterCurrencies(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aCurrency)
Get the counter currencies that apply, to a particular currency, in the correct order.
|
java.lang.String[] |
getCounterCurrenciesForStore(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aCurrency)
Get the counter currencies that apply, to a particular currency, in the correct order.
|
MonetaryAmount[] |
getCounterValues(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
MonetaryAmount aMonetaryAmount)
Get the list of counter values in the appropriate order.
|
java.lang.String |
getCurrency(com.ibm.commerce.common.objects.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(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit)
Gets the unit to which rounding occurs.
|
java.math.BigDecimal |
getCustomizedRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit,
java.lang.String aNumberUsage)
Gets the unit to which rounding occurs.
|
int |
getCustomizedRoundMethod(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit)
Returns 1 if the round method is 'T' (Truncate),
returns 2 if the round method is 'R' (Round) or
returns 3 if the round method is 'F' (Floor).
|
int |
getCustomizedRoundMethod(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit,
java.lang.String astrNumberUsage)
Returns 1 if the round method is 'T' (Truncate),
returns 2 if the round method is 'R' (Round) or
returns 3 if the round method is 'F' (Floor).
|
java.lang.String |
getCustomizedString(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aCurrency,
java.lang.Integer aLanguageId)
Get the customized string from the format table.
|
java.lang.String |
getDefaultCurrency(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean)
Get the store level default currency for a particular store.
|
java.lang.String |
getDefaultCurrency(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.Integer aLanguageId)
Get the default currency for a particular store and language Id.
|
java.lang.String |
getDescription(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aCurrency,
java.lang.Integer aLanguageId)
Get the description of the specified currency.
|
FormattedMonetaryAmount |
getFormattedMonetaryAmount(MonetaryAmount aMonetaryAmount,
com.ibm.commerce.common.objects.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,
com.ibm.commerce.common.objects.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(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB,
java.lang.String aCurrency)
Get the minimum approved amount.
|
java.math.BigDecimal |
getMinApproveAmount(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB,
java.lang.String aCurrency,
java.lang.String aNumberUsage)
Get the minimum approved amount.
|
java.math.BigDecimal |
getRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit)
Gets the unit to which rounding occurs.
|
java.math.BigDecimal |
getRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aUnit,
java.lang.String aNumberUsage)
Gets the unit to which rounding occurs.
|
java.lang.String[] |
getSupportedCurrencies(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB)
Get a list of the currencies supported by a store.
|
java.lang.String |
getSymbol(com.ibm.commerce.common.objects.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(com.ibm.commerce.common.objects.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,
com.ibm.commerce.common.objects.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.
|
void |
round(MonetaryAmount aMonetaryAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean)
Round the monetary amount to the appropriate number of decimal places.
|
void |
round(MonetaryAmount aMonetaryAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aNumberUsage)
Round the monetary amount to the appropriate number of decimal places.
|
void |
roundCustomized(MonetaryAmount aMonetaryAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean)
Perform customized rounding to the correct number of decimal places.
|
void |
roundCustomized(MonetaryAmount aMonetaryAmount,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean,
java.lang.String aNumberUsage)
Perform customized rounding to the correct number of decimal places.
|
getCustomizedString, getDescription, getNumberOfDecimalPlaces, getNumberOfDecimalPlaces, getSymbol, isRefreshRequired, refresh, setRefreshRequired
public MonetaryAmount convert(MonetaryAmount aMonetaryAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String toCurrency) throws com.ibm.commerce.exception.ECSystemException
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.com.ibm.commerce.exception.ECSystemException
public java.lang.String[] getCounterCurrencies(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aCurrency) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- a store.aCurrency
- the currency.com.ibm.commerce.exception.ECSystemException
public java.lang.String[] getCounterCurrenciesForStore(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aCurrency) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- a store.aCurrency
- the currency.com.ibm.commerce.exception.ECSystemException
public MonetaryAmount[] getCounterValues(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, MonetaryAmount aMonetaryAmount) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store to use to choose the counter values.aMonetaryAmount
- the monetary amount to find the counter values for.com.ibm.commerce.exception.ECSystemException
public java.lang.String getCurrency(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aPreferredCurrency, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.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)com.ibm.commerce.exception.ECSystemException
public java.math.BigDecimal getCustomizedRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store for which the rounding applies.aUnit
- the currency for which the rounding applies.com.ibm.commerce.exception.ECSystemException
public java.math.BigDecimal getCustomizedRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store for which the rounding applies.aUnit
- the currency for which the rounding applies.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException
public int getCustomizedRoundMethod(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit) throws com.ibm.commerce.exception.ECSystemException
getCustomizedRoundMethod
in class UnitManager
aStoreAccessBean
- The store for which the rounding applies.aUnit
- The currency for which the rounding applies.com.ibm.commerce.exception.ECSystemException
public int getCustomizedRoundMethod(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit, java.lang.String astrNumberUsage) throws com.ibm.commerce.exception.ECSystemException
getCustomizedRoundMethod
in class UnitManager
aStoreAccessBean
- The store for which the rounding applies.aUnit
- The currency for which the rounding applies.astrNumberUsage
- The number usage.com.ibm.commerce.exception.ECSystemException
public java.lang.String getCustomizedString(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aCurrency, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.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.com.ibm.commerce.exception.ECSystemException
public java.lang.String getDefaultCurrency(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- a store access bean.com.ibm.commerce.exception.ECSystemException
public java.lang.String getDefaultCurrency(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- a store access bean.aLanguageId
- a language Id.com.ibm.commerce.exception.ECSystemException
public java.lang.String getDescription(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aCurrency, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.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.com.ibm.commerce.exception.ECSystemException
public FormattedMonetaryAmount getFormattedMonetaryAmount(MonetaryAmount aMonetaryAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.ECSystemException
aMonetaryAmount
- the monetary amount to format.aStoreAccessBean
- a store.aLanguageId
- a language ID.com.ibm.commerce.exception.ECSystemException
public FormattedMonetaryAmount getFormattedMonetaryAmount(MonetaryAmount aMonetaryAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
aMonetaryAmount
- the monetary amount to format.aStoreAccessBean
- a store.aLanguageId
- a language ID.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException
public static CurrencyManager getInstance() throws com.ibm.commerce.exception.ECSystemException
com.ibm.commerce.exception.ECSystemException
public java.math.BigDecimal getMinApproveAmount(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB, java.lang.String aCurrency) throws com.ibm.commerce.exception.ECSystemException
aStoreAB
- the store access bean.aCurrency
- the currency.com.ibm.commerce.exception.ECSystemException
public java.math.BigDecimal getMinApproveAmount(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB, java.lang.String aCurrency, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
aStoreAB
- the store access bean.aCurrency
- the currency.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException
public java.math.BigDecimal getRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store for which the rounding applies.aUnit
- the currency for which the rounding applies.com.ibm.commerce.exception.ECSystemException
public java.math.BigDecimal getRoundingMultiple(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aUnit, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store for which the rounding applies.aUnit
- the currency for which the rounding applies.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException
public java.lang.String[] getSupportedCurrencies(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB) throws com.ibm.commerce.exception.ECSystemException
aStoreAB
- the store access bean for which the currencies are to be found.com.ibm.commerce.exception.ECSystemException
public java.lang.String getSymbol(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aCurrency, java.lang.Integer aLanguageId) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- the store.aCurrency
- the currency.aLanguageId
- the language Id of the language for the symbol.com.ibm.commerce.exception.ECSystemException
public void initialize() throws java.lang.Exception
java.lang.Exception
public boolean isSupportedCurrency(com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aCurrency) throws com.ibm.commerce.exception.ECSystemException
aStoreAccessBean
- The store access bean.aCurrency
- The currency to check.com.ibm.commerce.exception.ECSystemException
public java.math.BigDecimal parsePositiveAmount(java.lang.String anAmount, java.lang.String theUnit, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.Integer aLanguageId, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.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.com.ibm.commerce.exception.ECSystemException
java.text.ParseException
public void round(MonetaryAmount aMonetaryAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean) throws com.ibm.commerce.exception.ECSystemException
aMonetaryAmount
- the monetary amount to round.aStoreAccessBean
- the store.com.ibm.commerce.exception.ECSystemException
public void round(MonetaryAmount aMonetaryAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
aMonetaryAmount
- the monetary amount to round.aStoreAccessBean
- the store.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException
public void roundCustomized(MonetaryAmount aMonetaryAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean) throws com.ibm.commerce.exception.ECSystemException
aMonetaryAmount
- the monetary amount to round.aStoreAccessBean
- the store.com.ibm.commerce.exception.ECSystemException
public void roundCustomized(MonetaryAmount aMonetaryAmount, com.ibm.commerce.common.objects.StoreAccessBean aStoreAccessBean, java.lang.String aNumberUsage) throws com.ibm.commerce.exception.ECSystemException
aMonetaryAmount
- the monetary amount to round.aStoreAccessBean
- the store.aNumberUsage
- the number usage code.com.ibm.commerce.exception.ECSystemException