Skip to content

Commit

Permalink
fix: the project set by the importset will no longer be ignored
Browse files Browse the repository at this point in the history
chore: renamed failure folder to success
  • Loading branch information
mike-hig committed Nov 17, 2022
1 parent 9ab9881 commit f84f251
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public void startImport(ImportSet importSet) {
// read mappings

List<MappingField> 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;
}
Expand All @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit f84f251

Please sign in to comment.