use of org.openlca.core.model.ProcessLink 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.ProcessLink in project olca-modules by GreenDelta.
the class TestSystem method link.
public TestSystem link(Process process) {
if (processes.contains(process))
return this;
index(process);
for (Process p : processes) {
for (Exchange e : p.exchanges) {
if (isProvider(e))
continue;
if (e.flow == null || e.flow.flowType == FlowType.ELEMENTARY_FLOW)
continue;
long flowId = e.flow.id;
Process provider = providers.get(flowId);
if (provider == null)
continue;
ProcessLink link = new ProcessLink();
link.providerId = provider.id;
link.flowId = flowId;
link.processId = p.id;
link.exchangeId = e.id;
if (!system.processLinks.contains(link)) {
system.processLinks.add(link);
}
}
}
return this;
}
use of org.openlca.core.model.ProcessLink in project olca-modules by GreenDelta.
the class ExchangeUseSearchTest method createSystem.
private void createSystem() {
ProductSystem system = new ProductSystem();
system.name = SYS_NAME;
system.referenceProcess = p;
system.referenceExchange = p.exchanges.get(0);
Flow linkFlow = p.exchanges.get(1).flow;
ProcessLink link = new ProcessLink();
link.providerId = p.id;
link.processId = q.id;
link.flowId = linkFlow.id;
system.processLinks.add(link);
system = new ProductSystemDao(db).insert(system);
modelStack.push(system);
}
use of org.openlca.core.model.ProcessLink in project olca-modules by GreenDelta.
the class Update8Test method testSystemLink.
@Test
public void testSystemLink() {
ProductSystemDao dao = new ProductSystemDao(db);
ProductSystem system = new ProductSystem();
ProcessLink link = new ProcessLink();
link.providerType = ProcessLink.ProviderType.SUB_SYSTEM;
system.processLinks.add(link);
dao.insert(system);
system = dao.getForId(system.id);
assertTrue(system.processLinks.get(0).hasSubSystemProvider());
dao.delete(system);
}
use of org.openlca.core.model.ProcessLink in project olca-modules by GreenDelta.
the class ProductSystemLinks method map.
private void map() {
mapProcessIds();
for (ProcessLink link : system.processLinks) {
link.providerId = destId(Process.class, link.providerId);
link.processId = destId(Process.class, link.processId);
link.flowId = destId(Flow.class, link.flowId);
Ex ex = new Ex(link.exchangeId);
link.exchangeId = ex.map().id;
}
}
Aggregations