From f84f2512a219e49f1f47c56c437fa7b90feb135b Mon Sep 17 00:00:00 2001 From: Michael Lippold Date: Thu, 17 Nov 2022 10:37:47 +0100 Subject: [PATCH] fix: the project set by the importset will no longer be ignored chore: renamed failure folder to success --- .../java/de/intranda/goobi/plugins/DocumentManager.java | 6 +++++- .../de/intranda/goobi/plugins/HuImporterWorkflowPlugin.java | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/DocumentManager.java b/plugin/src/main/java/de/intranda/goobi/plugins/DocumentManager.java index cbc2d2e..3831bbd 100644 --- a/plugin/src/main/java/de/intranda/goobi/plugins/DocumentManager.java +++ b/plugin/src/main/java/de/intranda/goobi/plugins/DocumentManager.java @@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Row; import org.goobi.beans.Process; +import org.goobi.beans.Project; import de.intranda.goobi.plugins.HuImporterWorkflowPlugin.ImportSet; import de.intranda.goobi.plugins.HuImporterWorkflowPlugin.MappingField; @@ -118,15 +119,18 @@ public DocumentManager(ProcessDescription processDescription, ImportSet importSe bhelp.EigenschaftHinzufuegen(process, "Template", template.getTitel()); bhelp.EigenschaftHinzufuegen(process, "TemplateID", "" + template.getId()); + Project project = null; String projectName = importSet.getProject(); if (!StringUtils.isBlank(projectName)) { try { - ProjectManager.getProjectByName(projectName); + project = ProjectManager.getProjectByName(projectName); + process.setProjekt(project); } catch (DAOException e) { plugin.updateLog( "A Project with the name: " + projectName + " does not exist. Please update the configuration or create the Project.", 3); } } + this.process = process; // read fileformat etc. from process this.fileformat = this.process.readMetadataFile(); diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/HuImporterWorkflowPlugin.java b/plugin/src/main/java/de/intranda/goobi/plugins/HuImporterWorkflowPlugin.java index beb5c13..27f89d4 100644 --- a/plugin/src/main/java/de/intranda/goobi/plugins/HuImporterWorkflowPlugin.java +++ b/plugin/src/main/java/de/intranda/goobi/plugins/HuImporterWorkflowPlugin.java @@ -308,7 +308,7 @@ public void startImport(ImportSet importSet) { // read mappings List mappingFields = getMapping(importSet.getMapping()); - if (mappingFields == null || mappingFields.size() == 0) { + if (mappingFields == null || mappingFields.isEmpty()) { updateLog("Import could not be executed because no MappingSet with the name " + importSet.getMapping() + " was found!", 3); return; } @@ -323,7 +323,7 @@ public void startImport(ImportSet importSet) { return; } } - Path failureFolder = Paths.get(importSet.getMetadataFolder(), "failure"); + Path failureFolder = Paths.get(importSet.getMetadataFolder(), "error"); if (!storageProvider.isFileExists(failureFolder)) { try { storageProvider.createDirectories(failureFolder); @@ -345,7 +345,7 @@ public void startImport(ImportSet importSet) { Process process = null; try { - if (FilesToRead.size() == 0) { + if (FilesToRead.isEmpty()) { updateLog("There are no files in the folder: " + importSet.getMetadataFolder(), 3); } for (Path processFile : FilesToRead) {