From f23289cecd8571047056e53da375195b97990a4c Mon Sep 17 00:00:00 2001 From: BartChris Date: Fri, 22 Nov 2024 13:43:46 +0100 Subject: [PATCH] Add necessary temp process processing logic to process creation form --- .../kitodo/config/enums/ParameterCore.java | 2 +- .../createprocess/CreateProcessForm.java | 30 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Kitodo/src/main/java/org/kitodo/config/enums/ParameterCore.java b/Kitodo/src/main/java/org/kitodo/config/enums/ParameterCore.java index 8c41d1540e2..36a3ac2e159 100644 --- a/Kitodo/src/main/java/org/kitodo/config/enums/ParameterCore.java +++ b/Kitodo/src/main/java/org/kitodo/config/enums/ParameterCore.java @@ -367,7 +367,7 @@ public enum ParameterCore implements ParameterInterface { /** * Validation of process title via regular expression. */ - VALIDATE_PROCESS_TITLE_REGEX(new Parameter<>("validateProzessTitelRegex", "[\\w-]*")), + VALIDATE_PROCESS_TITLE_REGEX(new Parameter<>("validateProzessTitelRegex", "^[a-zA-Z0-9_-]+$")), /** * Validation of the identifier via regular expression. diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java index a9f6d425b8e..4d3d1212bd7 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java @@ -523,7 +523,7 @@ private void createProcessHierarchy() && !this.titleRecordLinkTab.getSelectedInsertionPosition().isEmpty()) { this.processes = new LinkedList<>(Collections.singletonList(this.processes.get(0))); } - ProcessService.checkTasks(this.getMainProcess(), processDataTab.getDocType()); + processTempProcess(this.processes.get(0)); processAncestors(); processChildren(); // main process and it's ancestors need to be saved, so they have IDs before creating their process directories @@ -588,7 +588,7 @@ private void saveChildProcessLinks() throws IOException, DataException { } } if (Objects.nonNull(PrimeFaces.current()) && Objects.nonNull(FacesContext.getCurrentInstance())) { - PrimeFaces.current().executeScript("PF('progressDialog')"); + PrimeFaces.current().executeScript("PF('proqgressDialog')"); } } @@ -612,21 +612,25 @@ private void processAncestors() throws ProcessGenerationException { ProcessService.setParentRelations(processes.get(index + 1).getProcess(), process); } if (Objects.nonNull(tempProcess.getMetadataNodes())) { - try { - tempProcess.getProcessMetadata().preserve(); - ImportService.processTempProcess(tempProcess, rulesetManagement, acquisitionStage, priorityList, null); - } catch (InvalidMetadataValueException | NoSuchMetadataFieldException e) { - throw new ProcessGenerationException("Error creating process hierarchy: invalid metadata found!"); - } catch (RulesetNotFoundException e) { - throw new ProcessGenerationException( - "Ruleset not found:" + tempProcess.getProcess().getRuleset().getTitle()); - } catch (IOException e) { - throw new ProcessGenerationException("Error reading Ruleset: " + tempProcess.getProcess().getRuleset().getTitle()); - } + processTempProcess(tempProcess); } } } + private void processTempProcess(TempProcess tempProcess) throws ProcessGenerationException { + try { + tempProcess.getProcessMetadata().preserve(); + ImportService.processTempProcess(tempProcess, rulesetManagement, acquisitionStage, priorityList, null); + } catch (InvalidMetadataValueException | NoSuchMetadataFieldException e) { + throw new ProcessGenerationException("Error creating process hierarchy: invalid metadata found!"); + } catch (RulesetNotFoundException e) { + throw new ProcessGenerationException( + "Ruleset not found:" + tempProcess.getProcess().getRuleset().getTitle()); + } catch (IOException e) { + throw new ProcessGenerationException("Error reading Ruleset: " + tempProcess.getProcess().getRuleset().getTitle()); + } + } + private void saveProcessHierarchyMetadata() { // save ancestor processes meta.xml files for (TempProcess tempProcess : this.processes) {