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";
}
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);
}
}
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);
}
}
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);
}
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;
}
Aggregations