public class CurrencyRateManager extends InfranetCachedData
InfranetCachedData.InstanceBuilder
Modifier and Type | Field and Description |
---|---|
static int |
CURRENCY_OPERATOR_DIVIDE |
static int |
CURRENCY_OPERATOR_MULTIPLY
Currency mode determines which operator to use for currency
exchange rates.
|
static int |
CURRENCY_OPERATOR_NONE |
static long |
TIME_NEVER
This value signifies that the end time for a currency rate is
infinite.
|
m_Connection
Modifier | Constructor and Description |
---|---|
protected |
CurrencyRateManager(PortalContext connection)
Construct a rate manager object.
|
Modifier and Type | Method and Description |
---|---|
BigDecimal |
convertCurrency(int srcCurrencyID,
int destCurrencyID,
Date transactionTime,
BigDecimal amount)
Convert an amount from one currency to another based on a point in
time.
|
static CurrencyRateManager |
getInstance(PortalContext connection)
Get the one and only instance of this class.
|
static CurrencyRateManager |
getInstance(PortalContext connection,
boolean rebuild)
Get the one and only instance of this class.
|
static boolean |
isTimeEQ(Date testTime,
Date baseTime)
Determine if tTestTime is equal to tBaseTime.
|
static boolean |
isTimeGT(Date testTime,
Date baseTime)
Determine if testTime is greater than baseTime.
|
static boolean |
isTimeGTE(Date testTime,
Date baseTime)
Determine if testTime is greater than or equal to baseTime.
|
static boolean |
isTimeLT(Date testTime,
Date baseTime)
Determine if testTime is less than baseTime.
|
static boolean |
isTimeLTE(Date testTime,
Date baseTime)
Determine if testTime is less than or equal to baseTime.
|
static boolean |
isTimeWithinRange(Date testTime,
Date startTime,
Date endTime)
Determine if tTestTime is between startTime and endTime.
|
protected boolean |
isTriangulationRequired(int srcCurrencyID,
int destCurrencyID)
Test to see if this is a case where we must do triangulation for
rate conversion of an amount from one currency to another.
|
protected ExchangeRate |
loadCurrencyRate(int srcCurrencyID,
int destCurrencyID,
Date transactionDate)
Try to load the currency rate for the specified source and destination
currencies and transaction time.
|
protected ExchangeRate |
lookupRate(int srcCurrencyID,
int destCurrencyID,
Date transTime)
Find the rate for the specified source currency, destination currency,
and transaction time.
|
buildKey, buildKeySimple, createDataManagers, getInstanceImpl, getInstanceImplSimple
public static final int CURRENCY_OPERATOR_MULTIPLY
public static final int CURRENCY_OPERATOR_DIVIDE
public static final int CURRENCY_OPERATOR_NONE
public static final long TIME_NEVER
protected CurrencyRateManager(PortalContext connection)
connection
- An active connection to Portal.public static CurrencyRateManager getInstance(PortalContext connection)
connection
- An active connection to Portal.public static CurrencyRateManager getInstance(PortalContext connection, boolean rebuild)
connection
- An active connection to Portal.rebuild
- If this flag is TRUE then the reference to the existing
instance will be set to null and a new instance will be created. This
will cause the data to be refreshed.public BigDecimal convertCurrency(int srcCurrencyID, int destCurrencyID, Date transactionTime, BigDecimal amount) throws CurrencyRateException
srcCurrencyID
- The ID of the currency to convert from.destCurrencyID
- The ID of the currency to convert to.transactionTime
- The point in time that the amount was
"realized" (time of billing, time of the adjustment was made, etc.)amount
- The amount to convert.CurrencyRateException
- is thrown if the specified rate was
not found, corrupt data, etc.protected boolean isTriangulationRequired(int srcCurrencyID, int destCurrencyID)
srcCurrencyID
- The ID of the currency to convert from.destCurrencyID
- The ID of the currency to convert to.public static boolean isTimeLT(Date testTime, Date baseTime)
testTime
- Time to test against tBaseTimebaseTime
- Basis for testpublic static boolean isTimeLTE(Date testTime, Date baseTime)
testTime
- Time to test against tBaseTimebaseTime
- Basis for testpublic static boolean isTimeGT(Date testTime, Date baseTime)
testTime
- Time to test against tBaseTimebaseTime
- Basis for testpublic static boolean isTimeGTE(Date testTime, Date baseTime)
testTime
- Time to test against tBaseTimebaseTime
- Basis for testpublic static boolean isTimeEQ(Date testTime, Date baseTime)
testTime
- Time to test against tBaseTimebaseTime
- Basis for testpublic static boolean isTimeWithinRange(Date testTime, Date startTime, Date endTime)
testTime
- Time to test against the time range.startTime
- The start of the time range.endTime
- The end of the time range.protected ExchangeRate loadCurrencyRate(int srcCurrencyID, int destCurrencyID, Date transactionDate) throws CurrencyRateException
srcCurrencyID
- The ID of the currency to convert from.destCurrencyID
- The ID of the currency to convert to.transactionDate
- The point time the transaction was made.CurrencyRateException
- is thrown if the specified rate was
not found, corrupt data, etc.protected ExchangeRate lookupRate(int srcCurrencyID, int destCurrencyID, Date transTime) throws CurrencyRateException
srcCurrencyID
- The ID of the currency to convert from.destCurrencyID
- The ID of the currency to convert to.transTime
- The point in time that the amount was
"realized" (time of billing, time of the adjustment was made, etc.)CurrencyRateException
- is thrown if the specified rate was
not found, corrupt data, etc.Copyright © 2003, 2023, Oracle and/or its affiliates.