Search in sources :

Example 1 with FlowInfo

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;
}
Also used : FlowInfo(org.openlca.ilcd.flows.FlowInfo) DataSetInfo(org.openlca.ilcd.flows.DataSetInfo) Other(org.openlca.ilcd.commons.Other)

Example 2 with FlowInfo

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;
}
Also used : FlowInfo(org.openlca.ilcd.flows.FlowInfo) LCIMethod(org.openlca.ilcd.flows.LCIMethod) FlowName(org.openlca.ilcd.flows.FlowName) AdminInfo(org.openlca.ilcd.flows.AdminInfo) Publication(org.openlca.ilcd.commons.Publication) Modelling(org.openlca.ilcd.flows.Modelling) DataSetInfo(org.openlca.ilcd.flows.DataSetInfo) Flow(org.openlca.ilcd.flows.Flow)

Example 3 with FlowInfo

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;
}
Also used : FlowInfo(org.openlca.ilcd.flows.FlowInfo) Geography(org.openlca.ilcd.flows.Geography)

Example 4 with FlowInfo

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);
}
Also used : FlowInfo(org.openlca.ilcd.flows.FlowInfo) LCIMethod(org.openlca.ilcd.flows.LCIMethod) Modelling(org.openlca.ilcd.flows.Modelling) LangString(org.openlca.ilcd.commons.LangString) Flow(org.openlca.ilcd.flows.Flow) Test(org.junit.Test)

Example 5 with FlowInfo

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;
}
Also used : FlowInfo(org.openlca.ilcd.flows.FlowInfo) QuantitativeReference(org.openlca.ilcd.flows.QuantitativeReference) Flow(org.openlca.ilcd.flows.Flow)

Aggregations

FlowInfo (org.openlca.ilcd.flows.FlowInfo)5 Flow (org.openlca.ilcd.flows.Flow)3 DataSetInfo (org.openlca.ilcd.flows.DataSetInfo)2 LCIMethod (org.openlca.ilcd.flows.LCIMethod)2 Modelling (org.openlca.ilcd.flows.Modelling)2 Test (org.junit.Test)1 LangString (org.openlca.ilcd.commons.LangString)1 Other (org.openlca.ilcd.commons.Other)1 Publication (org.openlca.ilcd.commons.Publication)1 AdminInfo (org.openlca.ilcd.flows.AdminInfo)1 FlowName (org.openlca.ilcd.flows.FlowName)1 Geography (org.openlca.ilcd.flows.Geography)1 QuantitativeReference (org.openlca.ilcd.flows.QuantitativeReference)1