Search in sources :

Example 1 with ModelName

use of org.openlca.ilcd.models.ModelName in project olca-modules by GreenDelta.

the class SystemExport method initModel.

private Model initModel() {
    Model model = new Model();
    Models.setOrigin(model, "openLCA");
    model.version = "1.1";
    model.locations = "../ILCDLocations.xml";
    DataSetInfo info = Models.forceDataSetInfo(model);
    info.uuid = system.refId;
    ModelName name = Models.forceModelName(model);
    name.name.add(LangString.of(system.name, config.lang));
    if (system.description != null) {
        info.comment.add(LangString.of(system.description, config.lang));
    }
    CategoryConverter conv = new CategoryConverter();
    Classification c = conv.getClassification(system.category);
    if (c != null)
        Models.forceClassifications(model).add(c);
    if (system.referenceProcess != null) {
        long refId = system.referenceProcess.id;
        QuantitativeReference qRef = Models.forceQuantitativeReference(model);
        qRef.refProcess = processIDs.getOrDefault(refId, -1);
    }
    Models.forcePublication(model).version = Version.asString(system.version);
    model.modelling = new Modelling();
    return model;
}
Also used : ModelName(org.openlca.ilcd.models.ModelName) Classification(org.openlca.ilcd.commons.Classification) Model(org.openlca.ilcd.models.Model) Modelling(org.openlca.ilcd.models.Modelling) DataSetInfo(org.openlca.ilcd.models.DataSetInfo) QuantitativeReference(org.openlca.ilcd.models.QuantitativeReference)

Example 2 with ModelName

use of org.openlca.ilcd.models.ModelName in project olca-modules by GreenDelta.

the class IO method getName.

@SuppressWarnings("unchecked")
private static String getName(Model m) {
    ModelName mn = Models.getModelName(m);
    if (mn == null)
        return "";
    List<?>[] parts = new List<?>[] { mn.name, mn.technicalDetails, mn.mixAndLocation, mn.flowProperties };
    String name = "";
    for (List<?> part : parts) {
        String s = LangString.getFirst((List<LangString>) part, "en");
        if (Strings.nullOrEmpty(s))
            continue;
        if (name.length() > 0)
            name += "; ";
        name += s.trim();
    }
    return name;
}
Also used : ModelName(org.openlca.ilcd.models.ModelName) LangString(org.openlca.ilcd.commons.LangString) List(java.util.List) ArrayList(java.util.ArrayList) LangString(org.openlca.ilcd.commons.LangString)

Aggregations

ModelName (org.openlca.ilcd.models.ModelName)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Classification (org.openlca.ilcd.commons.Classification)1 LangString (org.openlca.ilcd.commons.LangString)1 DataSetInfo (org.openlca.ilcd.models.DataSetInfo)1 Model (org.openlca.ilcd.models.Model)1 Modelling (org.openlca.ilcd.models.Modelling)1 QuantitativeReference (org.openlca.ilcd.models.QuantitativeReference)1