[jbpm-commits] JBoss JBPM SVN: r5382 - in jbpm4/trunk/modules/bpmn/src: main/java/org/jbpm/bpmn/flownodes and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 29 12:43:53 EDT 2009


Author: camunda
Date: 2009-07-29 12:43:53 -0400 (Wed, 29 Jul 2009)
New Revision: 5382

Added:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskBinding.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java
   jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml
Removed:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java
Modified:
   jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
   jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java
   jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java
   jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml
Log:
added uncontrolled sequence flow AND-Split test
added ManualTask (no-op)
renamed TaskActivity to UserTaskActivity

Modified: jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml	2009-07-29 15:12:21 UTC (rev 5381)
+++ jbpm4/trunk/modules/bpmn/src/main/java/jbpm.bpmn.flownodes.xml	2009-07-29 16:43:53 UTC (rev 5382)
@@ -1,9 +1,11 @@
 <activities>
   <activity binding="org.jbpm.bpmn.flownodes.StartBinding" />
-  <activity binding="org.jbpm.bpmn.flownodes.TaskBinding" />
+  <activity binding="org.jbpm.bpmn.flownodes.UserTaskBinding" />
   <activity binding="org.jbpm.bpmn.flownodes.ServiceActivityBinding" />
   <activity binding="org.jbpm.bpmn.flownodes.ReceiveBinding" />
   <activity binding="org.jbpm.bpmn.flownodes.EndBinding" />
   <activity binding="org.jbpm.bpmn.flownodes.ParallelGatewayBinding" />
   <activity binding="org.jbpm.bpmn.flownodes.ExclusiveGatewayBinding" />
+  <activity binding="org.jbpm.bpmn.flownodes.AbstractTaskBinding" />
+  <activity binding="org.jbpm.bpmn.flownodes.ManualTaskBinding" />
 </activities>

Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualActivity.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualActivity.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -0,0 +1,17 @@
+package org.jbpm.bpmn.flownodes;
+
+import org.jbpm.api.activity.ActivityExecution;
+
+/**
+ * Manual activities in BPMN are ignored by the Process Engine.
+ * So this is just a no-op, doing nothing.
+ * 
+ * @author Bernd Ruecker (bernd.ruecker at camunda.com)
+ */
+public class ManualActivity extends BpmnActivity {
+
+    private static final long serialVersionUID = 1L;
+
+    public void execute(ActivityExecution execution) {
+    }
+}

Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskBinding.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ManualTaskBinding.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -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;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author bernd.ruecker at camunda.com
+ */
+public class ManualTaskBinding extends BpmnBinding {
+
+  public ManualTaskBinding() {
+    super("manualTask");
+  }
+
+  public Object parse(Element element, Parse parse, Parser parser) {
+    return new ManualActivity();
+  }
+
+}

Deleted: 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	2009-07-29 15:12:21 UTC (rev 5381)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -1,151 +0,0 @@
-/*
- * 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 java.util.List;
-import java.util.Map;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.task.Task;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.events.TaskActivityStart;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.ParticipationImpl;
-import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
-import org.jbpm.pvm.internal.task.SwimlaneImpl;
-import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.task.TaskImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class TaskActivity extends BpmnExternalActivity {
-
-  private static final long serialVersionUID = 1L;
-  
-  private static final Log log = Log.getLog(TaskActivity.class.getName());
-
-  protected TaskDefinitionImpl taskDefinition;
-  
-  public void execute(ActivityExecution execution) {
-    execute((ExecutionImpl)execution);
-  }
-
-  public void execute(ExecutionImpl execution) {
-    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
-    TaskImpl task = (TaskImpl) dbSession.createTask();
-    task.setTaskDefinition(taskDefinition);
-    task.setExecution(execution);
-    task.setProcessInstance(execution.getProcessInstance());
-    task.setSignalling(true);
-    
-    // initialize the name
-    if (taskDefinition.getName()!=null) {
-      task.setName(taskDefinition.getName());
-    } else {
-      task.setName(execution.getActivityName());
-    }
-
-    task.setDescription(taskDefinition.getDescription());
-    task.setPriority(taskDefinition.getPriority());
-    task.setFormResourceName(taskDefinition.getFormResourceName());
-    
-    // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
-    dbSession.save(task);
-
-    SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
-    if (swimlaneDefinition!=null) {
-      SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
-      task.setSwimlane(swimlane);
-      
-      // copy the swimlane assignments to the task
-      task.setAssignee(swimlane.getAssignee());
-      for (ParticipationImpl participant: swimlane.getParticipations()) {
-        task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
-      }
-    }
-
-    execution.initializeAssignments(taskDefinition, task);
-    
-    HistoryEvent.fire(new TaskActivityStart(task), execution);
-
-    execution.waitForSignal();
-  }
-  
-  public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
-    signal((ExecutionImpl)execution, signalName, parameters);
-  }
-
-  public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
-    Activity activity = execution.getActivity();
-    
-    if (parameters!=null) {
-      execution.setVariables(parameters);
-    }
-    
-    execution.fire(signalName, activity);
-
-    DbSession taskDbSession = Environment
-        .getFromCurrent(DbSession.class);
-    TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
-    task.setSignalling(false);
-    
-    Transition transition = null;
-    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-    if ( (outgoingTransitions!=null)
-         && (!outgoingTransitions.isEmpty())
-       ) {
-      transition = activity.findOutgoingTransition(signalName);
-      if (transition==null) {
-        if (Task.STATE_COMPLETED.equals(signalName)) {
-          if (outgoingTransitions.size()==1) {
-            transition = outgoingTransitions.get(0);
-          } else {
-            transition = activity.getDefaultOutgoingTransition();
-          }
-        } else {
-          // if a user specified outcome was provided and it doesn't
-          // match with an outgoing transition name, then an exception is
-          // thrown since this is likely a programmatic error.
-          throw new JbpmException("No outcome named '" + signalName + "' was found."); 
-        }
-      }
-      if (transition!=null) {
-        execution.take(transition);
-      }
-    }
-  }
-
-  public TaskDefinitionImpl getTaskDefinition() {
-    return taskDefinition;
-  }
-  public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
-    this.taskDefinition = taskDefinition;
-  }
-}

Deleted: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java	2009-07-29 15:12:21 UTC (rev 5381)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -1,51 +0,0 @@
-/*
- * 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.bpmn.parser.BpmnParser;
-import org.jbpm.pvm.internal.model.ScopeElementImpl;
-import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-/**
- * @author Tom Baeyens
- */
-public class TaskBinding extends BpmnBinding {
-
-  private static final String TAG = "userTask";
-
-  public TaskBinding() {
-    super(TAG);
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    TaskActivity taskActivity = new TaskActivity();
-
-    ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
-    TaskDefinitionImpl taskDefinition = BpmnParser.parseTaskDefinition(element, parse, scopeElement);
-    taskActivity.setTaskDefinition(taskDefinition);
-    
-    return taskActivity;
-  }
-}

Copied: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java (from rev 5370, 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	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -0,0 +1,151 @@
+/*
+ * 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 java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.task.Task;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.events.TaskActivityStart;
+import org.jbpm.pvm.internal.model.Activity;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.Transition;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.ParticipationImpl;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserTaskActivity extends BpmnExternalActivity {
+
+  private static final long serialVersionUID = 1L;
+  
+  private static final Log log = Log.getLog(UserTaskActivity.class.getName());
+
+  protected TaskDefinitionImpl taskDefinition;
+  
+  public void execute(ActivityExecution execution) {
+    execute((ExecutionImpl)execution);
+  }
+
+  public void execute(ExecutionImpl execution) {
+    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+    TaskImpl task = (TaskImpl) dbSession.createTask();
+    task.setTaskDefinition(taskDefinition);
+    task.setExecution(execution);
+    task.setProcessInstance(execution.getProcessInstance());
+    task.setSignalling(true);
+    
+    // initialize the name
+    if (taskDefinition.getName()!=null) {
+      task.setName(taskDefinition.getName());
+    } else {
+      task.setName(execution.getActivityName());
+    }
+
+    task.setDescription(taskDefinition.getDescription());
+    task.setPriority(taskDefinition.getPriority());
+    task.setFormResourceName(taskDefinition.getFormResourceName());
+    
+    // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
+    dbSession.save(task);
+
+    SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
+    if (swimlaneDefinition!=null) {
+      SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
+      task.setSwimlane(swimlane);
+      
+      // copy the swimlane assignments to the task
+      task.setAssignee(swimlane.getAssignee());
+      for (ParticipationImpl participant: swimlane.getParticipations()) {
+        task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
+      }
+    }
+
+    execution.initializeAssignments(taskDefinition, task);
+    
+    HistoryEvent.fire(new TaskActivityStart(task), execution);
+
+    execution.waitForSignal();
+  }
+  
+  public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters) throws Exception {
+    signal((ExecutionImpl)execution, signalName, parameters);
+  }
+
+  public void signal(ExecutionImpl execution, String signalName, Map<String, ?> parameters) throws Exception {
+    Activity activity = execution.getActivity();
+    
+    if (parameters!=null) {
+      execution.setVariables(parameters);
+    }
+    
+    execution.fire(signalName, activity);
+
+    DbSession taskDbSession = Environment
+        .getFromCurrent(DbSession.class);
+    TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
+    task.setSignalling(false);
+    
+    Transition transition = null;
+    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+    if ( (outgoingTransitions!=null)
+         && (!outgoingTransitions.isEmpty())
+       ) {
+      transition = activity.findOutgoingTransition(signalName);
+      if (transition==null) {
+        if (Task.STATE_COMPLETED.equals(signalName)) {
+          if (outgoingTransitions.size()==1) {
+            transition = outgoingTransitions.get(0);
+          } else {
+            transition = activity.getDefaultOutgoingTransition();
+          }
+        } else {
+          // if a user specified outcome was provided and it doesn't
+          // match with an outgoing transition name, then an exception is
+          // thrown since this is likely a programmatic error.
+          throw new JbpmException("No outcome named '" + signalName + "' was found."); 
+        }
+      }
+      if (transition!=null) {
+        execution.take(transition);
+      }
+    }
+  }
+
+  public TaskDefinitionImpl getTaskDefinition() {
+    return taskDefinition;
+  }
+  public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
+    this.taskDefinition = taskDefinition;
+  }
+}

Copied: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java (from rev 5370, jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskBinding.java)
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -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.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.model.ScopeElementImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserTaskBinding extends BpmnBinding {
+
+  private static final String TAG = "userTask";
+
+  public UserTaskBinding() {
+    super(TAG);
+  }
+
+  public Object parse(Element element, Parse parse, Parser parser) {
+    UserTaskActivity taskActivity = new UserTaskActivity();
+
+    ScopeElementImpl scopeElement = parse.findObject(ScopeElementImpl.class);
+    TaskDefinitionImpl taskDefinition = BpmnParser.parseTaskDefinition(element, parse, scopeElement);
+    taskActivity.setTaskDefinition(taskDefinition);
+    
+    return taskActivity;
+  }
+}

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java	2009-07-29 15:12:21 UTC (rev 5381)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -34,6 +34,7 @@
 
 /**
  * @author Tom Baeyens
+ * @author bernd.ruecker at camunda.com
  */
 public class BindingsParser extends Parser {
 

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	2009-07-29 15:12:21 UTC (rev 5381)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -217,8 +217,8 @@
       TransitionImpl transition = compositeElement.findActivity(sourceRef).createOutgoingTransition();
       compositeElement.findActivity(targetRef).addIncomingTransition(transition);
 
-      transition.setName(transitionName);
-      transition.setDescription(transitionId);
+      transition.setName(transitionId);
+      transition.setDescription(transitionName);
     }
   }
 

Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java	2009-07-29 15:12:21 UTC (rev 5381)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -23,7 +23,14 @@
 
 import java.util.List;
 
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.TaskQuery;
+import org.jbpm.api.task.Task;
+import org.jbpm.bpmn.model.BpmnProcessDefinition;
 import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.client.ClientProcessInstance;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Problem;
 import org.jbpm.test.JbpmTestCase;
 
@@ -51,7 +58,6 @@
   }
 
   public void testInvalid() {
-
     List<Problem> problems = parse("org/jbpm/bpmn/flownodes/parallelGatewayInvalid.bpmn.xml");
 
     if ((problems == null) || (problems.isEmpty())) {
@@ -60,6 +66,53 @@
       assertTextPresent("parallelGateway 'The Fork' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='converging'", problems.get(0).getMsg());
     }
   }
+  
+  public void testUncontrolledSequenceFlowAsFork() {
+	String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml").deploy();
+
+	try {
+	    ProcessInstance pi = executionService.startProcessInstanceByKey("ForkWithUncontrolledSequenceFlowProcess");
+	    
+	    TaskQuery taskQuery = taskService.createTaskQuery();
+	    List<Task> allTasks = taskQuery.list();
+
+	    // since the uncontrolled sequence flow OUT of the activity behaves as a fork
+	    // we now have two tasks
+	    assertEquals(2, allTasks.size());
+	    assertEquals("UserTaskLeg1", allTasks.get(0).getActivityName());
+	    assertEquals("UserTaskLeg2", allTasks.get(1).getActivityName());
+//	    assertEquals("UserTask", allTasks.get(0));
+//	    
+//	    
+//	    List<Task> groupTasks = taskService.findGroupTasks("sampleResource");
+//	    assertEquals(1, groupTasks.size());
+//	    assertEquals("UserTask", groupTasks.get(0).getActivityName());
+	    
+	    // speciifiing a transition is unnecessary, BPMN has outgoing AND semantic!
+	    // TODO: fix
+	    taskService.completeTask( allTasks.get(0).getId(), "flow2" );
+
+	    pi = executionService.findProcessInstanceById(pi.getId());
+	    
+	    // process instance is ended
+	    assertNull(pi);
+	}
+	finally {
+	    repositoryService.deleteDeploymentCascade(deploymentId);
+	}
+
+      
+      Parse parse = bpmnParser.createParse().setResource("org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml").execute();
+
+      if (!parse.getProblems().isEmpty()) {
+	      fail("No problems should have occured. Problems: " + parse.getProblems());
+      }
+      
+      BpmnProcessDefinition processDefinition = ((List<BpmnProcessDefinition>) parse.getDocumentObject()).get(0);
+      
+      ClientProcessInstance pi = processDefinition.createProcessInstance();
+      pi.start();
+  }
 //  
 //  public void testNonExistingDefault() {
 //

Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java	2009-07-29 15:12:21 UTC (rev 5381)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java	2009-07-29 16:43:53 UTC (rev 5382)
@@ -77,7 +77,7 @@
 	    
 	    // speciifiing a transition is unnecessary, BPMN has outgoing AND semantic!
 	    // TODO: fix
-	    taskService.completeTask( allTasks.get(0).getId(), "fromUserTaskToEnd" );
+	    taskService.completeTask( allTasks.get(0).getId(), "flow2" );
 
 	    pi = executionService.findProcessInstanceById(pi.getId());
 	    

Modified: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml	2009-07-29 15:12:21 UTC (rev 5381)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml	2009-07-29 16:43:53 UTC (rev 5382)
@@ -7,8 +7,7 @@
 	expressionLanguage="http://www.w3.org/1999/XPath" 
 	targetNamespace="http://sample.bpmn.camunda.com/">
 	
-	<bpmn:resource name="sampleResource">	
-	</bpmn:resource>
+	<bpmn:resource name="sampleResource" />	
 
 	<bpmn:process id="UserTaskSimpleProcess" name="Simple process with user task">
 		<bpmn:startEvent id="Start" />

Added: jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml	2009-07-29 16:43:53 UTC (rev 5382)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ForkWithUncontrolledSequenceFlow"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+	xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+	expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+	<bpmn:resource name="sampleResource" />	
+
+	<bpmn:process id="ForkWithUncontrolledSequenceFlowProcess" name="ForkWithUncontrolledSequenceFlow">
+		<bpmn:startEvent id="Start" />
+
+		<bpmn:sequenceFlow id="flow1" name="fromStartToFork"
+			sourceRef="Start"
+			targetRef="parallelGatewayFork"  />
+
+		<bpmn:task id="parallelGatewayFork" name="The Fork" />
+
+		<bpmn:sequenceFlow id="flow2a" name="Leg 1"
+			sourceRef="parallelGatewayFork"
+			targetRef="UserTaskLeg1" />
+		<bpmn:userTask id="UserTaskLeg1" name="user task leg1" implementation="other">
+			<bpmn:potentialOwner resourceRef="sampleResource" />
+		</bpmn:userTask>
+		<bpmn:sequenceFlow id="flow2b" name="Leg 1 -> Join"
+			sourceRef="UserTaskLeg1"
+			targetRef="parallelGatewayJoin"  />
+			
+		<bpmn:sequenceFlow id="flow3a" name="Leg 2" 
+			sourceRef="parallelGatewayFork"
+			targetRef="UserTaskLeg2" />
+		<bpmn:userTask id="UserTaskLeg2" name="user task leg2" implementation="other">
+			<bpmn:potentialOwner resourceRef="sampleResource" />
+		</bpmn:userTask>
+		<bpmn:sequenceFlow id="flow3b" name="Leg 2 -> Join"
+			sourceRef="UserTaskLeg2"
+			targetRef="parallelGatewayJoin"  />
+			
+
+		<bpmn:parallelGateway id="parallelGatewayJoin" name="The Join" 
+			gatewayDirection="converging"/>
+		<bpmn:sequenceFlow id="flow4" 
+			sourceRef="parallelGatewayJoin"
+			targetRef="End">
+		</bpmn:sequenceFlow>
+
+		<bpmn:endEvent id="End" name="End" />
+	</bpmn:process>
+</bpmn:definitions>



More information about the jbpm-commits mailing list