[jbpm-commits] JBoss JBPM SVN: r1732 - in jbossbpm/spec/trunk/modules: ri/src/main/java/org/jboss/bpm/model/internal and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Jul 25 13:03:26 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-07-25 13:03:26 -0400 (Fri, 25 Jul 2008)
New Revision: 1732

Added:
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ActivityBuilder.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/PropertySupport.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityBuilderImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InputSetImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MutablePropertySupport.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/OutputSetImpl.java
Modified:
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Expression.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/InputSet.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Message.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/OutputSet.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExclusiveGatewayImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExpressionImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskBuilderImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java
   jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java
Log:
More Activity impl

Added: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ActivityBuilder.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ActivityBuilder.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/ActivityBuilder.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -0,0 +1,60 @@
+/*
+ * 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;
+
+import org.jboss.bpm.model.Expression.ExpressionLanguage;
+
+//$Id$
+
+/**
+ * The ActivityBuilder can be used to build an {@link Activity} dynamically.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface ActivityBuilder extends ProcessBuilder
+{
+  /**
+   * Add an {@link InputSet}
+   */
+  ActivityBuilder addInputSet();
+
+  /**
+   * Add an {@link Property} Input
+   */
+  ActivityBuilder addPropertyInput(String name, String value);
+
+  /**
+   * Add an {@link OutputSet}
+   */
+  ActivityBuilder addOutputSet();
+
+  /**
+   * Add an {@link Property} Output
+   */
+  ActivityBuilder addPropertyOutput(String name, String value);
+  
+  /**
+   * Add an IORule @{link Expression}
+   */
+  ActivityBuilder addIORule(String body, ExpressionLanguage lang);
+}
\ No newline at end of file


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

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Expression.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Expression.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Expression.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -32,6 +32,11 @@
  */
 public interface Expression extends SupportingElement
 {
+  public enum ExpressionLanguage
+  {
+    MVEL, String
+  }
+  
   /**
    * An ExpressionBody MUST be entered to provide the text of the expression, which
    * will be written in the language defined by the ExpressionLanguage attribute.
@@ -43,6 +48,6 @@
    * The value of the ExpressionLanguage should follow the naming conventions for the
    * version of the specified language.
    */
-  String getExpressionLanguage();
+  ExpressionLanguage getExpressionLanguage();
 
 }

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/InputSet.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/InputSet.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/InputSet.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -46,5 +46,5 @@
    * combination of ArtifactInputs and PropertyInputs, there MUST be at least one
    * item defined for the InputSet.
    */
-  List<Property> getPropertyInputs();
+  List<Property> getProperties();
 }

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Message.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Message.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Message.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -23,6 +23,7 @@
 
 import java.util.List;
 
+
 //$Id$
 
 /**

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/OutputSet.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/OutputSet.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/OutputSet.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -46,5 +46,5 @@
    * combination of ArtifactInputs and PropertyInputs, there MUST be at least one
    * item defined for the InputSet.
    */
-  List<Property> getPropertyOutputs();
+  List<Property> getProperties();
 }

Added: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/PropertySupport.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/PropertySupport.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/PropertySupport.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -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.jboss.bpm.model;
+
+//$Id$
+
+import java.util.List;
+
+
+/**
+ * Property support
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 21-Jul-2008
+ */
+public interface PropertySupport
+{
+  /**
+   * Get a Property with a given name. 
+   */
+  Property getProperty(String name);
+
+  /**
+   * Multiple Properties MAY entered for the Message.
+   */
+  List<Property> getProperties();
+
+  /**
+   * Get the list of property names
+   */
+  List<String> getPropertyNames();
+}
\ No newline at end of file


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

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 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/TaskBuilder.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -30,7 +30,7 @@
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public interface TaskBuilder extends ProcessBuilder
+public interface TaskBuilder extends ActivityBuilder
 {
   TaskBuilder addMessageRef(String name);
 

Added: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityBuilderImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityBuilderImpl.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityBuilderImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -0,0 +1,88 @@
+/*
+ * 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.Activity;
+import org.jboss.bpm.model.ActivityBuilder;
+import org.jboss.bpm.model.Property;
+import org.jboss.bpm.model.Expression.ExpressionLanguage;
+
+/**
+ * The ActivityBuilder can be used to build an {@link Activity} dynamically.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class ActivityBuilderImpl extends ProcessBuilderImpl implements ActivityBuilder
+{
+  private InputSetImpl inputSet;
+  private OutputSetImpl outputSet;
+
+  public ActivityBuilderImpl(ProcessImpl proc, FlowObjectImpl flowObject)
+  {
+    super(proc, flowObject);
+  }
+
+  public ActivityBuilder addInputSet()
+  {
+    inputSet = new InputSetImpl();
+    getActivity().addInputSet(inputSet);
+    return this;
+  }
+
+  public ActivityBuilder addPropertyInput(String name, String value)
+  {
+    Property prop = new PropertyImpl(name, new ExpressionImpl(value));
+    inputSet.addProperty(prop);
+    return this;
+  }
+
+  public ActivityBuilder addOutputSet()
+  {
+    outputSet = new OutputSetImpl();
+    getActivity().addOutputSet(outputSet);
+    return this;
+  }
+
+  public ActivityBuilder addPropertyOutput(String name, String value)
+  {
+    Property prop = new PropertyImpl(name, new ExpressionImpl(value));
+    outputSet.addProperty(prop);
+    return this;
+  }
+
+  public ActivityBuilder addIORule(String body, ExpressionLanguage lang)
+  {
+    ExpressionImpl expr = new ExpressionImpl(body, lang);
+    getActivity().addIORule(expr);
+    return this;
+  }
+  
+  private ActivityImpl getActivity()
+  {
+    if (flowObject instanceof Activity == false)
+      throw new IllegalStateException("Last added flow object is not a Activity");
+    return (ActivityImpl)flowObject;
+  }
+}
\ No newline at end of file


Property changes on: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityBuilderImpl.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/ActivityImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ActivityImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -23,20 +23,35 @@
 
 //$Id$
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.NotImplementedException;
 import org.jboss.bpm.model.Activity;
+import org.jboss.bpm.model.Expression;
+import org.jboss.bpm.model.InputSet;
+import org.jboss.bpm.model.OutputSet;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Property;
 
 /**
- * An activity is a generic term for work that a company or organization performs via business processes. 
- * An activity can be atomic or non-atomic (compound). 
- * The types of activities that are a part of a Process Model are: Process, Sub-Process, and Task. 
+ * An activity is a generic term for work that a company or organization performs via business processes. An activity
+ * can be atomic or non-atomic (compound). The types of activities that are a part of a Process Model are: Process,
+ * Sub-Process, and Task.
  * 
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public abstract class ActivityImpl extends FlowObjectImpl implements Activity
+public abstract class ActivityImpl extends FlowObjectImpl implements Activity, MutablePropertySupport
 {
   private String name;
-  
+  private List<InputSet> inputSets = new ArrayList<InputSet>();
+  private List<OutputSet> outputSets = new ArrayList<OutputSet>();
+  private List<Expression> ioRules = new ArrayList<Expression>();
+  private List<Property> props = new ArrayList<Property>();
+
   public ActivityImpl(String name)
   {
     this.name = name;
@@ -46,9 +61,119 @@
   {
     return name;
   }
-  
+
   public void setName(String name)
   {
     this.name = name;
   }
+
+  public int getStartQuantity()
+  {
+    throw new NotImplementedException();
+  }
+
+  public int getCompletionQuantity()
+  {
+    throw new NotImplementedException();
+  }
+
+  public List<Expression> getIORules()
+  {
+    return Collections.unmodifiableList(ioRules);
+  }
+
+  public void addIORule(Expression expr)
+  {
+    ioRules.add(expr);
+  }
+
+  public List<InputSet> getInputSets()
+  {
+    return Collections.unmodifiableList(inputSets);
+  }
+
+  public void addInputSet(InputSet inputSet)
+  {
+    inputSets.add(inputSet);
+  }
+
+  public List<OutputSet> getOutputSets()
+  {
+    return Collections.unmodifiableList(outputSets);
+  }
+
+  public void addOutputSet(OutputSet outputSet)
+  {
+    outputSets.add(outputSet);
+  }
+
+  public LoopType getLoopType()
+  {
+    throw new NotImplementedException();
+  }
+
+  public List<String> getPerformers()
+  {
+    throw new NotImplementedException();
+  }
+
+  public Property getProperty(String name)
+  {
+    for (Property prop : props)
+    {
+      if (prop.getName().equals(name))
+        return prop;
+    }
+    return null;
+  }
+
+  public List<Property> getProperties()
+  {
+    return Collections.unmodifiableList(props);
+  }
+
+  public List<String> getPropertyNames()
+  {
+    List<String> names = new ArrayList<String>();
+    for (Property prop : props)
+    {
+      names.add(prop.getName());
+    }
+    return names;
+  }
+
+  public void addProperty(Property prop)
+  {
+    props.add(prop);
+  }
+
+  @Override
+  protected void initialize(Process proc)
+  {
+    super.initialize(proc);
+
+    // Validate InputSets
+    for (InputSet inSet : inputSets)
+    {
+      int artSize = inSet.getArtifactInputs().size();
+      int propSize = inSet.getProperties().size();
+      if (artSize == 0 && propSize == 0) 
+      {
+        throw new InvalidProcessException(
+            "For the combination of ArtifactInputs and PropertyInputs, there MUST be at least one item defined for the InputSet");
+      }
+    }
+    
+    // Validate OutputSets
+    for (OutputSet outSet : outputSets)
+    {
+      int artSize = outSet.getArtifactOutputs().size();
+      int propSize = outSet.getProperties().size();
+      if (artSize == 0 && propSize == 0) 
+      {
+        throw new InvalidProcessException(
+            "For the combination of ArtifactOutputs and PropertyOututs, there MUST be at least one item defined for the OutputSet");
+      }
+    }
+  }
 }
\ No newline at end of file

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExclusiveGatewayImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExclusiveGatewayImpl.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExclusiveGatewayImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -23,11 +23,7 @@
 
 //$Id$
 
-import java.util.List;
-
-import org.jboss.bpm.NotImplementedException;
 import org.jboss.bpm.model.ExclusiveGateway;
-import org.jboss.bpm.model.Gate;
 
 /**
  * A point in the workflow process where, based on a decision or workflow control data, one of several branches is chosen. 

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExpressionImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExpressionImpl.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ExpressionImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -23,7 +23,6 @@
 
 //$Id$
 
-import org.jboss.bpm.NotImplementedException;
 import org.jboss.bpm.model.Expression;
 
 /**
@@ -36,19 +35,26 @@
 public class ExpressionImpl extends SupportingElementImpl implements Expression
 {
   private String body;
+  private ExpressionLanguage lang = ExpressionLanguage.String;
 
   public ExpressionImpl(String body)
   {
     this.body = body;
   }
 
+  public ExpressionImpl(String body, ExpressionLanguage lang)
+  {
+    this.body = body;
+    this.lang = lang;
+  }
+
   public String getExpressionBody()
   {
     return body;
   }
 
-  public String getExpressionLanguage()
+  public ExpressionLanguage getExpressionLanguage()
   {
-    throw new NotImplementedException();
+    return lang;
   }
 }

Added: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InputSetImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InputSetImpl.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InputSetImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -0,0 +1,86 @@
+/*
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.bpm.NotImplementedException;
+import org.jboss.bpm.model.ArtifactInput;
+import org.jboss.bpm.model.ArtifactOutput;
+import org.jboss.bpm.model.InputSet;
+import org.jboss.bpm.model.Property;
+
+/**
+ * An InputSet, which is used in the definition of common attributes for Activities and for attributes of a Process
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class InputSetImpl extends SupportingElementImpl implements InputSet, MutablePropertySupport
+{
+  private List<ArtifactInput> artInputs = new ArrayList<ArtifactInput>();
+  private List<Property> props = new ArrayList<Property>();
+
+  public List<ArtifactInput> getArtifactInputs()
+  {
+    return Collections.unmodifiableList(artInputs);
+  }
+
+  public void addArtifactInput(ArtifactInput artIn)
+  {
+    artInputs.add(artIn);
+  }
+  
+  public Property getProperty(String name)
+  {
+    for (Property prop : props)
+    {
+      if (prop.getName().equals(name))
+        return prop;
+    }
+    return null;
+  }
+
+  public List<Property> getProperties()
+  {
+    return Collections.unmodifiableList(props);
+  }
+
+  public List<String> getPropertyNames()
+  {
+    List<String> names = new ArrayList<String>();
+    for (Property prop : props)
+    {
+      names.add(prop.getName());
+    }
+    return names;
+  }
+
+  public void addProperty(Property prop)
+  {
+    props.add(prop);
+  }
+}


Property changes on: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/InputSetImpl.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/MessageImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageImpl.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MessageImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -29,6 +29,7 @@
 import org.jboss.bpm.model.Message;
 import org.jboss.bpm.model.Participant;
 import org.jboss.bpm.model.Property;
+import org.jboss.bpm.model.PropertySupport;
 
 //$Id$
 
@@ -40,7 +41,7 @@
  * @author thomas.diesler at jboss.com
  * @since 21-Jul-2008
  */
-public class MessageImpl extends SupportingElementImpl implements Message
+public class MessageImpl extends SupportingElementImpl implements Message, MutablePropertySupport
 {
   private String name;
   private List<Property> props = new ArrayList<Property>();
@@ -58,9 +59,6 @@
     return name;
   }
 
-  /**
-   * Get a Property with a given name. 
-   */
   public Property getProperty(String name)
   {
     for (Property prop : props)
@@ -70,18 +68,12 @@
     }
     return null;
   }
-  
-  /**
-   * Multiple Properties MAY entered for the Message.
-   */
+
   public List<Property> getProperties()
   {
     return Collections.unmodifiableList(props);
   }
 
-  /**
-   * Get the list of property names
-   */
   public List<String> getPropertyNames()
   {
     List<String> names = new ArrayList<String>();
@@ -115,7 +107,7 @@
   {
     throw new NotImplementedException();
   }
-  
+
   public String toString()
   {
     StringBuilder str = new StringBuilder("Message[name=" + name + ",props=");
@@ -124,4 +116,3 @@
     return str.toString();
   }
 }
-

Added: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MutablePropertySupport.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MutablePropertySupport.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MutablePropertySupport.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -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.jboss.bpm.model.internal;
+
+import org.jboss.bpm.model.Property;
+import org.jboss.bpm.model.PropertySupport;
+
+//$Id$
+
+/**
+ * Mutable property support
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 21-Jul-2008
+ */
+public interface MutablePropertySupport extends PropertySupport
+{
+  /**
+   * Add a property
+   */
+  void addProperty(Property prop);
+}
\ No newline at end of file


Property changes on: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/MutablePropertySupport.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/OutputSetImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/OutputSetImpl.java	                        (rev 0)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/OutputSetImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -0,0 +1,85 @@
+/*
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.bpm.NotImplementedException;
+import org.jboss.bpm.model.ArtifactOutput;
+import org.jboss.bpm.model.OutputSet;
+import org.jboss.bpm.model.Property;
+
+/**
+ * An OuputSet, which is used in the definition of common attributes for Activities and for attributes of a Process
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class OutputSetImpl extends SupportingElementImpl implements OutputSet, MutablePropertySupport
+{
+  private List<ArtifactOutput> artOutputs = new ArrayList<ArtifactOutput>();
+  private List<Property> props = new ArrayList<Property>();
+
+  public List<ArtifactOutput> getArtifactOutputs()
+  {
+    return Collections.unmodifiableList(artOutputs);
+  }
+
+  public void addArtifactOutput(ArtifactOutput artOut)
+  {
+    artOutputs.add(artOut);
+  }
+  
+  public Property getProperty(String name)
+  {
+    for (Property prop : props)
+    {
+      if (prop.getName().equals(name))
+        return prop;
+    }
+    return null;
+  }
+
+  public List<Property> getProperties()
+  {
+    return Collections.unmodifiableList(props);
+  }
+
+  public List<String> getPropertyNames()
+  {
+    List<String> names = new ArrayList<String>();
+    for (Property prop : props)
+    {
+      names.add(prop.getName());
+    }
+    return names;
+  }
+
+  public void addProperty(Property prop)
+  {
+    props.add(prop);
+  }
+}


Property changes on: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/OutputSetImpl.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/SubProcessImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -23,15 +23,9 @@
 
 //$Id$
 
-import java.util.List;
-
 import org.jboss.bpm.NotImplementedException;
-import org.jboss.bpm.model.Expression;
 import org.jboss.bpm.model.Flow;
 import org.jboss.bpm.model.FlowObject;
-import org.jboss.bpm.model.InputSet;
-import org.jboss.bpm.model.OutputSet;
-import org.jboss.bpm.model.Property;
 import org.jboss.bpm.model.Signal;
 import org.jboss.bpm.model.SubProcess;
 import org.jboss.bpm.runtime.ExecutionHandler;
@@ -65,46 +59,6 @@
     return ActivityType.SubProcess;
   }
 
-  public int getCompletionQuantity()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<Expression> getIORules()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<InputSet> getInputSets()
-  {
-    throw new NotImplementedException();
-  }
-
-  public LoopType getLoopType()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<OutputSet> getOutputSets()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<String> getPerformers()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<Property> getProperties()
-  {
-    throw new NotImplementedException();
-  }
-
-  public int getStartQuantity()
-  {
-    throw new NotImplementedException();
-  }
-  
   public Flow getInFlow()
   {
     return inFlow;

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskBuilderImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskBuilderImpl.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskBuilderImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -33,7 +33,7 @@
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public class TaskBuilderImpl extends ProcessBuilderImpl implements TaskBuilder
+public class TaskBuilderImpl extends ActivityBuilderImpl implements TaskBuilder
 {
   private MessageImpl message;
   

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java	2008-07-25 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -21,16 +21,9 @@
  */
 package org.jboss.bpm.model.internal;
 
-import java.util.List;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.NotImplementedException;
-import org.jboss.bpm.model.Expression;
 import org.jboss.bpm.model.Flow;
-import org.jboss.bpm.model.InputSet;
-import org.jboss.bpm.model.OutputSet;
-import org.jboss.bpm.model.Property;
 import org.jboss.bpm.model.Signal;
 import org.jboss.bpm.model.Task;
 import org.jboss.bpm.runtime.ExecutionHandler;
@@ -75,46 +68,6 @@
 
   public abstract TaskType getTaskType();
   
-  public int getCompletionQuantity()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<Expression> getIORules()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<InputSet> getInputSets()
-  {
-    throw new NotImplementedException();
-  }
-
-  public LoopType getLoopType()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<OutputSet> getOutputSets()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<String> getPerformers()
-  {
-    throw new NotImplementedException();
-  }
-
-  public List<Property> getProperties()
-  {
-    throw new NotImplementedException();
-  }
-
-  public int getStartQuantity()
-  {
-    throw new NotImplementedException();
-  }
-  
   /**
    * Get the out flow
    */

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 13:51:28 UTC (rev 1731)
+++ jbossbpm/spec/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/airticket/AirticketTest.java	2008-07-25 17:03:26 UTC (rev 1732)
@@ -37,6 +37,7 @@
 import org.jboss.bpm.model.ProcessBuilderFactory;
 import org.jboss.bpm.model.Signal;
 import org.jboss.bpm.model.TaskBuilder;
+import org.jboss.bpm.model.Expression.ExpressionLanguage;
 import org.jboss.bpm.model.Gateway.GatewayType;
 import org.jboss.bpm.model.Task.TaskType;
 import org.jboss.bpm.test.DefaultEngineTestCase;
@@ -96,6 +97,19 @@
     addMessageProperty("To", null, true).
     addMessageProperty("Date", null, true).
     addMessageProperty("Seats", null, true).
+    addSequenceFlow("ValidateTask");
+    
+    // Build the Validate Task
+    taskBuilder = procBuilder.addTask("ValidateTask", TaskType.None);
+    taskBuilder.addInputSet().
+    addPropertyInput("Name", null).
+    addPropertyInput("From", null).
+    addPropertyInput("To", null).
+    addPropertyInput("Date", null).
+    addPropertyInput("Seats", null).
+    addOutputSet().
+    addPropertyOutput("isReqDataValid", null).
+    addIORule("isReqDataValid == true if ....", ExpressionLanguage.MVEL).
     addSequenceFlow("ValidateGateway");
     
     // Build the Validate Gateway




More information about the jbpm-commits mailing list