JBoss JBPM SVN: r3344 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/activity and 25 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-12-11 11:47:48 -0500 (Thu, 11 Dec 2008)
New Revision: 3344
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/multiple/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/processinstance/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/end/state/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/exclusive/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/exclusive/conditions/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/exclusive/conditions/ExclusiveConditionsTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/exclusive/expression/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/exclusive/handler/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/states/StateSequenceTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/exclusive/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/exclusive/conditions/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/exclusive/conditions/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/states/process.jpdl.xml
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/activity/ActivityExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/client/ClientExecution.java
jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
jbpm4/trunk/modules/examples/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EndActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/EndBinding.java
jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/EventTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/ExecutionStateTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/SubProcessTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/TransitionBasedConcurrencyTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ExclusiveTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/svc/ProcessServiceTest.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
Log:
more examples
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Execution.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -90,19 +90,12 @@
* of the constants. */
String STATE_INACTIVE = "inactive";
- /** this execution has ended normally. Make sure that comparisons are
+ /** this execution has ended. Make sure that comparisons are
* done with .equals and not with '==' because if executions are
* loaded from persistent storage, a new string is created instead
* of the constants. */
String STATE_ENDED = "ended";
- /** this execution was cancelled with the {@link #cancel()}
- * method before normal execution ended. Make sure that comparisons are
- * done with .equals and not with '==' because if executions are
- * loaded from persistent storage, a new string is created instead
- * of the constants. */
- String STATE_CANCELLED = "cancelled";
-
/** indicates that this execution is temporary suspended with the
* {@link #suspend()} method. Human tasks of a suspended execution
* shouldn't show up in people's task list and timers of suspended
@@ -144,10 +137,7 @@
/** is this execution {@link #lock(String) locked} ? This is the inverse of {@link #isActive()}. */
boolean isLocked();
- /** is this execution ended or cancelled ? */
- boolean isFinished();
-
- /** is this execution ended normally ? */
+ /** is this execution ended */
boolean isEnded();
/** is this execution suspended ? */
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/activity/ActivityExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/activity/ActivityExecution.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/activity/ActivityExecution.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -200,12 +200,8 @@
*
* <p>This method should not be called in {@link Activity}s. It can be called from
* outside the process execution and in {@link ExternalActivity}s. </p> */
- void stop();
+ void end();
- /** ends this execution and assigns the state {@link #STATE_CANCELLED}.
- * @see #stop(String) */
- void cancel();
-
/** ends this execution and all it's child executions with a user defined
* status.
*
@@ -214,8 +210,15 @@
* side effects.</p>
*
* <p>The execution will be removed from it's parent.</p> */
- void stop(String state);
+ void end(String state);
+ /** ends the given execution and all it's child executions. */
+ void end(OpenExecution executionToEnd);
+
+ /** ends the given execution and all it's child executions with a user defined
+ * status. */
+ void end(OpenExecution executionToEnd, String state);
+
// firing events ////////////////////////////////////////////////////////////
/** fires the event on the given eventSource and then propagates the event
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/client/ClientExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/client/ClientExecution.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/client/ClientExecution.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -36,30 +36,20 @@
*/
public interface ClientExecution extends OpenExecution {
- // stop /////////////////////////////////////////////////////////////////////
-
// ending an execution //////////////////////////////////////////////////////
/** ends this execution and all of its child executions.
*
- * <p>All child executions will be stopped and removed. This execution
+ * <p>All child executions will be ended and removed. This execution
* will not be removed from its parent.</p>
*
* <p>This method should not be called in {@link Activity}s. It can be called from
* outside the process execution and in {@link ExternalActivity}s. </p> */
- void stop();
+ void end();
- /** ends this execution and assigns the state {@link #STATE_CANCELLED}.
- * @see #stop(String) */
- void cancel();
-
/** ends this execution and all it's child executions with a user defined
- * status.
- *
- *
- *
- * Giving states {@link */
- void stop(String state);
+ * status. */
+ void end(String state);
// signal ///////////////////////////////////////////////////////////////////
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl.xsd 2008-12-11 16:47:48 UTC (rev 3344)
@@ -118,6 +118,9 @@
</restriction>
</simpleType>
</attribute>
+ <attribute name="state" default="ended" type="string">
+ <annotation><documentation>sets the state of the execution explicitely</documentation></annotation>
+ </attribute>
</complexType>
</element>
@@ -148,7 +151,9 @@
</documentation></annotation>
<complexType>
<sequence>
- <element ref="tns:flow" minOccurs="0" maxOccurs="unbounded" />
+ <element ref="tns:flow" minOccurs="0" maxOccurs="unbounded">
+ <!-- TODO add conditions -->
+ </element>
<element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
<annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
</element>
Property changes on: jbpm4/trunk/modules/examples
___________________________________________________________________
Name: svn:ignore
+ target
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/exclusive/conditions/ExclusiveConditionsTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/exclusive/conditions/ExclusiveConditionsTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/exclusive/conditions/ExclusiveConditionsTest.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.exclusive.conditions;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.Execution;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveConditionsTest extends DbTestCase {
+
+ public void testExclusiveConditionsGood() {
+ deployJpdlResource("org/jbpm/examples/exclusive/conditions/process.jpdl.xml");
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("content", "good");
+ Execution execution = executionService.startExecutionByKey("ExclusiveConditions", variables);
+ assertEquals("submit document", execution.getNodeName());
+ }
+
+ public void testExclusiveConditionsBad() {
+ deployJpdlResource("org/jbpm/examples/exclusive/conditions/process.jpdl.xml");
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("content", "bad");
+ Execution execution = executionService.startExecutionByKey("ExclusiveConditions", variables);
+ assertEquals("try again", execution.getNodeName());
+ }
+
+ public void testExclusiveConditionsUgly() {
+ deployJpdlResource("org/jbpm/examples/exclusive/conditions/process.jpdl.xml");
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("content", "ugly");
+ Execution execution = executionService.startExecutionByKey("ExclusiveConditions", variables);
+ assertEquals("give up", execution.getNodeName());
+ }
+
+}
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/state/choice/StateChoiceTest.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.state.choice;
+
+import org.jbpm.Execution;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StateChoiceTest extends DbTestCase {
+
+ public void testStateChoiceAccept() {
+ deployJpdlResource("org/jbpm/examples/state/choice/process.jpdl.xml");
+
+ Execution execution = executionService.startExecutionByKey("StateChoice");
+ String executionId = execution.getId();
+ execution = executionService.signalExecutionById(executionId, "accept");
+ assertEquals("submit document", execution.getNodeName());
+ }
+
+ public void testStateChoiceReject() {
+ deployJpdlResource("org/jbpm/examples/state/choice/process.jpdl.xml");
+
+ Execution execution = executionService.startExecutionByKey("StateChoice");
+ String executionId = execution.getId();
+ execution = executionService.signalExecutionById(executionId, "reject");
+ assertEquals("try again", execution.getNodeName());
+ }
+}
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/states/StateSequenceTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/states/StateSequenceTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/states/StateSequenceTest.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.state.sequence;
+
+import org.jbpm.Execution;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StateSequenceTest extends DbTestCase {
+
+ public void testWaitStatesSequence() {
+ deployJpdlResource("org/jbpm/examples/state/sequence/process.jpdl.xml");
+
+ Execution execution = executionService.startExecutionByKey("StateSequence");
+ assertEquals("a", execution.getNodeName());
+
+ String executionId = execution.getId();
+ execution = executionService.signalExecutionById(executionId);
+ assertEquals("b", execution.getNodeName());
+
+ execution = executionService.signalExecutionById(executionId);
+ assertEquals("c", execution.getNodeName());
+ }
+
+}
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/exclusive/conditions/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/exclusive/conditions/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/exclusive/conditions/process.jpdl.xml 2008-12-11 16:47:48 UTC (rev 3344)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="ExclusiveConditions" >
+
+ <start>
+ <flow to="evaluate document" />
+ </start>
+
+ <exclusive name="evaluate document">
+ <flow to="submit document">
+ <condition expr="#{content=="good"}" />
+ </flow>
+ <flow to="try again">
+ <condition expr="#{content=="bad"}" />
+ </flow>
+ <flow to="give up" />
+ </exclusive>
+
+ <state name="submit document" />
+
+ <state name="try again" />
+
+ <state name="give up" />
+
+</process>
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/state/choice/process.jpdl.xml 2008-12-11 16:47:48 UTC (rev 3344)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="StateChoice" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <flow to="wait for response" />
+ </start>
+
+ <state name="wait for response">
+ <flow name="accept" to="submit document" />
+ <flow name="reject" to="try again" />
+ </state>
+
+ <state name="submit document" />
+
+ <state name="try again" />
+
+</process>
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/states/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/states/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/states/process.jpdl.xml 2008-12-11 16:47:48 UTC (rev 3344)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="StateSequence" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <flow to="a" />
+ </start>
+
+ <state name="a">
+ <flow to="b" />
+ </state>
+
+ <state name="b">
+ <flow to="c" />
+ </state>
+
+ <state name="c" />
+
+</process>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EndActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EndActivity.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EndActivity.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -22,6 +22,7 @@
package org.jbpm.jpdl.activity;
import org.jbpm.activity.ActivityExecution;
+import org.jbpm.model.OpenExecution;
/**
@@ -30,8 +31,30 @@
public class EndActivity extends JpdlActivity {
private static final long serialVersionUID = 1L;
+
+ protected boolean endProcessInstance = true;
+ protected String state = null;
+ public EndActivity() {
+ }
+
+ public EndActivity(boolean endProcessInstance, String state) {
+ this.endProcessInstance = endProcessInstance;
+ this.state = state;
+ }
+
public void execute(ActivityExecution execution) {
- execution.stop();
+ OpenExecution executionToEnd = null;
+ if (endProcessInstance) {
+ executionToEnd = execution.getProcessInstance();
+ } else {
+ executionToEnd = execution;
+ }
+
+ if (state==null) {
+ execution.end(executionToEnd);
+ } else {
+ execution.end(executionToEnd, state);
+ }
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/EndBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/EndBinding.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/EndBinding.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -22,6 +22,7 @@
package org.jbpm.jpdl.xml;
import org.jbpm.jpdl.activity.EndActivity;
+import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -37,6 +38,15 @@
}
public Object parse(Element element, Parse parse, Parser parser) {
- return new EndActivity();
+
+ boolean endProcessInstance = true;
+ String ends = XmlUtil.attribute(element, "ends", false, parse);
+ if ("execution".equalsIgnoreCase(ends)) {
+ endProcessInstance = false;
+ }
+
+ String state = XmlUtil.attribute(element, "state", false, parse);
+
+ return new EndActivity(endProcessInstance, state);
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2008-12-11 16:47:48 UTC (rev 3344)
@@ -23,7 +23,7 @@
<property name="lang" column="LANG_" />
</subclass>
<subclass name="org.jbpm.jpdl.activity.ExclusiveHandlerActivity" discriminator-value="excl-handler">
- <property name="exclusiveHandlerName" column="EXCLNAME_" />
+ <property name="exclusiveHandlerName" column="TEXT_" />
<many-to-one name="exclusiveHandlerDescriptor"
column="EXCLDESCR_"
cascade="all"
@@ -32,7 +32,10 @@
index="IDX_ACT_EXCLDESCR" />
</subclass>
<subclass name="org.jbpm.jpdl.activity.StateActivity" discriminator-value="state" />
- <subclass name="org.jbpm.jpdl.activity.EndActivity" discriminator-value="end" />
+ <subclass name="org.jbpm.jpdl.activity.EndActivity" discriminator-value="end">
+ <property name="endProcessInstance" column="ENDPI_" />
+ <property name="state" column="TEXT_" />
+ </subclass>
</class>
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -269,7 +269,7 @@
getParent().setPreviousTransition(getPreviousTransition());
getParent().setPreviousNode(getPreviousNode());
- stop();
+ end();
parent.removeExecution(this);
return parent;
@@ -289,11 +289,11 @@
// execution method : end ///////////////////////////////////////////////////
- public void stop() {
- stop(Execution.STATE_ENDED);
+ public void end() {
+ end(Execution.STATE_ENDED);
}
- public void stop(String state) {
+ public void end(String state) {
if (state==null) {
throw new JbpmException("state is null");
}
@@ -316,7 +316,7 @@
// end all child executions
if (executions!=null) {
for (ExecutionImpl child: executions) {
- child.stop(state);
+ child.end(state);
}
}
@@ -342,11 +342,16 @@
}
}
}
+
+ public void end(OpenExecution executionToEnd) {
+ ((ExecutionImpl)executionToEnd).end();
+ }
- public void cancel() {
- stop(Execution.STATE_CANCELLED);
+ public void end(OpenExecution executionToEnd, String state) {
+ ((ExecutionImpl)executionToEnd).end(state);
}
+
// execution method : suspend and resume ////////////////////////////////////
/** @see Execution#suspend() */
@@ -505,7 +510,7 @@
// throw new PvmException("don't know how to proceed");
// or to end the execution. Because of convenience for testing,
// I opted to end the execution.
- stop();
+ end();
}
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -116,7 +116,7 @@
}
public void createVariable(String key, Object value, String typeName, Type type) {
- if (isFinished()) {
+ if (isEnded()) {
throw new JbpmException("can't create variable '"+key+"' on "+this+": "+state);
}
@@ -174,7 +174,7 @@
}
public void setVariable(String key, Object value) {
- if (isFinished()) {
+ if (isEnded()) {
throw new JbpmException("can't update variable '"+key+"' on "+this+": "+state);
}
Variable variable = getVariableObject(key);
@@ -277,7 +277,7 @@
}
public boolean removeVariable(String key) {
- if (isFinished()) {
+ if (isEnded()) {
throw new JbpmException("can't remove variable '"+key+"' on "+this+": "+state);
}
@@ -451,12 +451,6 @@
return Execution.STATE_ENDED.equals(state);
}
- /** @see Execution#isFinished() */
- public boolean isFinished() {
- return Execution.STATE_ENDED.equals(state)
- || Execution.STATE_CANCELLED.equals(state);
- }
-
// customizable methods /////////////////////////////////////////////////////
public ExecutionImpl getProcessInstance() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -306,10 +306,19 @@
/** convenience method to combine extraction of a string attribute value.
*
+ * If the attribute exists, it is returned. If the attribute is not present, null
+ * is returned. The attribute is not present and it is required,
+ * a problem will be added to the parse. */
+ public static String attribute(Element element, String attributeName, boolean required, Parse parse) {
+ return attribute(element, attributeName, required, parse, null);
+ }
+
+ /** convenience method to combine extraction of a string attribute value.
+ *
* If the attribute exists, it is returned. If the attribute is not present, the
* defaultValue is returned. The attribute is not present and it is required,
* a problem will be added to the parse. */
- public static String attribute(Element element, String attributeName, boolean required, Parse parse) {
+ public static String attribute(Element element, String attributeName, boolean required, Parse parse, String defaultValue) {
if (element.hasAttribute(attributeName)) {
String value = element.getAttribute(attributeName);
if (required && "".equals(value)) {
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/EventTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/EventTest.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/EventTest.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -224,7 +224,7 @@
public static class EndState implements Activity {
private static final long serialVersionUID = 1L;
public void execute(ActivityExecution execution) throws Exception {
- execution.stop();
+ execution.end();
}
}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/ExecutionStateTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/ExecutionStateTest.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/ExecutionStateTest.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -122,7 +122,7 @@
}
}
- public void testCancel() {
+ public void testCustomEndState() {
ClientProcessDefinition processDefinition = ProcessFactory.build()
.node("a").initial().behaviour(new AutomaticActivity())
.transition().to("b")
@@ -133,32 +133,8 @@
ClientProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
- processInstance.cancel();
+ processInstance.end("error");
- assertEquals(Execution.STATE_CANCELLED, processInstance.getState());
-
- try {
- processInstance.signal();
- fail("expected exception");
- } catch (JbpmException e) {
- // OK
- assertTextPresent("process-instance is not active: cancelled", e.getMessage());
- }
- }
-
- public void testCustomState() {
- ClientProcessDefinition processDefinition = ProcessFactory.build()
- .node("a").initial().behaviour(new AutomaticActivity())
- .transition().to("b")
- .node("b").behaviour(new WaitState())
- .transition().to("c")
- .node("c").behaviour(new AutomaticActivity())
- .done();
-
- ClientProcessInstance processInstance = processDefinition.createProcessInstance();
- processInstance.start();
- processInstance.stop("error");
-
assertEquals("error", processInstance.getState());
try {
@@ -183,35 +159,35 @@
processInstance.start();
try {
- processInstance.stop("active");
+ processInstance.end("active");
fail("expected exception");
} catch (JbpmException e) {
// OK
assertTextPresent("invalid end state: active", e.getMessage());
}
try {
- processInstance.stop("suspended");
+ processInstance.end("suspended");
fail("expected exception");
} catch (JbpmException e) {
// OK
assertTextPresent("invalid end state: suspended", e.getMessage());
}
try {
- processInstance.stop("created");
+ processInstance.end("created");
fail("expected exception");
} catch (JbpmException e) {
// OK
assertTextPresent("invalid end state: created", e.getMessage());
}
try {
- processInstance.stop("async");
+ processInstance.end("async");
fail("expected exception");
} catch (JbpmException e) {
// OK
assertTextPresent("invalid end state: async", e.getMessage());
}
try {
- processInstance.stop("inactive");
+ processInstance.end("inactive");
fail("expected exception");
} catch (JbpmException e) {
// OK
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/SubProcessTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/SubProcessTest.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/SubProcessTest.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -70,7 +70,7 @@
public static class EndState implements Activity {
public void execute(ActivityExecution execution) throws Exception {
- execution.stop();
+ execution.end();
}
}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/TransitionBasedConcurrencyTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/TransitionBasedConcurrencyTest.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/basicfeatures/TransitionBasedConcurrencyTest.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -48,7 +48,7 @@
public void execute(ActivityExecution execution) throws Exception {
// end the child execution execution
// this will also remove the execution from it's parent
- execution.stop();
+ execution.end();
Node join = execution.getNode();
List<OpenExecution> joinedExecutions = findJoinedExecutions(execution, join);
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ExclusiveTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ExclusiveTest.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ExclusiveTest.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -60,42 +60,6 @@
assertEquals("Small car", execution.getNodeName());
}
- public static class DistanceHandler implements ExclusiveHandler {
- public String select(OpenExecution execution) {
- String distance = (String) execution.getVariable("distance");
- if (new Integer(distance) < 10) {
- return "nearby";
- }
- return "far";
- }
- }
-
- public void testExclusiveHandler() {
- deployJpdlXmlString(
- "<process name='Poolcar'>" +
- " <start>" +
- " <flow to='How far?' />" +
- " </start>" +
- " <exclusive name='How far?'>" +
- " <handler class='"+DistanceHandler.class.getName()+"' />" +
- " <flow name='far' to='Big car' />" +
- " <flow name='nearby' to='Small car' />" +
- " </exclusive>" +
- " <state name='Big car' />" +
- " <state name='Small car' />" +
- "</process>"
- );
-
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("distance", "69");
- Execution execution = executionService.startExecutionByKey("Poolcar", variables);
- assertEquals("Big car", execution.getNodeName());
-
- variables.put("distance", "3");
- execution = executionService.startExecutionByKey("Poolcar", variables);
- assertEquals("Small car", execution.getNodeName());
- }
-
public void testExclusiveWithConditions() {
deployJpdlXmlString(
"<process name='Poolcar'>" +
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/svc/ProcessServiceTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/svc/ProcessServiceTest.java 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/svc/ProcessServiceTest.java 2008-12-11 16:47:48 UTC (rev 3344)
@@ -339,7 +339,6 @@
assertEquals("end", execution.getNodeName());
assertTrue(execution.isEnded());
- assertTrue(execution.isFinished());
assertFalse(execution.isActive());
}
@@ -353,7 +352,6 @@
Execution execution = executionService.startExecutionByKey("minimal");
assertTrue(execution.isEnded());
- assertTrue(execution.isFinished());
assertFalse(execution.isActive());
}
}
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml 2008-12-11 16:44:51 UTC (rev 3343)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml 2008-12-11 16:47:48 UTC (rev 3344)
@@ -168,9 +168,76 @@
<section id="state">
<title><literal>state</literal></title>
<para>A wait state. Process execution will wait until an external trigger is
- provided through the API.
+ provided through the API. Apart from the <link linkend="commonactivitycontent">
+ common activity content</link>, <literal>state</literal> doesn't have any extra
+ attributes or elements.
</para>
- <para>Example: TODO</para>
+ <section id="statesequence">
+ <title><literal>state</literal> sequence</title>
+ <para>Let's look at an example which shows states connected with flows
+ as a sequence</para>
+ <programlisting><process name="StateSequence" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <flow to="a" />
+ </start>
+
+ <state name="a">
+ <flow to="b" />
+ </state>
+
+ <state name="b">
+ <flow to="c" />
+ </state>
+
+ <state name="c" />
+
+</process></programlisting>
+ <para>After you start an execution like this:</para>
+ <programlisting>Execution execution = executionService.startExecutionByKey("StateSequence");</programlisting>
+ <para>the created process instance will be positioned in
+ state <literal>a</literal>. Providing an external trigger can
+ be done with the <literal>signalExecution</literal> methods.</para>
+ <programlisting>String executionId = execution.getId();
+execution = executionService.signalExecutionById(executionId);</programlisting>
+ </section>
+ <section id="statechoice">
+ <title><literal>state</literal> choice</title>
+ <para>In this second example with states, we'll show how you can use a
+ <literal>state</literal> can be used to feed in an external choice of
+ the path to take.
+ </para>
+ <programlisting><process name="StateChoice" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <flow to="wait for response" />
+ </start>
+
+ <state name="wait for response">
+ <flow name="accept" to="submit document" />
+ <flow name="reject" to="try again" />
+ </state>
+
+ <state name="submit document" />
+
+ <state name="try again" />
+
+</process></programlisting>
+ <para>Let's start a new process instance for this process definition:</para>
+ <programlisting>Execution execution = executionService.startExecutionByKey("StateSequence");</programlisting>
+ <para>Now, the execution is arrived in the <literal>wait for response</literal>.
+ The execution will wait there until an external trigger is given. In case
+ a <literal>state</literal> has multiple outgoing flows, the signalName given
+ in the external trigger will be matched against the name of the outgoing flow
+ to take. So when we provide signalName <literal>accept</literal> like this:
+ </para>
+ <programlisting>executionService.signalExecutionById(executionId, "accept");</programlisting>
+ <para>Then the execution will continue over the outgoing flow named
+ <literal>accept</literal>. Analogue, when signalName <literal>reject</literal>
+ is given in the signalExecutionXxx methods, the execution will continue over
+ the outgoing flow named reject.
+ </para>
+ </section>
</section>
<section id="exclusive">
@@ -181,6 +248,73 @@
</para>
<para>An exclusive activity should be configured in one of the three following ways:
</para>
+
+ <section id="exclusiveconditions">
+ <title>Exclusive conditions</title>
+ <para>An exclusive with conditions on the flows evaluates the condition in each flow.
+ The first flow for which the nested condition expression resolves to true or which does
+ not have a condition is taken.
+ </para>
+ <table><title><literal>exclusive.flow.condition</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>expr</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>script that will be evaluated in the specified
+ expression language.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>lang</literal></entry>
+ <entry>expression language</entry>
+ <entry>the <literal>default-expression-language</literal> taken from the <link linkend="scripting"><literal>script-manager</literal> configuration</link></entry>
+ <entry>optional</entry>
+ <entry>the language in which <literal>expr</literal> is
+ to be evaluated.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>Example:
+ </para>
+ <programlisting><process name="ExclusiveConditions" >
+
+ <start>
+ <flow to="evaluate document" />
+ </start>
+
+ <exclusive name="evaluate document">
+ <flow to="submit document">
+ <emphasis role="bold"><condition expr="#{content=="good"}" /></emphasis>
+ </flow>
+ <flow to="try again">
+ <emphasis role="bold"><condition expr="#{content=="not so good"}" /></emphasis>
+ </flow>
+ <flow to="give up" />
+ </exclusive>
+
+ <state name="submit document" />
+
+ <state name="try again" />
+
+ <state name="give up" />
+
+</process></programlisting>
+ </section>
+
<section id="exclusiveexpression">
<title>Exclusive expression</title>
<para>An exclusive expression evaluates to a String representing the name of
@@ -200,7 +334,7 @@
<tbody>
<row>
<entry><literal>expr</literal></entry>
- <entry>script</entry>
+ <entry>expression</entry>
<entry></entry>
<entry><emphasis role="bold">required</emphasis></entry>
<entry>script that will be evaluated in the specified
@@ -232,19 +366,121 @@
<state name="Big car" />
<state name="Small car" />
</process></programlisting>
- </section>
- <para>When you start an new process instance like this
- </para>
- <programlisting>Map<String, Object> variables = new HashMap<String, Object>();
+ <para>When you start an new process instance like this
+ </para>
+ <programlisting>Map<String, Object> variables = new HashMap<String, Object>();
variables.put("distance", "far");
Execution execution = executionService.startExecutionByKey("Poolcar", variables);</programlisting>
- <para>then the new execution will go to node <literal>Big car</literal>.</para>
+ <para>then the new execution will go to node <literal>Big car</literal>.</para>
+ </section>
+
+ <section id="exclusivehandler">
+ <title>Exclusive handler</title>
+ <para>An exclusive handler is a java class that implements the
+ <literal>ExclusiveHandler</literal> interface. The exclusive handler
+ will be responsible for selecting the name of the outgoing flow.
+ </para>
+ <programlisting>public interface ExclusiveHandler {
+ String select(OpenExecution execution);
+}</programlisting>
+ <para>The handler is specified as a sub element of the exclusive</para>
+ <table><title><literal>exclusive.handler</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>class</literal></entry>
+ <entry>classname</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>fully qualified classname of the handler implementation class.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>Here's an example process of an exclusive using an ExclusiveHandler:</para>
+ <programlisting><process name="ExclusiveHandler">
+
+ <start>
+ <flow to="evaluate document" />
+ </start>
+
+ <exclusive name="evaluate document">
+ <handler class="org.jbpm.examples.exclusive.handler.ContentEvaluation" />
+ <flow name="good" to="submit document" />
+ <flow name="bad" to="try again" />
+ <flow name="ugly" to="give up" />
+ </exclusive>
+
+ <state name="submit document" />
+
+ <state name="try again" />
+
+ <state name="give up" />
+
+</process></programlisting>
+ <para>The ContentEvaluation class looks like this</para>
+ <programlisting>public class ContentEvaluation implements ExclusiveHandler {
+
+ public String select(OpenExecution execution) {
+ String content = (String) execution.getVariable("content");
+ if (content.equals("you're great")) {
+ return "good";
+ }
+ if (content.equals("you gotta improve")) {
+ return "bad";
+ }
+ return "ugly";
+ }
+}</programlisting>
+ <para>Now, when we start a process instance and supply value
+ <literal>you're great</literal> for variable content, then the
+ ContentEvaluation will return String <literal>good</literal> and
+ the process instance will arrive in node <literal>Submit document</literal>.
+ </para>
+ </section>
+
</section>
<section id="end">
<title><literal>end</literal></title>
<para>Ends the execution.
</para>
+ <section id="endprocessinstance">
+ <title><literal>end</literal> process instance</title>
+ <para>By default, an end activity will end the complete
+ process instance. In case multiple concurrent executions
+ are still active within the same process instance, all of
+ them will be ended.
+ </para>
+ </section>
+ <section id="endexecution">
+ <title><literal>end</literal> execution</title>
+ <para>Only the execution that arrives in the
+ end activity will be ended and other concurrent executions
+ should be left active. To get this behaviour, set
+ attribute <literal>ends="execution"</literal>
+ </para>
+ </section>
+ <section id="endmultiple">
+ <title><literal>end</literal> multiple</title>
+ <para>TODO
+ </para>
+ </section>
+ <section id="endstate">
+ <title><literal>end</literal> state</title>
+ <para>TODO
+ </para>
+ </section>
</section>
<section id="commonactivitycontents">
17 years, 4 months
JBoss JBPM SVN: r3343 - jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms.
by do-not-reply@jboss.org
Author: camunda
Date: 2008-12-11 11:44:51 -0500 (Thu, 11 Dec 2008)
New Revision: 3343
Modified:
jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageService.java
Log:
added hook to modify JMS message before sending, this allows overwriting and adding additional properties to the JMS message
Modified: jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageService.java
===================================================================
--- jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageService.java 2008-12-11 16:28:14 UTC (rev 3342)
+++ jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageService.java 2008-12-11 16:44:51 UTC (rev 3343)
@@ -80,12 +80,22 @@
if (job.getTaskInstance()!=null) {
message.setLongProperty("taskInstanceId", job.getTaskInstance().getId());
}
+ modifyMessage(message, job);
getMessageProducer().send(message);
} catch (JMSException e) {
throw new JbpmException("couldn't send jms message", e);
}
}
+ /**
+ * Hook to modify the message, e.g. adding additional properties
+ * to the header required by the own application. One possible
+ * use case is to rescue the actor id over the "JMS" intermezzo
+ * of asynchronous continuations.
+ */
+ public void modifyMessage(Message message, Job job) throws JMSException {
+ }
+
public void close() {
JbpmException exception = null;
17 years, 4 months
JBoss JBPM SVN: r3342 - in jbpm3/trunk/modules/enterprise: src/main/java/org/jbpm/msg/jms and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-11 11:28:14 -0500 (Thu, 11 Dec 2008)
New Revision: 3342
Modified:
jbpm3/trunk/modules/enterprise/.classpath
jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageServiceFactory.java
Log:
Fix JMS JNDI names
Modified: jbpm3/trunk/modules/enterprise/.classpath
===================================================================
--- jbpm3/trunk/modules/enterprise/.classpath 2008-12-11 15:13:58 UTC (rev 3341)
+++ jbpm3/trunk/modules/enterprise/.classpath 2008-12-11 16:28:14 UTC (rev 3342)
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageServiceFactory.java
===================================================================
--- jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageServiceFactory.java 2008-12-11 15:13:58 UTC (rev 3341)
+++ jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageServiceFactory.java 2008-12-11 16:28:14 UTC (rev 3342)
@@ -59,8 +59,8 @@
private static final long serialVersionUID = 1L;
String connectionFactoryJndiName = "java:JmsXA";
- String destinationJndiName = "java:queue/JbpmJobQueue";
- String commandDestinationJndiName = "java:queue/JbpmCommandQueue";
+ String destinationJndiName = "queue/JbpmJobQueue";
+ String commandDestinationJndiName = "queue/JbpmCommandQueue";
boolean isCommitEnabled = false;
private ConnectionFactory connectionFactory;
17 years, 4 months
JBoss JBPM SVN: r3341 - in projects/gwt-console/trunk/server/src: test/java/org/jboss/bpm/console/server and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-11 10:13:58 -0500 (Thu, 11 Dec 2008)
New Revision: 3341
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java
Log:
Fix procInst list with suspended
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-12-11 15:12:23 UTC (rev 3340)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-12-11 15:13:58 UTC (rev 3341)
@@ -31,8 +31,8 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.api.model.Gateway;
import org.jboss.bpm.api.model.Node;
+import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.model.ProcessInstance;
-import org.jboss.bpm.api.model.ProcessDefinition;
import org.jboss.bpm.api.model.SequenceFlow;
import org.jboss.bpm.api.model.SingleOutFlowSupport;
import org.jboss.bpm.api.model.ProcessInstance.ProcessStatus;
@@ -125,15 +125,19 @@
log.info("getProcessInstances: " + procDef);
ProcessInstanceService procService = getProcessService();
- Iterator<ObjectName> itProc = procService.getInstance(procDef.getKey(), ProcessStatus.Active).iterator();
+ Iterator<ObjectName> itProc = procService.getInstance(procDef.getKey(), null).iterator();
while (itProc.hasNext())
{
ObjectName procID = itProc.next();
ProcessInstance proc = procService.getInstance(procID);
-
+
log.info(proc);
- results.add(adaptProcess(proc));
+ ProcessStatus status = proc.getProcessStatus();
+ if (status == ProcessStatus.Active || status == ProcessStatus.Suspended)
+ {
+ results.add(adaptProcess(proc));
+ }
}
return results;
@@ -261,9 +265,7 @@
Long procDefID = adaptKey(proc.getProcessDefinition().getKey());
Long procID = adaptKey(proc.getKey());
- // The BPM Spec does not (yet) have the notion of a suspended Process
- boolean suspended = false;
-
+ boolean suspended = proc.getProcessStatus() == ProcessStatus.Suspended;
ProcessInstanceRef procRef = new ProcessInstanceRef(procID, procDefID, proc.getStartDate(), proc.getEndDate(), suspended);
Token rootToken = proc.getRootToken();
Modified: projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java
===================================================================
--- projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java 2008-12-11 15:12:23 UTC (rev 3340)
+++ projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/ProcessManagementTest.java 2008-12-11 15:13:58 UTC (rev 3341)
@@ -21,13 +21,11 @@
*/
package org.jboss.bpm.console.server;
-import net.sf.json.JSONObject;
-import org.jboss.bpm.console.client.model.*;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRefWrapper;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRefWrapper;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
/**
* Tests process management functionality.
*
@@ -35,87 +33,71 @@
*/
public class ProcessManagementTest extends BaseTC
{
+ /*
+ * Checks the following reqiorements:<br>
+ * <ul>
+ * <li> Process deployment
+ * <li> Create instance
+ * <li> Suspend instance
+ * <li> End an instance
+ * </ul>
+ */
+ public void testProcessDefinitionList() throws Exception
+ {
+ String response = HTTP.get(SERVER_URL + "/process/definitions", DEFAULT_CREDENTIALS);
- /**
- * Checks the following reqiorements:<br>
- *
- * <ul>
- * <li> Process deployment
- * <li> Create instance
- * <li> Suspend instance
- * <li> End an instance
- * </ul>
- *
- * @throws Exception
- */
- public void testProcessDefinitionList() throws Exception
- {
- String response = HTTP.get(
- SERVER_URL + "/process/definitions", DEFAULT_CREDENTIALS
- );
+ ProcessDefinitionRefWrapper dto = unmarshallProcessDefinitionList(response);
- ProcessDefinitionRefWrapper dto = unmarshallProcessDefinitionList(response);
+ ProcessDefinitionRef match = null;
+ for (ProcessDefinitionRef def : dto.getDefinitions())
+ {
+ if (def.equals(testDeploymentRef))
+ match = def;
+ }
- ProcessDefinitionRef match = null;
- for(ProcessDefinitionRef def : dto.getDefinitions())
- {
- if(def.equals(testDeploymentRef))
- match = def;
- }
+ assertNotNull(match);
- assertNotNull(match);
+ }
- }
+ /*
+ * Test instance creation, suspend, resume and deletion.
+ */
+ public void testInstanceOperations() throws Exception
+ {
+ ProcessInstanceRef newInstanceRef = createNewProcessInstance();
- /**
- * Test instance creation, suspend, resume and deletion.
- *
- * @throws Exception
- */
- public void testInstanceOperations() throws Exception
- {
- ProcessInstanceRef newInstanceRef = createNewProcessInstance();
+ // ------- Suspend it
- // ------- Suspend it
+ newInstanceRef.setState(ProcessInstanceRef.STATE.SUSPENDED);
+ HTTP.post(SERVER_URL + "/process/instances/" + newInstanceRef.getInstanceId() + "/state/" + newInstanceRef.getState(), EMPTY, DEFAULT_CREDENTIALS);
- newInstanceRef.setState(ProcessInstanceRef.STATE.SUSPENDED);
- HTTP.post(
- SERVER_URL + "/process/instances/"+newInstanceRef.getInstanceId()+"/state/"+newInstanceRef.getState(),
- EMPTY, DEFAULT_CREDENTIALS
- );
+ // ------- Verify
- // ------- Verify
+ ProcessInstanceRefWrapper instanceList = getInstanceList(testDeploymentRef);
+ assertFalse(instanceList.getInstances().isEmpty());
+ assertTrue(instanceList.getTotalCount() == 1);
- ProcessInstanceRefWrapper instanceList = getInstanceList(testDeploymentRef);
- assertFalse(instanceList.getInstances().isEmpty());
- assertTrue(instanceList.getTotalCount()==1);
-
- ProcessInstanceRef match = null;
- for(ProcessInstanceRef ref : instanceList.getInstances())
+ ProcessInstanceRef match = null;
+ for (ProcessInstanceRef ref : instanceList.getInstances())
+ {
+ if (ref.equals(newInstanceRef))
{
- if(ref.equals(newInstanceRef))
- {
- match = ref;
- break;
- }
+ match = ref;
+ break;
}
+ }
- assertNotNull(match);
- assertEquals(ProcessInstanceRef.STATE.SUSPENDED, match.getState());
+ assertNotNull(match);
+ assertEquals(ProcessInstanceRef.STATE.SUSPENDED, match.getState());
- // end and verify
- newInstanceRef.setState(ProcessInstanceRef.STATE.ENDED);
- HTTP.post(
- SERVER_URL + "/process/instances/"+newInstanceRef.getInstanceId()+"/state/"+newInstanceRef.getState(),
- EMPTY, DEFAULT_CREDENTIALS
- );
+ // end and verify
+ newInstanceRef.setState(ProcessInstanceRef.STATE.ENDED);
+ HTTP.post(SERVER_URL + "/process/instances/" + newInstanceRef.getInstanceId() + "/state/" + newInstanceRef.getState(), EMPTY, DEFAULT_CREDENTIALS);
- // refresh instance list
- instanceList = getInstanceList(testDeploymentRef);
- assertTrue(instanceList.getInstances().isEmpty());
+ // refresh instance list
+ instanceList = getInstanceList(testDeploymentRef);
+ assertTrue(instanceList.getInstances().isEmpty());
+ }
-
- }
-
}
17 years, 4 months
JBoss JBPM SVN: r3340 - in jbpm3/trunk/modules: integration and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-11 10:12:23 -0500 (Thu, 11 Dec 2008)
New Revision: 3340
Modified:
jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageServiceFactory.java
jbpm3/trunk/modules/integration/deploy.sh
Log:
Harcoded references should use the global JNDI names
Modified: jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageServiceFactory.java
===================================================================
--- jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageServiceFactory.java 2008-12-11 13:48:36 UTC (rev 3339)
+++ jbpm3/trunk/modules/enterprise/src/main/java/org/jbpm/msg/jms/JmsMessageServiceFactory.java 2008-12-11 15:12:23 UTC (rev 3340)
@@ -54,80 +54,100 @@
* @author Tom Baeyens
* @author Alejandro Guizar
*/
-public class JmsMessageServiceFactory implements ServiceFactory {
+public class JmsMessageServiceFactory implements ServiceFactory
+{
+ private static final long serialVersionUID = 1L;
- private static final long serialVersionUID = 1L;
-
- String connectionFactoryJndiName = "java:comp/env/jms/JbpmConnectionFactory";
- String destinationJndiName = "java:comp/env/jms/JobQueue";
- String commandDestinationJndiName = "java:comp/env/jms/CommandQueue";
+ String connectionFactoryJndiName = "java:JmsXA";
+ String destinationJndiName = "java:queue/JbpmJobQueue";
+ String commandDestinationJndiName = "java:queue/JbpmCommandQueue";
boolean isCommitEnabled = false;
private ConnectionFactory connectionFactory;
private Destination destination;
private Destination commandDestination;
- public ConnectionFactory getConnectionFactory() {
- if (connectionFactory == null) {
- try {
- connectionFactory = (ConnectionFactory) lookup(connectionFactoryJndiName);
+ public ConnectionFactory getConnectionFactory()
+ {
+ if (connectionFactory == null)
+ {
+ try
+ {
+ connectionFactory = (ConnectionFactory)lookup(connectionFactoryJndiName);
}
- catch (NamingException e) {
+ catch (NamingException e)
+ {
throw new JbpmException("could not retrieve message connection factory", e);
}
}
return connectionFactory;
}
- public Destination getDestination() {
- if (destination == null) {
- try {
- destination = (Destination) lookup(destinationJndiName);
+ public Destination getDestination()
+ {
+ if (destination == null)
+ {
+ try
+ {
+ destination = (Destination)lookup(destinationJndiName);
}
- catch (NamingException e) {
+ catch (NamingException e)
+ {
throw new JbpmException("could not retrieve job destination", e);
}
}
return destination;
}
- public Destination getCommandDestination() {
- if (commandDestination == null) {
- try {
- commandDestination = (Destination) lookup(commandDestinationJndiName);
+ public Destination getCommandDestination()
+ {
+ if (commandDestination == null)
+ {
+ try
+ {
+ commandDestination = (Destination)lookup(commandDestinationJndiName);
}
- catch (NamingException e) {
+ catch (NamingException e)
+ {
throw new JbpmException("could not retrieve command destination", e);
}
}
return commandDestination;
}
- public boolean isCommitEnabled() {
+ public boolean isCommitEnabled()
+ {
return isCommitEnabled;
}
- private static Object lookup(String name) throws NamingException {
+ private static Object lookup(String name) throws NamingException
+ {
Context initial = new InitialContext();
- try {
+ try
+ {
return initial.lookup(name);
}
- finally {
+ finally
+ {
initial.close();
}
}
- public Service openService() {
- try {
+ public Service openService()
+ {
+ try
+ {
Connection connection = getConnectionFactory().createConnection();
return new JmsMessageService(connection, getDestination(), isCommitEnabled);
- }
- catch (JMSException e) {
+ }
+ catch (JMSException e)
+ {
throw new JbpmException("couldn't open message session", e);
- }
+ }
}
- public void close() {
+ public void close()
+ {
connectionFactory = null;
destination = null;
commandDestination = null;
Modified: jbpm3/trunk/modules/integration/deploy.sh
===================================================================
--- jbpm3/trunk/modules/integration/deploy.sh 2008-12-11 13:48:36 UTC (rev 3339)
+++ jbpm3/trunk/modules/integration/deploy.sh 2008-12-11 15:12:23 UTC (rev 3340)
@@ -3,4 +3,4 @@
mvn -o install
rm $JBOSS422/server/default/deploy/jbpm/jbpm-integration.beans/jbpm-integration-spec*.jar
-cp target/bpm-spec-integration-jbpm3-3.3.1-SNAPSHOT.jar $JBOSS422/server/default/deploy/jbpm/jbpm-integration.beans
+cp target/jbpm-integration-spec-3.3.1-SNAPSHOT.jar $JBOSS422/server/default/deploy/jbpm/jbpm-integration.beans
17 years, 4 months
JBoss JBPM SVN: r3339 - in jbpm3/trunk: modules/core/src/main/java/org/jbpm/graph/def and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-11 08:48:36 -0500 (Thu, 11 Dec 2008)
New Revision: 3339
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/def/Transition.java
jbpm3/trunk/modules/enterprise/pom.xml
jbpm3/trunk/modules/integration/deploy.sh
jbpm3/trunk/pom.xml
Log:
Skip enterprise tests on no-jboss-bind-address
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/def/Transition.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/def/Transition.java 2008-12-11 12:14:24 UTC (rev 3338)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/def/Transition.java 2008-12-11 13:48:36 UTC (rev 3339)
@@ -33,10 +33,10 @@
import org.jbpm.graph.log.TransitionLog;
import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
-public class Transition extends GraphElement {
+public class Transition extends GraphElement
+{
+ private static final long serialVersionUID = 1L;
- private static final long serialVersionUID = 1L;
-
protected Node from = null;
protected Node to = null;
protected String condition = null;
@@ -44,128 +44,148 @@
// event types //////////////////////////////////////////////////////////////
- public static final String[] supportedEventTypes = new String[]{Event.EVENTTYPE_TRANSITION};
- public String[] getSupportedEventTypes() {
+ public static final String[] supportedEventTypes = new String[] { Event.EVENTTYPE_TRANSITION };
+
+ public String[] getSupportedEventTypes()
+ {
return supportedEventTypes;
}
// constructors /////////////////////////////////////////////////////////////
-
- public Transition() {
+
+ public Transition()
+ {
}
- public Transition(String name) {
+ public Transition(String name)
+ {
super(name);
}
// from /////////////////////////////////////////////////////////////////////
-
- public Node getFrom() {
+
+ public Node getFrom()
+ {
return from;
}
- /**
- * sets the from node unidirectionally. use {@link Node#addLeavingTransition(Transition)}
- * to get bidirectional relations mgmt.
+ /*
+ * sets the from node unidirectionally. use {@link Node#addLeavingTransition(Transition)} to get bidirectional relations mgmt.
*/
- public void setFrom(Node from) {
+ public void setFrom(Node from)
+ {
this.from = from;
}
// to ///////////////////////////////////////////////////////////////////////
-
- /**
- * sets the to node unidirectionally. use {@link Node#addArrivingTransition(Transition)}
- * to get bidirectional relations mgmt.
+
+ /*
+ * sets the to node unidirectionally. use {@link Node#addArrivingTransition(Transition)} to get bidirectional relations mgmt.
*/
- public void setTo(Node to) {
+ public void setTo(Node to)
+ {
this.to = to;
}
- public Node getTo() {
+ public Node getTo()
+ {
return to;
}
-
- /**
+
+ /*
* the condition expresssion for this transition.
*/
- public String getCondition() {
+ public String getCondition()
+ {
return condition;
}
- public void setCondition(String conditionExpression) {
+ public void setCondition(String conditionExpression)
+ {
this.condition = conditionExpression;
}
- public void removeConditionEnforcement() {
+ public void removeConditionEnforcement()
+ {
isConditionEnforced = false;
}
// behaviour ////////////////////////////////////////////////////////////////
-
- /**
+ /*
* passes execution over this transition.
*/
- public void take(ExecutionContext executionContext) {
- // update the runtime context information
+ public void take(ExecutionContext executionContext)
+ {
+ // update the runtime context information
executionContext.getToken().setNode(null);
-
+
Token token = executionContext.getToken();
-
- if ( (condition!=null)
- && (isConditionEnforced)
- ) {
+
+ if ((condition != null) && (isConditionEnforced))
+ {
Object result = JbpmExpressionEvaluator.evaluate(condition, executionContext);
- if (result==null) {
- throw new JbpmException("transition condition "+condition+" evaluated to null");
- } else if ( ! (result instanceof Boolean)) {
- throw new JbpmException("transition condition "+condition+" evaluated to non-boolean: "+result.getClass().getName());
- } else if ( !((Boolean)result).booleanValue()) {
- throw new JbpmException("transition condition "+condition+" evaluated to 'false'");
+ if (result == null)
+ {
+ throw new JbpmException("transition condition " + condition + " evaluated to null");
}
+ else if (!(result instanceof Boolean))
+ {
+ throw new JbpmException("transition condition " + condition + " evaluated to non-boolean: " + result.getClass().getName());
+ }
+ else if (!((Boolean)result).booleanValue())
+ {
+ throw new JbpmException("transition condition " + condition + " evaluated to 'false'");
+ }
}
-
+
// start the transition log
TransitionLog transitionLog = new TransitionLog(this, executionContext.getTransitionSource());
token.startCompositeLog(transitionLog);
- try {
-
+ try
+ {
+
// fire leave events for superstates (if any)
fireSuperStateLeaveEvents(executionContext);
-
+
// fire the transition event (if any)
fireEvent(Event.EVENTTYPE_TRANSITION, executionContext);
-
+
// fire enter events for superstates (if any)
Node destination = fireSuperStateEnterEvents(executionContext);
- // update the ultimate destinationNode of this transition
+ // update the ultimate destinationNode of this transition
transitionLog.setDestinationNode(destination);
-
- } finally {
+
+ }
+ finally
+ {
// end the transition log
token.endCompositeLog();
}
-
+
// pass the token to the destinationNode node
to.enter(executionContext);
}
- Node fireSuperStateEnterEvents(ExecutionContext executionContext) {
+ Node fireSuperStateEnterEvents(ExecutionContext executionContext)
+ {
// calculate the actual destinationNode node
Node destination = to;
- while (destination != null && destination.isSuperStateNode()) {
+ while (destination != null && destination.isSuperStateNode())
+ {
List nodes = destination.getNodes();
- destination = nodes != null && !nodes.isEmpty() ? (Node) nodes.get(0) : null;
+ destination = nodes != null && !nodes.isEmpty() ? (Node)nodes.get(0) : null;
}
-
- if (destination==null) {
- String transitionName = (name!=null ? "'"+name+"'" : "in node '"+from+"'");
- throw new JbpmException("transition "+transitionName+" doesn't have destination. check your processdefinition.xml");
+
+ if (destination == null)
+ {
+ String transitionName = (name != null ? "'" + name + "'" : "in node '" + from + "'");
+ throw new JbpmException("transition " + transitionName + " doesn't have destination. check your processdefinition.xml");
}
// performance optimisation: check if at least there is a candidate superstate to be entered.
- if ( destination.getSuperState()!=null ) {
+ if (destination.getSuperState() != null)
+ {
// collect all the superstates being left
List leavingSuperStates = collectAllSuperStates(destination, from);
// reverse the order so that events are fired from outer to inner superstates
@@ -173,13 +193,15 @@
// fire a superstate-enter event for all superstates being left
fireSuperStateEvents(leavingSuperStates, Event.EVENTTYPE_SUPERSTATE_ENTER, executionContext);
}
-
+
return destination;
}
- void fireSuperStateLeaveEvents(ExecutionContext executionContext) {
+ void fireSuperStateLeaveEvents(ExecutionContext executionContext)
+ {
// performance optimisation: check if at least there is a candidate superstate to be left.
- if (executionContext.getTransitionSource().getSuperState()!=null) {
+ if (executionContext.getTransitionSource().getSuperState() != null)
+ {
// collect all the superstates being left
List leavingSuperStates = collectAllSuperStates(executionContext.getTransitionSource(), to);
// fire a node-leave event for all superstates being left
@@ -187,65 +209,83 @@
}
}
- /**
+ /*
* collect all superstates of a that do not contain node b.
*/
- static List collectAllSuperStates(Node a, Node b) {
+ static List collectAllSuperStates(Node a, Node b)
+ {
SuperState superState = a.getSuperState();
List leavingSuperStates = new ArrayList();
- while (superState!=null) {
- if (!superState.containsNode(b)) {
+ while (superState != null)
+ {
+ if (!superState.containsNode(b))
+ {
leavingSuperStates.add(superState);
superState = superState.getSuperState();
- } else {
+ }
+ else
+ {
superState = null;
}
}
return leavingSuperStates;
}
- /**
+ /*
* fires the give event on all the superstates in the list.
*/
- void fireSuperStateEvents(List superStates, String eventType, ExecutionContext executionContext) {
+ void fireSuperStateEvents(List superStates, String eventType, ExecutionContext executionContext)
+ {
Iterator iter = superStates.iterator();
- while (iter.hasNext()) {
- SuperState leavingSuperState = (SuperState) iter.next();
+ while (iter.hasNext())
+ {
+ SuperState leavingSuperState = (SuperState)iter.next();
leavingSuperState.fireEvent(eventType, executionContext);
}
}
// other
- /////////////////////////////////////////////////////////////////////////////
-
- public void setName(String name) {
- if (from!=null) {
- if ( from.hasLeavingTransition(name) ) {
- throw new IllegalArgumentException("couldn't set name '"+name+"' on transition '"+this+"'cause the from-node of this transition has already another leaving transition with the same name");
+ // ///////////////////////////////////////////////////////////////////////////
+
+ public void setName(String name)
+ {
+ if (from != null)
+ {
+ if (from.hasLeavingTransition(name))
+ {
+ throw new IllegalArgumentException("couldn't set name '" + name + "' on transition '" + this
+ + "'cause the from-node of this transition has already another leaving transition with the same name");
}
Map fromLeavingTransitions = from.getLeavingTransitionsMap();
fromLeavingTransitions.remove(this.name);
- fromLeavingTransitions.put(name,this);
+ fromLeavingTransitions.put(name, this);
}
this.name = name;
}
- public GraphElement getParent() {
+ public GraphElement getParent()
+ {
GraphElement parent = null;
- if ( (from!=null)
- && (to!=null) ) {
- if (from.equals(to)) {
+ if ((from != null) && (to != null))
+ {
+ if (from.equals(to))
+ {
parent = from.getParent();
- } else {
+ }
+ else
+ {
List fromParentChain = from.getParentChain();
List toParentChain = to.getParentChain();
Iterator fromIter = fromParentChain.iterator();
- while ( fromIter.hasNext() && (parent==null) ) {
- GraphElement fromParent = (GraphElement) fromIter.next();
+ while (fromIter.hasNext() && (parent == null))
+ {
+ GraphElement fromParent = (GraphElement)fromIter.next();
Iterator toIter = toParentChain.iterator();
- while ( toIter.hasNext() && (parent==null) ) {
- GraphElement toParent = (GraphElement) toIter.next();
- if (fromParent==toParent) {
+ while (toIter.hasNext() && (parent == null))
+ {
+ GraphElement toParent = (GraphElement)toIter.next();
+ if (fromParent == toParent)
+ {
parent = fromParent;
}
}
Modified: jbpm3/trunk/modules/enterprise/pom.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/pom.xml 2008-12-11 12:14:24 UTC (rev 3338)
+++ jbpm3/trunk/modules/enterprise/pom.xml 2008-12-11 13:48:36 UTC (rev 3339)
@@ -191,32 +191,15 @@
<!-- Profiles -->
<profiles>
- <!--
- Name: no-jboss-bind-address
- Descr: Set the default jboss.bind.address command line cannot overwrite pom properties
- http://jira.codehaus.org/browse/MNG-3546
- -->
- <profile>
- <id>no-jboss-bind-address</id>
- <activation>
- <property>
- <name>!jboss.bind.address</name>
- </property>
- </activation>
- <properties>
- <jboss.bind.address>localhost</jboss.bind.address>
- </properties>
- </profile>
-
<!--
- Name: no-jbpm-target-container
+ Name: no-database
Descr: Setup the default database
-->
<profile>
- <id>no-jbpm-target-container</id>
+ <id>no-database</id>
<activation>
<property>
- <name>!jbpm.target.container</name>
+ <name>!database</name>
</property>
</activation>
<build>
@@ -224,31 +207,27 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <systemProperties>
- <property>
- <name>jbpm.target.container</name>
- <value>jboss422</value>
- </property>
- <property>
- <name>log4j.output.dir</name>
- <value>${basedir}/target</value>
- </property>
- </systemProperties>
+ <excludes>
+ <!-- [JBPM-1708] Enterprise EjbSchedulerTest fails -->
+ <exclude>org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java</exclude>
+ <!-- [JBPM-1811] JmsMessageTest fails intermitently on HSQLDB -->
+ <exclude>org/jbpm/enterprise/jms/JmsMessageTest.java</exclude>
+ </excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
- <!--
- Name: no-database
- Descr: Setup the default database
+ <!--
+ Name: no-jboss-bind-address
+ Descr: Skip tests if no jboss.bind address is given
-->
<profile>
- <id>no-database</id>
+ <id>no-jboss-bind-address</id>
<activation>
<property>
- <name>!database</name>
+ <name>!jboss.bind.address</name>
</property>
</activation>
<build>
@@ -256,18 +235,13 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <excludes>
- <!-- [JBPM-1708] Enterprise EjbSchedulerTest fails -->
- <exclude>org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java</exclude>
- <!-- [JBPM-1811] JmsMessageTest fails intermitently on HSQLDB -->
- <exclude>org/jbpm/enterprise/jms/JmsMessageTest.java</exclude>
- </excludes>
+ <skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</profile>
-
+
<!--
Name: hsqldb
Descr: Hypersonic Database Setup
Modified: jbpm3/trunk/modules/integration/deploy.sh
===================================================================
--- jbpm3/trunk/modules/integration/deploy.sh 2008-12-11 12:14:24 UTC (rev 3338)
+++ jbpm3/trunk/modules/integration/deploy.sh 2008-12-11 13:48:36 UTC (rev 3339)
@@ -2,5 +2,5 @@
mvn -o install
-rm $JBOSS422/server/default/deploy/jbpm/jbpm-integration.beans/bpm-spec-integration-jbpm3*.jar
+rm $JBOSS422/server/default/deploy/jbpm/jbpm-integration.beans/jbpm-integration-spec*.jar
cp target/bpm-spec-integration-jbpm3-3.3.1-SNAPSHOT.jar $JBOSS422/server/default/deploy/jbpm/jbpm-integration.beans
Modified: jbpm3/trunk/pom.xml
===================================================================
--- jbpm3/trunk/pom.xml 2008-12-11 12:14:24 UTC (rev 3338)
+++ jbpm3/trunk/pom.xml 2008-12-11 13:48:36 UTC (rev 3339)
@@ -447,15 +447,7 @@
</plugins>
</build>
- <!-- DistributionManagement -->
- <distributionManagement>
- <site>
- <id>jbws.dyndns.org</id>
- <url>file:///home/tdiesler/workspace/jbpm-site</url>
- </site>
- </distributionManagement>
-
- <!-- Repositories -->
+ <!-- Repositories -->
<repositories>
<repository>
<id>repository.jboss.org</id>
17 years, 4 months
JBoss JBPM SVN: r3338 - in projects/gwt-console/trunk: server and 1 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-12-11 07:14:24 -0500 (Thu, 11 Dec 2008)
New Revision: 3338
Added:
projects/gwt-console/trunk/war/deploy.sh
Modified:
projects/gwt-console/trunk/pom.xml
projects/gwt-console/trunk/server/.classpath
projects/gwt-console/trunk/server/deploy.sh
projects/gwt-console/trunk/server/pom.xml
projects/gwt-console/trunk/war/pom.xml
Log:
Use jbpm-enterprise.jar instead of jbpm-enterprise-beans.jar
Modified: projects/gwt-console/trunk/pom.xml
===================================================================
--- projects/gwt-console/trunk/pom.xml 2008-12-11 11:52:38 UTC (rev 3337)
+++ projects/gwt-console/trunk/pom.xml 2008-12-11 12:14:24 UTC (rev 3338)
@@ -50,7 +50,7 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-enterprise-beans</artifactId>
+ <artifactId>jbpm-enterprise</artifactId>
<scope>provided</scope>
<version>${jbpm.version}</version>
</dependency>
Modified: projects/gwt-console/trunk/server/.classpath
===================================================================
--- projects/gwt-console/trunk/server/.classpath 2008-12-11 11:52:38 UTC (rev 3337)
+++ projects/gwt-console/trunk/server/.classpath 2008-12-11 12:14:24 UTC (rev 3338)
@@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: projects/gwt-console/trunk/server/deploy.sh
===================================================================
--- projects/gwt-console/trunk/server/deploy.sh 2008-12-11 11:52:38 UTC (rev 3337)
+++ projects/gwt-console/trunk/server/deploy.sh 2008-12-11 12:14:24 UTC (rev 3338)
@@ -1,6 +1,6 @@
#! /bin/bash
-mvn -o install
+mvn -o -DskipTests install
SRC=target/gwt-console-server.war
DEST=$JBOSS422/server/default/deploy/jbpm
Modified: projects/gwt-console/trunk/server/pom.xml
===================================================================
--- projects/gwt-console/trunk/server/pom.xml 2008-12-11 11:52:38 UTC (rev 3337)
+++ projects/gwt-console/trunk/server/pom.xml 2008-12-11 12:14:24 UTC (rev 3338)
@@ -1,153 +1,150 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>JBoss jBPM3 - GWT Console (Server)</name>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>gwt-console-server</artifactId>
+ <packaging>war</packaging>
- <modelVersion>4.0.0</modelVersion>
- <name>JBoss jBPM3 - GWT Console (Server)</name>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-server</artifactId>
- <packaging>war</packaging>
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>gwt-console-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <!-- Parent -->
- <parent>
+ <!-- Properties -->
+ <properties>
+ <jboss.bpm.spec.version>1.0.0-SNAPSHOT</jboss.bpm.spec.version>
+ <balalaika.version>1.0.0-SNAPSHOT</balalaika.version>
+ <json-lib.version>2.2.3</json-lib.version>
+ </properties>
+
+ <dependencies>
+ <!-- Module -->
+ <dependency>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <artifactId>gwt-console-rpc</artifactId>
+ <version>${version}</version>
+ </dependency>
- <!-- Properties -->
- <properties>
- <jboss.bpm.spec.version>1.0.0-SNAPSHOT</jboss.bpm.spec.version>
- <balalaika.version>1.0.0-SNAPSHOT</balalaika.version>
- <json-lib.version>2.2.3</json-lib.version>
- </properties>
+ <!-- JBPM -->
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-enterprise</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-identity</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bpm</groupId>
+ <artifactId>bpm-spec-api</artifactId>
+ <version>${jboss.bpm.spec.version}</version>
+ <scope>provided</scope>
+ </dependency>
- <dependencies>
- <!-- Module -->
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-rpc</artifactId>
- <version>${version}</version>
- </dependency>
+ <!-- GWT related -->
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-servlet</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- JBPM -->
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-enterprise-beans</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-identity</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.bpm</groupId>
- <artifactId>bpm-spec-api</artifactId>
- <version>${jboss.bpm.spec.version}</version>
- <scope>provided</scope>
- </dependency>
+ <!-- Other -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
- <!-- GWT related -->
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-servlet</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <scope>provided</scope>
- </dependency>
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>${json-lib.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
- <!-- Other -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
+ <build>
+ <!-- Include SOURCE in output artifact for GWT (GWT libraries must include source) -->
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
- <dependency>
- <groupId>javax.ejb</groupId>
- <artifactId>ejb-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-jaxrs</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.json-lib</groupId>
- <artifactId>json-lib</artifactId>
- <version>${json-lib.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
- <build>
- <!-- Include SOURCE in output artifact for GWT (GWT libraries must include source) -->
- <resources>
- <resource>
- <directory>src/main/java</directory>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <finalName>${project.build.finalName}</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-config.xml</descriptor>
+ </descriptors>
</configuration>
- </plugin>
+ </execution>
+ </executions>
+ </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <finalName>${project.build.finalName}</finalName>
- <appendAssemblyId>true</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-config.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- <finalName>gwt-console-server</finalName>
- </build>
+ </plugins>
+ <finalName>gwt-console-server</finalName>
+ </build>
</project>
Added: projects/gwt-console/trunk/war/deploy.sh
===================================================================
--- projects/gwt-console/trunk/war/deploy.sh (rev 0)
+++ projects/gwt-console/trunk/war/deploy.sh 2008-12-11 12:14:24 UTC (rev 3338)
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+mvn -o -DskipTests install
+
+SRC=target/gwt-console.war
+DEST=$JBOSS422/server/default/deploy/jbpm
+
+echo
+echo "cp $SRC $DEST"
+cp $SRC $DEST
Property changes on: projects/gwt-console/trunk/war/deploy.sh
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/gwt-console/trunk/war/pom.xml
===================================================================
--- projects/gwt-console/trunk/war/pom.xml 2008-12-11 11:52:38 UTC (rev 3337)
+++ projects/gwt-console/trunk/war/pom.xml 2008-12-11 12:14:24 UTC (rev 3338)
@@ -82,6 +82,7 @@
<!-- Plugins -->
<build>
+ <finalName>gwt-console</finalName>
<plugins>
<plugin>
<groupId>com.totsp.gwt</groupId>
17 years, 4 months
JBoss JBPM SVN: r3337 - projects/gwt-console/trunk/server/src/main/webapp.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-12-11 06:52:38 -0500 (Thu, 11 Dec 2008)
New Revision: 3337
Modified:
projects/gwt-console/trunk/server/src/main/webapp/index.html
Log:
Update server resource overview page
Modified: projects/gwt-console/trunk/server/src/main/webapp/index.html
===================================================================
--- projects/gwt-console/trunk/server/src/main/webapp/index.html 2008-12-11 11:41:01 UTC (rev 3336)
+++ projects/gwt-console/trunk/server/src/main/webapp/index.html 2008-12-11 11:52:38 UTC (rev 3337)
@@ -82,6 +82,20 @@
</tr>
<tr>
+ <td>POST</td>
+ <td>/rs/tasks/{taskId}/close/transition?signal={signalName}</td>
+ <td>Complete a task with signal</td>
+ <td>application/json</td>
+</tr>
+
+<tr>
+ <td>POST</td>
+ <td>/rs/tasks/{taskId}/close/transition/default</td>
+ <td>Complete a task with default transition</td>
+ <td>application/json</td>
+</tr>
+
+<tr>
<td colspan=4><h3>jBPM3 proprietary extensions</h3></td>
</tr>
@@ -112,6 +126,20 @@
<td>Upload a new process definition</td>
<td>Accept:multipart/form-data<br>Produce:application/json</td>
</tr>
+
+<tr>
+ <td>POST</td>
+ <td>/rs/jbpm3/tokens/{tokenId}/transition?signal={signalName}</td>
+ <td>Signal a token by specifiy a transition</td>
+ <td></td>
+</tr>
+<tr>
+ <td>POST</td>
+ <td>/rs/jbpm3/tokens/{tokenId}/transition/default</td>
+ <td>Signal a token to take the default transition</td>
+ <td></td>
+</tr>
+
</table>
<h2>Example usage</h2>
17 years, 4 months
JBoss JBPM SVN: r3336 - projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-12-11 06:41:01 -0500 (Thu, 11 Dec 2008)
New Revision: 3336
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java
Log:
Toggle spec integration layer through: -Dorg.jboss.bpm.console.server.integration.ManagementFactory.spec=true
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java 2008-12-11 11:38:53 UTC (rev 3335)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java 2008-12-11 11:41:01 UTC (rev 3336)
@@ -33,11 +33,15 @@
import org.jboss.bpm.console.server.integration.jbpm3.JBPM3UserManagement;
/**
+ * Toggle the spec integration through:
+ * <code>
+ * -Dorg.jboss.bpm.console.server.integration.ManagementFactory.spec=true
+ * </code>
* @author Thomas.Diesler(a)jboss.com
*/
public class ManagementFactoryImpl extends ManagementFactory
{
- private boolean useSpecIntegration = false;
+ private boolean useSpecIntegration = Boolean.getBoolean(ManagementFactory.class.getName()+".spec");
public ProcessManagement createProcessManagement()
{
17 years, 4 months
JBoss JBPM SVN: r3335 - jbpm3/trunk/modules/core/src/main/java/org/jbpm/command.
by do-not-reply@jboss.org
Author: camunda
Date: 2008-12-11 06:38:53 -0500 (Thu, 11 Dec 2008)
New Revision: 3335
Added:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ResumeTokenCommand.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SuspendTokenCommand.java
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractProcessInstanceBaseCommand.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ResumeProcessInstanceCommand.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SuspendProcessInstanceCommand.java
Log:
JBPM-1905: added Suspend/Resume Token Command
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractProcessInstanceBaseCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractProcessInstanceBaseCommand.java 2008-12-11 11:38:23 UTC (rev 3334)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractProcessInstanceBaseCommand.java 2008-12-11 11:38:53 UTC (rev 3335)
@@ -1,5 +1,6 @@
package org.jbpm.command;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -48,6 +49,7 @@
public Object execute(JbpmContext jbpmContext) throws Exception
{
+ ArrayList result = new ArrayList();
this.jbpmContext = jbpmContext;
try {
log.debug("executing " + this);
@@ -58,7 +60,8 @@
for (int i = 0; i < processInstanceIds.length; i++)
{
ProcessInstance pi = jbpmContext.loadProcessInstanceForUpdate(processInstanceIds[i]);
- execute(pi);
+ result.add(
+ execute(pi));
}
}
@@ -92,14 +95,22 @@
}
}
- return null;
+ if (operateOnSingleObject) {
+ if (result.size()<1)
+ return null;
+ else
+ return result.get(0);
+ }
+ else {
+ return result;
+ }
}
finally {
this.jbpmContext = null;
}
}
- public abstract void execute(ProcessInstance processInstance);
+ public abstract ProcessInstance execute(ProcessInstance processInstance);
public AbstractProcessInstanceBaseCommand setProcessInstanceIds(long[] processInstanceIds)
{
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java 2008-12-11 11:38:23 UTC (rev 3334)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java 2008-12-11 11:38:53 UTC (rev 3335)
@@ -97,7 +97,7 @@
return getJbpmContext().getGraphSession().findProcessDefinition(processName, newVersion);
}
- public void execute(ProcessInstance pi)
+ public ProcessInstance execute(ProcessInstance pi)
{
ProcessDefinition oldDef = pi.getProcessDefinition();
ProcessDefinition newDef = loadNewProcessDefinition(oldDef.getName());
@@ -108,6 +108,7 @@
changeTokenVersion(pi.getRootToken());
log.debug("process id " + pi.getId() + " changed to version " + pi.getProcessDefinition().getVersion());
+ return pi;
}
private ProcessDefinition getNewProcessDefinition(Token t) {
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ResumeProcessInstanceCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ResumeProcessInstanceCommand.java 2008-12-11 11:38:23 UTC (rev 3334)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ResumeProcessInstanceCommand.java 2008-12-11 11:38:53 UTC (rev 3335)
@@ -10,9 +10,12 @@
*/
public class ResumeProcessInstanceCommand extends AbstractProcessInstanceBaseCommand {
+ private static final long serialVersionUID = 1L;
+
@Override
- public void execute(ProcessInstance processInstance)
+ public ProcessInstance execute(ProcessInstance processInstance)
{
- processInstance.resume();
+ processInstance.resume();
+ return processInstance;
}
}
Added: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ResumeTokenCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ResumeTokenCommand.java (rev 0)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ResumeTokenCommand.java 2008-12-11 11:38:53 UTC (rev 3335)
@@ -0,0 +1,22 @@
+package org.jbpm.command;
+
+import org.jbpm.graph.exe.Token;
+
+/**
+ * Resume the specified {@link Token}(s). See {@link AbstractTokenBaseCommand}
+ * to check possibilities to specify {@link Token}(s).
+ *
+ * @author bernd.ruecker(a)camunda.com
+ */
+public class ResumeTokenCommand extends AbstractTokenBaseCommand {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Token execute(Token token)
+ {
+ token.resume();
+ return token;
+ }
+
+}
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SuspendProcessInstanceCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SuspendProcessInstanceCommand.java 2008-12-11 11:38:23 UTC (rev 3334)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SuspendProcessInstanceCommand.java 2008-12-11 11:38:53 UTC (rev 3335)
@@ -14,10 +14,13 @@
*/
public class SuspendProcessInstanceCommand extends AbstractProcessInstanceBaseCommand {
+ private static final long serialVersionUID = 1L;
+
@Override
- public void execute(ProcessInstance processInstance)
+ public ProcessInstance execute(ProcessInstance processInstance)
{
processInstance.suspend();
+ return processInstance;
}
}
Added: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SuspendTokenCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SuspendTokenCommand.java (rev 0)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SuspendTokenCommand.java 2008-12-11 11:38:53 UTC (rev 3335)
@@ -0,0 +1,22 @@
+package org.jbpm.command;
+
+import org.jbpm.graph.exe.Token;
+
+/**
+ * Suspend the specified {@link Token}(s). See {@link AbstractTokenBaseCommand}
+ * to check possibilities to specify {@link Token}(s).
+ *
+ * @author bernd.ruecker(a)camunda.com
+ */
+public class SuspendTokenCommand extends AbstractTokenBaseCommand {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Token execute(Token token)
+ {
+ token.suspend();
+ return token;
+ }
+
+}
17 years, 4 months