[jbpm-commits] JBoss JBPM SVN: r6082 - in jbpm4/trunk/modules: bpmn/src/main/java/org/jbpm/bpmn/parser and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jan 14 18:09:04 EST 2010


Author: jbarrez
Date: 2010-01-14 18:09:03 -0500 (Thu, 14 Jan 2010)
New Revision: 6082

Added:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DatabasedGatewayActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/InclusiveGatewayActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/InclusiveGatewayBinding.java
Modified:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/JavaServiceTaskActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
   jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.flownodes.xml
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/gateway/exclusive/exclusive_gateway_default_seq_flow.bpmn.xml
Log:
Refactoring of gateway hierarchy.
Initial commit for Inclusive Gateway.

Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayActivity.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.bpmn.flownodes;
+
+/**
+ * Abstract superclass for all gateway types.
+ * 
+ * @author Joram Barrez
+ */
+public abstract class AbstractGatewayActivity extends BpmnActivity {
+  
+  protected String gatewayDirection;
+  
+  public String getGatewayDirection() {
+    return gatewayDirection;
+  }
+
+  public void setGatewayDirection(String gatewayDirection) {
+    this.gatewayDirection = gatewayDirection;
+  }
+
+}

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -52,8 +52,10 @@
   protected String name;
   
   protected String gatewayDirection; 
-  boolean valid = true;
+  protected boolean valid = true;
   
+  protected String default_;
+  
   static ObjectBinding objectBinding = new ObjectBinding();
   static WireParser wireParser = WireParser.getInstance();
 
@@ -68,16 +70,22 @@
   public void parse(Element element, Parse parse) {
     
     resetMemberFields();
+    
     id = element.getAttribute("id");
     name = element.getAttribute("name");
     
+    this.default_ = null;
+    if (element.hasAttribute("default")) {
+      default_ = element.getAttribute("default");
+    }
+    
     // 'gatewayDirection' is a constraint on any gateway type. 
     // Since this is an optional attribute, we can't rely on it at runtime.
     // As such, it is only used at parsing time to check if the constraints are met.
     if (element.hasAttribute("gatewayDirection")) {
       gatewayDirection = element.getAttribute("gatewayDirection");
     } else {
-      gatewayDirection = "unspecified";
+      gatewayDirection = "unspecified"; // default
     }
 
     // Count in/out sequence flow to validate gatewaydirection
@@ -108,6 +116,7 @@
     outgoing = 0;
     outSequenceFlows = new ArrayList<Element>();
     valid = true;
+    default_ = null;
   }
 
   protected boolean validGatewayDirection(Parse parse, String elementName, Element element) {
@@ -126,5 +135,45 @@
     }
     return valid;
   }
+  
+  /**
+   * For some gateway types (exclusive/inclusive), conditions are required on every outgoing
+   * sequence flow. This operation will check if all sequence flow (excluding the default
+   * sequence flow) have such a condition defined.
+   * 
+   * Also the reference from the default attribute is verified if it points to an existing
+   * sequence flow defined in the process.
+   * 
+   * The operation will add problems to the given {@link Parse} object if problems are found.
+   * Also the 'valid' boolean wil be changed if needed. 
+   */
+  protected void validateConditionOnAllSequenceFlow(Parse parse, Element element) {
+    boolean defaultExists = false;
+    for (Element outSeqFlow : outSequenceFlows) {
+      
+      String sourceRef = outSeqFlow.getAttribute("sourceRef");
+      Element conditionalExpression = XmlUtil.element(outSeqFlow, "conditionExpression");
+      
+      if (id.equals(sourceRef)) {
+        
+        if (outSeqFlow.getAttribute("id").equals(default_)) {
+          defaultExists = true;
+        } else if (default_ != null && conditionalExpression == null) {  // All but the 'default' sequenceFlow need to have a condition
+          parse.addProblem("exclusiveGateway '" + name + "' has default sequenceFlow '" + default_ 
+                  + "' but " + outSeqFlow.getAttribute("id")
+                  + " does not have a required conditionExpression", element);
+          valid = false; // do not break. Parsing may find other issues;
+        }
+      }
+      
+    }
+      
+      if (default_ != null && !defaultExists) {
+        parse.addProblem("exclusiveGateway '" + name + "' default sequenceFlow '" + default_ 
+                + "' does not exist or is not related to this node", element);
+        valid = false;
+      }
+      
+  }
 
 }
\ No newline at end of file

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -28,7 +28,6 @@
 
 import org.jbpm.api.Execution;
 import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.bpmn.parser.BindingsParser;
 import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.model.Activity;
 import org.jbpm.pvm.internal.model.Condition;
@@ -40,6 +39,7 @@
  * 
  * @author bernd.ruecker at camunda.com
  * @author Ronald van Kuijk (kukeltje)
+ * @author Joram Barrez
  */
 public abstract class BpmnActivity implements ActivityBehaviour {
 
@@ -47,8 +47,6 @@
 
   private static final long serialVersionUID = 1L;
 
-  protected static final boolean FORK_ALLOWED = true;
-  protected static final boolean FORK_DISALLOWED = !FORK_ALLOWED;
   protected static final boolean CONDITIONS_CHECKED = true;
   protected static final boolean CONDITIONS_IGNORED = !CONDITIONS_CHECKED;
 
@@ -56,8 +54,7 @@
 
   /**
    * In BPMN multiple outgoing sequence flows behave like a fork.
-   * 
-   * Code copied basically from jPDL fork.
+   * Code initially based on the JPDL fork logic.
    */
   protected void proceed(ExecutionImpl execution, List<Transition> transitions) {
 	if (log.isDebugEnabled()) {		
@@ -92,16 +89,14 @@
 
       Map<Transition, ExecutionImpl> childExecutionsMap = new HashMap<Transition, ExecutionImpl>();
       for (Transition transition : transitions) {
-        // launch a concurrent path of execution
-        String childExecutionName = transition.getName();
-        ExecutionImpl concurrentExecution = concurrentRoot.createExecution(childExecutionName);
+        ExecutionImpl concurrentExecution = concurrentRoot.createExecution(transition.getName());
         concurrentExecution.setActivity(activity);
         concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
         childExecutionsMap.put(transition, concurrentExecution);
       }
       
-      // For a correct functionality, the child executions must all exist before the actual
-      // transitions are taken.
+      // For a correct functionality, the child executions must all exist before the actual transitions are taken.
+      // So we start following the outgoing transitions after child execution creation.
       for (Transition transition : childExecutionsMap.keySet()) {
         childExecutionsMap.get(transition).take(transition);
 
@@ -112,7 +107,7 @@
     }
   }
 
-  protected List<Transition> findTransitions(ExecutionImpl execution, boolean checkConditions) {
+  protected List<Transition> findOutgoingSequenceFlow(ExecutionImpl execution, boolean checkConditions) {
     Activity activity = execution.getActivity();
     // evaluate the conditions and find the transitions that should be forked
     List<Transition> forkingTransitions = new ArrayList<Transition>();

Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DatabasedGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DatabasedGatewayActivity.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/DatabasedGatewayActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.bpmn.flownodes;
+
+/**
+ * Superclass for gateway activities which use process data to synchronize (ie merge or split)
+ * sequence flow. A common feature of those gateway types is the possibility to define
+ * a default outgoing sequence flow, that will be taken when no condition evaluates to true.
+ * 
+ * @author Joram Barrez
+ */
+public abstract class DatabasedGatewayActivity extends AbstractGatewayActivity {
+  
+  protected String default_;
+  
+  public String getDefault() {
+    return default_;
+  }
+
+  public void setDefault(String default_) {
+    this.default_ = default_;
+  }
+
+}

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -34,11 +34,8 @@
  * @author Tom Baeyens
  * @author Ronald van Kuijk (kukeltje)
  */
-public class ExclusiveGatewayActivity extends BpmnActivity {
+public class ExclusiveGatewayActivity extends DatabasedGatewayActivity {
 
-  String gatewayDirection = "unspecified"; // is the default behaviour
-  String default_;
-
   private static final long serialVersionUID = 1L;
 
   private static final Log log = Log.getLog(BindingsParser.class.getName());
@@ -54,7 +51,7 @@
    */
   public void execute(ExecutionImpl execution) {
 
-    List<Transition> transitions = findTransitions(execution, CONDITIONS_CHECKED);
+    List<Transition> transitions = findOutgoingSequenceFlow(execution, CONDITIONS_CHECKED);
     int numTransitions = transitions.size();
 
     if (numTransitions == 0) {
@@ -62,7 +59,8 @@
       if (defaultTransition != null) {
         transitions.add(defaultTransition);
       } else {
-        throw new JbpmException("No sequenceFlow condition evaluated to true for " + execution.getActivity() + " and no default sequenceFlow was speficied");
+        throw new JbpmException("No sequenceFlow condition evaluated to true for " + 
+                execution.getActivity() + " and no default sequenceFlow was speficied");
       }
     } else if (numTransitions > 2) {
       transitions = transitions.subList(0, 0);
@@ -83,20 +81,4 @@
 
   }
 
-  public String getGatewayDirection() {
-    return gatewayDirection;
-  }
-
-  public void setGatewayDirection(String gatewayDirection) {
-    this.gatewayDirection = gatewayDirection;
-  }
-
-  public String getDefault() {
-    return default_;
-  }
-
-  public void setDefault(String default_) {
-    this.default_ = default_;
-  }
-
 }

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayBinding.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -21,7 +21,6 @@
  */
 package org.jbpm.bpmn.flownodes;
 
-import org.jbpm.pvm.internal.util.XmlUtil;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
 import org.w3c.dom.Element;
@@ -38,42 +37,9 @@
   }
 
   public Object parse(Element element, Parse parse, Parser parser) {
-
     super.parse(element, parse);
+    validateConditionOnAllSequenceFlow(parse, element);
 
-    String default_ = null;
-    if (element.hasAttribute("default")) {
-      default_ = element.getAttribute("default");
-    }
-
-    // Check if all outgoing sequence flow have a condition (default excluded)
-    boolean defaultExists = false;
-    for (Element outSeqFlow : outSequenceFlows) {
-      
-      String sourceRef = outSeqFlow.getAttribute("sourceRef");
-      Element conditionalExpression = XmlUtil.element(outSeqFlow, "conditionExpression");
-      
-      if (id.equals(sourceRef)) {
-        
-        if (outSeqFlow.getAttribute("id").equals(default_)) {
-          defaultExists = true;
-        } else if (default_ != null && conditionalExpression == null) {  // All but the 'default' sequenceFlow need to have a condition
-          parse.addProblem("exclusiveGateway '" + name + "' has default sequenceFlow '" + default_ 
-                  + "' but " + outSeqFlow.getAttribute("id")
-                  + " does not have a required conditionExpression", element);
-          valid = false; // do not break. Parsing may find other issues;
-        }
-        
-      }
-      
-    }
-
-    if (default_ != null && !defaultExists) {
-      parse.addProblem("exclusiveGateway '" + name + "' default sequenceFlow '" + default_ 
-              + "' does not exist or is not related to this node", element);
-      valid = false;
-    }
-
     if (!valid) {
       return null;
     }

Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/InclusiveGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/InclusiveGatewayActivity.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/InclusiveGatewayActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.bpmn.flownodes;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+/**
+ * @author Joram Barrez
+ */
+public class InclusiveGatewayActivity extends DatabasedGatewayActivity {
+
+  private static final long serialVersionUID = 1L;
+  
+  private static final Log LOG = Log.getLog(InclusiveGatewayActivity.class.getName());
+
+  public void execute(ActivityExecution execution) throws Exception {
+    execute((ExecutionImpl) execution);
+  }
+  
+  public void execute(ExecutionImpl execution) {
+    int nrOfIncoming = execution.getActivity().getIncomingTransitions().size();
+    if (nrOfIncoming == 1) { // no merge behaviour needed, save some time and do a fork immediately
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Only one incoming sequence flow found. Executing fork logic only.");
+      }
+      proceed(execution, findOutgoingSequenceFlow(execution, CONDITIONS_CHECKED));
+    } 
+    
+    // TODO finish
+  }
+
+}

Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/InclusiveGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/InclusiveGatewayBinding.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/InclusiveGatewayBinding.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.bpmn.flownodes;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Joram Barrez
+ */
+public class InclusiveGatewayBinding extends AbstractGatewayBinding {
+  
+  public InclusiveGatewayBinding() {
+    super("inclusiveGateway");
+  }
+
+  public Object parse(Element element, Parse parse, Parser parser) {
+    super.parse(element, parse);
+    validateConditionOnAllSequenceFlow(parse, element);
+
+    if (!valid) {
+      return null;
+    }
+    
+    InclusiveGatewayActivity inclusiveGatewayActivity = new InclusiveGatewayActivity();
+    inclusiveGatewayActivity.setDefault(default_);
+    inclusiveGatewayActivity.setGatewayDirection(gatewayDirection);
+    return inclusiveGatewayActivity;    
+  }
+
+}

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/JavaServiceTaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/JavaServiceTaskActivity.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/JavaServiceTaskActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -93,7 +93,7 @@
     } catch (Exception e) {
       throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
     }
-    proceed((ExecutionImpl)execution, findTransitions((ExecutionImpl)execution, CONDITIONS_CHECKED));
+    proceed((ExecutionImpl)execution, findOutgoingSequenceFlow((ExecutionImpl)execution, CONDITIONS_CHECKED));
   }
 
   public void setTarget(Object target) {

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -38,7 +38,7 @@
  * @author Ronald van Kuijk (kukeltje)
  * @author Joram Barrez
  */
-public class ParallelGatewayActivity extends BpmnActivity {
+public class ParallelGatewayActivity extends AbstractGatewayActivity {
 
   private static final Log LOG = Log.getLog(ParallelGatewayActivity.class.getName());
   
@@ -46,9 +46,6 @@
   
   LockMode lockMode = LockMode.UPGRADE;
 
-  //GatewayDirection indicates fork (divergence) or join (convergence). 
-  private String gatewayDirection;
-
   public void execute(ActivityExecution execution) {
     execute((ExecutionImpl) execution);
   }
@@ -78,7 +75,7 @@
   }
   
   protected void fork(ExecutionImpl execution) {
-    proceed(execution, findTransitions(execution, CONDITIONS_IGNORED));
+    proceed(execution, findOutgoingSequenceFlow(execution, CONDITIONS_IGNORED));
   }
   
   protected void join(ExecutionImpl execution) {
@@ -150,14 +147,6 @@
       joinedExecution.end();
     }
   }
- 
-  public String getGatewayDirection() {
-    return gatewayDirection;
-  }
-
-  public void setGatewayDirection(String gatewayDirection) {
-    this.gatewayDirection = gatewayDirection;
-  }
   
   public void setLockMode(LockMode lockMode) {
     this.lockMode = lockMode;

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartActivity.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/StartActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -34,6 +34,6 @@
   }
 
   public void execute(ExecutionImpl execution) {
-    proceed(execution, findTransitions(execution, CONDITIONS_CHECKED));
+    proceed(execution, findOutgoingSequenceFlow(execution, CONDITIONS_CHECKED));
   }
 }

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -45,7 +45,7 @@
 
   public void execute(ExecutionImpl execution) {
 
-    proceed(execution, findTransitions(execution, CONDITIONS_CHECKED));
+    proceed(execution, findOutgoingSequenceFlow(execution, CONDITIONS_CHECKED));
     
   }
   

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -105,7 +105,7 @@
     task.setSignalling(false);
 
     execution.setVariable("jbpm_outcome", signalName);
-    proceed(execution, findTransitions(execution, CONDITIONS_CHECKED));
+    proceed(execution, findOutgoingSequenceFlow(execution, CONDITIONS_CHECKED));
     
   }
 

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java	2010-01-14 23:09:03 UTC (rev 6082)
@@ -32,8 +32,11 @@
 import org.jbpm.api.activity.ActivityBehaviour;
 import org.jbpm.bpmn.common.Resource;
 import org.jbpm.bpmn.common.ResourceParameter;
+import org.jbpm.bpmn.flownodes.AbstractGatewayActivity;
 import org.jbpm.bpmn.flownodes.BpmnBinding;
+import org.jbpm.bpmn.flownodes.DatabasedGatewayActivity;
 import org.jbpm.bpmn.flownodes.ExclusiveGatewayActivity;
+import org.jbpm.bpmn.flownodes.InclusiveGatewayActivity;
 import org.jbpm.bpmn.model.BpmnProcessDefinition;
 import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.model.ActivityImpl;
@@ -239,21 +242,17 @@
       String targetRef = XmlUtil.attribute(transitionElement, "targetRef", true, parse);
 
       if (log.isDebugEnabled()) {
-        log.trace(transitionId + ": " + sourceRef + " -> " + targetRef);        
+        log.debug(transitionId + ": " + sourceRef + " -> " + targetRef);        
       }
       Element conditionElement = XmlUtil.element(transitionElement, "conditionExpression");
-      if (log.isDebugEnabled()) {
-        log.trace("    with " + ((conditionElement == null) ? "0" : "1") + " conditionExpression");        
-      }
 
       TransitionImpl transition = compositeElement.findActivity(sourceRef).createOutgoingTransition();
-      
 
       try {
         // If something went wrong parsing the activity, there is no behaviour and an exception is thrown in .getBehaviour()
         ActivityBehaviour a = compositeElement.findActivity(sourceRef).getActivityBehaviour();
-        if (a instanceof ExclusiveGatewayActivity) {
-          if (transitionId.equals(((ExclusiveGatewayActivity) a).getDefault())) {
+        if (a instanceof DatabasedGatewayActivity) {
+          if (transitionId.equals(((DatabasedGatewayActivity) a).getDefault())) {
             compositeElement.findActivity(sourceRef).setDefaultOutgoingTransition(transition);
           }
         } else {

Modified: jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.flownodes.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.flownodes.xml	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.flownodes.xml	2010-01-14 23:09:03 UTC (rev 6082)
@@ -1,20 +1,21 @@
 <activities>
 	
-	<!--  -->
+	<!-- Start / end events -->
 	<activity binding="org.jbpm.bpmn.flownodes.StartBinding" />
 	<activity binding="org.jbpm.bpmn.flownodes.EndBinding" />
 	
 	<!-- Gateway bindings -->
 	<activity binding="org.jbpm.bpmn.flownodes.ExclusiveGatewayBinding" />
 	<activity binding="org.jbpm.bpmn.flownodes.ParallelGatewayBinding" />
+	<activity binding="org.jbpm.bpmn.flownodes.InclusiveGatewayBinding" />
 	
 	<!--  -->
 	<activity binding="org.jbpm.bpmn.flownodes.ReceiveBinding" />
 	
 	<!-- Task bindings -->
 	<activity binding="org.jbpm.bpmn.flownodes.ManualTaskBinding" />
-    <activity binding="org.jbpm.bpmn.flownodes.ScriptTaskBinding" />
-    <activity binding="org.jbpm.bpmn.flownodes.ServiceTaskBinding" />
+  <activity binding="org.jbpm.bpmn.flownodes.ScriptTaskBinding" />
+  <activity binding="org.jbpm.bpmn.flownodes.ServiceTaskBinding" />
 	<activity binding="org.jbpm.bpmn.flownodes.TaskBinding" />
 	<activity binding="org.jbpm.bpmn.flownodes.UserTaskBinding" />
 

Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/gateway/exclusive/exclusive_gateway_default_seq_flow.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/gateway/exclusive/exclusive_gateway_default_seq_flow.bpmn.xml	2010-01-14 15:27:31 UTC (rev 6081)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/bpmn/gateway/exclusive/exclusive_gateway_default_seq_flow.bpmn.xml	2010-01-14 23:09:03 UTC (rev 6082)
@@ -15,16 +15,17 @@
    <sequenceFlow id="flow1" name="fromStartToExclusiveGateway"
       sourceRef="start" targetRef="decision" />
       
-   <exclusiveGateway id="decision" name="decideBasedOnAmountAndBankType" default="flow2"/>
-   
-   <sequenceFlow id="flow2" name="fromGatewayToStandard"
-      sourceRef="decision" targetRef="standard">
-   </sequenceFlow>
+   <exclusiveGateway id="decision" name="decideBasedOnAmountAndBankType" default="flow3"/>
+ 
       
-   <sequenceFlow id="flow3" name="fromGatewayToEnEnough"
+   <sequenceFlow id="flow2" name="fromGatewayToEnEnough"
       sourceRef="decision" targetRef="largeDeposit">
       <conditionExpression xsi:type="tFormalExpression">${amount &gt;= 500 &amp;&amp; bankType != 'foreign'}</conditionExpression>
    </sequenceFlow>
+     
+   <sequenceFlow id="flow3" name="fromGatewayToStandard"
+      sourceRef="decision" targetRef="standard">
+   </sequenceFlow>
       
    <sequenceFlow id="flow4" name="fromGatewayToMoreThanEnough"
       sourceRef="decision" targetRef="foreignBank">



More information about the jbpm-commits mailing list