Skip to content

Commit

Permalink
Add necessary temp process processing logic to process creation form
Browse files Browse the repository at this point in the history
  • Loading branch information
BartChris committed Nov 22, 2024
1 parent 256951c commit e8c63dd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')");
}
}

Expand All @@ -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) {
Expand Down

0 comments on commit e8c63dd

Please sign in to comment.