Search in sources :

Example 6 with Flow

use of org.openlca.core.model.Flow 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);
}
Also used : ProcessLink(org.openlca.core.model.ProcessLink) ProductSystem(org.openlca.core.model.ProductSystem) Flow(org.openlca.core.model.Flow) ProductSystemDao(org.openlca.core.database.ProductSystemDao)

Example 7 with Flow

use of org.openlca.core.model.Flow in project olca-modules by GreenDelta.

the class ExchangeUseSearchTest method addExchanges.

private void addExchanges() {
    for (int i = 1; i < 4; i++) {
        Flow flow = new Flow();
        flow.name = "flow_" + 1;
        flow = new FlowDao(db).insert(flow);
        modelStack.push(flow);
        Exchange ep = new Exchange();
        ep.flow = flow;
        ep.isInput = false;
        p.exchanges.add(ep);
        Exchange eq = ep.copy();
        eq.isInput = true;
        q.exchanges.add(eq);
    }
}
Also used : Exchange(org.openlca.core.model.Exchange) FlowDao(org.openlca.core.database.FlowDao) Flow(org.openlca.core.model.Flow)

Example 8 with Flow

use of org.openlca.core.model.Flow in project olca-modules by GreenDelta.

the class FlowPropertyFactorUseSearchTest method setup.

@Before
public void setup() {
    flow = new Flow();
    flow.name = "flow";
    property = new FlowProperty();
    property.name = "property";
    factor = new FlowPropertyFactor();
    factor.flowProperty = property;
    flow.flowPropertyFactors.add(factor);
    property = new FlowPropertyDao(database).insert(property);
    flow = new FlowDao(database).insert(flow);
    factor = flow.getFactor(property);
    search = new FlowPropertyFactorUseSearch(flow, database);
}
Also used : FlowDao(org.openlca.core.database.FlowDao) FlowPropertyDao(org.openlca.core.database.FlowPropertyDao) FlowPropertyFactor(org.openlca.core.model.FlowPropertyFactor) FlowProperty(org.openlca.core.model.FlowProperty) Flow(org.openlca.core.model.Flow) Before(org.junit.Before)

Example 9 with Flow

use of org.openlca.core.model.Flow in project olca-modules by GreenDelta.

the class ProjectReferenceSearchTest method createProjectVariant.

private ProjectVariant createProjectVariant(String p1Name, String p2Name, String p3Name, long methodId) {
    ProjectVariant variant = new ProjectVariant();
    variant.productSystem = db.insert(new ProductSystem());
    variant.parameterRedefs.add(createParameterRedef(p1Name, methodId));
    variant.parameterRedefs.add(createParameterRedef(p2Name, p3Name + "*5"));
    FlowPropertyFactor factor = new FlowPropertyFactor();
    factor.flowProperty = db.insert(new FlowProperty());
    variant.flowPropertyFactor = factor;
    UnitGroup unitGroup = new UnitGroup();
    Unit unit = new Unit();
    unit.name = "unit";
    unitGroup.units.add(unit);
    unitGroup = db.insert(unitGroup);
    unit = unitGroup.getUnit(unit.name);
    variant.unit = unit;
    Flow flow = new Flow();
    flow.flowPropertyFactors.add(factor);
    // don't add flow to expected references, just for persisting the factor
    flow = db.insert(flow);
    return variant;
}
Also used : ProjectVariant(org.openlca.core.model.ProjectVariant) UnitGroup(org.openlca.core.model.UnitGroup) ProductSystem(org.openlca.core.model.ProductSystem) FlowPropertyFactor(org.openlca.core.model.FlowPropertyFactor) Unit(org.openlca.core.model.Unit) FlowProperty(org.openlca.core.model.FlowProperty) Flow(org.openlca.core.model.Flow)

Example 10 with Flow

use of org.openlca.core.model.Flow 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";
}
Also used : UnitGroup(org.openlca.core.model.UnitGroup) Actor(org.openlca.core.model.Actor) Process(org.openlca.core.model.Process) LangString(org.openlca.ilcd.commons.LangString) FlowProperty(org.openlca.core.model.FlowProperty) Source(org.openlca.core.model.Source) Flow(org.openlca.core.model.Flow)

Aggregations

Flow (org.openlca.core.model.Flow)102 FlowPropertyFactor (org.openlca.core.model.FlowPropertyFactor)23 FlowDao (org.openlca.core.database.FlowDao)22 FlowProperty (org.openlca.core.model.FlowProperty)17 Exchange (org.openlca.core.model.Exchange)14 Unit (org.openlca.core.model.Unit)14 Process (org.openlca.core.model.Process)13 UnitGroup (org.openlca.core.model.UnitGroup)9 ArrayList (java.util.ArrayList)8 Before (org.junit.Before)7 Test (org.junit.Test)7 TechFlow (org.openlca.core.matrix.index.TechFlow)6 Category (org.openlca.core.model.Category)6 ProcessDao (org.openlca.core.database.ProcessDao)5 EnviFlow (org.openlca.core.matrix.index.EnviFlow)5 Location (org.openlca.core.model.Location)5 FlowMapEntry (org.openlca.io.maps.FlowMapEntry)5 FlowRef (org.openlca.io.maps.FlowRef)5 HashSet (java.util.HashSet)4 List (java.util.List)4