use of org.openlca.core.model.Source in project olca-modules by GreenDelta.
the class ProcessReferenceSearchTest method createModel.
@Override
protected Process createModel() {
Process process = new Process();
process.category = insertAndAddExpected("category", new Category());
process.location = insertAndAddExpected("location", new Location());
process.dqSystem = insertAndAddExpected("dqSystem", new DQSystem());
process.exchangeDqSystem = insertAndAddExpected("exchangeDqSystem", new DQSystem());
process.socialDqSystem = insertAndAddExpected("socialDqSystem", new DQSystem());
String n1 = generateName();
String n2 = generateName();
String n3 = generateName();
String n4 = generateName();
String n5 = generateName();
createExchange(process, 3d, true);
createExchange(process, "2*" + n4, false);
process.parameters.add(createParameter(n1, 3d, false));
process.parameters.add(createParameter(n2, n1 + "*2*" + n3, false));
process.socialAspects.add(createSocialAspect());
process.socialAspects.add(createSocialAspect());
process.documentation = createDocumentation();
insertAndAddExpected(n3, createParameter(n3, "5*5", true));
// formula with parameter to see if added as reference (unexpected)
insertAndAddExpected(n4, createParameter(n4, "3*" + n5, true));
Parameter globalUnreferenced = createParameter(n1, "3*3", true);
Parameter globalUnreferenced2 = createParameter(n5, "3*3", true);
// must be inserted manually
globalUnreferenced = db.insert(globalUnreferenced);
globalUnreferenced2 = db.insert(globalUnreferenced2);
process = db.insert(process);
for (Exchange e : process.exchanges) {
addExpected("flow", e.flow, "exchanges", Exchange.class, e.id);
addExpected("flowPropertyFactor", e.flowPropertyFactor, "exchanges", Exchange.class, e.id);
addExpected("flowProperty", e.flowPropertyFactor.flowProperty, "flowPropertyFactor", FlowPropertyFactor.class, e.flowPropertyFactor.id);
addExpected("unit", e.unit, "exchanges", Exchange.class, e.id);
Process provider = processes.get(e.defaultProviderId);
if (provider != null)
addExpected("defaultProviderId", provider, "exchanges", Exchange.class, e.id);
}
for (SocialAspect a : process.socialAspects) {
addExpected("indicator", a.indicator, "socialAspects", SocialAspect.class, a.id);
addExpected("source", a.source, "socialAspects", SocialAspect.class, a.id);
}
ProcessDocumentation doc = process.documentation;
addExpected("dataDocumentor", doc.dataDocumentor, "documentation", ProcessDocumentation.class, doc.id);
addExpected("dataGenerator", doc.dataGenerator, "documentation", ProcessDocumentation.class, doc.id);
addExpected("dataSetOwner", doc.dataSetOwner, "documentation", ProcessDocumentation.class, doc.id);
addExpected("reviewer", doc.reviewer, "documentation", ProcessDocumentation.class, doc.id);
addExpected("publication", doc.publication, "documentation", ProcessDocumentation.class, doc.id);
for (Source s : process.documentation.sources) addExpected("sources", s, "documentation", ProcessDocumentation.class, doc.id);
return process;
}
use of org.openlca.core.model.Source 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.Source in project olca-modules by GreenDelta.
the class ModelingSheet method readSources.
private void readSources() {
int row = 17;
while (true) {
String name = config.getString(sheet, row, 0);
if (Strings.isNullOrEmpty(name)) {
break;
}
String category = config.getString(sheet, row, 1);
Source source = config.refData.getSource(name, category);
if (source != null) {
doc.sources.add(source);
}
row++;
}
}
use of org.openlca.core.model.Source in project olca-modules by GreenDelta.
the class SourceSheet method readSource.
private void readSource(String uuid, int row) {
String name = config.getString(sheet, row, 1);
String category = config.getString(sheet, row, 3);
Source source = dao.getForRefId(uuid);
if (source != null) {
config.refData.putSource(name, category, source);
return;
}
source = new Source();
source.refId = uuid;
source.name = name;
source.description = config.getString(sheet, row, 2);
source.category = config.getCategory(category, ModelType.SOURCE);
setAttributes(row, source);
source = dao.insert(source);
config.refData.putSource(name, category, source);
}
use of org.openlca.core.model.Source 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);
}
}
Aggregations