diff --git a/README.md b/README.md
index 3021e68..c4fd860 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-This is a Step plugin for Goobi workflow which allows the edition of individual metadata fields right inside of an accepted task. It is highly configurable and contains a flexible user interface with the possibility to show thumbnails and to set the representative image as well.
+This Step plugin for Goobi workflow allows editing individual metadata fields right inside of an accepted task. It is highly configurable and contains a user interface.
This is a plugin for Goobi workflow, the open source workflow tracking software for digitisation projects. More information about Goobi workflow is available under https://goobi.io. If you want to get in touch with the user community simply go to https://community.goobi.io.
@@ -10,31 +10,30 @@ This is a plugin for Goobi workflow, the open source workflow tracking software
More information about the functionality of this plugin and the complete documentation can be found in the central documentation area at https://docs.goobi.io
-Detail | Description
---- | ---
+Detail | Description
+--------------------------- | ----------------------
**Plugin identifier** | intranda_step_metadata_edition
-**Plugin type** | Step plugin
+**Plugin type** | step
**Licence** | GPL 2.0 or newer
-**Documentation (German)** | https://docs.goobi.io/goobi-workflow-plugins-de/step/intranda_step_metadata_edition
-**Documentation (English)** | https://docs.goobi.io/goobi-workflow-plugins-en/step/intranda_step_metadata_edition
+**Documentation (German)** | https://docs.goobi.io/workflow-plugins/v/eng/step/goobi-plugin-step-metadata-edition
+**Documentation (English)** | https://docs.goobi.io/workflow-plugins/v/ger/step/goobi-plugin-step-metadata-edition
## Goobi details
Goobi workflow is an open source web application to manage small and large digitisation projects mostly in cultural heritage institutions all around the world. More information about Goobi can be found here:
-Detail | Description
---- | ---
-**Goobi web site** | https://www.goobi.io
-**Twitter** | https://twitter.com/goobi
-**Goobi community** | https://community.goobi.io
+Detail | Description
+--------------------------- | ---------------------------
+**Goobi web site** | https://www.goobi.io
+**Goobi community** | https://community.goobi.io
+**Goobi documentation** | https://docs.goobi.io
## Development
This plugin was developed by intranda. If you have any issues, feedback, question or if you are looking for more information about Goobi workflow, Goobi viewer and all our other developments that are used in digitisation projects please get in touch with us.
-Contact | Details
---- | ---
-**Company name** | intranda GmbH
-**Address** | Bertha-von-Suttner-Str. 9, 37085 Göttingen, Germany
-**Web site** | https://www.intranda.com
-**Twitter** | https://twitter.com/intranda
+Contact | Details
+--------------------------- | ----------------------------------------------------
+**Company name** | intranda GmbH
+**Address** | Bertha-von-Suttner-Str. 9, 37085 Göttingen, Germany
+**Web site** | https://www.intranda.com
diff --git a/docs/index_de.md b/docs/index_de.md
new file mode 100644
index 0000000..098fed2
--- /dev/null
+++ b/docs/index_de.md
@@ -0,0 +1,185 @@
+---
+title: Metadaten bearbeiten
+identifier: intranda_step_metadata_edition
+published: true
+description: Dieses Step Plugin für Goobi workflow erlaubt die direkte Bearbeitung von Metadaten aus einer geöffneten Aufgabe heraus ohne Verwendung des METS-Editors.
+---
+## Einführung
+Dieses Plugin erlaubt die Bearbeitung von konfigurierbaren Eigenschaften und Metadaten innerhalb der Nutzeroberfläche eine geöffneten Aufgabe, ohne dass dafür der METS-Editor betreten werden muss. Neben der Bearbeitung der Metadaten ist auch eine Suche von anderen Vorgängen und die gezielte Übernahme von Metadaten aus gefundenen Vorgängen möglich. Mit der integrierten Thumbnailanzeige kann ausserdem der Repräsentant des Werkes gesetzt werden.
+
+
+## Installation
+Zur Installation des Plugins müssen folgende beiden Dateien installiert werden:
+
+```bash
+/opt/digiverso/goobi/plugins/step/plugin_intranda_step_metadata_edition-base.jar
+/opt/digiverso/goobi/plugins/GUI/plugin_intranda_step_metadata_edition-gui.jar
+```
+
+Um zu konfigurieren, wie sich das Plugin verhalten soll, können verschiedene Werte in der Konfigurationsdatei angepasst werden. Die Konfigurationsdatei befindet sich üblicherweise hier:
+
+```bash
+/opt/digiverso/goobi/config/plugin_intranda_step_metadata_edition.xml
+```
+
+
+### Überblick und Funktionsweise
+Zur Inbetriebnahme des Plugins muss dieses für einen oder mehrere gewünschte Aufgaben im Workflow aktiviert werden. Dies erfolgt wie im folgenden Screenshot aufgezeigt durch Auswahl des Plugins `intranda_step_metadata_edition` aus der Liste der installierten Plugins.
+
+![Zuweisung des Plugins zu einer bestimmten Aufgabe](screen1_de.png)
+
+Nachdem das Plugin vollständig installiert und eingerichtet wurde, steht es für die Bearbeiter der entsprechenden Aufgaben zur Verfügung. Nach dem Betreten einer Aufgabe ist im rechten Bereich der Nutzeroberfläche nun die Bearbeitung der Metadaten möglich.
+
+![Anzeige der Bearbeitungsmaske innerhalb der angenommenen Aufgabe](screen2_de.png)
+
+Abhängig von der Konfiguration werden hier die entsprechenden Metadaten angezeigt und können bearbeitet werden. Je nach Konfiguration ist hier auch eine Suche nach anderen Vorgängen möglich, indem auf das Icon für die Suche geklickt wird.
+
+![Suche nach anderen Vorgängen, um von diesen Metadaten übernehmen zu können](screen3_de.png)
+
+Innerhalb des Dialogs mit den gefundenen Vorgängen kann nun ausgewählt werden, welche der angezeigten Metadaten der gefundenen Vorgänge übernommen werden sollen.
+
+Ein Klick auf eines der angezeigten Thumbnails erlaubt das Setzen des Repräsentanten.
+
+Bitte beachten Sie, dass die Bearbeitungen nur dann gespeichert werden, wenn auf den dafür vorgesehenen Button geklickt wird.
+
+
+## Konfiguration
+Die Konfiguration des Plugins ist folgendermaßen aufgebaut:
+
+```xml
+
+
+
+ *
+ *
+
+ 200
+
+
+ true
+
+
+ media
+
+
+ true
+
+
+ true
+
+
+
+
+
+
+ \d{4}
+ Value must be a 4 digits year
+
+
+ Collection A
+ Collection A
+ Collection B
+ Collection C
+
+
+ false
+
+
+
+ Subject terms
+
+ type=AccessLocations
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+
+### Hauptkonfiguration
+Der Block `` kann für verschiedene Projekte oder Arbeitsschritte wiederholt vorkommen, um innerhalb verschiedener Workflows unterschiedliche Aktionen durchführen zu können. Die weiteren Parameter innerhalb dieser Konfigurationsdatei haben folgende Bedeutungen:
+
+| Wert | Beschreibung |
+| :--- | :--- |
+| `project` | Dieser Parameter legt fest, für welches Projekt der aktuelle Block `` gelten soll. Verwendet wird hierbei der Name des Projektes. Dieser Parameter kann mehrfach pro `` Block vorkommen. |
+| `step` | Dieser Parameter steuert, für welche Arbeitsschritte der Block `` gelten soll. Verwendet wird hier der Name des Arbeitsschritts. Dieser Parameter kann mehrfach pro `` Block vorkommen. |
+| `thumbnailsize` | Mit diesem Parameter wird festgelegt, in welcher Größe die Thumbnails, die zum Bestimmen des Repräsentanten angezeigt werden sollen. |
+| `hideEmptyFields` | Dieses Element kann die Werte `true` und `false` annehmen. Das Element besitzt außerdem das Attribut `onlyEmptyReadOnlyFields`. Wenn das Element den Wert `true` hat, werden leere Metadatenfelder versteckt. Mit dem Attribut `onlyEmptyReadOnlyFields` kann zusätzlich gesteuert werden, ob nur leere `ReadOnly`-Felder (`true`) oder alle leeren Felder (`false`) versteckt werden sollen. Der Standardwert von `onlyEmptyReadOnlyFields` ist `true`. |
+| `imageFolder` | Dieser Parameter bestimmt, aus welchem Verzeichnis die Bilder zur Anzeige verwendet werden sollen. Übliche Werte sind hier beispielsweise `master` oder `media`. |
+| `preselectFields` | Mit diesem Parameter kann festgelegt werden, ob die innerhalb der Vorgangssuche dieses Plugins gefundenen Metadaten bereits vorausgewählt sein sollen, so dass eine einfache Übernahme der Metadaten erfolgen kann. |
+| `showImages` | Mit diesem Parameter wird festgelegt, ob der Bildbereich zur Auswahl des Repräsentanten angezeigt werden soll. |
+| `showImportMetadata` | Dieser Parameter steuert, ob der Button für die Suche in existierenden Vorgängen und deren Datenübernahme möglich sein soll. |
+
+
+### Konfiguration: displayfield
+Für jedes einzublendende Metadatum kann ein Element `` definiert werden. Dieses steuert die Anzeige und Speicherug der jeweiligen Daten.
+
+| Wert | Beschreibung |
+| :--- | :--- |
+| `source` | Hiermit wird festgelegt, woher das Feld seinen Inhalt beziehen soll. Mögliche Werte hierfür sind `property`, `metadata` und `person`. |
+| `name` | Mit dem Parameter wird der interne Name des Feldes definiert. |
+| `type` | Der Parameter `type` legt fest, wie das Feld aussehen soll. Mögliche Werte hierfür sind `text`, `checkbox`, `multivalue` oder `list`. |
+| `required` | Der Wert `required` definiert, ob der Wert vom Nutzer ausgefüllt werden muss. |
+| `helpText` | Hier läßt sich ein erklärender Hilfetext für den Feldinhalt definierten, den der Nutzer einblenden kann. |
+| `validationRegex` | Mit diesem Parameter läßt sich ein regulärer Ausdruck definierten, um den Feldinhalt auf Validität zu überprüfen. |
+| `validationErrorText` | Hier läßt sich die Meldung definieren, die angezeigt werden soll, wenn die Validierung nicht erfolgreich stattfinden konnte. |
+| `label` | Mit dem Parameter kann eine Beschriftung definiert werden, die den Benutzern für das Feld angezeigt wird. |
+| `structType` | Mit diesem Parameter wird das Strukturelement definiert, von dem die Metadaten für die Anzeige verwendet werden sollen (z. B. `anchor`). |
+| `defaultValue` | Hier läßt sich ein Standardwert definieren, der gesetzt werden soll, wenn kein Wert vorhanden ist. |
+| `searchable` | Mit diesem Parameter läßt sich definieren, ob der Inhalt dieses Feldes für die Ausführung einer Suche verwendet werden soll. |
+| `suffix` | Hiermit läßt sich ein Suffix bestimmen, das der Suchanfrage angefügt werden soll, wenn andere Vorgänge mit gleichem Feldinhalt gesucht werden. |
+| `vocabularyName` | Hier wird der Name des Vokabulars festgelegt, wenn dieses für die Anzeige von auswählbaren Datensätzen verwendet werden soll (z. B. Fachbegriffe). |
+| `searchParameter` | Dieser Paremeter ist optional und wiederholbar. Er dient zur weiteren Einschränkung von Datensätzen aus dem Vokabular (z. B. `type=AccessLocations`) |
+
+
+### Konfiguration: importfield
+Für die Suche nach anderen Vorgängen kann festgelegt werden, welche deren Metadaten angezeigt und ggf. übernommen werden sollen.
+
+| Wert | Beschreibung |
+| :--- | :--- |
+| `rulesetName` | Der Parameter legt den Name des Metadatentyps fest, wie er im Regelsatz definiert ist. |
+| `label` | Mit diesem Parameter wird die Beschriftung des Feldes definiert, die für das Metadatum angezeigt werden soll. |
+| `selectable` | Mit dem Parameter kann festgelegt werden, ob das Metadatum für eine Übernahme an Daten ausgewählt werden kann. |
diff --git a/docs/index_en.md b/docs/index_en.md
new file mode 100644
index 0000000..ff4bf21
--- /dev/null
+++ b/docs/index_en.md
@@ -0,0 +1,184 @@
+---
+title: Metadata edition
+identifier: intranda_step_metadata_edition
+published: true
+description: This step plugin for Goobi workflow allows you to edit metadata directly from an open task without using the METS editor.
+---
+## Introduction
+This plugin allows the editing of configurable properties and metadata within the user interface of an open task without having to enter the METS editor. In addition to editing the metadata, it is also possible to search for other processes and to selectively transfer metadata from found processes. With the integrated thumbnail display, the representative of the object can also be set.
+
+
+## Installation
+To install the plugin, the following two files must be installed:
+
+```bash
+/opt/digiverso/goobi/plugins/step/plugin_intranda_step_metadata_edition-base.jar
+/opt/digiverso/goobi/plugins/GUI/plugin_intranda_step_metadata_edition-gui.jar
+```
+
+To configure how the plugin should behave, various values can be adjusted in the configuration file. The configuration file is usually located here:
+
+```bash
+/opt/digiverso/goobi/config/plugin_intranda_step_metadata_edition.xml
+```
+
+## Overview and functionality
+To put the plugin into operation, it must be activated for one or more desired tasks in the workflow. This is done as shown in the following screenshot by selecting the plugin `intranda_step_metadata_edition` from the list of installed plugins.
+
+![Assigning the plugin to a specific task](screen1_en.png)
+
+After the plugin has been completely installed and set up, it is available to the editors of the corresponding tasks. After entering a task, it is now possible to edit the metadata in the right-hand area of the user interface.
+
+![Display of the editing mask within the accepted task](screen2_en.png)
+
+Depending on the configuration, the corresponding metadata is displayed here and can be edited. Depending on the configuration, a search for other processes is also possible here by clicking on the search icon.
+
+![Search for other processes in order to be able to take over metadata from them.](screen3_en.png)
+
+Within the dialogue with the processes found, it is now possible to select which of the displayed metadata of the processes found should be taken over.
+
+A click on one of the displayed thumbnails allows the representative to be set.
+
+Please note that the edits are only saved when the button provided is clicked.
+
+
+## Configuration
+The configuration of the plugin is structured as follows:
+
+```xml
+
+
+
+ *
+ *
+
+ 200
+
+
+ true
+
+
+ media
+
+
+ true
+
+
+ true
+
+
+
+
+
+
+ \d{4}
+ Value must be a 4 digits year
+
+
+ Collection A
+ Collection A
+ Collection B
+ Collection C
+
+
+ false
+
+
+
+ Subject terms
+
+ type=AccessLocations
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+
+### Main configuration
+The block `` can occur repeatedly for different projects or workflow steps in order to be able to perform different actions within different workflows. The other parameters within this configuration file have the following meanings:
+
+| Value | Description |
+| :--- | :--- |
+| `project` | This parameter determines for which project the current block `` should apply. The name of the project is used here. This parameter can occur several times per `` block. |
+| `step` | This parameter controls for which workflow steps the block `` should apply. The name of the workflow step is used here. This parameter can occur several times per `` block. |
+| `thumbnailsize` | This parameter determines the size of the thumbnails to be displayed for determining the representative. |
+| `hideEmptyFields` | This element can have the values `true` and `false`. The element also has the attribute `onlyEmptyReadOnlyFields`. If the element has the value `true`, empty metadata fields are hidden. The attribute `onlyEmptyReadOnlyFields` can also be used to control whether only empty `ReadOnly` fields (`true`) or all empty fields (`false`) should be hidden. The default value of `onlyEmptyReadOnlyFields` is `true`. |
+| `imageFolder` | This parameter determines from which directory the images are to be used for display. Common values here are, for example, `master` or `media`. |
+| `preselectFields` | This parameter can be used to specify whether the metadata found within the process search of this plugin should already be preselected so that a simple transfer of the metadata can take place. |
+| `showImages` | This parameter determines whether the image area for selecting the representative is to be displayed. |
+| `showImportMetadata` | This parameter controls whether the button for searching in existing processes and their data transfer should be possible. |
+
+
+### Configuration: displayfield
+For each metadata to be displayed, an element `` can be defined. This controls the display and storage of the respective data.
+
+| Value | Description |
+| :--- | :--- |
+| `source` | This specifies where the field should get its content from. Possible values for this are `property`, `metadata` and `person`. |
+| `name` | The parameter defines the internal name of the field. |
+| `type` | The parameter `type` defines how the field should look like. Possible values for this are `text`, `checkbox`, `multivalue` or `list`. |
+| `required` | The value `required` defines whether the value must be filled in by the user. |
+| `helpText` | Here an explanatory help text can be defined for the field content, which the user can display. |
+| `validationRegex` | This parameter can be used to define a regular expression to check the field content for validity. |
+| `validationErrorText` | Here you can define the message to be displayed if the validation was not successful. |
+| `label` | The parameter can be used to define a label that is displayed to users for the field. |
+| `structType` | This parameter defines the structural element from which the metadata is to be used for the display (e.g. `anchor`). |
+| `defaultValue` | Here you can define a default value to be set if no value is available. |
+| `searchable` | This parameter can be used to define whether the content of this field is to be used for the execution of a search. |
+| `suffix` | This allows you to specify a suffix to be added to the search query when searching for other processes with the same field content. |
+| `vocabularyName` | The name of the vocabulary is defined here if it is to be used for the display of selectable data records (e.g. technical terms). |
+| `searchParameter` | This paremeter is optional and repeatable. It is used to further restrict records from the vocabulary (e.g. `type=AccessLocations`) |
+
+
+### Configuration: importfield
+For the search for other processes, it is possible to specify which of their metadata should be displayed and, if necessary, adopted.
+
+| Value | Description |
+| :--- | :--- |
+| `rulesetName` | The parameter specifies the name of the metadata type as defined in the ruleset. |
+| `label` | This parameter defines the label of the field to be displayed for the metadata. |
+| `selectable` | The parameter can be used to determine whether the metadata can be selected for a transfer to data. |
\ No newline at end of file
diff --git a/docs/screen1_de.png b/docs/screen1_de.png
new file mode 100644
index 0000000..c584368
Binary files /dev/null and b/docs/screen1_de.png differ
diff --git a/docs/screen1_en.png b/docs/screen1_en.png
new file mode 100644
index 0000000..23ccc5c
Binary files /dev/null and b/docs/screen1_en.png differ
diff --git a/docs/screen2_de.png b/docs/screen2_de.png
new file mode 100644
index 0000000..fce4b73
Binary files /dev/null and b/docs/screen2_de.png differ
diff --git a/docs/screen2_en.png b/docs/screen2_en.png
new file mode 100644
index 0000000..278942c
Binary files /dev/null and b/docs/screen2_en.png differ
diff --git a/docs/screen3_de.png b/docs/screen3_de.png
new file mode 100644
index 0000000..8335772
Binary files /dev/null and b/docs/screen3_de.png differ
diff --git a/docs/screen3_en.png b/docs/screen3_en.png
new file mode 100644
index 0000000..01dd014
Binary files /dev/null and b/docs/screen3_en.png differ
diff --git a/module-base/pom.xml b/module-base/pom.xml
index fb4041c..a77b5f4 100644
--- a/module-base/pom.xml
+++ b/module-base/pom.xml
@@ -3,7 +3,7 @@
io.goobi.workflow.plugin
plugin-step-metadata-edition
- 24.06
+ 24.07
plugin-step-metadata-edition-base
jar
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 3b99ce6..cd5c25e 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,54 +1,5 @@
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.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.goobi.vocabulary.Field;
-import org.goobi.vocabulary.VocabRecord;
-import org.goobi.vocabulary.Vocabulary;
-import org.primefaces.event.CloseEvent;
-
import de.intranda.goobi.plugins.ProcessMetadata.ProcessMetadataField;
import de.sub.goobi.config.ConfigPlugins;
import de.sub.goobi.helper.FacesContextHelper;
@@ -63,12 +14,31 @@
import de.sub.goobi.persistence.managers.MySQLHelper;
import de.sub.goobi.persistence.managers.ProcessManager;
import de.sub.goobi.persistence.managers.PropertyManager;
-import de.sub.goobi.persistence.managers.VocabularyManager;
+import io.goobi.vocabulary.exchange.FieldDefinition;
+import io.goobi.vocabulary.exchange.VocabularySchema;
+import io.goobi.workflow.api.vocabulary.VocabularyAPIManager;
+import io.goobi.workflow.api.vocabulary.helper.ExtendedVocabulary;
import lombok.AllArgsConstructor;
import lombok.Getter;
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;
@@ -81,6 +51,36 @@
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,6 +203,9 @@ public class MetadataEditionPlugin implements IStepPluginVersion2 {
@Setter
private boolean displayMetadataAddPopup = false;
+
+ private VocabularyAPIManager vocabularyAPI = VocabularyAPIManager.getInstance();
+
@Override
public PluginReturnValue run() {
return PluginReturnValue.FINISH;
@@ -353,53 +356,42 @@ private void initDisplayFields(SubnodeConfiguration config) {
List fields = Arrays.asList(field.getStringArray("/searchParameter"));
if (fields == null || fields.isEmpty()) {
- Vocabulary currentVocabulary = VocabularyManager.getVocabularyByTitle(vocabularyName);
- vocabularyUrl = getVocabularyBaseName() + currentVocabulary.getId();
- if (currentVocabulary != null) {
- VocabularyManager.getAllRecords(currentVocabulary);
- List recordList = currentVocabulary.getRecords();
- Collections.sort(recordList);
- vocabularyRecords = new ArrayList<>(recordList.size());
- if (currentVocabulary != null && currentVocabulary.getId() != null) {
- for (VocabRecord vr : recordList) {
- for (Field f : vr.getFields()) {
- if (f.getDefinition().isMainEntry()) {
- vocabularyRecords.add(new SelectItem(String.valueOf(vr.getId()), f.getValue()));
- break;
- }
- }
- }
- }
- }
+ ExtendedVocabulary vocabulary = vocabularyAPI.vocabularies().findByName(vocabularyName);
+ vocabularyUrl = vocabulary.getURI();
+
+ vocabularyRecords = vocabularyAPI.vocabularyRecords()
+ .getRecordSelectItems(vocabulary.getId());
} else {
- List vocabularySearchFields = new ArrayList<>();
- for (String fieldname : fields) {
- String[] parts = fieldname.trim().split("=");
- if (parts.length > 1) {
- String fieldName = parts[0];
- String value = parts[1];
- StringPair sp = new StringPair(fieldName, value);
- vocabularySearchFields.add(sp);
- }
+ if (fields.size() > 1) {
+ Helper.setFehlerMeldung("vocabularyList with multiple fields is not supported right now");
+ return;
}
- List records = VocabularyManager.findRecords(vocabularyName, vocabularySearchFields);
- if (records != null && !records.isEmpty()) {
- Collections.sort(records);
- vocabularyRecords = new ArrayList<>(records.size());
- for (VocabRecord vr : records) {
-
- if (StringUtils.isBlank(vocabularyUrl)) {
- vocabularyUrl = getVocabularyBaseName() + vr.getVocabularyId();
- }
- for (Field f : vr.getFields()) {
- if (f.getDefinition().isMainEntry()) {
- vocabularyRecords.add(new SelectItem(String.valueOf(vr.getId()), f.getValue()));
- break;
- }
- }
- }
+ String[] parts = fields.get(0).trim().split("=");
+ if (parts.length != 2) {
+ Helper.setFehlerMeldung("Wrong field format");
+ return;
+ }
+
+ String searchFieldName = parts[0];
+ String searchFieldValue = parts[1];
+
+ ExtendedVocabulary vocabulary = vocabularyAPI.vocabularies().findByName(vocabularyName);
+ vocabularyUrl = vocabulary.getURI();
+ VocabularySchema schema = vocabularyAPI.vocabularySchemas().get(vocabulary.getSchemaId());
+ Optional searchField = schema.getDefinitions().stream()
+ .filter(d -> d.getName().equals(searchFieldName))
+ .findFirst();
+
+ if (searchField.isEmpty()) {
+ Helper.setFehlerMeldung("Field " + searchFieldName + " not found in vocabulary " + vocabulary.getName());
+ return;
}
+
+ vocabularyRecords = vocabularyAPI.vocabularyRecords()
+ .getRecordSelectItems(vocabularyAPI.vocabularyRecords()
+ .list(vocabulary.getId())
+ .search(searchField.get().getId() + ":" + searchFieldValue));
}
}
diff --git a/module-base/src/main/java/de/intranda/goobi/plugins/MetadataField.java b/module-base/src/main/java/de/intranda/goobi/plugins/MetadataField.java
index b062e5e..61127df 100644
--- a/module-base/src/main/java/de/intranda/goobi/plugins/MetadataField.java
+++ b/module-base/src/main/java/de/intranda/goobi/plugins/MetadataField.java
@@ -41,18 +41,20 @@ public void setVocabularyValue(String value) {
}
public String getVocabularyValue() {
- String label = "";
+ String label;
if (metadata != null) {
label = metadata.getValue();
} else if (property != null) {
label = property.getWert();
+ } else {
+ label = "";
}
if (StringUtils.isNotBlank(label)) {
- for (SelectItem item : configuredField.getVocabularyList()) {
- if (label.equals(item.getLabel())) {
- return (String) item.getValue();
- }
- }
+ return configuredField.getVocabularyList().stream()
+ .filter(s -> label.equals(s.getLabel()))
+ .map(s -> (String) s.getValue())
+ .findFirst()
+ .orElse(null);
}
return null;
}
diff --git a/module-gui/pom.xml b/module-gui/pom.xml
index de4eca3..cea3ba1 100644
--- a/module-gui/pom.xml
+++ b/module-gui/pom.xml
@@ -3,7 +3,7 @@
io.goobi.workflow.plugin
plugin-step-metadata-edition
- 24.06
+ 24.07
plugin-step-metadata-edition-gui
jar
diff --git a/pom.xml b/pom.xml
index 149894e..10e6bca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
io.goobi.workflow
workflow-base
- 24.06
+ 24.07
io.goobi.workflow.plugin