Search in sources :

Example 1 with CurrencyDescriptor

use of org.openlca.core.model.descriptors.CurrencyDescriptor in project olca-modules by GreenDelta.

the class CurrencyDao method getReferenceCurrency.

/**
 * There should be only one currency that is the reference currency in the
 * database. This function returns the reference currency of the first
 * currency in the database (which should by the reference currency of all
 * other currencies by this definition). If there is no currency contained
 * in the database, this function will return null.
 */
public Currency getReferenceCurrency() {
    List<CurrencyDescriptor> all = getDescriptors();
    if (all.isEmpty())
        return null;
    Currency currency = getForId(all.get(0).id);
    return currency == null ? null : currency.referenceCurrency;
}
Also used : Currency(org.openlca.core.model.Currency) CurrencyDescriptor(org.openlca.core.model.descriptors.CurrencyDescriptor)

Aggregations

Currency (org.openlca.core.model.Currency)1 CurrencyDescriptor (org.openlca.core.model.descriptors.CurrencyDescriptor)1