use of com.google.api.ads.admanager.axis.v202205.Activity in project olca-modules by GreenDelta.
the class ProcessImport method valid.
private boolean valid(DataSet ds) {
Activity activity = Spold2.getActivity(ds);
if (activity.id == null || activity.name == null)
return false;
IntermediateExchange refFlow = null;
for (IntermediateExchange techFlow : Spold2.getProducts(ds)) {
if (techFlow.outputGroup == null)
continue;
if (techFlow.outputGroup != 0)
continue;
if (techFlow.amount == null || techFlow.amount == 0)
continue;
refFlow = techFlow;
break;
}
return refFlow != null;
}
use of com.google.api.ads.admanager.axis.v202205.Activity in project olca-modules by GreenDelta.
the class ProcessImport method getProcessName.
/**
* The name of the process has the following pattern:
* <p>
* <process name> | <product name> | <system model>, <process type>
* <p>
* Where <system model> is a mnemonic like "APOS" or "Cutoff" and the process
* type is "U" when it is a unit process or "S" when it is a LCI result
*/
private String getProcessName(DataSet ds) {
// the process and ref. product name
Activity a = Spold2.getActivity(ds);
String name = a != null ? a.name : "?";
IntermediateExchange qRef = Spold2.getReferenceProduct(ds);
if (qRef != null && qRef.name != null) {
name += " | " + qRef.name;
}
// we try to infer a short name for the system model here
// because the short name is part of the master data which
// is not always available (or can be found) when importing
// a data set
String model = null;
Representativeness repri = Spold2.getRepresentativeness(ds);
if (repri.systemModelName != null) {
String sys = repri.systemModelName.toLowerCase();
if (sys.contains("consequential")) {
model = "Consequential";
} else if (sys.contains("apos") || sys.contains("allocation at the point of substitution")) {
model = "APOS";
} else if (sys.contains("cut-off") || sys.contains("cutoff")) {
model = "Cutoff";
} else if (sys.contains("legacy")) {
model = "Legacy";
} else {
model = repri.systemModelName;
}
}
if (model != null) {
name += " | " + model;
}
// the process type
String type = a != null && a.type == 2 ? "S" : "U";
name += ", " + type;
return name;
}
use of com.google.api.ads.admanager.axis.v202205.Activity in project olca-modules by GreenDelta.
the class RefId method forProcess.
/**
* We generate a UUID for the resulting process in openLCA from the activity
* ID and the ID of the reference flow (the product output with an amount >
* 0).
*/
public static String forProcess(DataSet ds) {
Activity activity = Spold2.getActivity(ds);
if (activity == null)
return KeyGen.NULL_UUID;
// product ID
IntermediateExchange qRef = Spold2.getReferenceProduct(ds);
String productID = qRef != null && qRef.flowId != null ? qRef.flowId : KeyGen.NULL_UUID;
return KeyGen.get(activity.id, productID);
}
use of com.google.api.ads.admanager.axis.v202205.Activity 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;
}
use of com.google.api.ads.admanager.axis.v202205.Activity in project olca-modules by GreenDelta.
the class DocImportMapper method map.
public void map(DataSet ds, Process process) {
if (ds == null || process == null)
return;
this.process = process;
this.doc = new ProcessDocumentation();
process.documentation = doc;
Activity a = Spold2.getActivity(ds);
if (a != null) {
doc.precedingDataSet = a.id;
}
mapTechnology(ds);
mapGeography(Spold2.getGeography(ds));
mapTime(Spold2.getTime(ds));
mapAdminInfo(ds.adminInfo);
mapRepresentativeness(Spold2.getRepresentativeness(ds));
}
Aggregations