Search in sources :

Example 1 with Actor

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

the class DataSetRef method setUriAndType.

private static void setUriAndType(RootEntity iModel, Ref ref) {
    String uri = "../";
    if (iModel instanceof Actor) {
        ref.type = DataSetType.CONTACT;
        uri += "contacts/";
    } else if (iModel instanceof Source) {
        ref.type = DataSetType.SOURCE;
        uri += "sources/";
    } else if (iModel instanceof UnitGroup) {
        ref.type = DataSetType.UNIT_GROUP;
        uri += "unitgroups/";
    } else if (iModel instanceof FlowProperty) {
        ref.type = DataSetType.FLOW_PROPERTY;
        uri += "flowproperties/";
    } else if (iModel instanceof Flow) {
        ref.type = DataSetType.FLOW;
        uri += "flows/";
    } else if (iModel instanceof Process) {
        ref.type = DataSetType.PROCESS;
        uri += "processes/";
    }
    uri += iModel.refId;
    ref.uri = uri + ".xml";
}
Also used : UnitGroup(org.openlca.core.model.UnitGroup) Actor(org.openlca.core.model.Actor) Process(org.openlca.core.model.Process) LangString(org.openlca.ilcd.commons.LangString) FlowProperty(org.openlca.core.model.FlowProperty) Source(org.openlca.core.model.Source) Flow(org.openlca.core.model.Flow)

Example 2 with Actor

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

the class PersonUpdate method run.

@Override
public void run() {
    log.trace("update actors from {}", personFile);
    try {
        PersonList personList = spold2.IO.read(personFile, PersonList.class);
        if (personList == null)
            return;
        for (Person person : personList.persons) {
            Actor actor = dao.getForRefId(person.id);
            if (actor == null)
                continue;
            updateActor(actor, person);
        }
    } catch (Exception e) {
        log.error("failed to import persons from " + personFile, e);
    }
}
Also used : PersonList(spold2.PersonList) Actor(org.openlca.core.model.Actor) Person(spold2.Person)

Example 3 with Actor

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

the class ILCDExport method tryExport.

private void tryExport(RootEntity component) throws Exception {
    if (component instanceof ImpactMethod) {
        ImpactMethodExport export = new ImpactMethodExport(config);
        export.run((ImpactMethod) component);
    } else if (component instanceof ProductSystem) {
        SystemExport export = new SystemExport(config);
        export.run((ProductSystem) component);
    } else if (component instanceof Process) {
        ProcessExport export = new ProcessExport(config);
        export.run((Process) component);
    } else if (component instanceof Flow) {
        FlowExport flowExport = new FlowExport(config);
        flowExport.run((Flow) component);
    } else if (component instanceof FlowProperty) {
        FlowPropertyExport export = new FlowPropertyExport(config);
        export.run((FlowProperty) component);
    } else if (component instanceof UnitGroup) {
        UnitGroupExport export = new UnitGroupExport(config);
        export.run((UnitGroup) component);
    } else if (component instanceof Actor) {
        ActorExport export = new ActorExport(config);
        export.run((Actor) component);
    } else if (component instanceof Source) {
        SourceExport export = new SourceExport(config);
        export.run((Source) component);
    }
}
Also used : UnitGroup(org.openlca.core.model.UnitGroup) ProductSystem(org.openlca.core.model.ProductSystem) Process(org.openlca.core.model.Process) FlowExport(org.openlca.io.ilcd.output.FlowExport) UnitGroupExport(org.openlca.io.ilcd.output.UnitGroupExport) SourceExport(org.openlca.io.ilcd.output.SourceExport) ImpactMethod(org.openlca.core.model.ImpactMethod) Source(org.openlca.core.model.Source) Flow(org.openlca.core.model.Flow) FlowPropertyExport(org.openlca.io.ilcd.output.FlowPropertyExport) Actor(org.openlca.core.model.Actor) ActorExport(org.openlca.io.ilcd.output.ActorExport) ImpactMethodExport(org.openlca.io.ilcd.output.ImpactMethodExport) ProcessExport(org.openlca.io.ilcd.output.ProcessExport) FlowProperty(org.openlca.core.model.FlowProperty) SystemExport(org.openlca.io.ilcd.output.SystemExport)

Example 4 with Actor

use of org.openlca.core.model.Actor 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 5 with Actor

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

the class DocImportMapper method mapDataEntryBy.

private void mapDataEntryBy(AdminInfo adminInfo) {
    DataEntry dataEntry = adminInfo.dataEntry;
    if (dataEntry == null || dataEntry.personId == null)
        return;
    ActorDao dao = new ActorDao(database);
    Actor actor = dao.getForRefId(dataEntry.personId);
    if (actor == null) {
        actor = new Actor();
        actor.refId = dataEntry.personId;
        actor.email = dataEntry.personEmail;
        actor.name = dataEntry.personName;
        actor = dao.insert(actor);
    }
    doc.dataDocumentor = actor;
}
Also used : DataEntry(spold2.DataEntry) ActorDao(org.openlca.core.database.ActorDao) Actor(org.openlca.core.model.Actor)

Aggregations

Actor (org.openlca.core.model.Actor)26 Test (org.junit.Test)7 ActorDao (org.openlca.core.database.ActorDao)6 Source (org.openlca.core.model.Source)4 Flow (org.openlca.core.model.Flow)3 FlowProperty (org.openlca.core.model.FlowProperty)3 Process (org.openlca.core.model.Process)3 UnitGroup (org.openlca.core.model.UnitGroup)3 Path (java.nio.file.Path)2 Category (org.openlca.core.model.Category)2 ImpactMethod (org.openlca.core.model.ImpactMethod)2 ProductSystem (org.openlca.core.model.ProductSystem)2 DataGenerator (spold2.DataGenerator)2 JsonObject (com.google.gson.JsonObject)1 ArrayList (java.util.ArrayList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 CategoryDao (org.openlca.core.database.CategoryDao)1 Derby (org.openlca.core.database.Derby)1 Currency (org.openlca.core.model.Currency)1 DQSystem (org.openlca.core.model.DQSystem)1