AnsweredAssumed Answered

Need a way to skip process where isExecutable='false'

Question asked by farrukh_najmi on Oct 14, 2010
Latest reply on Feb 27, 2012 by sebastian.s
In my application I have a BPMN file that has a mix of executable and non-executable processes.
I need to make the BpmnParse class skip processing of any process that sets isExecuatble='false'
so I avoid problems during its being processed.

A proposed solution is that BpmnParse.parseProcessDefinitions() be modified to check if process/@isExecutable is set and is false.
If so, parser should skip processing that process.

Below is a simple patch that implements the proposed solution. It has passed the junit regresion test suite.
Does this seem reasonable? If so, shall I go ahead and file a JIRA RFE?


Index: modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/BpmnParse.java
===================================================================
— modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/BpmnParse.java   (revision 977)
+++ modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/BpmnParse.java   (working copy)
@@ -342,7 +342,19 @@
   public void parseProcessDefinitions(Element definitionsElement) {
     // TODO: parse specific definitions signalData (id, imports, etc)
     for (Element processElement : definitionsElement.elements("process")) {
-      processDefinitions.add(parseProcess(processElement));
+      boolean processProcess = true;
+      String isExecutableStr = processElement.attribute("isExecutable");
+      if (isExecutableStr != null) {
+        boolean isExecutable = Boolean.parseBoolean(isExecutableStr);
+        if (!isExecutable) {
+          processProcess = false;
+        }
+      }
+
+      //Only process executable processes
+      if (processProcess) {
+        processDefinitions.add(parseProcess(processElement));
+      }
     }
   }

Outcomes