From ef6b8445fd344501bc767c4d73d3ce9de4a8b9ee Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 18 Oct 2019 10:32:10 +0200 Subject: add post-validation steps into process-definition loader --- .../core/impl/idp/process/ProcessEngineImpl.java | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java index ce4aa15b..b6b42850 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java @@ -87,10 +87,13 @@ public class ProcessEngineImpl implements ProcessEngine { @Override public String registerProcessDefinition(InputStream processDefinitionInputStream) throws ProcessDefinitionParserException{ ProcessDefinition pd = pdp.parse(processDefinitionInputStream); + + postValidationOfProcessDefintion(pd); + registerProcessDefinition(pd); return pd.getId(); } - + /** * Sets the process definitions. * @@ -445,4 +448,24 @@ public class ProcessEngineImpl implements ProcessEngine { } + /** + * Perform some post-validation operations on process definition + * + * Like: check if all tasks that are defined are available on context + * + * @param pd + * @throws ProcessDefinitionParserException + */ + private void postValidationOfProcessDefintion(ProcessDefinition pd) throws ProcessDefinitionParserException{ + try { + for(TaskInfo task : pd.getTaskInfos().values()) { + createTaskInstance(task); + } + + } catch (ProcessExecutionException e) { + log.error("Post-validation of process definition: {} find an error: {}", pd.getId(), e.getMessage()); + throw new ProcessDefinitionParserException("Post-validation find an error in process definition:" + pd.getId(), e); + + } + } } -- cgit v1.2.3