use of org.openlca.core.model.Flow in project olca-modules by GreenDelta.
the class ImpactMethodReferenceSearchTest method createFlow.
private Flow createFlow() {
Flow flow = new Flow();
UnitGroup group = new UnitGroup();
Unit unit = new Unit();
unit.name = "unit";
group.units.add(unit);
group = db.insert(group);
FlowProperty property = new FlowProperty();
property.unitGroup = group;
property = db.insert(property);
FlowPropertyFactor factor = new FlowPropertyFactor();
factor.flowProperty = property;
flow.flowPropertyFactors.add(factor);
return db.insert(flow);
}
use of org.openlca.core.model.Flow in project olca-modules by GreenDelta.
the class ProductSystemReferenceSearchTest method createLink.
private ProcessLink createLink(Process p1, Process p2) {
ProcessLink link = new ProcessLink();
Flow flow = createFlow(false);
Exchange e1 = new Exchange();
e1.flow = flow;
p1.exchanges.add(e1);
Exchange e2 = new Exchange();
e2.flow = flow;
p2.exchanges.add(e2);
link.processId = p1.id;
link.providerId = p2.id;
link.flowId = flow.id;
addExpected("processId", p1);
addExpected("providerId", p2);
addExpected("exchangeId", e1);
return link;
}
use of org.openlca.core.model.Flow in project olca-modules by GreenDelta.
the class FlowDescriptorTest method setUp.
@Before
public void setUp() {
property = new FlowProperty();
property = new FlowPropertyDao(db).insert(property);
flow = new Flow();
flow.referenceFlowProperty = property;
flow = flowDao.insert(flow);
}
use of org.openlca.core.model.Flow in project olca-modules by GreenDelta.
the class TestData method flow.
public static Flow flow(String name, String unit, FlowType type) {
String flowId = KeyGen.get("flow", name, unit);
FlowDao dao = new FlowDao(Tests.getDb());
Flow flow = dao.getForRefId(flowId);
if (flow != null)
return flow;
flow = new Flow();
flow.name = name;
flow.refId = flowId;
flow.flowType = type;
FlowProperty property = property(unit);
FlowPropertyFactor factor = new FlowPropertyFactor();
factor.flowProperty = property;
factor.conversionFactor = 1;
flow.flowPropertyFactors.add(factor);
flow.referenceFlowProperty = property;
return dao.insert(flow);
}
use of org.openlca.core.model.Flow in project olca-modules by GreenDelta.
the class TestProcess method addCosts.
public TestProcess addCosts(String flow, double amount, String currency) {
for (Exchange e : process.exchanges) {
Flow f = e.flow;
if (f == null || !Strings.nullOrEqual(f.name, flow))
continue;
e.currency = TestData.currency(currency);
e.costs = amount;
break;
}
return this;
}
Aggregations