use of org.openlca.core.model.SocialIndicator in project olca-modules by GreenDelta.
the class SocialIndicatorImport method createSocialIndicator.
private void createSocialIndicator(SocialIndicatorDescriptor descriptor) {
SocialIndicator src = srcDao.getForId(descriptor.id);
SocialIndicator dest = src.copy();
dest.refId = src.refId;
dest.category = refs.switchRef(src.category);
dest.activityQuantity = refs.switchRef(src.activityQuantity);
dest.activityUnit = refs.switchRef(src.activityUnit);
dest = destDao.insert(dest);
seq.put(seq.SOCIAL_INDICATOR, src.refId, dest.id);
}
use of org.openlca.core.model.SocialIndicator in project olca-modules by GreenDelta.
the class DataUtil method toDataSet.
static ProtoDataSet.Builder toDataSet(IDatabase db, RefEntity e) {
var ds = ProtoDataSet.newBuilder();
var conf = WriterConfig.of(db);
if (e instanceof Actor)
return ds.setActor(new ActorWriter(conf).write((Actor) e));
if (e instanceof Category)
return ds.setCategory(new CategoryWriter(conf).write((Category) e));
if (e instanceof Currency)
return ds.setCurrency(new CurrencyWriter(conf).write((Currency) e));
if (e instanceof DQSystem)
return ds.setDqSystem(new DQSystemWriter(conf).write((DQSystem) e));
if (e instanceof Flow)
return ds.setFlow(new FlowWriter(conf).write((Flow) e));
if (e instanceof FlowProperty)
return ds.setFlowProperty(new FlowPropertyWriter(conf).write((FlowProperty) e));
if (e instanceof ImpactCategory)
return ds.setImpactCategory(new ImpactCategoryWriter(conf).write((ImpactCategory) e));
if (e instanceof ImpactMethod)
return ds.setImpactMethod(new ImpactMethodWriter(conf).write((ImpactMethod) e));
if (e instanceof Location)
return ds.setLocation(new LocationWriter(conf).write((Location) e));
if (e instanceof Parameter)
return ds.setParameter(new ParameterWriter(conf).write((Parameter) e));
if (e instanceof Process)
return ds.setProcess(new ProcessWriter(conf).write((Process) e));
if (e instanceof ProductSystem)
return ds.setProductSystem(new ProductSystemWriter(conf).write((ProductSystem) e));
if (e instanceof Project)
return ds.setProject(new ProjectWriter(conf).write((Project) e));
if (e instanceof SocialIndicator)
return ds.setSocialIndicator(new SocialIndicatorWriter(conf).write((SocialIndicator) e));
if (e instanceof Source)
return ds.setSource(new SourceWriter(conf).write((Source) e));
if (e instanceof UnitGroup)
return ds.setUnitGroup(new UnitGroupWriter(conf).write((UnitGroup) e));
return ds;
}
use of org.openlca.core.model.SocialIndicator in project olca-modules by GreenDelta.
the class SocialIndicatorTest method doImport.
private void doImport(SocialIndicatorDao dao, SocialIndicator indicator) {
with(zip -> {
JsonImport jImport = new JsonImport(zip, Tests.getDb());
jImport.run();
});
Assert.assertTrue(dao.contains(indicator.refId));
SocialIndicator clone = dao.getForRefId(indicator.refId);
Assert.assertEquals(indicator.name, clone.name);
}
use of org.openlca.core.model.SocialIndicator in project olca-modules by GreenDelta.
the class SocialIndicatorTest method testSocialIndicator.
@Test
public void testSocialIndicator() {
SocialIndicatorDao dao = new SocialIndicatorDao(Tests.getDb());
SocialIndicator indicator = createModel(dao);
doExport(indicator, dao);
doImport(dao, indicator);
dao.delete(indicator);
}
use of org.openlca.core.model.SocialIndicator in project olca-modules by GreenDelta.
the class SocialIndicatorTest method createModel.
private SocialIndicator createModel(SocialIndicatorDao dao) {
SocialIndicator indicator = new SocialIndicator();
indicator.name = "indicator";
indicator.refId = UUID.randomUUID().toString();
dao.insert(indicator);
return indicator;
}
Aggregations