Search in sources :

Example 16 with Category

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

the class ProcessWriter method writeDummies.

private void writeDummies() {
    for (Flow flow : inputProducts) {
        if (outputProducts.contains(flow))
            continue;
        var p = Process.of("Dummy: " + flow.name, flow);
        p.id = flow.id;
        p.category = new Category();
        p.category.name = "Dummy processes";
        writeProcess(p);
    }
}
Also used : Category(org.openlca.core.model.Category) Flow(org.openlca.core.model.Flow)

Example 17 with Category

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

the class CategoryConverter method makeClasses.

private void makeClasses(Classification classification, Stack<Category> stack) {
    Category category;
    int level = 0;
    while (!stack.isEmpty()) {
        category = stack.pop();
        org.openlca.ilcd.commons.Category clazz = new org.openlca.ilcd.commons.Category();
        clazz.classId = category.refId;
        clazz.level = level;
        clazz.value = category.name;
        classification.categories.add(clazz);
        level++;
    }
}
Also used : Category(org.openlca.core.model.Category)

Example 18 with Category

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

the class CategoryConverter method getClassification.

Classification getClassification(Category category) {
    if (category == null)
        return null;
    Classification classification = new Classification();
    if (category != null) {
        Stack<Category> stack = fillStack(category);
        makeClasses(classification, stack);
    }
    return classification;
}
Also used : Category(org.openlca.core.model.Category) Classification(org.openlca.ilcd.commons.Classification)

Example 19 with Category

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

the class CategoryConverter method makeElementaryFlowCategories.

private void makeElementaryFlowCategories(CompartmentList list, Stack<Category> stack) {
    Category category;
    int level = 0;
    while (!stack.isEmpty()) {
        category = stack.pop();
        Compartment c = new Compartment();
        list.compartments.add(c);
        c.catId = category.refId;
        c.level = level;
        c.value = category.name;
        level++;
    }
}
Also used : Category(org.openlca.core.model.Category) Compartment(org.openlca.ilcd.flows.Compartment)

Example 20 with Category

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

the class RefDataImport method classification.

private void classification(DataSet ds) {
    Classification classification = findClassification(ds);
    if (classification == null || classification.id == null)
        return;
    String refId = classification.id;
    Category c = index.getProcessCategory(refId);
    if (c != null)
        return;
    c = categoryDao.getForRefId(refId);
    if (c == null) {
        c = new Category();
        c.description = classification.system;
        c.modelType = ModelType.PROCESS;
        c.name = classification.value;
        c.refId = refId;
        c = categoryDao.insert(c);
    }
    index.putProcessCategory(refId, c);
}
Also used : Category(org.openlca.core.model.Category) Classification(spold2.Classification)

Aggregations

Category (org.openlca.core.model.Category)77 Test (org.junit.Test)11 CategoryDao (org.openlca.core.database.CategoryDao)11 Flow (org.openlca.core.model.Flow)6 Parameter (org.openlca.core.model.Parameter)6 CategoryElement (org.openlca.app.navigation.elements.CategoryElement)4 ModelElement (org.openlca.app.navigation.elements.ModelElement)4 IDatabase (org.openlca.core.database.IDatabase)4 FlowProperty (org.openlca.core.model.FlowProperty)4 Location (org.openlca.core.model.Location)4 Process (org.openlca.core.model.Process)4 UnitGroup (org.openlca.core.model.UnitGroup)4 ArrayList (java.util.ArrayList)3 ImpactCategory (org.openlca.core.model.ImpactCategory)3 ImpactMethod (org.openlca.core.model.ImpactMethod)3 ModelType (org.openlca.core.model.ModelType)3 IsicNode (org.openlca.io.ecospold2.input.IsicTree.IsicNode)3 Actor (org.openlca.core.model.Actor)2 Currency (org.openlca.core.model.Currency)2 DQSystem (org.openlca.core.model.DQSystem)2