Search in sources :

Example 1 with ActivityDescription

use of spold2.ActivityDescription in project olca-modules by GreenDelta.

the class EcoSpold2Export method exportProcess.

public void exportProcess(Process process) {
    var ds = new DataSet();
    ds.description = new ActivityDescription();
    ds.masterData = new UserMasterData();
    mapActivity(process, ds);
    mapLocation(process, ds);
    ProcessDoc.map(process, ds);
    mapExchanges(process, ds);
    mapParameters(process, ds);
    MasterData.writeIndexEntry(ds);
    var fileName = process.refId == null ? UUID.randomUUID().toString() : process.refId;
    var file = new File(activityDir, fileName + ".spold");
    EcoSpold2.write(ds, file);
}
Also used : ActivityDescription(spold2.ActivityDescription) DataSet(spold2.DataSet) UserMasterData(spold2.UserMasterData) File(java.io.File)

Example 2 with ActivityDescription

use of spold2.ActivityDescription in project olca-modules by GreenDelta.

the class EcoSpold2Export method mapLocation.

private void mapLocation(Process process, DataSet ds) {
    if (ds.description == null) {
        ds.description = new ActivityDescription();
    }
    var geo = new Geography();
    ds.description.geography = geo;
    if (process.documentation != null) {
        geo.comment = RichText.of(process.documentation.geography);
    }
    if (process.location == null) {
        // set defaults
        geo.id = "34dbbff8-88ce-11de-ad60-0019e336be3a";
        geo.shortName = "GLO";
    } else {
        geo.id = process.location.refId;
        geo.shortName = process.location.code;
    }
}
Also used : Geography(spold2.Geography) ActivityDescription(spold2.ActivityDescription)

Example 3 with ActivityDescription

use of spold2.ActivityDescription in project olca-modules by GreenDelta.

the class MasterData method writeIndexEntry.

public static void writeIndexEntry(DataSet ds) {
    if (ds == null || ds.masterData == null)
        return;
    ActivityIndexEntry indexEntry = new ActivityIndexEntry();
    ds.masterData.activityIndexEntries.add(indexEntry);
    indexEntry.systemModelId = "8b738ea0-f89e-4627-8679-433616064e82";
    ActivityDescription d = ds.description;
    if (d == null)
        return;
    Activity activity = d.activity;
    if (activity != null) {
        indexEntry.activityNameId = activity.activityNameId;
        indexEntry.id = activity.id;
    }
    Time timePeriod = d.timePeriod;
    if (timePeriod != null) {
        indexEntry.endDate = timePeriod.end;
        indexEntry.startDate = timePeriod.start;
    }
    Geography geography = d.geography;
    if (geography != null)
        indexEntry.geographyId = geography.id;
}
Also used : Geography(spold2.Geography) ActivityIndexEntry(spold2.ActivityIndexEntry) ActivityDescription(spold2.ActivityDescription) Activity(spold2.Activity) Time(spold2.Time)

Aggregations

ActivityDescription (spold2.ActivityDescription)3 Geography (spold2.Geography)2 File (java.io.File)1 Activity (spold2.Activity)1 ActivityIndexEntry (spold2.ActivityIndexEntry)1 DataSet (spold2.DataSet)1 Time (spold2.Time)1 UserMasterData (spold2.UserMasterData)1