use of org.openlca.core.database.CurrencyDao in project olca-modules by GreenDelta.
the class Sequence method init.
private void init(IDatabase db) {
index(CATEGORY, new CategoryDao(db));
index(LOCATION, new LocationDao(db));
index(ACTOR, new ActorDao(db));
index(SOURCE, new SourceDao(db));
index(UNIT, new UnitDao(db));
index(UNIT_GROUP, new UnitGroupDao(db));
index(FLOW_PROPERTY, new FlowPropertyDao(db));
index(FLOW, new FlowDao(db));
index(CURRENCY, new CurrencyDao(db));
index(PROCESS, new ProcessDao(db));
index(PRODUCT_SYSTEM, new ProductSystemDao(db));
index(IMPACT_CATEGORY, new ImpactCategoryDao(db));
index(IMPACT_METHOD, new ImpactMethodDao(db));
index(NW_SET, new NwSetDao(db));
index(PROJECT, new ProjectDao(db));
index(DQ_SYSTEM, new DQSystemDao(db));
index(SOCIAL_INDICATOR, new SocialIndicatorDao(db));
}
use of org.openlca.core.database.CurrencyDao in project olca-modules by GreenDelta.
the class CurrencyTest method testCurrency.
@Test
public void testCurrency() {
CurrencyDao dao = new CurrencyDao(Tests.getDb());
Currency currency = createModel(dao);
doExport(currency, dao);
doImport(dao, currency);
dao.delete(currency);
}
use of org.openlca.core.database.CurrencyDao in project olca-modules by GreenDelta.
the class CostHandler method getReferenceCurrencyCode.
private String getReferenceCurrencyCode() {
CurrencyDao dao = new CurrencyDao(db);
Currency c = dao.getReferenceCurrency();
if (c != null && c.code != null)
return c.code;
return "?";
}
use of org.openlca.core.database.CurrencyDao in project olca-app by GreenDelta.
the class CurrencyTable method getOthers.
private List<Currency> getOthers() {
CurrencyDao dao = new CurrencyDao(Database.get());
List<Currency> others = new ArrayList<>();
for (Currency c : dao.getAll()) {
if (Objects.equals(c, currency))
continue;
if (!Objects.equals(c.referenceCurrency, currency.referenceCurrency))
continue;
others.add(c);
}
Collections.sort(others, (c1, c2) -> {
return Strings.compare(c1.name, c2.name);
});
return others;
}
use of org.openlca.core.database.CurrencyDao in project olca-app by GreenDelta.
the class ReportFiller method appendCostResults.
private void appendCostResults(Report report) {
var currency = new CurrencyDao(db).getReferenceCurrency();
for (var v : result.getVariants()) {
double costs = result.getResult(v).totalCosts();
report.netCosts.add(ReportCostResult.of(v, currency, costs));
double addedValue = costs == 0 ? 0 : -costs;
report.addedValues.add(ReportCostResult.of(v, currency, addedValue));
}
Comparator<ReportCostResult> c = (r1, r2) -> Strings.compare(r1.variant, r2.variant);
report.netCosts.sort(c);
report.addedValues.sort(c);
}
Aggregations