[jbpm-commits] JBoss JBPM SVN: r1728 - in jbossbpm/spec/trunk/modules: dialects/api10/src/main/java/org/jboss/bpm/dialect/api10 and 5 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Jul 25 09:01:49 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-07-25 09:01:49 -0400 (Fri, 25 Jul 2008)
New Revision: 1728

Added:
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/GatewayBuilder.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GateImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayBuilderImpl.java
Modified:
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java
   jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/ProcessUnmarshaller.java
   jbossbpm/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/ProcessDefinitionAdapter.java
   jbossbpm/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/ProcessUnmarshaller.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ComplexGatewayImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InclusiveGatewayImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ReceiveTaskImpl.java
   jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java
   jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
Log:
Add GateImpl

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -35,7 +35,7 @@
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public interface Gateway extends FlowObject, NameSupport, MultipleOutFlowSupport, MultipleInFlowSupport
+public interface Gateway extends FlowObject, NameSupport, MultipleInFlowSupport
 {
   /**
    * The GatewayType

Added: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/GatewayBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/GatewayBuilder.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/GatewayBuilder.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -0,0 +1,37 @@
+/*
+ * 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.jboss.bpm.model;
+
+
+//$Id$
+
+/**
+ * The GatewayBuilder can be used to build a {@link Gateway} dynamically.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface GatewayBuilder extends ProcessBuilder
+{
+  GatewayBuilder addGate(String targetName);
+
+}
\ No newline at end of file


Property changes on: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/GatewayBuilder.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -21,6 +21,7 @@
  */
 package org.jboss.bpm.model;
 
+import org.jboss.bpm.model.Gateway.GatewayType;
 import org.jboss.bpm.model.Task.TaskType;
 import org.jboss.bpm.runtime.ExecutionHandler;
 import org.jboss.bpm.runtime.FlowHandler;
@@ -86,24 +87,9 @@
   /**
    * Add an {@link ExclusiveGateway} with a given name
    */
-  ProcessBuilder addExclusiveDataBasedGateway(String name);
+  ProcessBuilder addGateway(String name, GatewayType type);
 
   /**
-   * Add an {@link InclusiveGateway} with a given name
-   */
-  ProcessBuilder addInclusiveGateway(String name);
-
-  /**
-   * Add a {@link ComplexGateway} with a given name
-   */
-  ProcessBuilder addComplexGateway(String name);
-
-  /**
-   * Add a {@link ParallelGateway} with a given name
-   */
-  ProcessBuilder addParallelGateway(String name);
-
-  /**
    * Add an {@link ExecutionHandler} with a given Class
    */
   ProcessBuilder addExecutionHandler(Class<?> clazz);

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -25,7 +25,7 @@
 //$Id$
 
 /**
- * The ProcessBuilder can be used to build a {@link Process} dynamically.
+ * The TaskBuilder can be used to build a {@link Task} dynamically.
  * 
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008

Modified: jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/ProcessUnmarshaller.java
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/ProcessUnmarshaller.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/dialects/api10/src/main/java/org/jboss/bpm/dialect/api10/ProcessUnmarshaller.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -48,6 +48,7 @@
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.ProcessBuilder;
 import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.model.Gateway.GatewayType;
 import org.jboss.bpm.model.Task.TaskType;
 
 
@@ -124,28 +125,28 @@
 
   private void adaptExclusiveGateway(ProcessBuilder builder, JAXBExclusiveGateway jaxb)
   {
-    builder.addExclusiveDataBasedGateway(jaxb.getName());
+    builder.addGateway(jaxb.getName(), GatewayType.Exclusive);
     for(JAXBFlow flow : jaxb.getOutFlows())
       builder.addSequenceFlow(flow.getTargetName());
   }
 
   private void adaptInclusiveGateway(ProcessBuilder builder, JAXBInclusiveGateway jaxb)
   {
-    builder.addInclusiveGateway(jaxb.getName());
+    builder.addGateway(jaxb.getName(), GatewayType.Inclusive);
     for(JAXBFlow flow : jaxb.getOutFlows())
       builder.addSequenceFlow(flow.getTargetName());
   }
 
   private void adaptComplexGateway(ProcessBuilder builder, JAXBComplexGateway jaxb)
   {
-    builder.addComplexGateway(jaxb.getName());
+    builder.addGateway(jaxb.getName(), GatewayType.Complex);
     for(JAXBFlow flow : jaxb.getOutFlows())
       builder.addSequenceFlow(flow.getTargetName());
   }
 
   private void adaptParallelGateway(ProcessBuilder builder, JAXBParallelGateway jaxb)
   {
-    builder.addParallelGateway(jaxb.getName());
+    builder.addGateway(jaxb.getName(), GatewayType.Parallel);
     for(JAXBFlow flow : jaxb.getOutFlows())
       builder.addSequenceFlow(flow.getTargetName());
   }

Modified: jbossbpm/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/ProcessDefinitionAdapter.java
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/ProcessDefinitionAdapter.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/dialects/jpdl32/src/main/java/org/jboss/bpm/dialect/jpdl32/ProcessDefinitionAdapter.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -37,6 +37,7 @@
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.ProcessBuilder;
 import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.model.Gateway.GatewayType;
 import org.jboss.bpm.model.Task.TaskType;
 import org.jboss.bpm.runtime.ExecutionHandler;
 
@@ -123,7 +124,7 @@
 
   private void adaptFork(ProcessBuilder builder, JPDL32Fork jpdlObj)
   {
-    builder.addParallelGateway(jpdlObj.getName());
+    builder.addGateway(jpdlObj.getName(), GatewayType.Parallel);
     adaptTransitions(builder, jpdlObj.getScriptOrDescriptionOrEvent());
   }
 

Modified: jbossbpm/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/ProcessUnmarshaller.java
===================================================================
--- jbossbpm/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/ProcessUnmarshaller.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/dialects/stp/src/main/java/org/jboss/bpm/dialect/stp/ProcessUnmarshaller.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -45,6 +45,7 @@
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.ProcessBuilder;
 import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.model.Gateway.GatewayType;
 import org.jboss.bpm.model.Task.TaskType;
 import org.jboss.util.xml.DOMUtils;
 import org.w3c.dom.Document;
@@ -172,13 +173,13 @@
     else if (activityType == ActivityType.GATEWAY_DATA_BASED_EXCLUSIVE)
     {
       String name = stpActivity.getLabel();
-      builder.addExclusiveDataBasedGateway(name);
+      builder.addGateway(name, GatewayType.Exclusive);
       adaptOutgoingEdges(builder, stpActivity);
     }
     else if (activityType == ActivityType.GATEWAY_PARALLEL)
     {
       String name = stpActivity.getLabel();
-      builder.addParallelGateway(name);
+      builder.addGateway(name, GatewayType.Parallel);
       adaptOutgoingEdges(builder, stpActivity);
     }
     else

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ComplexGatewayImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ComplexGatewayImpl.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ComplexGatewayImpl.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -23,12 +23,9 @@
 
 //$Id$
 
-import java.util.List;
-
 import org.jboss.bpm.NotImplementedException;
 import org.jboss.bpm.model.ComplexGateway;
 import org.jboss.bpm.model.Expression;
-import org.jboss.bpm.model.Gate;
 
 /**
  * A Complex Gateway handles situations that are not easily handled through the other types of Gateways. Complex
@@ -45,26 +42,21 @@
     super(name);
   }
 
-  public Expression getIncommingCondition()
+  public GatewayType getGatewayType()
   {
-    throw new NotImplementedException();
+    return GatewayType.Complex;
   }
 
-  public Expression getOutgoingCondition()
+  public Expression getIncommingCondition()
   {
     throw new NotImplementedException();
   }
 
-  public List<Gate> getGates()
+  public Expression getOutgoingCondition()
   {
     throw new NotImplementedException();
   }
 
-  public GatewayType getGatewayType()
-  {
-    throw new NotImplementedException();
-  }
-
   public String toString()
   {
     return "ComplexGateway[" + getName() + "]";

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -25,6 +25,8 @@
 import org.jboss.bpm.NameNotUniqueException;
 import org.jboss.bpm.model.Flow;
 import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Gate;
+import org.jboss.bpm.model.Gateway;
 import org.jboss.bpm.model.MultipleInFlowSupport;
 import org.jboss.bpm.model.MultipleOutFlowSupport;
 import org.jboss.bpm.model.NameSupport;
@@ -80,9 +82,18 @@
       for (Flow flow : mof.getOutFlows())
       {
         outFlow = flow;
-        initFlow(proc, (FlowImpl)flow);
+        initFlow(proc, (FlowImpl)outFlow);
       }
     }
+    else if (this instanceof Gateway)
+    {
+      Gateway gateway = (Gateway)this;
+      for (Gate gate : gateway.getGates())
+      {
+        outFlow = gate.getOutgoingSequenceFlow();
+        initFlow(proc, (FlowImpl)outFlow);
+      }
+    }
 
     Flow inFlow = null;
     if (this instanceof SingleInFlowSupport)

Added: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GateImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GateImpl.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GateImpl.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -0,0 +1,58 @@
+/*
+ * 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.jboss.bpm.model.internal;
+
+//$Id$
+
+import java.util.List;
+
+import org.jboss.bpm.NotImplementedException;
+import org.jboss.bpm.model.Assignment;
+import org.jboss.bpm.model.Gate;
+import org.jboss.bpm.model.Gateway;
+import org.jboss.bpm.model.SequenceFlow;
+
+/**
+ * A {@link Gate} associated with a {@link Gateway}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class GateImpl extends SupportingElementImpl implements Gate
+{
+  private SequenceFlow seqFlow;
+
+  public GateImpl(String targetName)
+  {
+    seqFlow = new SequenceFlowImpl(targetName);
+  }
+
+  public SequenceFlow getOutgoingSequenceFlow()
+  {
+    return seqFlow;
+  }
+  
+  public List<Assignment> getAssignments()
+  {
+    throw new NotImplementedException();
+  }
+}


Property changes on: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GateImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayBuilderImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayBuilderImpl.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayBuilderImpl.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -0,0 +1,58 @@
+/*
+ * 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.jboss.bpm.model.internal;
+
+//$Id$
+
+import org.jboss.bpm.model.Gate;
+import org.jboss.bpm.model.Gateway;
+import org.jboss.bpm.model.GatewayBuilder;
+
+/**
+ * The GatewayBuilder can be used to build a {@link Gateway} dynamically.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class GatewayBuilderImpl extends ProcessBuilderImpl implements GatewayBuilder
+{
+  private Gate gate;
+
+  public GatewayBuilderImpl(ProcessImpl proc, FlowObjectImpl flowObject)
+  {
+    super(proc, flowObject);
+  }
+
+  public GatewayBuilder addGate(String targetName)
+  {
+    gate = new GateImpl(targetName);
+    getGateway().addGate(gate);
+    return this;
+  }
+
+  private GatewayImpl getGateway()
+  {
+    if (flowObject instanceof Gateway == false)
+      throw new IllegalStateException("Last added flow object is not a Gateway");
+    return (GatewayImpl)flowObject;
+  }
+}
\ No newline at end of file


Property changes on: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayBuilderImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -49,17 +49,17 @@
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public abstract class GatewayImpl extends FlowObjectImpl implements Gateway, HandlerSetterSupport, MultipleInFlowSetterSupport, MultipleOutFlowSetterSupport
+public abstract class GatewayImpl extends FlowObjectImpl implements Gateway, HandlerSetterSupport, MultipleInFlowSetterSupport
 {
   // provide logging
   private static final Log log = LogFactory.getLog(GatewayImpl.class);
 
   private String name;
   protected List<Flow> inFlows = new ArrayList<Flow>();
-  protected List<Flow> outFlows = new ArrayList<Flow>();
   private ExecutionHandler executionHandler;
   private FlowHandler flowHandler;
   private SignalHandler signalHandler;
+  private List<Gate> gates = new ArrayList<Gate>();
 
   public GatewayImpl(String name)
   {
@@ -73,19 +73,14 @@
 
   public List<Gate> getGates()
   {
-    throw new NotImplementedException();
+    return Collections.unmodifiableList(gates);
   }
 
-  public List<Flow> getOutFlows()
+  public void addGate(Gate gate)
   {
-    return Collections.unmodifiableList(outFlows);
+    gates.add(gate);
   }
-
-  public void addOutFlow(Flow flow)
-  {
-    outFlows.add(flow);
-  }
-
+  
   public List<Flow> getInFlows()
   {
     return Collections.unmodifiableList(inFlows);
@@ -120,13 +115,13 @@
   public FlowHandler getFlowHandler()
   {
     FlowHandler handler = flowHandler;
-    if (handler == null && outFlows.size() == 1)
+    if (handler == null && gates.size() == 1)
     {
       handler = new FlowHandler()
       {
         public void execute(FlowScheduler scheduler, Token token)
         {
-          Tuple tuple = new Tuple(outFlows.get(0), token);
+          Tuple tuple = new Tuple(gates.get(0).getOutgoingSequenceFlow(), token);
           scheduler.scheduleTuple(tuple);
         }
       };

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InclusiveGatewayImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InclusiveGatewayImpl.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InclusiveGatewayImpl.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -28,6 +28,7 @@
 import org.jboss.bpm.NotImplementedException;
 import org.jboss.bpm.model.Gate;
 import org.jboss.bpm.model.InclusiveGateway;
+import org.jboss.bpm.model.Gateway.GatewayType;
 
 
 
@@ -46,21 +47,16 @@
     super(name);
   }
 
-  public Gate getDefaultGate()
+  public GatewayType getGatewayType()
   {
-    throw new NotImplementedException();
+    return GatewayType.Inclusive;
   }
 
-  public List<Gate> getGates()
+  public Gate getDefaultGate()
   {
     throw new NotImplementedException();
   }
 
-  public GatewayType getGatewayType()
-  {
-    throw new NotImplementedException();
-  }
-
   public String toString()
   {
     return "InclusiveGateway[" + getName() + "]";

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -48,14 +48,9 @@
     super(name);
   }
 
-  public List<Gate> getGates()
-  {
-    throw new NotImplementedException();
-  }
-
   public GatewayType getGatewayType()
   {
-    throw new NotImplementedException();
+    return GatewayType.Parallel;
   }
   
   /**
@@ -70,9 +65,9 @@
       {
         public void execute(FlowScheduler scheduler, Token token)
         {
-          for(Flow outFlow : getOutFlows())
+          for(Gate gate : getGates())
           {
-            Tuple tuple = new Tuple(outFlow, token.createCopy());
+            Tuple tuple = new Tuple(gate.getOutgoingSequenceFlow(), token.createCopy());
             scheduler.scheduleTuple(tuple);
           }
         }

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -24,9 +24,12 @@
 //$Id$
 
 import org.jboss.bpm.NotImplementedException;
+import org.jboss.bpm.model.Gateway;
+import org.jboss.bpm.model.GatewayBuilder;
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.ProcessBuilder;
 import org.jboss.bpm.model.TaskBuilder;
+import org.jboss.bpm.model.Gateway.GatewayType;
 import org.jboss.bpm.model.Task.TaskType;
 import org.jboss.bpm.runtime.ExecutionHandler;
 import org.jboss.bpm.runtime.FlowHandler;
@@ -75,18 +78,23 @@
     return this;
   }
 
-  public ProcessBuilder addSequenceFlow(String name)
+  public ProcessBuilder addSequenceFlow(String targetName)
   {
     if (flowObject instanceof SingleOutFlowSetterSupport)
     {
       SingleOutFlowSetterSupport outFlow = (SingleOutFlowSetterSupport)flowObject;
-      outFlow.setOutFlow(new SequenceFlowImpl(name));
+      outFlow.setOutFlow(new SequenceFlowImpl(targetName));
     }
     else if (flowObject instanceof MultipleOutFlowSetterSupport)
     {
       MultipleOutFlowSetterSupport outFlow = (MultipleOutFlowSetterSupport)flowObject;
-      outFlow.addOutFlow(new SequenceFlowImpl(name));
+      outFlow.addOutFlow(new SequenceFlowImpl(targetName));
     }
+    else if (flowObject instanceof Gateway)
+    {
+      GatewayBuilder gwBuilder = new GatewayBuilderImpl(proc, flowObject);
+      gwBuilder.addGate(targetName);
+    }
     else
     {
       throw new IllegalStateException("Cannot add a sequence flow to: " + flowObject);
@@ -94,17 +102,17 @@
     return this;
   }
 
-  public ProcessBuilder addMessageFlow(String name)
+  public ProcessBuilder addMessageFlow(String targetName)
   {
     if (flowObject instanceof SingleOutFlowSetterSupport)
     {
       SingleOutFlowSetterSupport outFlow = (SingleOutFlowSetterSupport)flowObject;
-      outFlow.setOutFlow(new MessageFlowImpl(name));
+      outFlow.setOutFlow(new MessageFlowImpl(targetName));
     }
     else if (flowObject instanceof MultipleOutFlowSetterSupport)
     {
       MultipleOutFlowSetterSupport outFlow = (MultipleOutFlowSetterSupport)flowObject;
-      outFlow.addOutFlow(new MessageFlowImpl(name));
+      outFlow.addOutFlow(new MessageFlowImpl(targetName));
     }
     else
     {
@@ -152,34 +160,28 @@
     return new TaskBuilderImpl(proc, flowObject);
   }
 
-  public ProcessBuilder addExclusiveDataBasedGateway(String name)
+  public ProcessBuilder addGateway(String name, GatewayType type)
   {
-    flowObject = new ExclusiveGatewayDataBasedImpl(name);
+    if (GatewayType.Exclusive == type)
+    {
+      flowObject = new ExclusiveGatewayDataBasedImpl(name);
+    }
+    else if (GatewayType.Inclusive == type)
+    {
+      flowObject = new InclusiveGatewayImpl(name);
+    }
+    else if (GatewayType.Parallel == type)
+    {
+      flowObject = new ParallelGatewayImpl(name);
+    }
+    else if (GatewayType.Complex == type)
+    {
+      flowObject = new ComplexGatewayImpl(name);
+    }
     addFlowObject();
     return this;
   }
-
-  public ProcessBuilder addInclusiveGateway(String name)
-  {
-    flowObject = new InclusiveGatewayImpl(name);
-    addFlowObject();
-    return this;
-  }
-
-  public ProcessBuilder addComplexGateway(String name)
-  {
-    flowObject = new ComplexGatewayImpl(name);
-    addFlowObject();
-    return this;
-  }
-
-  public ProcessBuilder addParallelGateway(String name)
-  {
-    flowObject = new ParallelGatewayImpl(name);
-    addFlowObject();
-    return this;
-  }
-
+  
   public ProcessBuilder addExecutionHandler(Class<?> clazz)
   {
     return addHandler(clazz);

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ReceiveTaskImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ReceiveTaskImpl.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ReceiveTaskImpl.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -21,6 +21,9 @@
  */
 package org.jboss.bpm.model.internal;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.bpm.InvalidProcessException;
@@ -54,7 +57,7 @@
   // A Web service is the default technology
   private Implementation implementation = Implementation.WebService;
   private Message messageRef;
-  private Message receivedMessage;
+  private List<Message> messages = new ArrayList<Message>();
 
   public ReceiveTaskImpl(String name)
   {
@@ -98,7 +101,7 @@
         if (message.getProperty(name) == null)
           throw new IllegalArgumentException("Received message does not contain expected property: " + name);
       }
-      this.receivedMessage = message;
+      messages.add(message);
     }
     else
     {
@@ -120,7 +123,7 @@
           // Wait for the message to arrive
           long now = System.currentTimeMillis();
           long until = now + RECEIVE_TIMEOUT;
-          while (receivedMessage == null && now < until)
+          while (messages.size() == 0 && now < until)
           {
             try
             {
@@ -134,16 +137,17 @@
           }
           
           // Timeout if the message did not arrive
-          if (receivedMessage == null)
+          if (messages.size() == 0)
             throw new ProcessTimeoutException("Message receive timeout in: " + task);
           
           // Copy the expected properties from the 
           // received message to the execution context
           ExecutionContext exContext = token.getExecutionContext();
+          Message msg = messages.remove(0);
           for (Property prop : messageRef.getProperties())
           {
             String key = prop.getName();
-            Expression value = receivedMessage.getProperty(key).getValue();
+            Expression value = msg.getProperty(key).getValue();
             exContext.addAttachment(key, value);
           }
         }

Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -95,7 +95,7 @@
     addMessageProperty("Seats", null, true).
     addSequenceFlow("End");
     
-    Process proc = procBuilder.addEndEvent("End").getProcess();
+    Process proc = procBuilder.addGateway("Validate", null).addEndEvent("End").getProcess();
 
     // Register the Process with the ProcessManager
     ProcessManager pm = ProcessManager.locateProcessManager();

Modified: jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java
===================================================================
--- jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java	2008-07-25 12:49:54 UTC (rev 1727)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/parallelsplit/ParallelSplitTest.java	2008-07-25 13:01:49 UTC (rev 1728)
@@ -33,6 +33,7 @@
 import org.jboss.bpm.model.ProcessBuilder;
 import org.jboss.bpm.model.ProcessBuilderFactory;
 import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.model.Gateway.GatewayType;
 import org.jboss.bpm.test.DefaultEngineTestCase;
 
 /**
@@ -71,7 +72,7 @@
   {
     // Create a Process through the ProcessBuilder
     ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder();
-    Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("gateway").addParallelGateway("gateway").
+    Process proc = procBuilder.addProcess(getName()).addStartEvent().addSequenceFlow("gateway").addGateway("gateway", GatewayType.Parallel).
     addSequenceFlow("endA").addSequenceFlow("endB").addEndEvent("endA").addEndEvent("endB").getProcess();
     
     // Register the Process with the ProcessManager




More information about the jbpm-commits mailing list