JBoss JBPM SVN: r1585 - api/trunk/modules/api/src/main/java/org/jboss/bpm/model.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-11 09:14:17 -0400 (Fri, 11 Jul 2008)
New Revision: 1585
Modified:
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java
Log:
transient process
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java 2008-07-11 13:11:10 UTC (rev 1584)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java 2008-07-11 13:14:17 UTC (rev 1585)
@@ -35,7 +35,6 @@
@XmlType(name = "AbstractFlowObject")
abstract class AbstractFlowObject
{
- @XmlTransient
private Process process;
public Process getProcess()
@@ -43,6 +42,7 @@
return process;
}
+ @XmlTransient
public void setProcess(Process process)
{
this.process = process;
15 years, 10 months
JBoss JBPM SVN: r1584 - jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-11 09:11:10 -0400 (Fri, 11 Jul 2008)
New Revision: 1584
Modified:
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java
Log:
Initialize FlowObject
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java 2008-07-11 13:11:03 UTC (rev 1583)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java 2008-07-11 13:11:10 UTC (rev 1584)
@@ -38,7 +38,6 @@
{
EndEventImpl(Process proc, Node oldNode)
{
- setProcess(proc);
setImplObject(oldNode);
}
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java 2008-07-11 13:11:03 UTC (rev 1583)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java 2008-07-11 13:11:10 UTC (rev 1584)
@@ -90,11 +90,6 @@
delegate = (Task)obj;
}
flowObject = new TaskImpl(apiProc, oldNode, delegate);
- if (delegate != null)
- {
- delegate.setProcess(apiProc);
- delegate.setName(oldNode.getName());
- }
}
else
{
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java 2008-07-11 13:11:03 UTC (rev 1583)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java 2008-07-11 13:11:10 UTC (rev 1584)
@@ -44,7 +44,6 @@
StartEventImpl(Process proc, Node oldNode)
{
- setProcess(proc);
setImplObject(oldNode);
}
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java 2008-07-11 13:11:03 UTC (rev 1583)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java 2008-07-11 13:11:10 UTC (rev 1584)
@@ -41,11 +41,20 @@
TaskImpl(Process proc, Node oldNode, Task task)
{
- setProcess(proc);
setImplObject(oldNode);
this.delegate = task;
}
+ protected void initialize(Process proc)
+ {
+ super.initialize(proc);
+ if (delegate != null)
+ {
+ delegate.setProcess(proc);
+ delegate.setName(getName());
+ }
+ }
+
public String getName()
{
GraphElement oldEl = (GraphElement)getImplObject();
15 years, 10 months
JBoss JBPM SVN: r1583 - in api/trunk: modules/api and 3 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-11 09:11:03 -0400 (Fri, 11 Jul 2008)
New Revision: 1583
Modified:
api/trunk/docs/VioletUML/APIModel.class.violet
api/trunk/docs/VioletUML/APIModel.png
api/trunk/modules/api/pom.xml
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractItermediateEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleInFlowSupport.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleInFlowSupport.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java
Log:
Initialize FlowObject
Modified: api/trunk/docs/VioletUML/APIModel.class.violet
===================================================================
--- api/trunk/docs/VioletUML/APIModel.class.violet 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/docs/VioletUML/APIModel.class.violet 2008-07-11 13:11:03 UTC (rev 1583)
@@ -89,6 +89,11 @@
</void>
<void method="addNode">
<object id="ClassNode5" class="com.horstmann.violet.ClassNode">
+ <void property="attributes">
+ <void property="text">
+ <string>outFlow</string>
+ </void>
+ </void>
<void property="name">
<void property="text">
<string>StartEvent</string>
@@ -97,8 +102,8 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>33.0</double>
- <double>209.0</double>
+ <double>32.0</double>
+ <double>224.0</double>
</void>
</object>
</void>
@@ -106,7 +111,9 @@
<object id="ClassNode6" class="com.horstmann.violet.ClassNode">
<void property="attributes">
<void property="text">
- <string>name</string>
+ <string>name
+inFlows
+outFlows</string>
</void>
</void>
<void property="name">
@@ -117,8 +124,8 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>9.0</double>
- <double>134.0</double>
+ <double>12.0</double>
+ <double>101.0</double>
</void>
</object>
</void>
@@ -126,7 +133,8 @@
<object id="ClassNode7" class="com.horstmann.violet.ClassNode">
<void property="attributes">
<void property="text">
- <string>name</string>
+ <string>name
+inFlow</string>
</void>
</void>
<void property="name">
@@ -137,8 +145,8 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>27.0</double>
- <double>302.0</double>
+ <double>26.0</double>
+ <double>317.0</double>
</void>
</object>
</void>
@@ -166,7 +174,9 @@
<object id="ClassNode9" class="com.horstmann.violet.ClassNode">
<void property="attributes">
<void property="text">
- <string>name</string>
+ <string>name
+inFlows
+outFlows</string>
</void>
</void>
<void property="name">
@@ -187,7 +197,9 @@
<object id="ClassNode10" class="com.horstmann.violet.ClassNode">
<void property="attributes">
<void property="text">
- <string>parent</string>
+ <string>parent
+inFlow
+outFlow</string>
</void>
</void>
<void property="name">
@@ -199,13 +211,19 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>269.0</double>
- <double>342.0</double>
+ <double>271.0</double>
+ <double>356.0</double>
</void>
</object>
</void>
<void method="addNode">
<object id="ClassNode11" class="com.horstmann.violet.ClassNode">
+ <void property="attributes">
+ <void property="text">
+ <string>inFlow
+outFlow</string>
+ </void>
+ </void>
<void property="name">
<void property="text">
<string>Task</string>
@@ -309,8 +327,8 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>28.0</double>
- <double>396.0</double>
+ <double>25.0</double>
+ <double>421.0</double>
</void>
</object>
</void>
@@ -324,8 +342,8 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>29.0</double>
- <double>490.0</double>
+ <double>33.0</double>
+ <double>495.0</double>
</void>
</object>
</void>
Modified: api/trunk/docs/VioletUML/APIModel.png
===================================================================
(Binary files differ)
Modified: api/trunk/modules/api/pom.xml
===================================================================
--- api/trunk/modules/api/pom.xml 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/pom.xml 2008-07-11 13:11:03 UTC (rev 1583)
@@ -89,6 +89,7 @@
<include>AbstractFlow.java</include>
<include>AbstractFlowObject.java</include>
<include>AbstractGateway.java</include>
+ <include>AbstractItermediateEvent.java</include>
<include>AbstractProcess.java</include>
<include>AbstractStartEvent.java</include>
<include>AbstractSubProcess.java</include>
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -23,6 +23,7 @@
//$Id$
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
/**
@@ -34,4 +35,16 @@
@XmlType(name = "AbstractFlowObject")
abstract class AbstractFlowObject
{
+ @XmlTransient
+ private Process process;
+
+ public Process getProcess()
+ {
+ return process;
+ }
+
+ public void setProcess(Process process)
+ {
+ this.process = process;
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractItermediateEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractItermediateEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractItermediateEvent.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -43,7 +43,7 @@
* @since 08-Jul-2008
*/
@XmlType(name="AbstractItermediateEvent")
-abstract class AbstractItermediateEvent extends Event implements MultipleOutFlowSupport, MultipleInFlowSupport
+abstract class AbstractItermediateEvent extends Event implements MultipleOutFlowSupport, MultipleInFlowSupport, NamedFlowObject
{
private String name;
@@ -51,6 +51,7 @@
@XmlElement(name = "sequence", type = SequenceFlow.class),
@XmlElement(name = "message", type = MessageFlow.class)
})
+
protected List<Flow> outFlows = new ArrayList<Flow>();
/**
* Construct an anonymous StartEvent.
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -40,9 +40,10 @@
* @since 08-Jul-2008
*/
@XmlType(name="EndEvent")
-public class EndEvent extends AbstractEndEvent implements NamedFlowObject
+public class EndEvent extends AbstractEndEvent implements NamedFlowObject, SingleInFlowSupport
{
private Result result;
+ private Flow inFlow;
/**
* Construct an anonymous StartEvent.
@@ -61,6 +62,23 @@
super(name);
}
+ /**
+ * Get the out flow
+ */
+ public Flow getInFlow()
+ {
+ return inFlow;
+ }
+
+ /**
+ * Set the in flow
+ */
+ @XmlTransient
+ public void setInFlow(Flow inFlow)
+ {
+ this.inFlow = inFlow;
+ }
+
/**
* Get the result
*/
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -42,6 +42,7 @@
public abstract class Flow extends AbstractFlow
{
private FlowObject source;
+ private FlowObject target;
/**
* Construct a flow with no target
@@ -77,4 +78,22 @@
{
this.source = source;
}
+
+ /**
+ * Get the target flow object
+ */
+ public FlowObject getTarget()
+ {
+ return target;
+ }
+
+ /**
+ * Set the target flow object
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlTransient
+ public void setTarget(FlowObject target)
+ {
+ this.target = target;
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
+import org.jboss.bpm.InvalidProcessException;
import org.jboss.bpm.client.SignalManager;
import org.jboss.bpm.runtime.Token;
@@ -39,8 +40,6 @@
public abstract class FlowObject extends AbstractFlowObject
{
@XmlTransient
- private Process process;
- @XmlTransient
private Object implObject;
/**
@@ -51,12 +50,84 @@
{
}
+ /**
+ * Initialize the flow object
+ */
+ protected void initialize(Process proc)
+ {
+ setProcess(proc);
+
+ Flow outFlow = null;
+ if (this instanceof SingleOutFlowSupport)
+ {
+ SingleOutFlowSupport sof = (SingleOutFlowSupport)this;
+ outFlow = sof.getOutFlow();
+ initFlow(proc, outFlow);
+ }
+ else if (this instanceof MultipleOutFlowSupport)
+ {
+ MultipleOutFlowSupport mof = (MultipleOutFlowSupport)this;
+ for (Flow flow : mof.getOutFlows())
+ {
+ outFlow = flow;
+ initFlow(proc, flow);
+ }
+ }
+
+ Flow inFlow = null;
+ if (this instanceof SingleInFlowSupport)
+ {
+ SingleInFlowSupport sif = (SingleInFlowSupport)this;
+ inFlow = sif.getInFlow();
+ }
+ else if (this instanceof MultipleInFlowSupport)
+ {
+ MultipleInFlowSupport mif = (MultipleInFlowSupport)this;
+ for (Flow flow : mif.getInFlows())
+ {
+ inFlow = flow;
+ }
+ }
+
+ //if (inFlow == null && outFlow == null)
+ // throw new InvalidProcessException("Unconnected flow object: " + this);
+ }
+
+ private void initFlow(Process proc, Flow flow)
+ {
+ if (flow != null)
+ {
+ String name = flow.getTargetName();
+ FlowObject target = proc.findFlowObject(name);
+ if (target == null)
+ throw new InvalidProcessException("Cannot find target for out flow: " + name);
+
+ if (target instanceof SingleInFlowSupport)
+ {
+ SingleInFlowSupport sif = (SingleInFlowSupport)target;
+ sif.setInFlow(flow);
+ }
+ else if (target instanceof MultipleInFlowSupport)
+ {
+ MultipleInFlowSupport mif = (MultipleInFlowSupport)target;
+ mif.addInFlow(flow);
+ }
+ else
+ {
+ throw new InvalidProcessException("Target does not support in flow: " + target);
+ }
+
+ flow.setSource(this);
+ flow.setTarget(target);
+ }
+ }
+
/**
* Get the associated Process
*/
public Process getProcess()
{
- return process;
+ return super.getProcess();
}
/**
@@ -72,20 +143,6 @@
public abstract Signal getExitSignal();
/**
- * Set the associated process
- * Note, this MUST NOT leak into the public API.
- */
- @XmlTransient
- // TODO
- public void setProcess(Process process)
- {
- if (this.process != null && this.process != process)
- throw new IllegalStateException("Cannot reassign task to process");
-
- this.process = process;
- }
-
- /**
* Set the associated implementation object
* Note, this MUST NOT leak into the public API.
*/
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -78,4 +78,9 @@
{
this.inFlows.add(inFlow);
}
+
+ public String toString()
+ {
+ return "ItermediateEvent[" + getName() + "]";
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleInFlowSupport.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleInFlowSupport.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleInFlowSupport.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -35,5 +35,5 @@
/**
* Add an out flow
*/
- void addOutFlow(Flow flow);
+ void addInFlow(Flow flow);
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -21,7 +21,7 @@
*/
package org.jboss.bpm.model;
-//$Id$
+//$Id: Process.java 1581 2008-07-10 19:41:52Z thomas.diesler(a)jboss.com $
import java.util.ArrayList;
import java.util.Collections;
@@ -97,9 +97,8 @@
if (flowObject instanceof NamedFlowObject)
{
NamedFlowObject nfo = (NamedFlowObject)flowObject;
- String name = nfo.getName();
- if (name != null && findFlowObject(name) != null)
- throw new NameNotUniqueException("NamedFlowObject: " + name);
+ if (findFlowObject(nfo.getName()) != null)
+ throw new NameNotUniqueException("NamedFlowObject: " + nfo.getName());
}
flowObjects.add(flowObject);
@@ -171,18 +170,22 @@
*
* @return null if not found
*/
- public NamedFlowObject findFlowObject(String name)
+ public FlowObject findFlowObject(String name)
{
if (name == null)
throw new IllegalArgumentException("Cannot find flow object with name: null");
- NamedFlowObject nfo = null;
+ FlowObject nfo = null;
for (FlowObject aux : flowObjects)
{
- if (aux instanceof NamedFlowObject && name.equals(((NamedFlowObject)aux).getName()))
+ if (aux instanceof NamedFlowObject)
{
- nfo = (NamedFlowObject)aux;
- break;
+ NamedFlowObject auxnfo = (NamedFlowObject)aux;
+ if (auxnfo.getName().equals(name))
+ {
+ nfo = aux;
+ break;
+ }
}
}
return nfo;
@@ -230,7 +233,7 @@
// Set the associated process
for (FlowObject aux : flowObjects)
- aux.setProcess(this);
+ aux.initialize(this);
processState = ProcessState.INITIALIZED;
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleInFlowSupport.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleInFlowSupport.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleInFlowSupport.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -33,5 +33,5 @@
/**
* Set the in flow
*/
- void setOutFlow(Flow flow);
+ void setInFlow(Flow flow);
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -35,7 +35,7 @@
* @since 08-Jul-2008
*/
@XmlType(name = "StartEvent")
-public class StartEvent extends AbstractStartEvent implements SingleOutFlowSupport
+public class StartEvent extends AbstractStartEvent
{
/**
* Construct a StartEvent with a constant name: 'start'
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -33,10 +33,9 @@
* @since 08-Jul-2008
*/
@XmlType(name="SubProcess")
-public class SubProcess extends AbstractSubProcess
+public class SubProcess extends AbstractSubProcess implements SingleInFlowSupport
{
- @XmlTransient
- private Process parentProcess;
+ private Flow inFlow;
/**
* Construct an anonymous process
@@ -55,9 +54,25 @@
super(name);
}
- /** Get the parent process */
- public Process getParentProcess()
+ /**
+ * Get the out flow
+ */
+ public Flow getInFlow()
{
- return parentProcess;
+ return inFlow;
}
+
+ /**
+ * Set the in flow
+ */
+ @XmlTransient
+ public void setInFlow(Flow inFlow)
+ {
+ this.inFlow = inFlow;
+ }
+
+ public String toString()
+ {
+ return "SubProcess[" + getName() + "]";
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -21,6 +21,7 @@
*/
package org.jboss.bpm.model;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
//$Id$
@@ -35,8 +36,10 @@
* @since 08-Jul-2008
*/
@XmlType(name = "Task")
-public class Task extends AbstractTask implements SingleOutFlowSupport
+public class Task extends AbstractTask implements SingleInFlowSupport
{
+ private Flow inFlow;
+
/**
* Construct an anonymous Task
* Note, this MUST NOT leak into the public API.
@@ -54,6 +57,23 @@
super(name);
}
+ /**
+ * Get the out flow
+ */
+ public Flow getInFlow()
+ {
+ return inFlow;
+ }
+
+ /**
+ * Set the in flow
+ */
+ @XmlTransient
+ public void setInFlow(Flow inFlow)
+ {
+ this.inFlow = inFlow;
+ }
+
/** Get signal for enter */
public Signal getEnterSignal()
{
Modified: api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
===================================================================
--- api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -41,7 +41,7 @@
{
public void testProcess() throws Exception
{
- Process inProc = new ProcessBuilder("myproc").addStartEvent().addSequenceFlow("task").addTask("taskA").
+ Process inProc = new ProcessBuilder("myproc").addStartEvent().addSequenceFlow("task").addTask("task").
addSequenceFlow("split").addParallelGateway("split").addSequenceFlow("subproc").addSequenceFlow("event").
addSubProcess("subproc").addSequenceFlow("join").addItermediateEvent("event").addSequenceFlow("join").
addParallelGateway("join").addSequenceFlow("end").addEndEvent("end").getProcess();
@@ -56,16 +56,87 @@
ProcessUnmarshaller unmarshaller = new ProcessUnmarshaller();
Process outProc = unmarshaller.unmarshallProcess(new StringReader(xml));
StartEvent start = outProc.getStartEvent();
- Task taskA = (Task)outProc.findFlowObject("taskA");
- EndEvent end = outProc.getEndEvents().get(0);
+ Task task = (Task)outProc.findFlowObject("task");
+ ParallelGateway split = (ParallelGateway)outProc.findFlowObject("split");
+ ParallelGateway join = (ParallelGateway)outProc.findFlowObject("join");
+ ItermediateEvent event = (ItermediateEvent)outProc.findFlowObject("event");
+ SubProcess subproc = (SubProcess)outProc.findFlowObject("subproc");
+ EndEvent end = (EndEvent)outProc.findFlowObject("end");
+
+ assertEquals(inProc.getName(), outProc.getName());
+ assertEquals(1, outProc.getEndEvents().size());
- assertEquals(inProc.getName(), outProc.getName());
assertNotNull(start);
+ assertNotNull(task);
+ assertNotNull(event);
+ assertNotNull(join);
+ assertNotNull(split);
+ assertNotNull(subproc);
+ assertNotNull(end);
+
assertEquals(outProc, start.getProcess());
- assertNotNull(taskA);
- assertEquals(outProc, taskA.getProcess());
- assertEquals(1, outProc.getEndEvents().size());
- assertNotNull(end);
+ assertEquals(outProc, task.getProcess());
+ assertEquals(outProc, event.getProcess());
+ assertEquals(outProc, join.getProcess());
+ assertEquals(outProc, split.getProcess());
+ assertEquals(outProc, subproc.getProcess());
assertEquals(outProc, end.getProcess());
+
+ Flow of1 = start.getOutFlow();
+ Flow of2 = task.getOutFlow();
+ Flow of3 = split.getOutFlows().get(0);
+ Flow of4 = split.getOutFlows().get(1);
+ Flow of5 = subproc.getOutFlow();
+ Flow of6 = event.getOutFlows().get(0);
+ Flow of7 = join.getOutFlows().get(0);
+
+ assertNotNull(of1);
+ assertNotNull(of2);
+ assertNotNull(of3);
+ assertNotNull(of4);
+ assertNotNull(of5);
+ assertNotNull(of6);
+ assertNotNull(of7);
+
+ assertEquals(2, split.getOutFlows().size());
+ assertEquals(1, event.getOutFlows().size());
+ assertEquals(1, join.getOutFlows().size());
+
+ Flow if1 = task.getInFlow();
+ Flow if2 = split.getInFlows().get(0);
+ Flow if3 = subproc.getInFlow();
+ Flow if4 = event.getInFlows().get(0);
+ Flow if5 = join.getInFlows().get(0);
+ Flow if6 = join.getInFlows().get(1);
+ Flow if7 = end.getInFlow();
+
+ assertEquals(of1, if1);
+ assertEquals(of2, if2);
+ assertEquals(of3, if3);
+ assertEquals(of4, if4);
+ assertEquals(of5, if5);
+ assertEquals(of6, if6);
+ assertEquals(of7, if7);
+
+ assertEquals(start, of1.getSource());
+ assertEquals(task, of1.getTarget());
+
+ assertEquals(task, of2.getSource());
+ assertEquals(split, of2.getTarget());
+
+ assertEquals(split, of3.getSource());
+ assertEquals(subproc, of3.getTarget());
+
+ assertEquals(split, of4.getSource());
+ assertEquals(event, of4.getTarget());
+
+ assertEquals(subproc, of5.getSource());
+ assertEquals(join, of5.getTarget());
+
+ assertEquals(event, of6.getSource());
+ assertEquals(join, of6.getTarget());
+
+ assertEquals(join, of7.getSource());
+ assertEquals(end, of7.getTarget());
}
}
Modified: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java 2008-07-11 11:23:42 UTC (rev 1582)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java 2008-07-11 13:11:03 UTC (rev 1583)
@@ -52,7 +52,7 @@
StartEvent start = proc.getStartEvent();
assertNotNull("Start expected", start);
- NamedFlowObject nfo = proc.findFlowObject("stateA");
+ FlowObject nfo = proc.findFlowObject("stateA");
assertNotNull("FlowObject expected", nfo);
assertTrue("Task expected", nfo instanceof Task);
15 years, 10 months
JBoss JBPM SVN: r1582 - in api/trunk: docs/VioletUML and 5 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-11 07:23:42 -0400 (Fri, 11 Jul 2008)
New Revision: 1582
Added:
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractActivity.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEndEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlow.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractGateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractItermediateEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractProcess.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractStartEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractSubProcess.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractTask.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ObjectFactory.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
Removed:
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
api/trunk/modules/api/src/main/resources/org/
Modified:
api/trunk/.project
api/trunk/docs/VioletUML/APIModel.class.violet
api/trunk/docs/VioletUML/APIModel.png
api/trunk/modules/api/pom.xml
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ComplexGateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ExclusiveGateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/InclusiveGateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageFlow.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ParallelGateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Signal.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/package-info.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessMarshaller.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java
api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
Log:
Seperate behaviour from jaxb
Modified: api/trunk/.project
===================================================================
--- api/trunk/.project 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/.project 2008-07-11 11:23:42 UTC (rev 1582)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>jbpm-api-root</name>
+ <name>jbpm-api</name>
<comment></comment>
<projects>
</projects>
Modified: api/trunk/docs/VioletUML/APIModel.class.violet
===================================================================
--- api/trunk/docs/VioletUML/APIModel.class.violet 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/docs/VioletUML/APIModel.class.violet 2008-07-11 11:23:42 UTC (rev 1582)
@@ -67,8 +67,8 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>211.0</double>
- <double>354.0</double>
+ <double>267.0</double>
+ <double>251.0</double>
</void>
</object>
</void>
@@ -104,6 +104,11 @@
</void>
<void method="addNode">
<object id="ClassNode6" class="com.horstmann.violet.ClassNode">
+ <void property="attributes">
+ <void property="text">
+ <string>name</string>
+ </void>
+ </void>
<void property="name">
<void property="text">
<string>IntermediateEvent</string>
@@ -119,6 +124,11 @@
</void>
<void method="addNode">
<object id="ClassNode7" class="com.horstmann.violet.ClassNode">
+ <void property="attributes">
+ <void property="text">
+ <string>name</string>
+ </void>
+ </void>
<void property="name">
<void property="text">
<string>EndEvent</string>
@@ -134,6 +144,11 @@
</void>
<void method="addNode">
<object id="ClassNode8" class="com.horstmann.violet.ClassNode">
+ <void property="attributes">
+ <void property="text">
+ <string>name</string>
+ </void>
+ </void>
<void property="name">
<void property="text">
<string>Activity</string>
@@ -142,13 +157,18 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>349.0</double>
- <double>240.0</double>
+ <double>350.0</double>
+ <double>130.0</double>
</void>
</object>
</void>
<void method="addNode">
<object id="ClassNode9" class="com.horstmann.violet.ClassNode">
+ <void property="attributes">
+ <void property="text">
+ <string>name</string>
+ </void>
+ </void>
<void property="name">
<void property="text">
<string>Gateway
@@ -179,8 +199,8 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>205.0</double>
- <double>445.0</double>
+ <double>269.0</double>
+ <double>342.0</double>
</void>
</object>
</void>
@@ -194,8 +214,8 @@
</object>
<object class="java.awt.geom.Point2D$Double">
<void method="setLocation">
- <double>436.0</double>
- <double>353.0</double>
+ <double>423.0</double>
+ <double>249.0</double>
</void>
</object>
</void>
@@ -281,29 +301,8 @@
</void>
<void method="addNode">
<object id="ClassNode17" class="com.horstmann.violet.ClassNode">
- <void property="attributes">
- <void property="text">
- <string>name</string>
- </void>
- </void>
<void property="name">
<void property="text">
- <string>NamedFlowObject
-</string>
- </void>
- </void>
- </object>
- <object class="java.awt.geom.Point2D$Double">
- <void method="setLocation">
- <double>327.0</double>
- <double>127.0</double>
- </void>
- </object>
- </void>
- <void method="addNode">
- <object id="ClassNode18" class="com.horstmann.violet.ClassNode">
- <void property="name">
- <void property="text">
<string>Result</string>
</void>
</void>
@@ -316,7 +315,7 @@
</object>
</void>
<void method="addNode">
- <object id="ClassNode19" class="com.horstmann.violet.ClassNode">
+ <object id="ClassNode18" class="com.horstmann.violet.ClassNode">
<void property="name">
<void property="text">
<string>Attachments</string>
@@ -501,26 +500,26 @@
<void method="connect">
<object class="com.horstmann.violet.ClassRelationshipEdge">
<void property="bentStyle">
- <object class="com.horstmann.violet.BentStyle" field="VHV"/>
+ <object class="com.horstmann.violet.BentStyle" field="HVH"/>
</void>
<void property="endArrowHead">
- <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/>
+ <object class="com.horstmann.violet.ArrowHead" field="V"/>
</void>
</object>
+ <object idref="ClassNode7"/>
<object idref="ClassNode17"/>
- <object idref="ClassNode2"/>
</void>
<void method="connect">
<object class="com.horstmann.violet.ClassRelationshipEdge">
<void property="bentStyle">
- <object class="com.horstmann.violet.BentStyle" field="VHV"/>
+ <object class="com.horstmann.violet.BentStyle" field="HVH"/>
</void>
<void property="endArrowHead">
- <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/>
+ <object class="com.horstmann.violet.ArrowHead" field="V"/>
</void>
</object>
- <object idref="ClassNode8"/>
- <object idref="ClassNode17"/>
+ <object idref="ClassNode2"/>
+ <object idref="ClassNode12"/>
</void>
<void method="connect">
<object class="com.horstmann.violet.ClassRelationshipEdge">
@@ -531,32 +530,20 @@
<object class="com.horstmann.violet.ArrowHead" field="V"/>
</void>
</object>
- <object idref="ClassNode7"/>
+ <object idref="ClassNode17"/>
<object idref="ClassNode18"/>
</void>
<void method="connect">
<object class="com.horstmann.violet.ClassRelationshipEdge">
<void property="bentStyle">
- <object class="com.horstmann.violet.BentStyle" field="HVH"/>
+ <object class="com.horstmann.violet.BentStyle" field="VHV"/>
</void>
<void property="endArrowHead">
- <object class="com.horstmann.violet.ArrowHead" field="V"/>
+ <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/>
</void>
</object>
+ <object idref="ClassNode8"/>
<object idref="ClassNode2"/>
- <object idref="ClassNode12"/>
</void>
- <void method="connect">
- <object class="com.horstmann.violet.ClassRelationshipEdge">
- <void property="bentStyle">
- <object class="com.horstmann.violet.BentStyle" field="HVH"/>
- </void>
- <void property="endArrowHead">
- <object class="com.horstmann.violet.ArrowHead" field="V"/>
- </void>
- </object>
- <object idref="ClassNode18"/>
- <object idref="ClassNode19"/>
- </void>
</object>
</java>
Modified: api/trunk/docs/VioletUML/APIModel.png
===================================================================
(Binary files differ)
Modified: api/trunk/modules/api/pom.xml
===================================================================
--- api/trunk/modules/api/pom.xml 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/pom.xml 2008-07-11 11:23:42 UTC (rev 1582)
@@ -61,7 +61,15 @@
<build>
<plugins>
<plugin>
- <!-- mvn jaxb-schemagen:generate -->
+ <!--
+ ~/.m2/settings.xml
+
+ <pluginGroups>
+ <pluginGroup>com.sun.tools.jxc.maven2</pluginGroup>
+ </pluginGroups>
+
+ mvn jaxb-schemagen:generate
+ -->
<groupId>com.sun.tools.jxc.maven2</groupId>
<artifactId>maven-jaxb-schemagen-plugin</artifactId>
<configuration>
@@ -69,12 +77,23 @@
<destdir>target/schema</destdir>
<schemas>
<schema>
- <namespace>http://org.jboss.bpm.api</namespace>
- <file>jbpm-api.xsd</file>
+ <namespace>urn:api.bpm.jboss:jpdl-0.1</namespace>
+ <file>jbpm-api-0.1.xsd</file>
</schema>
</schemas>
<includes>
<include>package-info.java</include>
+ <include>AbstractActivity.java</include>
+ <include>AbstractEndEvent.java</include>
+ <include>AbstractEvent.java</include>
+ <include>AbstractFlow.java</include>
+ <include>AbstractFlowObject.java</include>
+ <include>AbstractGateway.java</include>
+ <include>AbstractProcess.java</include>
+ <include>AbstractStartEvent.java</include>
+ <include>AbstractSubProcess.java</include>
+ <include>AbstractTask.java</include>
+
<include>Activity.java</include>
<include>ComplexGateway.java</include>
<include>EndEvent.java</include>
@@ -97,16 +116,6 @@
<verbose>false</verbose>
</configuration>
</plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <configuration>
- <tasks>
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="java.home" value="${java.home}" />
- <ant antfile="scripts/antrun-schemagen.xml" target="schemagen" />
- </tasks>
- </configuration>
- </plugin>
</plugins>
</build>
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractActivity.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractActivity.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractActivity.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,77 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * 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(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name="AbstractActivity")
+abstract class AbstractActivity extends FlowObject implements NamedFlowObject
+{
+ protected String name;
+
+ /**
+ * Construct an anonymous Activity
+ */
+ public AbstractActivity()
+ {
+ }
+
+ /**
+ * Construct a Activity with a given name
+ */
+ public AbstractActivity(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the name.
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlAttribute(required = true)
+ public void setName(String name)
+ {
+ if (this.name != null)
+ throw new IllegalStateException("Cannot rename: " + name);
+
+ this.name = name;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEndEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEndEvent.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEndEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,75 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+// $Id$
+
+/**
+ * As the name implies, the End Event indicates where a Process will end.
+ *
+ * In terms of Sequence Flow, the End Event ends the flow of the Process, and thus, will not have any outgoing Sequence Flow. An End Event can have a specific Result
+ * that will appear as a marker within the center of the End Event shape. End Event Results are Message, Error, Compensation, Link, and Multiple.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name = "AbstractEndEvent")
+abstract class AbstractEndEvent extends Event
+{
+ private String name;
+
+ public AbstractEndEvent()
+ {
+ }
+
+ /**
+ * Construct a Activity with a given name
+ */
+ public AbstractEndEvent(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the name.
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlAttribute(required = true)
+ protected void setName(String name)
+ {
+ if (this.name != null)
+ throw new IllegalStateException("Cannot rename: " + name);
+
+ this.name = name;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEndEvent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEvent.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,40 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlType;
+
+
+
+// $Id$
+
+/**
+ * An Event is something that “happens” during the course of a business process.
+ * These Events affect the flow of the Process and usually have a cause or an impact.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name="AbstractEvent")
+abstract class AbstractEvent extends FlowObject
+{
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractEvent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlow.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlow.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlow.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,97 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+
+// $Id$
+
+/**
+ * A Flow is a graphical line connecting two objects in a BPD.
+ *
+ * There are two types of Flow: Sequence Flow and Message Flow, each with their own line style.
+ * Flow is also used in a generic sense (and lowercase) to describe how Tokens will traverse
+ * Sequence Flow from the Start Event to an End Event.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name="AbstractFlow")
+abstract class AbstractFlow
+{
+ private String name;
+ private String targetName;
+
+ /**
+ * Construct a flow with no target
+ */
+ public AbstractFlow()
+ {
+ }
+
+ /**
+ * Construct a flow with a given target
+ */
+ public AbstractFlow(String targetName)
+ {
+ this.targetName = targetName;
+ }
+
+ /**
+ * Get the optional name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the optional name
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlAttribute(required = false)
+ protected void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the target name
+ */
+ public String getTargetName()
+ {
+ return targetName;
+ }
+
+ /**
+ * Set the target name
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlAttribute(required = true)
+ protected void setTargetName(String targetName)
+ {
+ this.targetName = targetName;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlow.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -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$
+
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * A Flow Object is one of the set of following graphical objects: Event, Activity, and Gateway.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name = "AbstractFlowObject")
+abstract class AbstractFlowObject
+{
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractFlowObject.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractGateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractGateway.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractGateway.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,97 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * Gateways are modelling elements that are used to control how Sequence Flow interact as they converge and diverge within a Process. If the flow does not need to be
+ * controlled, then a Gateway is not needed.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name = "AbstractGateway")
+abstract class AbstractGateway extends FlowObject implements NamedFlowObject, MultipleOutFlowSupport, MultipleInFlowSupport
+{
+ private String name;
+
+ @XmlElements( {
+ @XmlElement(name = "sequence", type = SequenceFlow.class),
+ @XmlElement(name = "message", type = MessageFlow.class)
+ })
+ protected List<Flow> outFlows = new ArrayList<Flow>();
+
+ /**
+ * Construct an anonymous Gateway
+ */
+ public AbstractGateway()
+ {
+ }
+
+ /**
+ * Construct a Activity with a given name
+ */
+ public AbstractGateway(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the name.
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlAttribute(required = true)
+ protected void setName(String name)
+ {
+ if (this.name != null)
+ throw new IllegalStateException("Cannot rename: " + name);
+
+ this.name = name;
+ }
+
+ public List<Flow> getOutFlows()
+ {
+ return outFlows;
+ }
+
+ protected void setOutFlow(List<Flow> outFlow)
+ {
+ this.outFlows = outFlow;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractGateway.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractItermediateEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractItermediateEvent.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractItermediateEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,101 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlType;
+
+
+// $Id$
+
+/**
+ * An Intermediate Event is an Event that occurs after a Process has been started.
+ *
+ * It will affect the Flow of the Process, but will not start or (directly) terminate the Process.
+ * An Intermediate Event will show where messages or delays are expected within the Process,
+ * disrupt the Normal Flow through exception handling, or show the extra flow required for compensating a transaction.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name="AbstractItermediateEvent")
+abstract class AbstractItermediateEvent extends Event implements MultipleOutFlowSupport, MultipleInFlowSupport
+{
+ private String name;
+
+ @XmlElements( {
+ @XmlElement(name = "sequence", type = SequenceFlow.class),
+ @XmlElement(name = "message", type = MessageFlow.class)
+ })
+ protected List<Flow> outFlows = new ArrayList<Flow>();
+ /**
+ * Construct an anonymous StartEvent.
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected AbstractItermediateEvent()
+ {
+ }
+
+ /**
+ * Construct a Activity with a given name
+ */
+ public AbstractItermediateEvent(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the name.
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlAttribute(required = true)
+ protected void setName(String name)
+ {
+ if (this.name != null)
+ throw new IllegalStateException("Cannot rename: " + name);
+
+ this.name = name;
+ }
+
+ public List<Flow> getOutFlows()
+ {
+ return outFlows;
+ }
+
+ protected void setOutFlow(List<Flow> outFlow)
+ {
+ this.outFlows = outFlow;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractItermediateEvent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractProcess.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractProcess.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractProcess.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,78 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * A Process is any Activity performed within a company or organization.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name = "AbstractProcess")
+abstract class AbstractProcess extends Activity
+{
+ @XmlElements( {
+ @XmlElement(name = "start", type = StartEvent.class),
+ @XmlElement(name = "event", type = ItermediateEvent.class),
+ @XmlElement(name = "task", type = Task.class),
+ @XmlElement(name = "exclusive-gateway", type = ExclusiveGateway.class),
+ @XmlElement(name = "inclusive-gateway", type = InclusiveGateway.class),
+ @XmlElement(name = "complex-gateway", type = ComplexGateway.class),
+ @XmlElement(name = "parallel-gateway", type = ParallelGateway.class),
+ @XmlElement(name = "sub-process", type = SubProcess.class),
+ @XmlElement(name = "end", type = EndEvent.class)
+ })
+ protected List<FlowObject> flowObjects = new ArrayList<FlowObject>();
+
+ /**
+ * Construct an anonymous process
+ */
+ public AbstractProcess()
+ {
+ }
+
+ /**
+ * Construct a process with a given name
+ */
+ public AbstractProcess(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Get the list of flow objects
+ */
+ public List<FlowObject> getFlowObjects()
+ {
+ return flowObjects;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractProcess.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractStartEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractStartEvent.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractStartEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,77 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * A Start Event indicates where a particular Process will start.
+ *
+ * In terms of Sequence Flow, the Start Event starts the Flow of the Process, and thus, will not have any incoming Sequence Flow.
+ * A Start Event can have a Trigger that indicates how the Process starts: Message, Timer, Rule, Link, or Multiple.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name="AbstractStartEvent")
+abstract class AbstractStartEvent extends Event implements SingleOutFlowSupport
+{
+ @XmlElements( {
+ @XmlElement(name = "sequence", type = SequenceFlow.class),
+ @XmlElement(name = "message", type = MessageFlow.class)
+ })
+ protected Flow outFlow;
+
+ /**
+ * Construct an anonymous StartEvent.
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected AbstractStartEvent()
+ {
+ }
+
+ /**
+ * Get the out flow
+ */
+ public Flow getOutFlow()
+ {
+ return outFlow;
+ }
+
+ /**
+ * Set the out flow
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlTransient
+ public void setOutFlow(Flow outFlow)
+ {
+ if (this.outFlow != null)
+ throw new IllegalStateException("Cannot reassign out flow");
+ this.outFlow = outFlow;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractStartEvent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractSubProcess.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractSubProcess.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractSubProcess.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,79 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * A Sub-Process is Process that is included within another Process.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name="AbstractSubProcess")
+abstract class AbstractSubProcess extends Process implements SingleOutFlowSupport
+{
+ @XmlElements( {
+ @XmlElement(name = "sequence", type = SequenceFlow.class),
+ @XmlElement(name = "message", type = MessageFlow.class)
+ })
+ protected Flow outFlow;
+
+ /**
+ * Construct an anonymous process
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected AbstractSubProcess()
+ {
+ }
+
+ /**
+ * Construct a process with a given name
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected AbstractSubProcess(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Get the out flow
+ */
+ public Flow getOutFlow()
+ {
+ return outFlow;
+ }
+
+ /**
+ * Set the out flow Note, this MUST NOT leak into the public API.
+ */
+ @XmlTransient
+ public void setOutFlow(Flow outFlow)
+ {
+ this.outFlow = outFlow;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractSubProcess.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractTask.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractTask.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractTask.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,80 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+//$Id$
+
+/**
+ * A Task is an Atomic Activity that is included within a Process.
+ *
+ * A Task is used when the work in the Process is not broken down to a finer level of Process Model detail. Generally, an end-user and/or an application are used to
+ * perform the Task when it is executed.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name = "AbstractTask")
+abstract class AbstractTask extends Activity implements SingleOutFlowSupport
+{
+ @XmlElements( {
+ @XmlElement(name = "sequence", type = SequenceFlow.class),
+ @XmlElement(name = "message", type = MessageFlow.class)
+ })
+ protected Flow outFlow;
+
+ /**
+ * Construct an anonymous Task
+ */
+ public AbstractTask()
+ {
+ }
+
+ /**
+ * Construct a Task with a given name
+ */
+ public AbstractTask(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Get the out flow
+ */
+ public Flow getOutFlow()
+ {
+ return outFlow;
+ }
+
+ /**
+ * Set the out flow Note, this MUST NOT leak into the public API.
+ */
+ @XmlTransient
+ public void setOutFlow(Flow outFlow)
+ {
+ this.outFlow = outFlow;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/AbstractTask.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -21,7 +21,6 @@
*/
package org.jboss.bpm.model;
-import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
// $Id$
@@ -35,44 +34,22 @@
* @since 08-Jul-2008
*/
@XmlType(name="Activity")
-public abstract class Activity extends FlowObject implements NamedFlowObject
+public abstract class Activity extends AbstractActivity implements NamedFlowObject
{
- private String name;
-
/**
* Construct an anonymous Activity
+ * Note, this MUST NOT leak into the public API.
*/
- public Activity()
+ protected Activity()
{
}
/**
* Construct a Activity with a given name
+ * Note, this MUST NOT leak into the public API.
*/
public Activity(String name)
{
- this.name = name;
+ super(name);
}
-
- /**
- * Get the name
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Set the name.
- * Note, this MUST NOT leak into the public API.
- */
- // TODO
- @XmlAttribute(required = true)
- public void setName(String name)
- {
- if (this.name != null)
- throw new IllegalStateException("Cannot rename: " + name);
-
- this.name = name;
- }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ComplexGateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ComplexGateway.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ComplexGateway.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -39,4 +39,25 @@
@XmlType(name="ComplexGateway")
public class ComplexGateway extends Gateway
{
+ /**
+ * Construct an anonymous Task
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected ComplexGateway()
+ {
+ }
+
+ /**
+ * Construct a Task with a given name
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected ComplexGateway(String name)
+ {
+ super(name);
+ }
+
+ public String toString()
+ {
+ return "ComplexGateway[" + getName() + "]";
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -21,16 +21,14 @@
*/
package org.jboss.bpm.model;
-import javax.xml.bind.annotation.XmlAttribute;
+//$Id$
+
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.jboss.bpm.runtime.Attachments;
import org.jboss.bpm.runtime.Token;
-
-// $Id$
-
/**
* As the name implies, the End Event indicates where a Process will end.
*
@@ -42,39 +40,25 @@
* @since 08-Jul-2008
*/
@XmlType(name="EndEvent")
-public class EndEvent extends Event implements NamedFlowObject
+public class EndEvent extends AbstractEndEvent implements NamedFlowObject
{
- private String name;
private Result result;
- public EndEvent()
- {
- }
-
- public EndEvent(String name)
- {
- this.name = name;
- }
-
/**
- * Get the name
+ * Construct an anonymous StartEvent.
+ * Note, this MUST NOT leak into the public API.
*/
- public String getName()
+ protected EndEvent()
{
- return name;
}
-
+
/**
- * Set the name.
+ * Construct an anonymous StartEvent.
* Note, this MUST NOT leak into the public API.
*/
- @XmlAttribute(required = true)
- protected void setName(String name)
+ protected EndEvent(String name)
{
- if (this.name != null)
- throw new IllegalStateException("Cannot rename: " + name);
-
- this.name = name;
+ super(name);
}
/**
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -35,8 +35,16 @@
* @since 08-Jul-2008
*/
@XmlType(name="Event")
-public abstract class Event extends FlowObject
+public abstract class Event extends AbstractEvent
{
+ /**
+ * Construct an anonymous StartEvent.
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected Event()
+ {
+ }
+
/**
* Get signal for enter
*/
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ExclusiveGateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ExclusiveGateway.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ExclusiveGateway.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -21,11 +21,11 @@
*/
package org.jboss.bpm.model;
+//$Id$
+
import javax.xml.bind.annotation.XmlType;
-// $Id$
-
/**
* A point in the workflow process where, based on a decision or workflow control data, one of several branches is chosen.
*
@@ -35,4 +35,25 @@
@XmlType(name="ExclusiveGateway")
public class ExclusiveGateway extends Gateway
{
+ /**
+ * Construct an anonymous Task
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected ExclusiveGateway()
+ {
+ }
+
+ /**
+ * Construct a Task with a given name
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected ExclusiveGateway(String name)
+ {
+ super(name);
+ }
+
+ public String toString()
+ {
+ return "ExclusiveGateway[" + getName() + "]";
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -21,7 +21,6 @@
*/
package org.jboss.bpm.model;
-import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -40,25 +39,25 @@
* @since 08-Jul-2008
*/
@XmlType(name="Flow")
-public abstract class Flow
+public abstract class Flow extends AbstractFlow
{
private FlowObject source;
- private String name;
- private String targetName;
/**
- * JAXB Constructer
+ * Construct a flow with no target
+ * Note, this MUST NOT leak into the public API.
*/
- public Flow()
+ protected Flow()
{
}
/**
* Construct a flow with a given target
+ * Note, this MUST NOT leak into the public API.
*/
public Flow(String targetName)
{
- this.targetName = targetName;
+ super(targetName);
}
/**
@@ -78,42 +77,4 @@
{
this.source = source;
}
-
- /**
- * Get the optional name
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Set the optional name
- * Note, this MUST NOT leak into the public API.
- */
- @XmlAttribute(required = false)
- protected void setName(String name)
- {
- this.name = name;
- }
-
- /**
- * Get the target name
- * Note, this MUST NOT leak into the public API.
- */
- public String getTargetName()
- {
- return targetName;
- }
-
- /**
- * Set the target name
- * Note, this MUST NOT leak into the public API.
- */
- @XmlAttribute(required = true)
- protected void setTargetName(String targetName)
- {
- this.targetName = targetName;
- }
-
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -36,13 +36,21 @@
* @since 08-Jul-2008
*/
@XmlType(name="FlowObject")
-public abstract class FlowObject
+public abstract class FlowObject extends AbstractFlowObject
{
@XmlTransient
private Process process;
@XmlTransient
private Object implObject;
+ /**
+ * Construct an anonymous StartEvent.
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected FlowObject()
+ {
+ }
+
/**
* Get the associated Process
*/
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -23,6 +23,11 @@
//$Id$
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
/**
@@ -33,8 +38,28 @@
* @since 08-Jul-2008
*/
@XmlType(name="Gateway")
-public abstract class Gateway extends FlowObject
+public abstract class Gateway extends AbstractGateway implements NamedFlowObject
{
+ @XmlTransient
+ protected List<Flow> inFlows = new ArrayList<Flow>();
+
+ /**
+ * Construct an anonymous Gateway
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected Gateway()
+ {
+ }
+
+ /**
+ * Construct a Gateway with a given name
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected Gateway(String name)
+ {
+ super(name);
+ }
+
@Override
public Signal getEnterSignal()
{
@@ -46,4 +71,19 @@
{
return new Signal(getProcess(), Signal.Type.EXIT_GATEWAY);
}
+
+ public void addOutFlow(Flow flow)
+ {
+ outFlows.add(flow);
+ }
+
+ public List<Flow> getInFlows()
+ {
+ return Collections.unmodifiableList(inFlows);
+ }
+
+ public void addInFlow(Flow inFlow)
+ {
+ this.inFlows.add(inFlow);
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/InclusiveGateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/InclusiveGateway.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/InclusiveGateway.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -37,4 +37,25 @@
@XmlType(name="InclusiveGateway")
public class InclusiveGateway extends Gateway
{
+ /**
+ * Construct an anonymous Task
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected InclusiveGateway()
+ {
+ }
+
+ /**
+ * Construct a Task with a given name
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected InclusiveGateway(String name)
+ {
+ super(name);
+ }
+
+ public String toString()
+ {
+ return "InclusiveGateway[" + getName() + "]";
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ItermediateEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -21,6 +21,11 @@
*/
package org.jboss.bpm.model;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -37,6 +42,40 @@
* @since 08-Jul-2008
*/
@XmlType(name="ItermediateEvent")
-public class ItermediateEvent extends Event
+public class ItermediateEvent extends AbstractItermediateEvent
{
+ @XmlTransient
+ protected List<Flow> inFlows = new ArrayList<Flow>();
+
+ /**
+ * Construct an anonymous StartEvent.
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected ItermediateEvent()
+ {
+ }
+
+ /**
+ * Construct an anonymous StartEvent.
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected ItermediateEvent(String name)
+ {
+ super(name);
+ }
+
+ public void addOutFlow(Flow flow)
+ {
+ outFlows.add(flow);
+ }
+
+ public List<Flow> getInFlows()
+ {
+ return Collections.unmodifiableList(inFlows);
+ }
+
+ public void addInFlow(Flow inFlow)
+ {
+ this.inFlows.add(inFlow);
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageFlow.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageFlow.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageFlow.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -36,14 +36,16 @@
public class MessageFlow extends Flow
{
/**
- * JAXB Constructer
+ * Construct a flow with no target
+ * Note, this MUST NOT leak into the public API.
*/
- public MessageFlow()
+ protected MessageFlow()
{
}
/**
* Construct a flow with a given target
+ * Note, this MUST NOT leak into the public API.
*/
public MessageFlow(String targetName)
{
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ObjectFactory.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ObjectFactory.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ObjectFactory.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,131 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.07.11 at 09:21:08 AM CEST
+//
+
+package org.jboss.bpm.model;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each Java content interface and Java element interface generated in the api.bpm.jboss.org package.
+ * <p>
+ * An ObjectFactory allows you to programatically construct new instances of the Java representation for XML content. The Java representation of XML content can consist
+ * of schema derived interfaces and classes representing the binding of schema type definitions, element declarations and model groups. Factory methods for each of
+ * these are provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory
+{
+ /**
+ * Create an instance of {@link ExclusiveGateway }
+ *
+ */
+ public ExclusiveGateway createExclusiveGateway()
+ {
+ return new ExclusiveGateway();
+ }
+
+ /**
+ * Create an instance of {@link Task }
+ *
+ */
+ public Task createTask()
+ {
+ return new Task();
+ }
+
+ /**
+ * Create an instance of {@link Process }
+ *
+ */
+ public Process createProcess()
+ {
+ return new Process();
+ }
+
+ /**
+ * Create an instance of {@link ParallelGateway }
+ *
+ */
+ public ParallelGateway createParallelGateway()
+ {
+ return new ParallelGateway();
+ }
+
+ /**
+ * Create an instance of {@link MessageFlow }
+ *
+ */
+ public MessageFlow createMessageFlow()
+ {
+ return new MessageFlow();
+ }
+
+ /**
+ * Create an instance of {@link EndEvent }
+ *
+ */
+ public EndEvent createEndEvent()
+ {
+ return new EndEvent();
+ }
+
+ /**
+ * Create an instance of {@link SubProcess }
+ *
+ */
+ public SubProcess createSubProcess()
+ {
+ return new SubProcess();
+ }
+
+ /**
+ * Create an instance of {@link SequenceFlow }
+ *
+ */
+ public SequenceFlow createSequenceFlow()
+ {
+ return new SequenceFlow();
+ }
+
+ /**
+ * Create an instance of {@link ComplexGateway }
+ *
+ */
+ public ComplexGateway createComplexGateway()
+ {
+ return new ComplexGateway();
+ }
+
+ /**
+ * Create an instance of {@link InclusiveGateway }
+ *
+ */
+ public InclusiveGateway createInclusiveGateway()
+ {
+ return new InclusiveGateway();
+ }
+
+ /**
+ * Create an instance of {@link ItermediateEvent }
+ *
+ */
+ public ItermediateEvent createItermediateEvent(String name)
+ {
+ return new ItermediateEvent(name);
+ }
+
+ /**
+ * Create an instance of {@link StartEvent }
+ *
+ */
+ public StartEvent createStartEvent()
+ {
+ return new StartEvent();
+ }
+}
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ParallelGateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ParallelGateway.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ParallelGateway.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -35,4 +35,25 @@
@XmlType(name="ParallelGateway")
public class ParallelGateway extends Gateway
{
+ /**
+ * Construct an anonymous Task
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected ParallelGateway()
+ {
+ }
+
+ /**
+ * Construct a Task with a given name
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected ParallelGateway(String name)
+ {
+ super(name);
+ }
+
+ public String toString()
+ {
+ return "ParallelGateway[" + getName() + "]";
+ }
}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -1,319 +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.jboss.bpm.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.bpm.InvalidProcessException;
-import org.jboss.bpm.NameNotUniqueException;
-import org.jboss.bpm.NotImplementedException;
-import org.jboss.bpm.client.ProcessManager;
-import org.jboss.bpm.runtime.Attachments;
-
-// $Id$
-
-/**
- * A Process is any Activity performed within a company or organization.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 08-Jul-2008
- */
-@XmlType(name = "Process", propOrder = { "startEvent", "flowObjects", "endEvents" })
-@XmlRootElement(name = "process")
-public class Process extends Activity
-{
- private StartEvent startEvent;
- private List<FlowObject> flowObjects = new ArrayList<FlowObject>();
- private List<EndEvent> endEvents = new ArrayList<EndEvent>();
-
- @XmlTransient
- public enum ProcessState { CREATED, INITIALIZED, STARTED, ENDED };
- private ProcessState processState = ProcessState.CREATED;
-
- /**
- * Construct an anonymous process
- */
- public Process()
- {
- }
-
- /**
- * Construct a process with a given name
- */
- public Process(String name)
- {
- super(name);
- }
-
- /**
- * Call to initialize fully. Note, this MUST NOT leak into the public API.
- */
- protected void init(String name)
- {
- if (name == null)
- {
- ProcessManager pdm = ProcessManager.locateProcessManager();
- name = "AnonymousProcess#" + pdm.getProcesses().size();
- setName(name);
- }
- }
-
- /**
- * Add a flow object. Note, this MUST NOT leak into the public API.
- */
- protected void addFlowObject(FlowObject flowObject)
- {
- if (flowObject instanceof NamedFlowObject)
- {
- String name = ((NamedFlowObject)flowObject).getName();
- if (name != null && findFlowObject(name) != null)
- throw new NameNotUniqueException("NamedFlowObject: " + name);
- }
-
- if (flowObject instanceof StartEvent)
- {
- setStartEvent((StartEvent)flowObject);
- }
- else if (flowObject instanceof EndEvent)
- {
- endEvents.add((EndEvent)flowObject);
- }
- else
- {
- flowObjects.add(flowObject);
- }
- }
-
- /**
- * Get the start event
- */
- public StartEvent getStartEvent()
- {
- if (startEvent == null)
- throw new InvalidProcessException("Process does not have a start event");
-
- return startEvent;
- }
-
- /**
- * Set the start event Note, this MUST NOT leak into the public API.
- */
- @XmlElement(name = "start-event")
- protected void setStartEvent(StartEvent startEvent)
- {
- if (this.startEvent != null)
- throw new InvalidProcessException("Process cannot have multiple start events: " + startEvent);
-
- this.startEvent = startEvent;
- }
-
- /**
- * Get the set of end events
- */
- public List<EndEvent> getEndEvents()
- {
- if (processState == ProcessState.CREATED)
- return endEvents;
-
- return Collections.unmodifiableList(endEvents);
- }
-
- /**
- * Set the start event Note, this MUST NOT leak into the public API.
- */
- @XmlElement(name = "end-event")
- protected void setEndEvents(List<EndEvent> endEvents)
- {
- this.endEvents = endEvents;
- }
-
- /**
- * Get the list of flow objects, excluding start and end states
- */
- @XmlElement(name = "node")
- public List<FlowObject> getFlowObjects()
- {
- if (processState == ProcessState.CREATED)
- return flowObjects;
-
- return Collections.unmodifiableList(flowObjects);
- }
-
- /** Start the process */
- public Future<Result> startProcess()
- {
- return startProcess(null);
- }
-
- /** Start the process, with a given execution context */
- public Future<Result> startProcess(Attachments att)
- {
- if (processState != ProcessState.INITIALIZED)
- throw new IllegalStateException("Cannot start process in state: " + processState);
-
- processState = ProcessState.STARTED;
- execute(new InitialToken(this, att));
- return new ResultFuture();
- }
-
- /**
- * Find a flow object by name
- *
- * @return null if not found
- */
- public NamedFlowObject findFlowObject(String name)
- {
- if (name == null)
- throw new IllegalArgumentException("Cannot find flow object with name: null");
-
- List<FlowObject> allFlowObjects = new ArrayList<FlowObject>();
- allFlowObjects.add(startEvent);
- allFlowObjects.addAll(flowObjects);
- allFlowObjects.addAll(endEvents);
-
- NamedFlowObject nfo = null;
- for (FlowObject aux : allFlowObjects)
- {
- if (aux instanceof NamedFlowObject && name.equals(((NamedFlowObject)aux).getName()))
- {
- nfo = (NamedFlowObject)aux;
- break;
- }
- }
- return nfo;
- }
-
- /**
- * Get signal for enter
- */
- @Override
- public Signal getEnterSignal()
- {
- return new Signal(this, Signal.Type.ENTER_PROCESS);
- }
-
- /**
- * Get signal for exit
- */
- @Override
- public Signal getExitSignal()
- {
- return new Signal(this, Signal.Type.EXIT_PROCESS);
- }
-
-
- /**
- * Get the process state
- */
- public ProcessState getProcessState()
- {
- return processState;
- }
-
- /**
- * Set the process state
- */
- public void initialize()
- {
- if (processState != ProcessState.CREATED)
- throw new IllegalStateException("Cannot initialize process in state: " + processState);
-
- if (startEvent == null)
- throw new InvalidProcessException("Process does not have a start event");
-
- if (endEvents.size() == 0)
- throw new InvalidProcessException("Process does not have end events");
-
- // Set the associated process
- startEvent.setProcess(this);
- for (FlowObject aux : flowObjects)
- aux.setProcess(this);
- for (FlowObject aux : endEvents)
- aux.setProcess(this);
-
- processState = ProcessState.INITIALIZED;
- }
-
-
- @XmlTransient
- class ResultFuture implements Future<Result>
- {
- private Result result;
-
- public boolean cancel(boolean mayInterruptIfRunning)
- {
- throw new NotImplementedException();
- }
-
- public Result get() throws InterruptedException, ExecutionException
- {
- return getResult();
- }
-
- public Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- {
- throw new NotImplementedException();
- }
-
- public boolean isCancelled()
- {
- return false;
- }
-
- public boolean isDone()
- {
- boolean isDone = getResult() != null;
- if (isDone)
- processState = ProcessState.ENDED;
-
- return isDone;
- }
-
- private Result getResult()
- {
- if (result == null)
- {
- for (EndEvent aux : endEvents)
- {
- result = aux.getResult();
- if (result != null)
- {
- processState = ProcessState.ENDED;
- break;
- }
- }
- }
- return result;
- }
- }
-}
\ No newline at end of file
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -0,0 +1,289 @@
+/*
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.NameNotUniqueException;
+import org.jboss.bpm.NotImplementedException;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.runtime.Attachments;
+
+/**
+ * A Process is any Activity performed within a company or organization.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+@XmlType(name = "Process")
+@XmlRootElement(name = "process")
+public class Process extends AbstractProcess
+{
+ public enum ProcessState
+ {
+ CREATED, INITIALIZED, STARTED, ENDED
+ };
+
+ private ProcessState processState = ProcessState.CREATED;
+
+ /**
+ * Construct an anonymous process
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected Process()
+ {
+ }
+
+ /**
+ * Construct a process with a given name
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected Process(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Call to initialize fully.
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected void init(String name)
+ {
+ if (name == null)
+ {
+ ProcessManager pdm = ProcessManager.locateProcessManager();
+ name = "AnonymousProcess#" + pdm.getProcesses().size();
+ setName(name);
+ }
+ }
+
+ /**
+ * Add a flow object. Note, this MUST NOT leak into the public API.
+ */
+ protected void addFlowObject(FlowObject flowObject)
+ {
+ if (flowObject instanceof NamedFlowObject)
+ {
+ NamedFlowObject nfo = (NamedFlowObject)flowObject;
+ String name = nfo.getName();
+ if (name != null && findFlowObject(name) != null)
+ throw new NameNotUniqueException("NamedFlowObject: " + name);
+ }
+
+ flowObjects.add(flowObject);
+ }
+
+ /**
+ * Get the start event
+ */
+ public StartEvent getStartEvent()
+ {
+ StartEvent start = null;
+ for (FlowObject aux : flowObjects)
+ {
+ if (aux instanceof StartEvent)
+ {
+ start = (StartEvent)aux;
+ break;
+ }
+ }
+ return start;
+ }
+
+ /**
+ * Get the set of end events
+ */
+ public List<EndEvent> getEndEvents()
+ {
+ List<EndEvent> ends = new ArrayList<EndEvent>();
+ for (FlowObject aux : flowObjects)
+ {
+ if (aux instanceof EndEvent)
+ {
+ ends.add((EndEvent)aux);
+ }
+ }
+ return Collections.unmodifiableList(ends);
+ }
+
+ /**
+ * Get the list of flow objects
+ */
+ public List<FlowObject> getFlowObjects()
+ {
+ if (processState == ProcessState.CREATED)
+ return flowObjects;
+
+ return Collections.unmodifiableList(flowObjects);
+ }
+
+ /** Start the process */
+ public Future<Result> startProcess()
+ {
+ return startProcess(null);
+ }
+
+ /** Start the process, with a given execution context */
+ public Future<Result> startProcess(Attachments att)
+ {
+ if (processState != ProcessState.INITIALIZED)
+ throw new IllegalStateException("Cannot start process in state: " + processState);
+
+ processState = ProcessState.STARTED;
+ execute(new InitialToken(this, att));
+ return new ResultFuture();
+ }
+
+ /**
+ * Find a flow object by name
+ *
+ * @return null if not found
+ */
+ public NamedFlowObject findFlowObject(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Cannot find flow object with name: null");
+
+ NamedFlowObject nfo = null;
+ for (FlowObject aux : flowObjects)
+ {
+ if (aux instanceof NamedFlowObject && name.equals(((NamedFlowObject)aux).getName()))
+ {
+ nfo = (NamedFlowObject)aux;
+ break;
+ }
+ }
+ return nfo;
+ }
+
+ /**
+ * Get signal for enter
+ */
+ @Override
+ public Signal getEnterSignal()
+ {
+ return new Signal(this, Signal.Type.ENTER_PROCESS);
+ }
+
+ /**
+ * Get signal for exit
+ */
+ @Override
+ public Signal getExitSignal()
+ {
+ return new Signal(this, Signal.Type.EXIT_PROCESS);
+ }
+
+ /**
+ * Get the process state
+ */
+ public ProcessState getProcessState()
+ {
+ return processState;
+ }
+
+ /**
+ * Set the process state
+ */
+ public void initialize()
+ {
+ if (processState != ProcessState.CREATED)
+ throw new IllegalStateException("Cannot initialize process in state: " + processState);
+
+ if (getStartEvent() == null)
+ throw new InvalidProcessException("Process does not have a start event");
+
+ if (getEndEvents().size() == 0)
+ throw new InvalidProcessException("Process does not have end events");
+
+ // Set the associated process
+ for (FlowObject aux : flowObjects)
+ aux.setProcess(this);
+
+ processState = ProcessState.INITIALIZED;
+ }
+
+ @XmlTransient
+ class ResultFuture implements Future<Result>
+ {
+ private Result result;
+
+ public boolean cancel(boolean mayInterruptIfRunning)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Result get() throws InterruptedException, ExecutionException
+ {
+ return getResult();
+ }
+
+ public Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
+ {
+ throw new NotImplementedException();
+ }
+
+ public boolean isCancelled()
+ {
+ return false;
+ }
+
+ public boolean isDone()
+ {
+ boolean isDone = getResult() != null;
+ if (isDone)
+ processState = ProcessState.ENDED;
+
+ return isDone;
+ }
+
+ private Result getResult()
+ {
+ if (result == null)
+ {
+ for (EndEvent aux : getEndEvents())
+ {
+ result = aux.getResult();
+ if (result != null)
+ {
+ processState = ProcessState.ENDED;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+ }
+}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -21,6 +21,7 @@
*/
package org.jboss.bpm.model;
+
// $Id$
/**
@@ -99,32 +100,46 @@
public ProcessBuilder addExclusiveGateway(String name)
{
- flowObject = new ExclusiveGateway();
+ flowObject = new ExclusiveGateway(name);
proc.addFlowObject(flowObject);
return this;
}
public ProcessBuilder addInclusiveGateway(String name)
{
- flowObject = new InclusiveGateway();
+ flowObject = new InclusiveGateway(name);
proc.addFlowObject(flowObject);
return this;
}
public ProcessBuilder addComplexGateway(String name)
{
- flowObject = new ComplexGateway();
+ flowObject = new ComplexGateway(name);
proc.addFlowObject(flowObject);
return this;
}
public ProcessBuilder addParallelGateway(String name)
{
- flowObject = new ParallelGateway();
+ flowObject = new ParallelGateway(name);
proc.addFlowObject(flowObject);
return this;
}
+ public ProcessBuilder addSubProcess(String name)
+ {
+ flowObject = new SubProcess(name);
+ proc.addFlowObject(flowObject);
+ return this;
+ }
+
+ public ProcessBuilder addItermediateEvent(String name)
+ {
+ flowObject = new ItermediateEvent(name);
+ proc.addFlowObject(flowObject);
+ return this;
+ }
+
public ProcessBuilder addEndEvent(String name)
{
flowObject = new EndEvent(name);
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -36,14 +36,16 @@
public class SequenceFlow extends Flow
{
/**
- * JAXB Constructer
+ * Construct a flow with no target
+ * Note, this MUST NOT leak into the public API.
*/
- public SequenceFlow()
+ protected SequenceFlow()
{
}
/**
* Construct a flow with a given target
+ * Note, this MUST NOT leak into the public API.
*/
public SequenceFlow(String targetName)
{
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Signal.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Signal.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Signal.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
+
//$Id$
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -23,58 +23,42 @@
//$Id$
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-
/**
- * A Start Event indicates where a particular Process will start.
+ * A Start Event indicates where a particular Process will start.
*
- * In terms of Sequence Flow, the Start Event starts the Flow of the Process, and thus, will not have any incoming Sequence Flow.
- * A Start Event can have a Trigger that indicates how the Process starts: Message, Timer, Rule, Link, or Multiple.
+ * In terms of Sequence Flow, the Start Event starts the Flow of the Process, and thus, will not have any incoming Sequence Flow. A Start Event can have a Trigger that
+ * indicates how the Process starts: Message, Timer, Rule, Link, or Multiple.
*
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-@XmlType(name="StartEvent")
-public class StartEvent extends Event implements SingleOutFlowSupport
+@XmlType(name = "StartEvent")
+public class StartEvent extends AbstractStartEvent implements SingleOutFlowSupport
{
- private Flow outFlow;
-
- /**
- * Get signal for enter
+ /**
+ * Construct a StartEvent with a constant name: 'start'
+ * Note, this MUST NOT leak into the public API.
*/
- public Signal getEnterSignal()
+ protected StartEvent()
{
- return new Signal(getProcess(), Signal.Type.ENTER_START_EVENT);
}
-
- /**
- * Get signal for exit
- */
- public Signal getExitSignal()
- {
- return new Signal(getProcess(), Signal.Type.EXIT_START_EVENT);
- }
/**
- * Get the out flow
+ * Get signal for enter
*/
- public Flow getOutFlow()
+ public Signal getEnterSignal()
{
- return outFlow;
+ return new Signal(getProcess(), Signal.Type.ENTER_START_EVENT);
}
/**
- * Set the out flow
- * Note, this MUST NOT leak into the public API.
+ * Get signal for exit
*/
- @XmlElement(name = "flow", required = true)
- public void setOutFlow(Flow outFlow)
+ public Signal getExitSignal()
{
- if (this.outFlow != null)
- throw new IllegalStateException("Cannot reassign out flow");
- this.outFlow = outFlow;
+ return new Signal(getProcess(), Signal.Type.EXIT_START_EVENT);
}
public String toString()
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -21,11 +21,11 @@
*/
package org.jboss.bpm.model;
+//$Id$
+
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-// $Id$
-
/**
* A Sub-Process is Process that is included within another Process.
*
@@ -33,11 +33,28 @@
* @since 08-Jul-2008
*/
@XmlType(name="SubProcess")
-public class SubProcess extends Process
+public class SubProcess extends AbstractSubProcess
{
@XmlTransient
private Process parentProcess;
+ /**
+ * Construct an anonymous process
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected SubProcess()
+ {
+ }
+
+ /**
+ * Construct a process with a given name
+ * Note, this MUST NOT leak into the public API.
+ */
+ protected SubProcess(String name)
+ {
+ super(name);
+ }
+
/** Get the parent process */
public Process getParentProcess()
{
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -21,73 +21,51 @@
*/
package org.jboss.bpm.model;
-import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
//$Id$
/**
- * A Task is an Atomic Activity that is included within a Process.
+ * A Task is an Atomic Activity that is included within a Process.
*
- * A Task is used when the work in the Process is not broken down to a finer level of Process Model detail.
- * Generally, an end-user and/or an application are used to perform the Task when it is executed.
+ * A Task is used when the work in the Process is not broken down to a finer level of Process Model detail. Generally, an end-user and/or an application are used to
+ * perform the Task when it is executed.
*
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-@XmlType(name="Task")
-public class Task extends Activity implements SingleOutFlowSupport
+@XmlType(name = "Task")
+public class Task extends AbstractTask implements SingleOutFlowSupport
{
- private Flow outFlow;
-
/**
* Construct an anonymous Task
+ * Note, this MUST NOT leak into the public API.
*/
- public Task()
+ protected Task()
{
}
/**
* Construct a Task with a given name
+ * Note, this MUST NOT leak into the public API.
*/
- public Task(String name)
+ protected Task(String name)
{
super(name);
}
-
- /**
- * Get the out flow
- */
- public Flow getOutFlow()
- {
- return outFlow;
- }
- /**
- * Set the out flow
- * Note, this MUST NOT leak into the public API.
- */
- @XmlElement(name = "flow", required = true)
- public void setOutFlow(Flow outFlow)
- {
- if (this.outFlow != null)
- throw new IllegalStateException("Cannot reassign out flow");
-
- this.outFlow = outFlow;
- }
-
/** Get signal for enter */
public Signal getEnterSignal()
{
return new Signal(getProcess(), Signal.Type.ENTER_TASK, getName());
}
-
+
/** Get signal for exit */
public Signal getExitSignal()
{
return new Signal(getProcess(), Signal.Type.EXIT_TASK, getName());
}
-
+
public String toString()
{
return "Task[" + getName() + "]";
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/package-info.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/package-info.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/package-info.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-@XmlSchema(namespace="http://org.jboss.bpm.api")
+@XmlSchema(namespace="urn:api.bpm.jboss:jpdl-0.1")
package org.jboss.bpm.model;
import javax.xml.bind.annotation.XmlSchema;
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessMarshaller.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessMarshaller.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessMarshaller.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -31,6 +31,7 @@
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
+import org.jboss.bpm.model.ObjectFactory;
import org.jboss.bpm.model.Process;
/**
@@ -43,7 +44,7 @@
{
public void marshallProcess(Process proc, Writer out) throws JAXBException, IOException
{
- JAXBContext jaxbContext = JAXBContext.newInstance(Process.class.getPackage().getName());
+ JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -28,6 +28,7 @@
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
+import org.jboss.bpm.model.ObjectFactory;
import org.jboss.bpm.model.Process;
/**
@@ -40,8 +41,9 @@
{
public Process unmarshallProcess(Reader xml) throws Exception
{
- JAXBContext jaxbContext = JAXBContext.newInstance(Process.class.getPackage().getName());
+ JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ unmarshaller.setProperty("com.sun.xml.bind.ObjectFactory",new ObjectFactory());
Process proc = (Process)unmarshaller.unmarshal(xml);
proc.initialize();
return proc;
Modified: api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
===================================================================
--- api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java 2008-07-10 19:41:52 UTC (rev 1581)
+++ api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java 2008-07-11 11:23:42 UTC (rev 1582)
@@ -40,8 +40,11 @@
public class ProcessMarshallerTest extends TestCase
{
public void testProcess() throws Exception
- {
- Process inProc = new ProcessBuilder("myproc").addStartEvent().addSequenceFlow("taskA").addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
+ {
+ Process inProc = new ProcessBuilder("myproc").addStartEvent().addSequenceFlow("task").addTask("taskA").
+ addSequenceFlow("split").addParallelGateway("split").addSequenceFlow("subproc").addSequenceFlow("event").
+ addSubProcess("subproc").addSequenceFlow("join").addItermediateEvent("event").addSequenceFlow("join").
+ addParallelGateway("join").addSequenceFlow("end").addEndEvent("end").getProcess();
StringWriter strwr = new StringWriter();
ProcessMarshaller marshaller = new ProcessMarshaller();
15 years, 10 months
JBoss JBPM SVN: r1581 - in api/trunk/modules/api/src: test/java/org/jboss/bpm/model and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-10 15:41:52 -0400 (Thu, 10 Jul 2008)
New Revision: 1581
Added:
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleInFlowSupport.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleOutFlowSupport.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleInFlowSupport.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleOutFlowSupport.java
Modified:
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
Log:
Add ProcessBuilder
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-10 17:55:37 UTC (rev 1580)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -112,4 +112,9 @@
}
};
}
+
+ public String toString()
+ {
+ return "EndEvent[" + getName() + "]";
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java 2008-07-10 17:55:37 UTC (rev 1580)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -21,12 +21,10 @@
*/
package org.jboss.bpm.model;
+//$Id$
+
import javax.xml.bind.annotation.XmlType;
-
-
-// $Id$
-
/**
* Gateways are modelling elements that are used to control how Sequence Flow interact as they converge and diverge within a Process.
* If the flow does not need to be controlled, then a Gateway is not needed.
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleInFlowSupport.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleInFlowSupport.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleInFlowSupport.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -0,0 +1,39 @@
+/*
+ * 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 java.util.List;
+
+//$Id$
+
+public interface MultipleInFlowSupport
+{
+ /**
+ * Get the list of in flows
+ */
+ List<Flow> getInFlows();
+
+ /**
+ * Add an out flow
+ */
+ void addOutFlow(Flow flow);
+}
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleInFlowSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleOutFlowSupport.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleOutFlowSupport.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleOutFlowSupport.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -0,0 +1,39 @@
+/*
+ * 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 java.util.List;
+
+//$Id$
+
+public interface MultipleOutFlowSupport
+{
+ /**
+ * Get the list of out flows
+ */
+ List<Flow> getOutFlows();
+
+ /**
+ * Add an out flow
+ */
+ void addOutFlow(Flow flow);
+}
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MultipleOutFlowSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-10 17:55:37 UTC (rev 1580)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -48,12 +48,12 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-@XmlType(name = "Process", propOrder = { "startEvent", "tasks", "endEvents" })
+@XmlType(name = "Process", propOrder = { "startEvent", "flowObjects", "endEvents" })
@XmlRootElement(name = "process")
public class Process extends Activity
{
private StartEvent startEvent;
- private List<Task> tasks = new ArrayList<Task>();
+ private List<FlowObject> flowObjects = new ArrayList<FlowObject>();
private List<EndEvent> endEvents = new ArrayList<EndEvent>();
@XmlTransient
@@ -107,20 +107,11 @@
else if (flowObject instanceof EndEvent)
{
endEvents.add((EndEvent)flowObject);
- flowObject.setProcess(this);
}
- else if (flowObject instanceof Task)
+ else
{
- if (tasks == null)
- tasks = new ArrayList<Task>();
-
- tasks.add((Task)flowObject);
- flowObject.setProcess(this);
+ flowObjects.add(flowObject);
}
- else
- {
- throw new InvalidProcessException("Unsupported type: " + flowObject);
- }
}
/**
@@ -143,7 +134,6 @@
if (this.startEvent != null)
throw new InvalidProcessException("Process cannot have multiple start events: " + startEvent);
- startEvent.setProcess(this);
this.startEvent = startEvent;
}
@@ -168,25 +158,17 @@
}
/**
- * Get the list of tasks
+ * Get the list of flow objects, excluding start and end states
*/
- public List<Task> getTasks()
+ @XmlElement(name = "node")
+ public List<FlowObject> getFlowObjects()
{
if (processState == ProcessState.CREATED)
- return tasks;
+ return flowObjects;
- return Collections.unmodifiableList(tasks);
+ return Collections.unmodifiableList(flowObjects);
}
- /**
- * Set the tasks Note, this MUST NOT leak into the public API.
- */
- @XmlElement(name = "task")
- protected void setTasks(List<Task> tasks)
- {
- this.tasks = tasks;
- }
-
/** Start the process */
public Future<Result> startProcess()
{
@@ -196,6 +178,10 @@
/** Start the process, with a given execution context */
public Future<Result> startProcess(Attachments att)
{
+ if (processState != ProcessState.INITIALIZED)
+ throw new IllegalStateException("Cannot start process in state: " + processState);
+
+ processState = ProcessState.STARTED;
execute(new InitialToken(this, att));
return new ResultFuture();
}
@@ -210,8 +196,13 @@
if (name == null)
throw new IllegalArgumentException("Cannot find flow object with name: null");
+ List<FlowObject> allFlowObjects = new ArrayList<FlowObject>();
+ allFlowObjects.add(startEvent);
+ allFlowObjects.addAll(flowObjects);
+ allFlowObjects.addAll(endEvents);
+
NamedFlowObject nfo = null;
- for (FlowObject aux : getFlowObjects())
+ for (FlowObject aux : allFlowObjects)
{
if (aux instanceof NamedFlowObject && name.equals(((NamedFlowObject)aux).getName()))
{
@@ -222,15 +213,6 @@
return nfo;
}
- public List<FlowObject> getFlowObjects()
- {
- List<FlowObject> flowObjects = new ArrayList<FlowObject>();
- flowObjects.add(startEvent);
- flowObjects.addAll(tasks);
- flowObjects.addAll(endEvents);
- return flowObjects;
- }
-
/**
* Get signal for enter
*/
@@ -266,17 +248,18 @@
if (processState != ProcessState.CREATED)
throw new IllegalStateException("Cannot initialize process in state: " + processState);
- for (EndEvent aux : endEvents)
- aux.setProcess(this);
-
- for (Task aux : tasks)
- aux.setProcess(this);
-
if (startEvent == null)
throw new InvalidProcessException("Process does not have a start event");
if (endEvents.size() == 0)
throw new InvalidProcessException("Process does not have end events");
+
+ // Set the associated process
+ startEvent.setProcess(this);
+ for (FlowObject aux : flowObjects)
+ aux.setProcess(this);
+ for (FlowObject aux : endEvents)
+ aux.setProcess(this);
processState = ProcessState.INITIALIZED;
}
@@ -309,7 +292,11 @@
public boolean isDone()
{
- return getResult() != null;
+ boolean isDone = getResult() != null;
+ if (isDone)
+ processState = ProcessState.ENDED;
+
+ return isDone;
}
private Result getResult()
@@ -321,6 +308,7 @@
result = aux.getResult();
if (result != null)
{
+ processState = ProcessState.ENDED;
break;
}
}
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -0,0 +1,134 @@
+/*
+ * 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$
+
+/**
+ * A Process is any Activity performed within a company or organization.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2008
+ */
+public class ProcessBuilder
+{
+ private Process proc;
+ private FlowObject flowObject;
+
+ public ProcessBuilder (String procName)
+ {
+ proc = new Process(procName);
+ }
+
+ public Process getProcess()
+ {
+ proc.initialize();
+ return proc;
+ }
+
+ public ProcessBuilder addStartEvent()
+ {
+ flowObject = new StartEvent();
+ proc.addFlowObject(flowObject);
+ return this;
+ }
+
+ public ProcessBuilder addSequenceFlow(String name)
+ {
+ if (flowObject instanceof SingleOutFlowSupport)
+ {
+ SingleOutFlowSupport outFlow = (SingleOutFlowSupport)flowObject;
+ outFlow.setOutFlow(new SequenceFlow(name));
+ }
+ else if (flowObject instanceof MultipleOutFlowSupport)
+ {
+ MultipleOutFlowSupport outFlow = (MultipleOutFlowSupport)flowObject;
+ outFlow.addOutFlow(new SequenceFlow(name));
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot add a sequence flow to: " + flowObject);
+ }
+ return this;
+ }
+
+ public ProcessBuilder addMessageFlow(String name)
+ {
+ if (flowObject instanceof SingleOutFlowSupport)
+ {
+ SingleOutFlowSupport outFlow = (SingleOutFlowSupport)flowObject;
+ outFlow.setOutFlow(new MessageFlow(name));
+ }
+ else if (flowObject instanceof MultipleOutFlowSupport)
+ {
+ MultipleOutFlowSupport outFlow = (MultipleOutFlowSupport)flowObject;
+ outFlow.addOutFlow(new MessageFlow(name));
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot add a message flow to: " + flowObject);
+ }
+ return this;
+ }
+
+ public ProcessBuilder addTask(String name)
+ {
+ flowObject = new Task(name);
+ proc.addFlowObject(flowObject);
+ return this;
+ }
+
+ public ProcessBuilder addExclusiveGateway(String name)
+ {
+ flowObject = new ExclusiveGateway();
+ proc.addFlowObject(flowObject);
+ return this;
+ }
+
+ public ProcessBuilder addInclusiveGateway(String name)
+ {
+ flowObject = new InclusiveGateway();
+ proc.addFlowObject(flowObject);
+ return this;
+ }
+
+ public ProcessBuilder addComplexGateway(String name)
+ {
+ flowObject = new ComplexGateway();
+ proc.addFlowObject(flowObject);
+ return this;
+ }
+
+ public ProcessBuilder addParallelGateway(String name)
+ {
+ flowObject = new ParallelGateway();
+ proc.addFlowObject(flowObject);
+ return this;
+ }
+
+ public ProcessBuilder addEndEvent(String name)
+ {
+ flowObject = new EndEvent(name);
+ proc.addFlowObject(flowObject);
+ return this;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleInFlowSupport.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleInFlowSupport.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleInFlowSupport.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -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$
+
+public interface SingleInFlowSupport
+{
+ /**
+ * Get the out flow
+ */
+ Flow getInFlow();
+
+ /**
+ * Set the in flow
+ */
+ void setOutFlow(Flow flow);
+}
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleInFlowSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleOutFlowSupport.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleOutFlowSupport.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleOutFlowSupport.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -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$
+
+public interface SingleOutFlowSupport
+{
+ /**
+ * Get the out flow
+ */
+ Flow getOutFlow();
+
+ /**
+ * Set the out flow
+ */
+ void setOutFlow(Flow flow);
+}
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SingleOutFlowSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-10 17:55:37 UTC (rev 1580)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -37,7 +37,7 @@
* @since 08-Jul-2008
*/
@XmlType(name="StartEvent")
-public class StartEvent extends Event
+public class StartEvent extends Event implements SingleOutFlowSupport
{
private Flow outFlow;
@@ -70,9 +70,15 @@
* Note, this MUST NOT leak into the public API.
*/
@XmlElement(name = "flow", required = true)
- protected void setOutFlow(Flow outFlow)
+ public void setOutFlow(Flow outFlow)
{
+ if (this.outFlow != null)
+ throw new IllegalStateException("Cannot reassign out flow");
this.outFlow = outFlow;
}
+ public String toString()
+ {
+ return "StartEvent[]";
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-10 17:55:37 UTC (rev 1580)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -36,7 +36,7 @@
* @since 08-Jul-2008
*/
@XmlType(name="Task")
-public class Task extends Activity
+public class Task extends Activity implements SingleOutFlowSupport
{
private Flow outFlow;
@@ -68,8 +68,11 @@
* Note, this MUST NOT leak into the public API.
*/
@XmlElement(name = "flow", required = true)
- protected void setOutFlow(Flow outFlow)
+ public void setOutFlow(Flow outFlow)
{
+ if (this.outFlow != null)
+ throw new IllegalStateException("Cannot reassign out flow");
+
this.outFlow = outFlow;
}
@@ -84,4 +87,9 @@
{
return new Signal(getProcess(), Signal.Type.EXIT_TASK, getName());
}
+
+ public String toString()
+ {
+ return "Task[" + getName() + "]";
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
===================================================================
--- api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java 2008-07-10 17:55:37 UTC (rev 1580)
+++ api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java 2008-07-10 19:41:52 UTC (rev 1581)
@@ -41,29 +41,21 @@
{
public void testProcess() throws Exception
{
- Process inProc = new Process("myproc");
- StartEvent start = new StartEvent();
- start.setOutFlow(new SequenceFlow("taskA"));
- inProc.addFlowObject(start);
- Task taskA = new Task("taskA");
- taskA.setOutFlow(new SequenceFlow("end"));
- inProc.addFlowObject(taskA);
- EndEvent end = new EndEvent("end");
- inProc.addFlowObject(end);
-
+ Process inProc = new ProcessBuilder("myproc").addStartEvent().addSequenceFlow("taskA").addTask("taskA").addSequenceFlow("end").addEndEvent("end").getProcess();
+
StringWriter strwr = new StringWriter();
ProcessMarshaller marshaller = new ProcessMarshaller();
marshaller.marshallProcess(inProc, strwr);
String xml = strwr.toString();
-
+
System.out.println(xml);
-
+
ProcessUnmarshaller unmarshaller = new ProcessUnmarshaller();
Process outProc = unmarshaller.unmarshallProcess(new StringReader(xml));
- start = outProc.getStartEvent();
- taskA = (Task)outProc.findFlowObject("taskA");
- end = outProc.getEndEvents().get(0);
-
+ StartEvent start = outProc.getStartEvent();
+ Task taskA = (Task)outProc.findFlowObject("taskA");
+ EndEvent end = outProc.getEndEvents().get(0);
+
assertEquals(inProc.getName(), outProc.getName());
assertNotNull(start);
assertEquals(outProc, start.getProcess());
15 years, 10 months
JBoss JBPM SVN: r1580 - jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-07-10 13:55:37 -0400 (Thu, 10 Jul 2008)
New Revision: 1580
Modified:
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/JbpmConfiguration.java
Log:
restored the ability to create a jbpm configuration in the abscence of an external configuration resource, without an exception being thrown
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/JbpmConfiguration.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/JbpmConfiguration.java 2008-07-10 17:53:01 UTC (rev 1579)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/JbpmConfiguration.java 2008-07-10 17:55:37 UTC (rev 1580)
@@ -278,12 +278,13 @@
log.info("using jbpm configuration resource '"+resource+"'");
InputStream jbpmCfgXmlStream = ClassLoaderUtil.getStream(resource);
- // if a resource SHOULD BE used, but is not found in the classpath
- // throw exception (otherwise, the user wants to load own stuff
- // but is confused, if it is not found and not loaded, without
+ // if a custom resource is to be used, but is not found in the classpath
+ // log a warning (otherwise, users who want to load custom stuff
+ // will be confused if the resource is not found and not loaded, without
// any notice)
- if (jbpmCfgXmlStream==null)
- throw new JbpmException("jbpm configuration resource '"+resource+"' is not available");
+ if (jbpmCfgXmlStream==null && !"jbpm.cfg.xml".equals(resource)) {
+ log.warn("jbpm configuration resource '"+resource+"' is not available");
+ }
ObjectFactory objectFactory = parseObjectFactory(jbpmCfgXmlStream);
instance = createJbpmConfiguration(objectFactory);
15 years, 10 months
JBoss JBPM SVN: r1579 - in api/trunk/modules/api/src/main/java/org/jboss/bpm: model and 1 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-10 13:53:01 -0400 (Thu, 10 Jul 2008)
New Revision: 1579
Modified:
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java
Log:
Add Process lifecycle
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-10 17:52:51 UTC (rev 1578)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-10 17:53:01 UTC (rev 1579)
@@ -84,7 +84,10 @@
throw new EngineShutdownException("Cannot create new Process while engine is shutting down");
Process proc = createProcessOverride(procDescriptor);
+ proc.initialize();
+
marshallProcess(proc);
+
return proc;
}
@@ -98,7 +101,10 @@
throw new EngineShutdownException("Cannot create new Process while engine is shutting down");
Process proc = createProcessOverride(procURL);
+ proc.initialize();
+
marshallProcess(proc);
+
return proc;
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-10 17:52:51 UTC (rev 1578)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-10 17:53:01 UTC (rev 1579)
@@ -55,7 +55,11 @@
private StartEvent startEvent;
private List<Task> tasks = new ArrayList<Task>();
private List<EndEvent> endEvents = new ArrayList<EndEvent>();
-
+
+ @XmlTransient
+ public enum ProcessState { CREATED, INITIALIZED, STARTED, ENDED };
+ private ProcessState processState = ProcessState.CREATED;
+
/**
* Construct an anonymous process
*/
@@ -92,7 +96,7 @@
if (flowObject instanceof NamedFlowObject)
{
String name = ((NamedFlowObject)flowObject).getName();
- if (findFlowObject(name) != null)
+ if (name != null && findFlowObject(name) != null)
throw new NameNotUniqueException("NamedFlowObject: " + name);
}
@@ -148,12 +152,10 @@
*/
public List<EndEvent> getEndEvents()
{
- // Lock end events
- if (endEvents.size() > 0)
- {
- endEvents = Collections.unmodifiableList(endEvents);
- }
- return endEvents;
+ if (processState == ProcessState.CREATED)
+ return endEvents;
+
+ return Collections.unmodifiableList(endEvents);
}
/**
@@ -170,12 +172,10 @@
*/
public List<Task> getTasks()
{
- // Lock tasks
- if (tasks.size() > 0)
- {
- tasks = Collections.unmodifiableList(tasks);
- }
- return tasks;
+ if (processState == ProcessState.CREATED)
+ return tasks;
+
+ return Collections.unmodifiableList(tasks);
}
/**
@@ -207,10 +207,13 @@
*/
public NamedFlowObject findFlowObject(String name)
{
+ if (name == null)
+ throw new IllegalArgumentException("Cannot find flow object with name: null");
+
NamedFlowObject nfo = null;
for (FlowObject aux : getFlowObjects())
{
- if (aux instanceof NamedFlowObject && ((NamedFlowObject)aux).getName().equals(name))
+ if (aux instanceof NamedFlowObject && name.equals(((NamedFlowObject)aux).getName()))
{
nfo = (NamedFlowObject)aux;
break;
@@ -246,6 +249,39 @@
return new Signal(this, Signal.Type.EXIT_PROCESS);
}
+
+ /**
+ * Get the process state
+ */
+ public ProcessState getProcessState()
+ {
+ return processState;
+ }
+
+ /**
+ * Set the process state
+ */
+ public void initialize()
+ {
+ if (processState != ProcessState.CREATED)
+ throw new IllegalStateException("Cannot initialize process in state: " + processState);
+
+ for (EndEvent aux : endEvents)
+ aux.setProcess(this);
+
+ for (Task aux : tasks)
+ aux.setProcess(this);
+
+ if (startEvent == null)
+ throw new InvalidProcessException("Process does not have a start event");
+
+ if (endEvents.size() == 0)
+ throw new InvalidProcessException("Process does not have end events");
+
+ processState = ProcessState.INITIALIZED;
+ }
+
+
@XmlTransient
class ResultFuture implements Future<Result>
{
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java 2008-07-10 17:52:51 UTC (rev 1578)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java 2008-07-10 17:53:01 UTC (rev 1579)
@@ -28,9 +28,7 @@
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
-import org.jboss.bpm.model.EndEvent;
import org.jboss.bpm.model.Process;
-import org.jboss.bpm.model.Task;
/**
* A JAXB unmarshaller for a Process
@@ -45,13 +43,7 @@
JAXBContext jaxbContext = JAXBContext.newInstance(Process.class.getPackage().getName());
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Process proc = (Process)unmarshaller.unmarshal(xml);
-
- for (EndEvent aux : proc.getEndEvents())
- aux.setProcess(proc);
-
- for (Task aux : proc.getTasks())
- aux.setProcess(proc);
-
+ proc.initialize();
return proc;
}
}
15 years, 10 months
JBoss JBPM SVN: r1578 - jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-10 13:52:51 -0400 (Thu, 10 Jul 2008)
New Revision: 1578
Modified:
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java
Log:
Add Process lifecycle
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java 2008-07-10 17:18:06 UTC (rev 1577)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java 2008-07-10 17:52:51 UTC (rev 1578)
@@ -25,6 +25,7 @@
import org.jboss.bpm.model.EndEvent;
import org.jboss.bpm.model.Process;
+import org.jbpm.graph.def.GraphElement;
import org.jbpm.graph.def.Node;
/**
@@ -40,4 +41,16 @@
setProcess(proc);
setImplObject(oldNode);
}
+
+ public String getName()
+ {
+ GraphElement oldEl = (GraphElement)getImplObject();
+ return oldEl.getName();
+ }
+
+ public void setName(String name)
+ {
+ GraphElement oldEl = (GraphElement)getImplObject();
+ oldEl.setName(name);
+ }
}
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java 2008-07-10 17:18:06 UTC (rev 1577)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java 2008-07-10 17:52:51 UTC (rev 1578)
@@ -54,20 +54,9 @@
FlowObject flowObject = NodeAdapter.adaptNode(apiProc, oldNode);
apiProc.addFlowObject(flowObject);
}
-
- // validate
- validateProcess(apiProc);
-
return apiProc;
}
- private static void validateProcess(Process apiProc)
- {
- // These methods are expected to throw exceptions if there are no such states
- apiProc.getStartEvent();
- apiProc.getEndEvents();
- }
-
static class NodeAdapter
{
static FlowObject adaptNode(Process apiProc, Node oldNode)
@@ -92,12 +81,12 @@
throw new InvalidProcessException("Cannot find action on event: " + event);
if (actions.size() > 1)
throw new InvalidProcessException("Multiple actions not supported: " + event);
-
+
Action action = (Action)actions.get(0);
Object obj = action.getActionDelegation().getInstance();
if (obj instanceof Task == false)
throw new InvalidProcessException("Node action is not of type Task");
-
+
delegate = (Task)obj;
}
flowObject = new TaskImpl(apiProc, oldNode, delegate);
15 years, 10 months
JBoss JBPM SVN: r1577 - in api/trunk/modules/api: scripts and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-10 13:18:06 -0400 (Thu, 10 Jul 2008)
New Revision: 1577
Modified:
api/trunk/modules/api/pom.xml
api/trunk/modules/api/scripts/antrun-schemagen.xml
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java
api/trunk/modules/api/src/main/resources/org/jboss/bpm/model/jaxb.index
Log:
interface NamedFlowObject
Modified: api/trunk/modules/api/pom.xml
===================================================================
--- api/trunk/modules/api/pom.xml 2008-07-10 17:10:40 UTC (rev 1576)
+++ api/trunk/modules/api/pom.xml 2008-07-10 17:18:06 UTC (rev 1577)
@@ -86,7 +86,6 @@
<include>InclusiveGateway.java</include>
<include>ItermediateEvent.java</include>
<include>MessageFlow.java</include>
- <include>NamedFlowObject.java</include>
<include>ParallelGateway.java</include>
<include>Process.java</include>
<include>SequenceFlow.java</include>
Modified: api/trunk/modules/api/scripts/antrun-schemagen.xml
===================================================================
--- api/trunk/modules/api/scripts/antrun-schemagen.xml 2008-07-10 17:10:40 UTC (rev 1576)
+++ api/trunk/modules/api/scripts/antrun-schemagen.xml 2008-07-10 17:18:06 UTC (rev 1577)
@@ -36,7 +36,6 @@
<include name="InclusiveGateway.java"/>
<include name="ItermediateEvent.java"/>
<include name="MessageFlow.java"/>
- <include name="NamedFlowObject.java"/>
<include name="ParallelGateway.java"/>
<include name="Process.java"/>
<include name="SequenceFlow.java"/>
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-10 17:10:40 UTC (rev 1576)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-10 17:18:06 UTC (rev 1577)
@@ -21,6 +21,7 @@
*/
package org.jboss.bpm.model;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
// $Id$
@@ -34,8 +35,10 @@
* @since 08-Jul-2008
*/
@XmlType(name="Activity")
-public abstract class Activity extends NamedFlowObject
+public abstract class Activity extends FlowObject implements NamedFlowObject
{
+ private String name;
+
/**
* Construct an anonymous Activity
*/
@@ -48,6 +51,28 @@
*/
public Activity(String name)
{
- super(name);
+ this.name = name;
}
+
+ /**
+ * Get the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the name.
+ * Note, this MUST NOT leak into the public API.
+ */
+ // TODO
+ @XmlAttribute(required = true)
+ public void setName(String name)
+ {
+ if (this.name != null)
+ throw new IllegalStateException("Cannot rename: " + name);
+
+ this.name = name;
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-10 17:10:40 UTC (rev 1576)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-10 17:18:06 UTC (rev 1577)
@@ -42,7 +42,7 @@
* @since 08-Jul-2008
*/
@XmlType(name="EndEvent")
-public class EndEvent extends Event
+public class EndEvent extends Event implements NamedFlowObject
{
private String name;
private Result result;
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java 2008-07-10 17:10:40 UTC (rev 1576)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java 2008-07-10 17:18:06 UTC (rev 1577)
@@ -21,9 +21,6 @@
*/
package org.jboss.bpm.model;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
//$Id$
/**
@@ -32,45 +29,10 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-@XmlType(name = "NamedFlowObject")
-public abstract class NamedFlowObject extends FlowObject
+public interface NamedFlowObject
{
- private String name;
-
/**
- * Construct an anonymous NamedFlowObject
- */
- public NamedFlowObject()
- {
- }
-
- /**
- * Construct a NamedFlowObject with a given name
- */
- public NamedFlowObject(String name)
- {
- this.name = name;
- }
-
- /**
* Get the name
*/
- public String getName()
- {
- return name;
- }
-
- /**
- * Set the name.
- * Note, this MUST NOT leak into the public API.
- */
- // TODO
- @XmlAttribute(required = true)
- public void setName(String name)
- {
- if (this.name != null)
- throw new IllegalStateException("Cannot rename: " + name);
-
- this.name = name;
- }
+ String getName();
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/resources/org/jboss/bpm/model/jaxb.index
===================================================================
--- api/trunk/modules/api/src/main/resources/org/jboss/bpm/model/jaxb.index 2008-07-10 17:10:40 UTC (rev 1576)
+++ api/trunk/modules/api/src/main/resources/org/jboss/bpm/model/jaxb.index 2008-07-10 17:18:06 UTC (rev 1577)
@@ -9,7 +9,6 @@
InclusiveGateway
ItermediateEvent
MessageFlow
-NamedFlowObject
ParallelGateway
Process
SequenceFlow
15 years, 10 months
JBoss JBPM SVN: r1576 - in api/trunk: modules/api and 7 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-07-10 13:10:40 -0400 (Thu, 10 Jul 2008)
New Revision: 1576
Modified:
api/trunk/modules/api/pom.xml
api/trunk/modules/api/scripts/antrun-schemagen.xml
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageFlow.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessMarshaller.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java
api/trunk/modules/api/src/main/resources/org/jboss/bpm/model/jaxb.index
api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
api/trunk/modules/testsuite/pom.xml
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java
api/trunk/pom.xml
Log:
Add JAXB Flow
Modified: api/trunk/modules/api/pom.xml
===================================================================
--- api/trunk/modules/api/pom.xml 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/pom.xml 2008-07-10 17:10:40 UTC (rev 1576)
@@ -41,14 +41,14 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
-
+
<!-- Provided Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
-
+
<!-- Runtime/System Dependencies -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
@@ -81,12 +81,15 @@
<include>Event.java</include>
<include>ExclusiveGateway.java</include>
<include>FlowObject.java</include>
+ <include>Flow.java</include>
<include>Gateway.java</include>
<include>InclusiveGateway.java</include>
<include>ItermediateEvent.java</include>
+ <include>MessageFlow.java</include>
<include>NamedFlowObject.java</include>
<include>ParallelGateway.java</include>
<include>Process.java</include>
+ <include>SequenceFlow.java</include>
<include>Signal.java</include>
<include>StartEvent.java</include>
<include>SubProcess.java</include>
Modified: api/trunk/modules/api/scripts/antrun-schemagen.xml
===================================================================
--- api/trunk/modules/api/scripts/antrun-schemagen.xml 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/scripts/antrun-schemagen.xml 2008-07-10 17:10:40 UTC (rev 1576)
@@ -30,13 +30,16 @@
<include name="EndEvent.java"/>
<include name="Event.java"/>
<include name="ExclusiveGateway.java"/>
+ <include name="Flow.java"/>
<include name="FlowObject.java"/>
<include name="Gateway.java"/>
<include name="InclusiveGateway.java"/>
<include name="ItermediateEvent.java"/>
+ <include name="MessageFlow.java"/>
<include name="NamedFlowObject.java"/>
<include name="ParallelGateway.java"/>
<include name="Process.java"/>
+ <include name="SequenceFlow.java"/>
<include name="Signal.java"/>
<include name="StartEvent.java"/>
<include name="SubProcess.java"/>
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -50,18 +50,4 @@
{
super(name);
}
-
- /**
- * Call to initialize fully
- * Note, this MUST NOT leak into the public API.
- */
- protected void init(String name)
- {
- if (name == null)
- {
- Process proc = getProcess();
- name = "AnonymousActivity#" + proc.getFlowObjects().size();
- setName(name);
- }
- }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/EndEvent.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -21,6 +21,7 @@
*/
package org.jboss.bpm.model;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -43,10 +44,43 @@
@XmlType(name="EndEvent")
public class EndEvent extends Event
{
- @XmlTransient
+ private String name;
private Result result;
- /** Get the result */
+ public EndEvent()
+ {
+ }
+
+ public EndEvent(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the name.
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlAttribute(required = true)
+ protected void setName(String name)
+ {
+ if (this.name != null)
+ throw new IllegalStateException("Cannot rename: " + name);
+
+ this.name = name;
+ }
+
+ /**
+ * Get the result
+ */
+ @XmlTransient
public Result getResult()
{
return result;
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Flow.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -21,7 +21,12 @@
*/
package org.jboss.bpm.model;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+
// $Id$
/**
@@ -34,14 +39,81 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-public interface Flow
+@XmlType(name="Flow")
+public abstract class Flow
{
- /** Get the name */
- String getName();
+ private FlowObject source;
+ private String name;
+ private String targetName;
- /** Get the source of this Flow */
- FlowObject getSource();
+ /**
+ * JAXB Constructer
+ */
+ public Flow()
+ {
+ }
- /** Get the target for this Flow */
- FlowObject getTarget();
+ /**
+ * Construct a flow with a given target
+ */
+ public Flow(String targetName)
+ {
+ this.targetName = targetName;
+ }
+
+ /**
+ * Get the source flow object
+ */
+ public FlowObject getSource()
+ {
+ return source;
+ }
+
+ /**
+ * Set the source flow object
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlTransient
+ protected void setSource(FlowObject source)
+ {
+ this.source = source;
+ }
+
+ /**
+ * Get the optional name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the optional name
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlAttribute(required = false)
+ protected void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the target name
+ * Note, this MUST NOT leak into the public API.
+ */
+ public String getTargetName()
+ {
+ return targetName;
+ }
+
+ /**
+ * Set the target name
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlAttribute(required = true)
+ protected void setTargetName(String targetName)
+ {
+ this.targetName = targetName;
+ }
+
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -39,7 +39,7 @@
public abstract class FlowObject
{
@XmlTransient
- protected Process process;
+ private Process process;
@XmlTransient
private Object implObject;
@@ -71,7 +71,7 @@
// TODO
public void setProcess(Process process)
{
- if (this.process != null)
+ if (this.process != null && this.process != process)
throw new IllegalStateException("Cannot reassign task to process");
this.process = process;
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageFlow.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageFlow.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/MessageFlow.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -21,8 +21,9 @@
*/
package org.jboss.bpm.model;
+//$Id$
-// $Id$
+import javax.xml.bind.annotation.XmlType;
/**
* A Message Flow is a dashed line that is used to show the flow of messages between two entities that are prepared to send and receive them.
@@ -31,6 +32,21 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-public interface MessageFlow extends Flow
+@XmlType(name="MessageFlow")
+public class MessageFlow extends Flow
{
+ /**
+ * JAXB Constructer
+ */
+ public MessageFlow()
+ {
+ }
+
+ /**
+ * Construct a flow with a given target
+ */
+ public MessageFlow(String targetName)
+ {
+ super(targetName);
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -22,7 +22,6 @@
package org.jboss.bpm.model;
import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
//$Id$
@@ -36,7 +35,6 @@
@XmlType(name = "NamedFlowObject")
public abstract class NamedFlowObject extends FlowObject
{
- @XmlAttribute(required = true)
private String name;
/**
@@ -63,10 +61,11 @@
}
/**
- * Set the name Note, this MUST NOT leak into the public API.
+ * Set the name.
+ * Note, this MUST NOT leak into the public API.
*/
// TODO
- @XmlTransient
+ @XmlAttribute(required = true)
public void setName(String name)
{
if (this.name != null)
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -48,12 +48,13 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-@XmlType(name = "Process")
+@XmlType(name = "Process", propOrder = { "startEvent", "tasks", "endEvents" })
@XmlRootElement(name = "process")
public class Process extends Activity
{
- @XmlElement(name = "flowObject")
- protected List<FlowObject> flowObjects = new ArrayList<FlowObject>();
+ private StartEvent startEvent;
+ private List<Task> tasks = new ArrayList<Task>();
+ private List<EndEvent> endEvents = new ArrayList<EndEvent>();
/**
* Construct an anonymous process
@@ -71,7 +72,7 @@
}
/**
- * Call to initialize fully Note, this MUST NOT leak into the public API.
+ * Call to initialize fully. Note, this MUST NOT leak into the public API.
*/
protected void init(String name)
{
@@ -84,13 +85,10 @@
}
/**
- * Add a flow object Note, this MUST NOT leak into the public API.
+ * Add a flow object. Note, this MUST NOT leak into the public API.
*/
protected void addFlowObject(FlowObject flowObject)
{
- if (flowObject instanceof StartEvent && getStartEventInternal() != null)
- throw new InvalidProcessException("Process cannot have multiple start events: " + flowObject);
-
if (flowObject instanceof NamedFlowObject)
{
String name = ((NamedFlowObject)flowObject).getName();
@@ -98,64 +96,95 @@
throw new NameNotUniqueException("NamedFlowObject: " + name);
}
- flowObjects.add(flowObject);
+ if (flowObject instanceof StartEvent)
+ {
+ setStartEvent((StartEvent)flowObject);
+ }
+ else if (flowObject instanceof EndEvent)
+ {
+ endEvents.add((EndEvent)flowObject);
+ flowObject.setProcess(this);
+ }
+ else if (flowObject instanceof Task)
+ {
+ if (tasks == null)
+ tasks = new ArrayList<Task>();
+
+ tasks.add((Task)flowObject);
+ flowObject.setProcess(this);
+ }
+ else
+ {
+ throw new InvalidProcessException("Unsupported type: " + flowObject);
+ }
}
/**
* Get the start event
*/
- @XmlTransient
public StartEvent getStartEvent()
{
- StartEvent start = getStartEventInternal();
- if (start == null)
+ if (startEvent == null)
throw new InvalidProcessException("Process does not have a start event");
- return start;
+ return startEvent;
}
- private StartEvent getStartEventInternal()
+ /**
+ * Set the start event Note, this MUST NOT leak into the public API.
+ */
+ @XmlElement(name = "start-event")
+ protected void setStartEvent(StartEvent startEvent)
{
- StartEvent start = null;
- for (FlowObject aux : flowObjects)
+ if (this.startEvent != null)
+ throw new InvalidProcessException("Process cannot have multiple start events: " + startEvent);
+
+ startEvent.setProcess(this);
+ this.startEvent = startEvent;
+ }
+
+ /**
+ * Get the set of end events
+ */
+ public List<EndEvent> getEndEvents()
+ {
+ // Lock end events
+ if (endEvents.size() > 0)
{
- if (aux instanceof StartEvent)
- {
- start = (StartEvent)aux;
- break;
- }
+ endEvents = Collections.unmodifiableList(endEvents);
}
- return start;
+ return endEvents;
}
- /** Get the set of end events */
- @XmlTransient
- public List<EndEvent> getEndEvents()
+ /**
+ * Set the start event Note, this MUST NOT leak into the public API.
+ */
+ @XmlElement(name = "end-event")
+ protected void setEndEvents(List<EndEvent> endEvents)
{
- List<EndEvent> ends = getEndEventsInternal();
- if (ends.size() == 0)
- throw new InvalidProcessException("Process does not have end events");
-
- return ends;
+ this.endEvents = endEvents;
}
- private List<EndEvent> getEndEventsInternal()
+ /**
+ * Get the list of tasks
+ */
+ public List<Task> getTasks()
{
- List<EndEvent> ends = new ArrayList<EndEvent>();
- for (FlowObject aux : flowObjects)
+ // Lock tasks
+ if (tasks.size() > 0)
{
- if (aux instanceof EndEvent)
- {
- ends.add((EndEvent)aux);
- }
+ tasks = Collections.unmodifiableList(tasks);
}
- return ends;
+ return tasks;
}
- /** Get the set of flow objects */
- public List<FlowObject> getFlowObjects()
+ /**
+ * Set the tasks Note, this MUST NOT leak into the public API.
+ */
+ @XmlElement(name = "task")
+ protected void setTasks(List<Task> tasks)
{
- return Collections.unmodifiableList(flowObjects);
+ this.tasks = tasks;
}
/** Start the process */
@@ -179,7 +208,7 @@
public NamedFlowObject findFlowObject(String name)
{
NamedFlowObject nfo = null;
- for (FlowObject aux : flowObjects)
+ for (FlowObject aux : getFlowObjects())
{
if (aux instanceof NamedFlowObject && ((NamedFlowObject)aux).getName().equals(name))
{
@@ -190,6 +219,15 @@
return nfo;
}
+ public List<FlowObject> getFlowObjects()
+ {
+ List<FlowObject> flowObjects = new ArrayList<FlowObject>();
+ flowObjects.add(startEvent);
+ flowObjects.addAll(tasks);
+ flowObjects.addAll(endEvents);
+ return flowObjects;
+ }
+
/**
* Get signal for enter
*/
@@ -242,8 +280,7 @@
{
if (result == null)
{
- List<EndEvent> ends = getEndEventsInternal();
- for (EndEvent aux : ends)
+ for (EndEvent aux : endEvents)
{
result = aux.getResult();
if (result != null)
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SequenceFlow.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -21,8 +21,9 @@
*/
package org.jboss.bpm.model;
+//$Id$
-// $Id$
+import javax.xml.bind.annotation.XmlType;
/**
* A Sequence Flow is a solid graphical line that is used to show the order that Activities will be performed in a Process.
@@ -31,6 +32,21 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2008
*/
-public interface SequenceFlow extends Flow
+@XmlType(name="SequenceFlow")
+public class SequenceFlow extends Flow
{
+ /**
+ * JAXB Constructer
+ */
+ public SequenceFlow()
+ {
+ }
+
+ /**
+ * Construct a flow with a given target
+ */
+ public SequenceFlow(String targetName)
+ {
+ super(targetName);
+ }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -23,8 +23,10 @@
//$Id$
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+
/**
* A Start Event indicates where a particular Process will start.
*
@@ -37,6 +39,8 @@
@XmlType(name="StartEvent")
public class StartEvent extends Event
{
+ private Flow outFlow;
+
/**
* Get signal for enter
*/
@@ -52,4 +56,23 @@
{
return new Signal(getProcess(), Signal.Type.EXIT_START_EVENT);
}
+
+ /**
+ * Get the out flow
+ */
+ public Flow getOutFlow()
+ {
+ return outFlow;
+ }
+
+ /**
+ * Set the out flow
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlElement(name = "flow", required = true)
+ protected void setOutFlow(Flow outFlow)
+ {
+ this.outFlow = outFlow;
+ }
+
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -21,6 +21,7 @@
*/
package org.jboss.bpm.model;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
//$Id$
@@ -37,6 +38,8 @@
@XmlType(name="Task")
public class Task extends Activity
{
+ private Flow outFlow;
+
/**
* Construct an anonymous Task
*/
@@ -52,6 +55,24 @@
super(name);
}
+ /**
+ * Get the out flow
+ */
+ public Flow getOutFlow()
+ {
+ return outFlow;
+ }
+
+ /**
+ * Set the out flow
+ * Note, this MUST NOT leak into the public API.
+ */
+ @XmlElement(name = "flow", required = true)
+ protected void setOutFlow(Flow outFlow)
+ {
+ this.outFlow = outFlow;
+ }
+
/** Get signal for enter */
public Signal getEnterSignal()
{
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessMarshaller.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessMarshaller.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessMarshaller.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -43,20 +43,17 @@
{
public void marshallProcess(Process proc, Writer out) throws JAXBException, IOException
{
- StringWriter strwr = new StringWriter();
JAXBContext jaxbContext = JAXBContext.newInstance(Process.class.getPackage().getName());
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
- marshaller.marshal(proc, strwr);
-
// Add xmlns:xsi to the top level element and remove it from all others
+ StringWriter strwr = new StringWriter();
+ marshaller.marshal(proc, strwr);
String str = strwr.toString();
String xsi = " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
str = new StringBuilder(str.replace(xsi, "")).insert(str.indexOf(">"), xsi).toString();
-
- // Write the xml string
out.write(str);
}
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/util/ProcessUnmarshaller.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -28,8 +28,9 @@
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
-import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.EndEvent;
import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Task;
/**
* A JAXB unmarshaller for a Process
@@ -45,10 +46,12 @@
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Process proc = (Process)unmarshaller.unmarshal(xml);
- // Set the process reference
- for (FlowObject fo : proc.getFlowObjects())
- fo.setProcess(proc);
+ for (EndEvent aux : proc.getEndEvents())
+ aux.setProcess(proc);
+ for (Task aux : proc.getTasks())
+ aux.setProcess(proc);
+
return proc;
}
}
Modified: api/trunk/modules/api/src/main/resources/org/jboss/bpm/model/jaxb.index
===================================================================
--- api/trunk/modules/api/src/main/resources/org/jboss/bpm/model/jaxb.index 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/main/resources/org/jboss/bpm/model/jaxb.index 2008-07-10 17:10:40 UTC (rev 1576)
@@ -3,13 +3,16 @@
EndEvent
Event
ExclusiveGateway
+Flow
FlowObject
Gateway
InclusiveGateway
ItermediateEvent
+MessageFlow
NamedFlowObject
ParallelGateway
Process
+SequenceFlow
Signal
StartEvent
SubProcess
Modified: api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java
===================================================================
--- api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/api/src/test/java/org/jboss/bpm/model/ProcessMarshallerTest.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -42,27 +42,35 @@
public void testProcess() throws Exception
{
Process inProc = new Process("myproc");
- inProc.addFlowObject(new StartEvent());
- inProc.addFlowObject(new Task("mytask"));
- inProc.addFlowObject(new EndEvent());
+ StartEvent start = new StartEvent();
+ start.setOutFlow(new SequenceFlow("taskA"));
+ inProc.addFlowObject(start);
+ Task taskA = new Task("taskA");
+ taskA.setOutFlow(new SequenceFlow("end"));
+ inProc.addFlowObject(taskA);
+ EndEvent end = new EndEvent("end");
+ inProc.addFlowObject(end);
StringWriter strwr = new StringWriter();
ProcessMarshaller marshaller = new ProcessMarshaller();
marshaller.marshallProcess(inProc, strwr);
String xml = strwr.toString();
- //System.out.println(xml);
+ System.out.println(xml);
ProcessUnmarshaller unmarshaller = new ProcessUnmarshaller();
Process outProc = unmarshaller.unmarshallProcess(new StringReader(xml));
+ start = outProc.getStartEvent();
+ taskA = (Task)outProc.findFlowObject("taskA");
+ end = outProc.getEndEvents().get(0);
assertEquals(inProc.getName(), outProc.getName());
- assertNotNull(outProc.getStartEvent());
- assertEquals(outProc, outProc.getStartEvent().getProcess());
- assertNotNull(outProc.findFlowObject("mytask"));
- assertEquals(outProc, outProc.findFlowObject("mytask").getProcess());
+ assertNotNull(start);
+ assertEquals(outProc, start.getProcess());
+ assertNotNull(taskA);
+ assertEquals(outProc, taskA.getProcess());
assertEquals(1, outProc.getEndEvents().size());
- assertNotNull(outProc.getEndEvents().get(0));
- assertEquals(outProc, outProc.getEndEvents().get(0).getProcess());
+ assertNotNull(end);
+ assertEquals(outProc, end.getProcess());
}
}
Modified: api/trunk/modules/testsuite/pom.xml
===================================================================
--- api/trunk/modules/testsuite/pom.xml 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/testsuite/pom.xml 2008-07-10 17:10:40 UTC (rev 1576)
@@ -117,23 +117,5 @@
</dependency>
</dependencies>
</profile>
-
- <!--
- Name: skiptests
- Desc: Skips the tests
- -->
- <profile>
- <id>skiptests</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
</profiles>
</project>
\ No newline at end of file
Modified: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/model/ProcessTest.java 2008-07-10 17:10:40 UTC (rev 1576)
@@ -52,9 +52,6 @@
StartEvent start = proc.getStartEvent();
assertNotNull("Start expected", start);
- List<FlowObject> fos = proc.getFlowObjects();
- assertEquals(3, fos.size());
-
NamedFlowObject nfo = proc.findFlowObject("stateA");
assertNotNull("FlowObject expected", nfo);
assertTrue("Task expected", nfo instanceof Task);
Modified: api/trunk/pom.xml
===================================================================
--- api/trunk/pom.xml 2008-07-10 17:10:18 UTC (rev 1575)
+++ api/trunk/pom.xml 2008-07-10 17:10:40 UTC (rev 1576)
@@ -87,5 +87,26 @@
<url>scp://jbpm.dyndns.org/var/www/html/jbpm-site</url>
</site>
</distributionManagement>
+
+ <!-- Profiles -->
+ <profiles>
+ <!--
+ Name: skiptests
+ Desc: Skips the tests
+ -->
+ <profile>
+ <id>skiptests</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
15 years, 10 months