use of org.openlca.core.model.DQSystem in project olca-modules by GreenDelta.
the class DQSystemImport method map.
@Override
DQSystem map(JsonObject json, long id) {
if (json == null)
return null;
DQSystem s = new DQSystem();
In.mapAtts(json, s, id, conf);
s.hasUncertainties = Json.getBool(json, "hasUncertainties", false);
String sourceRefId = Json.getRefId(json, "source");
if (sourceRefId != null)
s.source = SourceImport.run(sourceRefId, conf);
mapIndicators(json, s);
return conf.db.put(s);
}
use of org.openlca.core.model.DQSystem in project olca-modules by GreenDelta.
the class DQSystems method ecoinvent.
/**
* Returns the ecoinvent data quality system from the database. It creates a
* new instance of the system and inserts it in the database if it does not
* exist yet.
*/
public static DQSystem ecoinvent(IDatabase db) {
if (db == null)
return null;
DQSystemDao dao = new DQSystemDao(db);
DQSystem dqs = dao.getForRefId(EI_DQS);
if (dqs == null) {
dqs = dao.insert(ecoinvent());
}
return dqs;
}
use of org.openlca.core.model.DQSystem in project olca-modules by GreenDelta.
the class DQSystems method ecoinvent.
/**
* Creates an instance of the ecoinvent data quality system.
*/
public static DQSystem ecoinvent() {
DQSystem system = new DQSystem();
system.name = "ecoinvent data quality system";
system.refId = EI_DQS;
system.hasUncertainties = true;
String[] indicators = eiIndicators();
String[][] scores = eiScores();
double[][] uncertainties = eiUncertainties();
for (int i = 0; i < indicators.length; i++) {
DQIndicator indicator = new DQIndicator();
indicator.name = indicators[i];
indicator.position = i + 1;
for (int j = 0; j < scores[i].length; j++) {
DQScore score = new DQScore();
score.description = scores[i][j];
score.position = j + 1;
score.uncertainty = uncertainties[i][j];
indicator.scores.add(score);
}
system.indicators.add(indicator);
}
return system;
}
use of org.openlca.core.model.DQSystem in project olca-app by GreenDelta.
the class DQInfoSection method statisticsTree.
private void statisticsTree(Composite parent, String label, boolean forProcesses) {
DQSystem system = forProcesses ? dqResult.setup.processSystem : dqResult.setup.exchangeSystem;
if (system == null)
return;
UI.formLabel(parent, toolkit, label);
UI.formLabel(parent, toolkit, "");
String[] headers = { M.Indicator, M.Coverage };
TreeViewer viewer = Trees.createViewer(parent, headers);
viewer.setContentProvider(new ContentProvider(forProcesses));
viewer.setLabelProvider(new LabelProvider(forProcesses));
((GridData) viewer.getTree().getLayoutData()).horizontalSpan = 2;
viewer.setInput(system.indicators);
Trees.bindColumnWidths(viewer.getTree(), 0.6, 0.4);
}
use of org.openlca.core.model.DQSystem in project olca-modules by GreenDelta.
the class DQSystemReferenceSearchTest method createModel.
@Override
protected DQSystem createModel() {
DQSystem system = new DQSystem();
system.source = insertAndAddExpected("source", new Source());
system = db.insert(system);
systems.add(system);
return system;
}
Aggregations