use of org.openlca.core.database.SourceDao 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.SourceDao in project olca-modules by GreenDelta.
the class DocImportMapper method mapPublicationSource.
private void mapPublicationSource(AdminInfo adminInfo) {
DataGenerator gen = adminInfo.dataGenerator;
if (gen == null || gen.publishedSourceId == null)
return;
SourceDao dao = new SourceDao(database);
Source source = dao.getForRefId(gen.publishedSourceId);
if (source == null) {
source = new Source();
source.refId = gen.publishedSourceId;
StringBuilder title = new StringBuilder();
StringBuilder shortTitle = new StringBuilder();
if (gen.publishedSourceFirstAuthor != null) {
title.append(gen.publishedSourceFirstAuthor);
shortTitle.append(gen.publishedSourceFirstAuthor);
}
if (gen.publishedSourceYear != null) {
title.append(gen.publishedSourceYear);
shortTitle.append(gen.publishedSourceYear);
}
source.textReference = title.toString();
source.name = shortTitle.toString();
source = dao.insert(source);
}
doc.publication = source;
}
use of org.openlca.core.database.SourceDao in project olca-app by GreenDelta.
the class Dialog method sourceRow.
private void sourceRow(Composite body, FormToolkit tk) {
UI.formLabel(body, tk, M.Source);
TextDropComponent drop = new TextDropComponent(body, tk, ModelType.SOURCE);
UI.gridData(drop, true, false);
if (aspect.source != null) {
drop.setContent(Descriptor.of(aspect.source));
}
drop.onChange(d -> {
if (d == null) {
aspect.source = null;
} else {
SourceDao dao = new SourceDao(Database.get());
aspect.source = dao.getForId(d.id);
}
});
UI.filler(body, tk);
}
use of org.openlca.core.database.SourceDao in project olca-modules by GreenDelta.
the class SourceSheet method write.
private void write() {
Excel.trackSize(sheet, 0, 5);
writeHeader();
var sources = new SourceDao(config.database).getAll();
sources.sort(new EntitySorter());
for (Source source : sources) {
row++;
write(source);
}
Excel.autoSize(sheet, 0, 5);
}
use of org.openlca.core.database.SourceDao in project olca-modules by GreenDelta.
the class SourceTest method testSource.
@Test
public void testSource() {
SourceDao dao = new SourceDao(Tests.getDb());
Source source = createModel(dao);
doExport(source, dao);
doImport(dao, source);
dao.delete(source);
}
Aggregations