Search in sources :

Example 1 with CategoryDao

use of org.openlca.core.database.CategoryDao 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));
}
Also used : SourceDao(org.openlca.core.database.SourceDao) CurrencyDao(org.openlca.core.database.CurrencyDao) ImpactCategoryDao(org.openlca.core.database.ImpactCategoryDao) CategoryDao(org.openlca.core.database.CategoryDao) ActorDao(org.openlca.core.database.ActorDao) FlowPropertyDao(org.openlca.core.database.FlowPropertyDao) LocationDao(org.openlca.core.database.LocationDao) UnitDao(org.openlca.core.database.UnitDao) DQSystemDao(org.openlca.core.database.DQSystemDao) NwSetDao(org.openlca.core.database.NwSetDao) FlowDao(org.openlca.core.database.FlowDao) ImpactMethodDao(org.openlca.core.database.ImpactMethodDao) ProcessDao(org.openlca.core.database.ProcessDao) UnitGroupDao(org.openlca.core.database.UnitGroupDao) SocialIndicatorDao(org.openlca.core.database.SocialIndicatorDao) ImpactCategoryDao(org.openlca.core.database.ImpactCategoryDao) ProductSystemDao(org.openlca.core.database.ProductSystemDao) ProjectDao(org.openlca.core.database.ProjectDao)

Example 2 with CategoryDao

use of org.openlca.core.database.CategoryDao in project olca-modules by GreenDelta.

the class CategoryExport method doIt.

@Override
protected void doIt(CSVPrinter writer, IDatabase database) throws Exception {
    log.trace("write categories");
    CategoryDao dao = new CategoryDao(database);
    List<Category> categories = dao.getAll();
    for (Category category : categories) {
        Object[] line = createLine(category);
        writer.printRecord(line);
    }
    log.trace("{} categories written", categories.size());
}
Also used : Category(org.openlca.core.model.Category) CategoryDao(org.openlca.core.database.CategoryDao)

Example 3 with CategoryDao

use of org.openlca.core.database.CategoryDao in project olca-modules by GreenDelta.

the class ContactImport method createNew.

private Actor createNew() {
    actor = new Actor();
    var path = Categories.getPath(ilcdContact.getValue());
    actor.category = new CategoryDao(config.db()).sync(ModelType.ACTOR, path);
    setDescriptionAttributes();
    setVersionTime();
    return config.insert(actor);
}
Also used : CategoryDao(org.openlca.core.database.CategoryDao) Actor(org.openlca.core.model.Actor)

Example 4 with CategoryDao

use of org.openlca.core.database.CategoryDao in project olca-modules by GreenDelta.

the class SourceImport method createNew.

private Source createNew() {
    source = new Source();
    String[] path = Categories.getPath(ilcdSource.getValue());
    source.category = new CategoryDao(config.db()).sync(ModelType.SOURCE, path);
    setDescriptionAttributes();
    importExternalFile();
    return config.insert(source);
}
Also used : CategoryDao(org.openlca.core.database.CategoryDao) Source(org.openlca.core.model.Source)

Example 5 with CategoryDao

use of org.openlca.core.database.CategoryDao in project olca-modules by GreenDelta.

the class UnitGroupImport method createNew.

private UnitGroup createNew() {
    unitGroup = new UnitGroup();
    var path = Categories.getPath(ilcdUnitGroup.getValue());
    unitGroup.category = new CategoryDao(config.db()).sync(ModelType.UNIT_GROUP, path);
    mapDescriptionAttributes();
    createUnits();
    return config.insert(unitGroup);
}
Also used : UnitGroup(org.openlca.core.model.UnitGroup) CategoryDao(org.openlca.core.database.CategoryDao)

Aggregations

CategoryDao (org.openlca.core.database.CategoryDao)20 Category (org.openlca.core.model.Category)11 Test (org.junit.Test)4 CategoryElement (org.openlca.app.navigation.elements.CategoryElement)2 ModelElement (org.openlca.app.navigation.elements.ModelElement)2 FlowDao (org.openlca.core.database.FlowDao)2 IDatabase (org.openlca.core.database.IDatabase)2 ImpactMethodDao (org.openlca.core.database.ImpactMethodDao)2 ProductSystemDao (org.openlca.core.database.ProductSystemDao)2 FlowProperty (org.openlca.core.model.FlowProperty)2 Logger (org.slf4j.Logger)2 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 ActorDao (org.openlca.core.database.ActorDao)1 CurrencyDao (org.openlca.core.database.CurrencyDao)1 DQSystemDao (org.openlca.core.database.DQSystemDao)1 FlowPropertyDao (org.openlca.core.database.FlowPropertyDao)1 ImpactCategoryDao (org.openlca.core.database.ImpactCategoryDao)1 LocationDao (org.openlca.core.database.LocationDao)1 NwSetDao (org.openlca.core.database.NwSetDao)1