public class CurrencyService extends AppService implements CurrencyServiceRemote
APPLOGGER, CRONTASKLOGGER, CRONTASKMGRLOGGER, CRONTASKMGRSQLLOGGER, DBCONNECTIONLOGGER, DDLOGGER, DMLOGGER, EVENTLOGGER, EXCEPTIONLOGGER, MAILLOGGER, MAXIMOLOGGER, MTLOGGER, NULLMBOPOINTER, SECURITY, SENDFAILEDLOGGER, SERVICELOGGER, SQLLOGGER
appenderPrefix, LOGGERNAME_APP, LOGGERNAME_CRONTASK, LOGGERNAME_CRONTASKMGR, LOGGERNAME_DBCONNECTION, LOGGERNAME_DD, LOGGERNAME_DM, LOGGERNAME_DMPREVIEW, LOGGERNAME_EVENT, LOGGERNAME_EXCEPTION, LOGGERNAME_MAIL, LOGGERNAME_MAXIMO, LOGGERNAME_MT, LOGGERNAME_NULLMBOPOINTER, LOGGERNAME_SECURITY, LOGGERNAME_SENDFAILED, LOGGERNAME_SERVICE, LOGGERNAME_SQL, LOGGERNAME_SQL_CRONTASKMGR, LOGGERNAME_TXN, loggerPrefix
Constructor and Description |
---|
CurrencyService()
The currency code object.
|
CurrencyService(MXServer mxServer)
The Server environment this service is created in.
|
Modifier and Type | Method and Description |
---|---|
double |
calculateCurrencyCost(UserInfo userInfo,
java.lang.String currencyFrom,
java.lang.String currencyTo,
double value,
java.util.Date date,
java.lang.String orgId)
Calculates the To currency cost given From currency code, From currency cost, To currency code and date.
|
java.lang.String |
getBaseCurrency1(java.lang.String orgID,
UserInfo user)
Return the base currency1 which is now stored at the organization level.
|
java.lang.String |
getBaseCurrency2(java.lang.String orgID,
UserInfo user)
Return the base currency2 which is now stored at the organization level.
|
double |
getCurrencyExchangeRate(UserInfo userInfo,
java.lang.String currencyCodeFrom,
java.lang.String currencyCodeTo,
java.util.Date exchangeDate,
java.lang.String orgId)
This is a generic method that returns the exchange rate for converting one currency code to another.
|
boolean |
isABaseCurrency(java.lang.String currency,
UserInfo user) |
checkSecurity, configure, destroy, freeDBConnection, freeMboSet, getCriteria, getCurrentState, getDBConnection, getLiveObjCount, getLoad, getMaximoDD, getMaxVar, getMboSet, getMXServer, getName, getProfile, getProxy, getSchemaOwner, getServiceInfo, getServiceLogger, getSetForRelationship, getSetFromKeys, getStateCmdList, getStateList, getURL, init, initCriteriaList, isAppService, isRunning, isSingletonService, restart, setProxy, setRunning, setURL, verifyUser, verifyUser
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkSecurity, getCriteria, getCurrentState, getLiveObjCount, getMboSet, getName, getSchemaOwner, getSetForRelationship, getSetFromKeys, getStateCmdList, getStateList, getURL, verifyUser, verifyUser
isAppService, isSingletonService, restart
public CurrencyService() throws java.rmi.RemoteException
java.rmi.RemoteException
public CurrencyService(MXServer mxServer) throws java.rmi.RemoteException
mxServer
- Mxserverjava.rmi.RemoteException
public double calculateCurrencyCost(UserInfo userInfo, java.lang.String currencyFrom, java.lang.String currencyTo, double value, java.util.Date date, java.lang.String orgId) throws MXException, java.rmi.RemoteException
calculateCurrencyCost
in interface CurrencyServiceRemote
userInfo
- user information to instantiate a mbo setcurrencyFrom
- the From currency codecurrencyTo
- the To currency codevalue
- value of currencyfrom to be converteddate
- the given date to find an exchange rateorgId
- the orgId associated with the currencyToMXApplicationException
- (currency, InvalidCurrency) is thrown
when the given From currency code is not a valid oneMXException
java.rmi.RemoteException
Currency.getCurrencyCost(String, double, Date, String)
public double getCurrencyExchangeRate(UserInfo userInfo, java.lang.String currencyCodeFrom, java.lang.String currencyCodeTo, java.util.Date exchangeDate, java.lang.String orgId) throws MXException, java.rmi.RemoteException
The three-step method to find an exchange rate between the "From" currency and the "To" currency: |
First, an attempt is made to find the requested exchange rate in the EXCHANGE table. |
Second, if the exchange rate is not found, an attempt is made to find the inverse of the rate requested, that is, an attempt is made to find the exchange rate for the "To" currency to the "From" currency. If this is found, the inverse (1/rate) is used for the excahnge rate for the "From" currency to the "To" currency. |
Third, If the above fail, an attempt is made to find the exchange rates for both the "From" currency to the "Base" currency, and the "To" currency to the "Base" currency. If this succeeds, the desired exchange rate is calculated from these two rates. |
If all attempts fail,an exception is thrown. |
getCurrencyExchangeRate
in interface CurrencyServiceRemote
userInfo
- user information to instantiate a mbo setcurrencyFrom
- the From currency codecurrencyTo
- the To currency codedate
- the given date to find an exchange rateorgId
- organization identifier used to get base currencyMXApplicationException
- (currency, GetExchangeRate) is thrown
when the exchange rate cannot be found for the given currency codesMXException
java.rmi.RemoteException
getCurrencyExchangeRate(UserInfo userInfo,String currencyFrom,String currencyTo,Date date,String orgId)
public java.lang.String getBaseCurrency1(java.lang.String orgID, UserInfo user) throws MXException, java.rmi.RemoteException
getBaseCurrency1
in interface CurrencyServiceRemote
UserInfo
- user The information of the user accessing this service.MXException
java.rmi.RemoteException
getBaseCurrency1(String,UserInfo)
public java.lang.String getBaseCurrency2(java.lang.String orgID, UserInfo user) throws MXException, java.rmi.RemoteException
getBaseCurrency2
in interface CurrencyServiceRemote
UserInfo
- user The information of the user accessing this service.MXException
java.rmi.RemoteException
getBaseCurrency2(String,UserInfo)
public boolean isABaseCurrency(java.lang.String currency, UserInfo user) throws MXException, java.rmi.RemoteException
isABaseCurrency
in interface CurrencyServiceRemote
MXException
java.rmi.RemoteException
isABaseCurrency(String currency, UserInfo user)