use of org.openlca.ilcd.flows.FlowInfo in project olca-modules by GreenDelta.
the class FlowExtensions method getInfoExtension.
private static Other getInfoExtension(Flow flow, boolean create) {
FlowInfo flowInfo = flow.flowInfo;
if (flowInfo == null) {
if (!create)
return null;
flowInfo = new FlowInfo();
flow.flowInfo = flowInfo;
}
DataSetInfo dataInfo = flowInfo.dataSetInfo;
if (dataInfo == null) {
if (!create)
return null;
dataInfo = new DataSetInfo();
flowInfo.dataSetInfo = dataInfo;
}
Other other = dataInfo.other;
if (other == null && create) {
other = new Other();
dataInfo.other = other;
}
return other;
}
use of org.openlca.ilcd.flows.FlowInfo in project olca-modules by GreenDelta.
the class FlowUpdateTest method makeFlow.
private Flow makeFlow(String id) {
Flow flow = new Flow();
FlowInfo info = new FlowInfo();
flow.flowInfo = info;
DataSetInfo dataInfo = new DataSetInfo();
dataInfo.uuid = id;
info.dataSetInfo = dataInfo;
FlowName name = new FlowName();
dataInfo.name = name;
LangString.set(name.baseName, "test flow - " + id, "en");
AdminInfo adminInfo = new AdminInfo();
Publication pub = new Publication();
adminInfo.publication = pub;
pub.version = "01.00.000";
flow.adminInfo = adminInfo;
Modelling mav = new Modelling();
flow.modelling = mav;
LCIMethod method = new LCIMethod();
mav.lciMethod = method;
method.flowType = FlowType.ELEMENTARY_FLOW;
return flow;
}
use of org.openlca.ilcd.flows.FlowInfo in project olca-modules by GreenDelta.
the class FlowBag method getLocation.
public List<LangString> getLocation() {
FlowInfo info = flow.flowInfo;
if (info == null)
return Collections.emptyList();
Geography geo = info.geography;
if (geo == null)
return Collections.emptyList();
else
return geo.location;
}
use of org.openlca.ilcd.flows.FlowInfo in project olca-modules by GreenDelta.
the class NetworkPutFlowTest method testPutFlow.
@Test
public void testPutFlow() throws Exception {
Assume.assumeTrue(TestServer.isAvailable());
String id = UUID.randomUUID().toString();
Flow flow = new Flow();
FlowInfo info = new FlowInfo();
flow.flowInfo = info;
info.dataSetInfo = makeDataInfo(id);
flow.adminInfo = makeAdminInfo();
Modelling mav = new Modelling();
flow.modelling = mav;
LCIMethod method = new LCIMethod();
mav.lciMethod = method;
method.flowType = FlowType.ELEMENTARY_FLOW;
client.put(flow);
}
use of org.openlca.ilcd.flows.FlowInfo in project olca-modules by GreenDelta.
the class FlowExport method run.
public Flow run(org.openlca.core.model.Flow flow) {
if (config.store.contains(Flow.class, flow.refId))
return config.store.get(Flow.class, flow.refId);
this.flow = flow;
Flow iFlow = new Flow();
iFlow.version = "1.1";
FlowInfo info = new FlowInfo();
iFlow.flowInfo = info;
info.dataSetInfo = makeDataSetInfo();
QuantitativeReference qRef = new QuantitativeReference();
info.quantitativeReference = qRef;
qRef.referenceFlowProperty = 0;
iFlow.adminInfo = makeAdminInfo();
iFlow.modelling = makeModellingInfo();
makeFlowProperties(Flows.flowProperties(iFlow));
addLocation(iFlow);
config.store.put(iFlow);
this.flow = null;
return iFlow;
}
Aggregations