Skip to content

Commit

Permalink
allow handling of source and import folder
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenHankiewicz committed Dec 18, 2024
1 parent ceb1a51 commit 69e26ed
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
3 changes: 1 addition & 2 deletions docs/index_de.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ Die folgende Tabelle enthält eine Zusammenstellung der Parameter und ihrer Besc
Parameter | Erläuterung
------------------------|------------------------------------
`title` | Hier kann ein individueller Titel für die Anzeige im Menü und die Überschriften des Plugins festgelegt werden.
`importSet` | Mit diesem Element lassen sich individuelle Importsets definieren. Sie bestehen jeweils aus einem `title` für den anzuzeigenden Namen, sowie einer Angabe für den Speicherort, von dem die Daten importiert werden sollen. Der Speicherort kann dabei beliebig tiefe Verzeichnisstrukturen aufweisen.
`workflow` | Hiermit läßt sich festlegen, welche Produktionsvorlage für das Anlegen von Goobi-Vorgängen verwendet werden soll.
`importSet` | Mit diesem Element lassen sich individuelle Importsets definieren. Sie bestehen jeweils aus einem `title` für den anzuzeigenden Namen, sowie einer Angabe für den Speicherort, von dem die Daten importiert werden sollen. Der Speicherort kann dabei beliebig tiefe Verzeichnisstrukturen aufweisen. Ausserdem läßt sich mit `workflow` festlegen, welche Produktionsvorlage für das Anlegen von Goobi-Vorgängen verwendet werden soll.

3 changes: 1 addition & 2 deletions docs/index_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ The following table contains a summary of the parameters and their descriptions:
Parameter | Explanation
------------------------|------------------------------------
`title` | An individual title for the display in the menu and the headings of the plugin can be defined here.
`importSet` | Individual import sets can be defined with this element. They each consist of a `title` for the name to be displayed and a specification for the storage location from which the data is to be imported. The storage location can have any depth of directory structure.
`workflow` | This allows you to specify which production template is to be used for creating Goobi processes.
`importSet` | Individual import sets can be defined with this element. They each consist of a `title` for the name to be displayed and a specification for the storage location from which the data is to be imported. The storage location can have any depth of directory structure. You can also use `workflow` to specify which production template is to be used for creating Goobi processes.
13 changes: 5 additions & 8 deletions install/plugin_intranda_workflow_wu_wma_import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
<title>Mass import for the WU</title>

<!-- importsets with source folder definition -->
<importSet title="Markenstudien 1" source="/opt/digiverso/import/markenstudien01/" />
<importSet title="Markenstudien 2" source="/opt/digiverso/import/markenstudien02/" />
<importSet title="Markenstudien 3" source="/opt/digiverso/import/markenstudien03/" />
<importSet title="Markenstudien 4" source="/opt/digiverso/import/markenstudien04/" />

<!-- which workflow to use -->
<workflow>Sample_Workflow</workflow>

<importSet title="Markenstudien 1" workflow="Marken-Workflow" source="/opt/digiverso/import/markenstudien01/" />
<importSet title="Markenstudien 2" workflow="Marken-Workflow" source="/opt/digiverso/import/markenstudien02/" />
<importSet title="Markenstudien 3" workflow="Marken-Workflow" source="/opt/digiverso/import/markenstudien03/" />
<importSet title="Markenstudien 4" workflow="Marken-Workflow" source="/opt/digiverso/import/markenstudien04/" />

</config_plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ public class WuWmaImportWorkflowPlugin implements IWorkflowPlugin, IPushPlugin {
@Getter
private int errors = 0;

private String workflow;

@Override
public PluginType getType() {
return PluginType.Workflow;
Expand Down Expand Up @@ -120,16 +118,14 @@ private void readConfiguration() {
// set specific title
title = ConfigPlugins.getPluginConfig(id).getString("title");

// read some main configuration
workflow = ConfigPlugins.getPluginConfig(id).getString("workflow");

// read list of mapping configuration
importSets = new ArrayList<ImportSet>();
List<HierarchicalConfiguration> mappings = ConfigPlugins.getPluginConfig(id).configurationsAt("importSet");
for (HierarchicalConfiguration node : mappings) {
String settitle = node.getString("[@title]", "-");
String source = node.getString("[@source]", "-");
importSets.add(new ImportSet(settitle, source));
String workflow = node.getString("[@workflow]", "-");
importSets.add(new ImportSet(settitle, source, workflow));
}

// write a log into the UI
Expand Down Expand Up @@ -180,7 +176,7 @@ public void startImport(ImportSet importset) {
updateLog("Start importing: Record " + (itemCurrent + 1), 1);

// get the correct workflow to use
Process template = ProcessManager.getProcessByExactTitle(workflow);
Process template = ProcessManager.getProcessByExactTitle(importset.getWorkflow());
Prefs prefs = template.getRegelsatz().getPreferences();

// create digital document
Expand Down Expand Up @@ -256,6 +252,16 @@ public void startImport(ImportSet importset) {
for (SimpleContent con : sio.getProcess().getContents()) {
String targetBase = process.getConfiguredImageFolder(con.getFolder().trim());

// get the source folder
if (targetBase == null && "source".equals(con.getFolder().trim())) {
targetBase = process.getSourceDirectory();
}

// get the import folder
if (targetBase == null && "import".equals(con.getFolder().trim())) {
targetBase = process.getImportDirectory();
}

// if the target folder cannot be found
if (targetBase == null) {
updateLog("Error: Target folder '" + con.getFolder() + "' does not exist for file '" + con.getSource() + "'", 3);
Expand Down Expand Up @@ -456,6 +462,7 @@ private void updateLog(String logmessage, int level) {
public class ImportSet {
private String title;
private String source;
private String workflow;
}

@Data
Expand Down

0 comments on commit 69e26ed

Please sign in to comment.