use of org.openlca.ilcd.units.UnitGroup in project olca-modules by GreenDelta.
the class UnitGroupExport method run.
public UnitGroup run(org.openlca.core.model.UnitGroup unitGroup) {
if (config.store.contains(UnitGroup.class, unitGroup.refId))
return config.store.get(UnitGroup.class, unitGroup.refId);
this.unitGroup = unitGroup;
UnitGroup iUnitGroup = new UnitGroup();
iUnitGroup.version = "1.1";
UnitGroupInfo info = new UnitGroupInfo();
iUnitGroup.unitGroupInfo = info;
info.dataSetInfo = makeDataSetInfo();
info.quantitativeReference = makeQRef();
iUnitGroup.adminInfo = makeAdminInfo();
makeUnits(iUnitGroup);
config.store.put(iUnitGroup);
this.unitGroup = null;
return iUnitGroup;
}
use of org.openlca.ilcd.units.UnitGroup in project olca-modules by GreenDelta.
the class NetworkPutUnitGroupTest method testPutUnitGroup.
@Test
public void testPutUnitGroup() throws Exception {
Assume.assumeTrue(TestServer.isAvailable());
String id = UUID.randomUUID().toString();
UnitGroup ug = new UnitGroup();
UnitGroupInfo info = new UnitGroupInfo();
ug.unitGroupInfo = info;
info.dataSetInfo = makeDataInfo(id);
ug.adminInfo = makeAdminInfo();
client.put(ug);
}
use of org.openlca.ilcd.units.UnitGroup in project olca-modules by GreenDelta.
the class FileStoreTest method testGet.
@Test
public void testGet() throws Exception {
UnitGroup group = fileStore.get(UnitGroup.class, "93a60a57-a4c8-11da-a746-0800200c9a66");
assertNotNull(group);
UnitGroupBag bag = new UnitGroupBag(group, "en");
assertEquals("Units of mass", bag.getName());
}
use of org.openlca.ilcd.units.UnitGroup in project olca-modules by GreenDelta.
the class DescriptorTest method setUp.
@Before
public void setUp() throws Exception {
if (!TestServer.isAvailable())
return;
SodaClient client = TestServer.newClient();
XmlBinder binder = new XmlBinder();
UnitGroup group = binder.fromStream(UnitGroup.class, getClass().getResourceAsStream("unit.xml"));
UnitGroupBag bag = new UnitGroupBag(group, "en");
if (client.contains(UnitGroup.class, bag.getId()))
return;
client.put(group);
}
use of org.openlca.ilcd.units.UnitGroup in project olca-modules by GreenDelta.
the class DataSets method putUnitGroup.
private static void putUnitGroup(SodaClient client) throws Exception {
UnitGroup group = load(UnitGroup.class, "unit.xml");
UnitGroupBag bag = new UnitGroupBag(group, "en");
if (!client.contains(UnitGroup.class, bag.getId()))
client.put(group);
}
Aggregations