From e87c1c0b007ece2a1d17bdd5346313491b1fe5f2 Mon Sep 17 00:00:00 2001 From: Robert Sehr Date: Wed, 25 Sep 2024 09:52:18 +0200 Subject: [PATCH] changed container to string --- .../goobi/plugins/MetadataEditionPlugin.java | 103 +++++++++--------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/module-base/src/main/java/de/intranda/goobi/plugins/MetadataEditionPlugin.java b/module-base/src/main/java/de/intranda/goobi/plugins/MetadataEditionPlugin.java index cd5c25e..4d798c8 100644 --- a/module-base/src/main/java/de/intranda/goobi/plugins/MetadataEditionPlugin.java +++ b/module-base/src/main/java/de/intranda/goobi/plugins/MetadataEditionPlugin.java @@ -1,5 +1,52 @@ package de.intranda.goobi.plugins; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; + +import org.apache.commons.configuration.HierarchicalConfiguration; +import org.apache.commons.configuration.SubnodeConfiguration; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.ResultSetHandler; +import org.apache.commons.lang.StringUtils; +import org.goobi.beans.Process; +import org.goobi.beans.Processproperty; +import org.goobi.beans.Step; +import org.goobi.production.cli.helper.StringPair; +import org.goobi.production.enums.PluginGuiType; +import org.goobi.production.enums.PluginReturnValue; +import org.goobi.production.enums.PluginType; +import org.goobi.production.enums.StepReturnValue; +import org.goobi.production.flow.statistics.hibernate.FilterHelper; +import org.goobi.production.plugin.interfaces.IStepPluginVersion2; +import org.primefaces.event.CloseEvent; + import de.intranda.goobi.plugins.ProcessMetadata.ProcessMetadataField; import de.sub.goobi.config.ConfigPlugins; import de.sub.goobi.helper.FacesContextHelper; @@ -23,22 +70,6 @@ import lombok.Setter; import lombok.extern.log4j.Log4j2; import net.xeoh.plugins.base.annotations.PluginImplementation; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.configuration.SubnodeConfiguration; -import org.apache.commons.dbutils.QueryRunner; -import org.apache.commons.dbutils.ResultSetHandler; -import org.apache.commons.lang.StringUtils; -import org.goobi.beans.Process; -import org.goobi.beans.Processproperty; -import org.goobi.beans.Step; -import org.goobi.production.cli.helper.StringPair; -import org.goobi.production.enums.PluginGuiType; -import org.goobi.production.enums.PluginReturnValue; -import org.goobi.production.enums.PluginType; -import org.goobi.production.enums.StepReturnValue; -import org.goobi.production.flow.statistics.hibernate.FilterHelper; -import org.goobi.production.plugin.interfaces.IStepPluginVersion2; -import org.primefaces.event.CloseEvent; import ugh.dl.DigitalDocument; import ugh.dl.DocStruct; import ugh.dl.Fileformat; @@ -51,36 +82,6 @@ import ugh.exceptions.ReadException; import ugh.exceptions.WriteException; -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.WebTarget; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - @Log4j2 @PluginImplementation public class MetadataEditionPlugin implements IStepPluginVersion2 { @@ -203,7 +204,6 @@ public class MetadataEditionPlugin implements IStepPluginVersion2 { @Setter private boolean displayMetadataAddPopup = false; - private VocabularyAPIManager vocabularyAPI = VocabularyAPIManager.getInstance(); @Override @@ -379,7 +379,8 @@ private void initDisplayFields(SubnodeConfiguration config) { ExtendedVocabulary vocabulary = vocabularyAPI.vocabularies().findByName(vocabularyName); vocabularyUrl = vocabulary.getURI(); VocabularySchema schema = vocabularyAPI.vocabularySchemas().get(vocabulary.getSchemaId()); - Optional searchField = schema.getDefinitions().stream() + Optional searchField = schema.getDefinitions() + .stream() .filter(d -> d.getName().equals(searchFieldName)) .findFirst(); @@ -431,7 +432,7 @@ private void initDisplayFields(SubnodeConfiguration config) { } if (!found) { Processproperty property = new Processproperty(); - property.setContainer(0); + property.setContainer("0"); property.setCreationDate(new Date()); property.setProcessId(this.process.getId()); property.setProzess(this.process); @@ -1000,7 +1001,7 @@ public void addField() { if ("property".contains(field.getSource())) { Processproperty property = new Processproperty(); - property.setContainer(0); + property.setContainer("0"); property.setCreationDate(new Date()); property.setProcessId(this.process.getId()); property.setProzess(this.process); @@ -1068,7 +1069,7 @@ public void addMetadataField() { switch (this.selectedField.getSource()) { case "property": Processproperty property = new Processproperty(); - property.setContainer(0); + property.setContainer("0"); property.setCreationDate(new Date()); property.setProcessId(this.process.getId()); property.setProzess(this.process);