use of org.openlca.core.database.ProductSystemDao in project olca-modules by GreenDelta.
the class ExchangeUseSearchTest method createSystem.
private void createSystem() {
ProductSystem system = new ProductSystem();
system.name = SYS_NAME;
system.referenceProcess = p;
system.referenceExchange = p.exchanges.get(0);
Flow linkFlow = p.exchanges.get(1).flow;
ProcessLink link = new ProcessLink();
link.providerId = p.id;
link.processId = q.id;
link.flowId = linkFlow.id;
system.processLinks.add(link);
system = new ProductSystemDao(db).insert(system);
modelStack.push(system);
}
use of org.openlca.core.database.ProductSystemDao in project olca-modules by GreenDelta.
the class Update8Test method testSystemLink.
@Test
public void testSystemLink() {
ProductSystemDao dao = new ProductSystemDao(db);
ProductSystem system = new ProductSystem();
ProcessLink link = new ProcessLink();
link.providerType = ProcessLink.ProviderType.SUB_SYSTEM;
system.processLinks.add(link);
dao.insert(system);
system = dao.getForId(system.id);
assertTrue(system.processLinks.get(0).hasSubSystemProvider());
dao.delete(system);
}
use of org.openlca.core.database.ProductSystemDao in project olca-modules by GreenDelta.
the class Sequence method init.
private void init(IDatabase db) {
index(CATEGORY, new CategoryDao(db));
index(LOCATION, new LocationDao(db));
index(ACTOR, new ActorDao(db));
index(SOURCE, new SourceDao(db));
index(UNIT, new UnitDao(db));
index(UNIT_GROUP, new UnitGroupDao(db));
index(FLOW_PROPERTY, new FlowPropertyDao(db));
index(FLOW, new FlowDao(db));
index(CURRENCY, new CurrencyDao(db));
index(PROCESS, new ProcessDao(db));
index(PRODUCT_SYSTEM, new ProductSystemDao(db));
index(IMPACT_CATEGORY, new ImpactCategoryDao(db));
index(IMPACT_METHOD, new ImpactMethodDao(db));
index(NW_SET, new NwSetDao(db));
index(PROJECT, new ProjectDao(db));
index(DQ_SYSTEM, new DQSystemDao(db));
index(SOCIAL_INDICATOR, new SocialIndicatorDao(db));
}
use of org.openlca.core.database.ProductSystemDao in project olca-modules by GreenDelta.
the class TechIndex method fillFrom.
private void fillFrom(IDatabase db, ProductSystem system) {
var systems = new ProductSystemDao(db).descriptorMap();
var processes = new ProcessDao(db).descriptorMap();
var results = new ResultDao(db).descriptorMap();
var flows = new FlowDao(db).descriptorMap();
for (var link : system.processLinks) {
RootDescriptor p = processes.get(link.providerId);
if (p == null) {
p = systems.get(link.providerId);
if (p == null) {
p = results.get(link.providerId);
}
}
if (p == null)
continue;
var flow = flows.get(link.flowId);
if (flow == null)
continue;
// the tech-index checks for duplicates of products and links
var provider = TechFlow.of(p, flow);
add(provider);
var exchange = new LongPair(link.processId, link.exchangeId);
putLink(exchange, provider);
}
}
use of org.openlca.core.database.ProductSystemDao in project olca-modules by GreenDelta.
the class SystemsInSystemsTests method testCalc.
@Test
public void testCalc() {
IDatabase db = Tests.getDb();
UnitGroupDao ugDao = new UnitGroupDao(db);
FlowPropertyDao fpDao = new FlowPropertyDao(db);
FlowDao flowDao = new FlowDao(db);
ProcessDao processDao = new ProcessDao(db);
ProductSystemDao systemDao = new ProductSystemDao(db);
UnitGroup ug6939 = new UnitGroup();
ug6939.refId = UUID.randomUUID().toString();
ug6939.name = "Units of mass";
Unit kg = new Unit();
kg.name = "kg";
kg.conversionFactor = 1.0;
kg.refId = UUID.randomUUID().toString();
}
Aggregations