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