Search in sources :

Example 11 with ProcessDocumentation

use of org.openlca.core.model.ProcessDocumentation in project olca-modules by GreenDelta.

the class ProcessConverter method mapDocumentation.

private void mapDocumentation(DataSet dataSet) {
    ProcessDocumentation doc = process.documentation;
    if (doc == null)
        return;
    mapDataSetInformation(doc, dataSet);
    mapTime(doc, dataSet);
    mapTechnology(doc, dataSet);
    mapGeography(doc, dataSet);
    mapModelingAndValidation(doc, dataSet);
    mapAdminInfo(doc, dataSet);
}
Also used : ProcessDocumentation(org.openlca.core.model.ProcessDocumentation)

Example 12 with ProcessDocumentation

use of org.openlca.core.model.ProcessDocumentation in project olca-modules by GreenDelta.

the class EcoSpold01Import method process.

private void process(DataSet ds) {
    String id = ES1KeyGen.forProcess(ds);
    Process p = db.get(Process.class, id);
    if (p != null) {
        log.skipped(p);
        return;
    }
    p = new Process();
    p.refId = id;
    ProcessDocumentation doc = new ProcessDocumentation();
    p.documentation = doc;
    IReferenceFunction refFun = ds.getReferenceFunction();
    if (refFun != null)
        mapReferenceFunction(refFun, p);
    p.processType = Mapper.getProcessType(ds);
    mapTimeAndGeography(ds, p, doc);
    if (ds.getTechnology() != null && ds.getTechnology().getText() != null) {
        doc.technology = Strings.cut((ds.getTechnology().getText()), 65500);
    }
    mapExchanges(ds.getExchanges(), p);
    if (p.quantitativeReference == null)
        createProductFromRefFun(ds, p);
    if (ds.getAllocations() != null && ds.getAllocations().size() > 0) {
        mapAllocations(p, ds.getAllocations());
        p.defaultAllocationMethod = AllocationMethod.CAUSAL;
    }
    Mapper.mapModellingAndValidation(ds, doc);
    Mapper.mapAdminInfo(ds, p);
    mapActors(doc, ds);
    mapSources(doc, ds);
    db.put(p, id);
    localExchangeCache.clear();
    log.imported(p);
}
Also used : Process(org.openlca.core.model.Process) IReferenceFunction(org.openlca.ecospold.IReferenceFunction) ProcessDocumentation(org.openlca.core.model.ProcessDocumentation)

Example 13 with ProcessDocumentation

use of org.openlca.core.model.ProcessDocumentation in project olca-modules by GreenDelta.

the class ProcessImport method switchDocRefs.

private void switchDocRefs(Process destProcess) {
    if (destProcess.documentation == null)
        return;
    ProcessDocumentation doc = destProcess.documentation;
    doc.reviewer = refs.switchRef(doc.reviewer);
    doc.dataGenerator = refs.switchRef(doc.dataGenerator);
    doc.dataDocumentor = refs.switchRef(doc.dataDocumentor);
    doc.dataSetOwner = refs.switchRef(doc.dataSetOwner);
    doc.publication = refs.switchRef(doc.publication);
    List<Source> translatedSources = new ArrayList<>();
    for (Source source : doc.sources) translatedSources.add(refs.switchRef(source));
    doc.sources.clear();
    doc.sources.addAll(translatedSources);
}
Also used : ArrayList(java.util.ArrayList) TLongArrayList(gnu.trove.list.array.TLongArrayList) ProcessDocumentation(org.openlca.core.model.ProcessDocumentation) Source(org.openlca.core.model.Source)

Example 14 with ProcessDocumentation

use of org.openlca.core.model.ProcessDocumentation in project olca-modules by GreenDelta.

the class ProcessReferenceSearchTest method createDocumentation.

private ProcessDocumentation createDocumentation() {
    ProcessDocumentation doc = new ProcessDocumentation();
    doc.dataDocumentor = db.insert(new Actor());
    doc.dataGenerator = db.insert(new Actor());
    doc.dataSetOwner = db.insert(new Actor());
    doc.reviewer = db.insert(new Actor());
    doc.publication = db.insert(new Source());
    doc.sources.add(db.insert(new Source()));
    doc.sources.add(db.insert(new Source()));
    return doc;
}
Also used : Actor(org.openlca.core.model.Actor) ProcessDocumentation(org.openlca.core.model.ProcessDocumentation) Source(org.openlca.core.model.Source)

Example 15 with ProcessDocumentation

use of org.openlca.core.model.ProcessDocumentation in project olca-modules by GreenDelta.

the class Update8Test method testProcessDoc.

@Test
public void testProcessDoc() {
    Source source = new Source();
    source.name = "source";
    Daos.base(db, Source.class).insert(source);
    ProcessDao dao = new ProcessDao(db);
    Process proc = new Process();
    proc.documentation = new ProcessDocumentation();
    proc.documentation.sources.add(source);
    proc.documentation.precedingDataSet = "ABC123";
    dao.insert(proc);
    proc = dao.getForId(proc.id);
    assertEquals("source", proc.documentation.sources.get(0).name);
    assertEquals("ABC123", proc.documentation.precedingDataSet);
    dao.delete(proc);
    Daos.base(db, Source.class).delete(source);
}
Also used : ProcessDao(org.openlca.core.database.ProcessDao) Process(org.openlca.core.model.Process) ProcessDocumentation(org.openlca.core.model.ProcessDocumentation) Source(org.openlca.core.model.Source) Test(org.junit.Test)

Aggregations

ProcessDocumentation (org.openlca.core.model.ProcessDocumentation)18 Process (org.openlca.core.model.Process)9 Source (org.openlca.core.model.Source)5 ProcessDao (org.openlca.core.database.ProcessDao)4 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 DQSystem (org.openlca.core.model.DQSystem)2 ProcessDescriptor (org.openlca.core.model.descriptors.ProcessDescriptor)2 JsonElement (com.google.gson.JsonElement)1 TLongArrayList (gnu.trove.list.array.TLongArrayList)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Workbook (org.apache.poi.ss.usermodel.Workbook)1 SXSSFWorkbook (org.apache.poi.xssf.streaming.SXSSFWorkbook)1 Composite (org.eclipse.swt.widgets.Composite)1 Control (org.eclipse.swt.widgets.Control)1 ScrolledForm (org.eclipse.ui.forms.widgets.ScrolledForm)1 Before (org.junit.Before)1