Using Multiple Currencies in Java Classes

The Currency Java class exposes the currency properties for a project (Budget Currency) or for a user (User-Default Currency). The class has these methods:

String getCode();
String getSymbol();

The User class and the Project interface provide access to per-user and per-project currency properties:

Project.Immutable project = ContextStore.get().getProject();
Currency currency = project.getBudgetCurrency();
User user = ContextStore.get().getUser();
Currency currency = user.getUserCurrency();

The Currencies class encapsulates the list of all currencies available for the project. It is loaded on startup from the Archibus Currencies table.

Currencies currencies =
ContextStore.get().getProject().getCurrencies();
Currency currency1 = currencies.getCurrency("USD");
Currency currency2 = currencies.currencyForSymbol("$");

Custom workflow rules that support custom UI controls or custom reports can use the CurrencyConversions Java API methods to convert values from Budget Currency to other currencies and back.

To obtain the CurrencyConversions object for the current project:

CurrencyConversions conversions =ContextStore.get().getProject().getCurrencyConversions();

To reload currencies from the Archibus Currencies table for the current project:

ContextStore.get().getProject().reloadCurrencyConversions();

CurrencyConversions methods return the most recently updated conversion rates for specified currencies:

Double getExchangeRateFromBudget(currency, exchangeRateType);
Double getExchangeRateToBudget(currency, exchangeRateType);
Double getExchangeRateFromBudgetToUser(exchangeRateType);
Exchange rate types are represented by the ExchangeRateType enumeration:
ExchangeRateType.BUDGET
ExchangeRateType.PAYMENT