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);
}
}
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++;
}
}
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;
}
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++;
}
}
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);
}
Aggregations