Search in sources :

Example 6 with ZipStore

use of org.openlca.jsonld.ZipStore in project olca-app by GreenDelta.

the class JsonImportWizard method doRun.

private void doRun(File zip) throws Exception {
    UpdateMode mode = settingsPage.updateMode;
    var log = LoggerFactory.getLogger(getClass());
    log.info("Import JSON LD package {} with update mode = {}", zip, mode);
    getContainer().run(true, true, (monitor) -> {
        monitor.beginTask(M.Import, IProgressMonitor.UNKNOWN);
        try (ZipStore store = ZipStore.open(zip)) {
            JsonImport importer = new JsonImport(store, Database.get());
            importer.setUpdateMode(mode);
            importer.run();
        } catch (Exception e) {
            throw new InvocationTargetException(e);
        }
    });
}
Also used : JsonImport(org.openlca.jsonld.input.JsonImport) UpdateMode(org.openlca.jsonld.input.UpdateMode) ZipStore(org.openlca.jsonld.ZipStore) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

ZipStore (org.openlca.jsonld.ZipStore)6 Path (java.nio.file.Path)2 Test (org.junit.Test)2 JsonImport (org.openlca.jsonld.input.JsonImport)2 Logger (org.slf4j.Logger)2 Gson (com.google.gson.Gson)1 JsonObject (com.google.gson.JsonObject)1 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 FlowDao (org.openlca.core.database.FlowDao)1 Actor (org.openlca.core.model.Actor)1 Category (org.openlca.core.model.Category)1 Flow (org.openlca.core.model.Flow)1 FlowMap (org.openlca.io.maps.FlowMap)1 FlowRef (org.openlca.io.maps.FlowRef)1 UpdateMode (org.openlca.jsonld.input.UpdateMode)1