JBoss JBPM SVN: r5712 - in jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test: migration and 1 other directory.
by do-not-reply@jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-10-07 15:34:20 -0400 (Wed, 07 Oct 2009)
New Revision: 5712
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java
Log:
add instance migration test in the test-db module
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java 2009-10-07 19:34:20 UTC (rev 5712)
@@ -0,0 +1,78 @@
+package org.jbpm.test.migration;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+public class InstanceMigratorTest extends JbpmTestCase {
+
+ private String firstVersion =
+ "<process name='foobar'>" +
+ " <start>" +
+ " <transition to='foo'/>" +
+ " </start>" +
+ " <state name='foo'>" +
+ " <transition to='bar'/>" +
+ " </state>" +
+ " <state name='bar'>" +
+ " <transition to='end'/>" +
+ " </state>" +
+ " <end name='end'/>" +
+ "</process>";
+
+ private String secondVersion =
+ "<process name='foobar'>" +
+ " <start>" +
+ " <transition to='foo'/>" +
+ " </start>" +
+ " <state name='foo'>" +
+ " <transition to='bar'/>" +
+ " </state>" +
+ " <state name='bar'>" +
+ " <transition to='end'/>" +
+ " </state>" +
+ " <end name='end'/>" +
+ " <migrate-instances/>" +
+ "</process>";
+
+
+ public void testSimpleMigration() {
+ String deploymentId1 = repositoryService.createDeployment()
+ .addResourceFromString("foobar.jpdl.xml", firstVersion)
+ .deploy();
+ ProcessDefinition processDefinition1 = repositoryService
+ .createProcessDefinitionQuery()
+ .deploymentId(deploymentId1)
+ .uniqueResult();
+ Execution execution = executionService
+ .startProcessInstanceById(processDefinition1.getId())
+ .findActiveExecutionIn("foo");
+ executionService.signalExecutionById(execution.getId());
+ ProcessInstance processInstance1 = executionService
+ .createProcessInstanceQuery()
+ .processDefinitionId(processDefinition1.getId())
+ .uniqueResult();
+ assertNotNull(processInstance1.findActiveExecutionIn("bar"));
+
+ String deploymentId2 = repositoryService.createDeployment()
+ .addResourceFromString("foobar.jpdl.xml", secondVersion)
+ .deploy();
+ ProcessDefinition processDefinition2 = repositoryService
+ .createProcessDefinitionQuery()
+ .deploymentId(deploymentId2)
+ .uniqueResult();
+ ProcessInstance processInstance2 = executionService
+ .createProcessInstanceQuery()
+ .processDefinitionId(processDefinition2.getId())
+ .uniqueResult();
+
+ assertNotNull(processInstance2);
+
+ repositoryService.deleteDeploymentCascade(deploymentId2);
+ repositoryService.deleteDeploymentCascade(deploymentId1);
+
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 6 months
JBoss JBPM SVN: r5711 - in jbpm4/trunk/modules: jpdl/src/main/java/org/jbpm/jpdl/internal/activity and 4 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-07 11:01:42 -0400 (Wed, 07 Oct 2009)
New Revision: 5711
Modified:
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.2.xsd
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeReference.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2565 java activity refactoring in context of the new usercode facilities
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.2.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.2.xsd 2009-10-07 13:53:48 UTC (rev 5710)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.2.xsd 2009-10-07 15:01:42 UTC (rev 5711)
@@ -179,6 +179,9 @@
<sequence>
<element name="condition" minOccurs="0" maxOccurs="unbounded">
<complexType>
+ <sequence>
+ <element name="handler" minOccurs="0" type="tns:wireObjectType" />
+ </sequence>
<attribute name="expr" type="string">
<annotation><documentation>The script text that will be evaluated.
</documentation></annotation>
@@ -879,10 +882,6 @@
<annotation><documentation>Method arguments.</documentation></annotation>
</element>
</sequence>
- <attribute name="object" type="string">
- <annotation><documentation>Name of the object in the environment
- </documentation></annotation>
- </attribute>
<attribute name="method" type="string" use="required">
<annotation><documentation>The name of the method to invoke.
</documentation></annotation>
@@ -1058,6 +1057,7 @@
any other custom event.
</documentation></annotation>
</attribute>
+ <attribute name="continue" type="tns:continueType" default="sync" />
</complexType>
</element>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java 2009-10-07 13:53:48 UTC (rev 5710)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java 2009-10-07 15:01:42 UTC (rev 5711)
@@ -22,20 +22,18 @@
package org.jbpm.jpdl.internal.activity;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.List;
import org.jbpm.api.JbpmException;
import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireDefinition;
import org.jbpm.pvm.internal.wire.WireException;
import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeReference;
/**
@@ -44,75 +42,62 @@
public class JavaActivity extends JpdlAutomaticActivity {
private static final long serialVersionUID = 1L;
-
- protected String targetExpression;
- protected String targetLanguage;
- protected Object target;
- protected String methodName;
+ protected UserCodeReference invocationReference;
+
+ protected String methodName = null;
+ protected List<ArgDescriptor> argDescriptors = null;
+
protected String variableName;
- protected InvokeOperation invokeOperation;
public void perform(OpenExecution execution) throws Exception {
-
- Object invocationTarget = null;
+ if (invocationReference==null) {
+ throw new JbpmException("no target specified");
+ }
- WireContext wireContext = new WireContext();
+ Object target = invocationReference.getObject(execution);
+ Class<?> clazz;
+ // method invocation on object or static method invocation in case object is null
if (target!=null) {
- invocationTarget = target;
-
- } else if (targetExpression!=null) {
- ScriptManager scriptManager = ScriptManager.getScriptManager();
- invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
-
+ clazz = target.getClass();
} else {
- throw new JbpmException("no target specified");
+ ObjectDescriptor objectDescriptor = (ObjectDescriptor) invocationReference.getDescriptor();
+ String className = objectDescriptor.getClassName();
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ clazz = Class.forName(className, true, classLoader);
}
-
- try {
- List<ArgDescriptor> argDescriptors = null;
- Object[] args = null;
- if (invokeOperation!=null) {
- argDescriptors = invokeOperation.getArgDescriptors();
- args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
- }
-
- Class<?> clazz = invocationTarget.getClass();
- Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
- if (method==null) {
- throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
- }
-
- Object returnValue = ReflectUtil.invoke(method, invocationTarget, args);
-
- if (variableName!=null) {
- execution.setVariable(variableName, returnValue);
- }
-
- } catch (WireException e) {
- throw e;
- } catch (Exception e) {
- throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
+
+ WireContext wireContext = new WireContext(new WireDefinition());
+ Object returnValue = ObjectDescriptor.invokeMethod(methodName, argDescriptors, wireContext, target, clazz);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
}
}
- public void setTarget(Object target) {
- this.target = target;
+ public void setInvocationReference(UserCodeReference invocationReference) {
+ this.invocationReference = invocationReference;
}
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+ public String getMethodName() {
+ return methodName;
+ }
public void setMethodName(String methodName) {
this.methodName = methodName;
}
- public void setVariableName(String variableName) {
- this.variableName = variableName;
+ public List<ArgDescriptor> getArgDescriptors() {
+ return argDescriptors;
}
- public void setInvokeOperation(InvokeOperation invokeOperation) {
- this.invokeOperation = invokeOperation;
+ public void setArgDescriptors(List<ArgDescriptor> argDescriptors) {
+ this.argDescriptors = argDescriptors;
}
- public void setTargetExpression(String expression) {
- this.targetExpression = expression;
+ public UserCodeReference getInvocationReference() {
+ return invocationReference;
}
- public void setTargetLanguage(String language) {
- this.targetLanguage = language;
+ public String getVariableName() {
+ return variableName;
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-10-07 13:53:48 UTC (rev 5710)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-10-07 15:01:42 UTC (rev 5711)
@@ -21,14 +21,10 @@
*/
package org.jbpm.jpdl.internal.activity;
-import java.util.List;
-
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeReference;
import org.jbpm.pvm.internal.xml.Parse;
import org.w3c.dom.Element;
@@ -47,34 +43,22 @@
public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
JavaActivity javaActivity = new JavaActivity();
- String methodName = XmlUtil.attribute(element, "method", true, parse, null);
- javaActivity.setMethodName(methodName);
+ if (XmlUtil.attribute(element, "method", true, parse, null)!=null) {
+ UserCodeReference invocationReference = parser.parseUserCodeReference(element, parse);
+ javaActivity.setInvocationReference(invocationReference);
+
+ ObjectDescriptor objectDescriptor = (ObjectDescriptor) invocationReference.getDescriptor();
+
+ javaActivity.setArgDescriptors(objectDescriptor.getArgDescriptors());
+ objectDescriptor.setArgDescriptors(null);
+ javaActivity.setMethodName(objectDescriptor.getMethodName());
+ objectDescriptor.setMethodName(null);
+ }
+
String variableName = XmlUtil.attribute(element, "var");
javaActivity.setVariableName(variableName);
- List<Element> argElements = XmlUtil.elements(element, "arg");
- if (!argElements.isEmpty()) {
- List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
- InvokeOperation invokeOperation = new InvokeOperation();
- invokeOperation.setArgDescriptors(argDescriptors);
- javaActivity.setInvokeOperation(invokeOperation);
- }
-
- if (element.hasAttribute("class")) {
- ObjectDescriptor objectDescriptor = parser.parseObjectDescriptor(element, parse);
- Object target = WireContext.create(objectDescriptor);
- javaActivity.setTarget(target);
-
- } else if (element.hasAttribute("expr")) {
- String expression = element.getAttribute("expr");
- javaActivity.setTargetExpression(expression);
- javaActivity.setTargetLanguage(XmlUtil.attribute(element, "lang"));
-
- } else {
- // parse.addProblem("no target specified in "+TAG+": must specify attribute 'class' or 'expr'", element);
- }
-
return javaActivity;
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-07 13:53:48 UTC (rev 5710)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-07 15:01:42 UTC (rev 5711)
@@ -730,19 +730,22 @@
return null;
}
- // generic helper methods for jpdl activity and event listener bindings /////
-
public UserCodeReference parseUserCodeReference(Element element, Parse parse) {
UserCodeReference userCodeReference = new UserCodeReference();
ObjectDescriptor objectDescriptor = (ObjectDescriptor) objectBinding.parse(element, parse, wireParser);
userCodeReference.setDescriptor(objectDescriptor);
+
+ if (objectDescriptor.getExpr()!=null) {
+ // expressions are not cached by default
+ userCodeReference.setCached(false);
+ }
Boolean isCached = XmlUtil.attributeBoolean(element, "cache", false, parse, null);
if (isCached!=null) {
userCodeReference.setCached(isCached.booleanValue());
}
-
+
return userCodeReference;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-10-07 13:53:48 UTC (rev 5710)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-10-07 15:01:42 UTC (rev 5711)
@@ -181,23 +181,8 @@
}
if (methodName!=null) {
- // method invocation on object or static method invocation in case object is null
- if (object!=null) {
- clazz = object.getClass();
- }
try {
- Object[] args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
- Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
- if (method==null) {
- // throw exception but first, generate decent message
- throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" is not available on "+
- (object!=null ? "object "+object+" ("+clazz.getName()+")" : "class "+clazz.getName()));
- }
- if (object == null && (!Modifier.isStatic(method.getModifiers()))) {
- // A non static method is invoked on a null object
- throw new WireException("method "+ clazz.getName() + "." + ReflectUtil.getSignature(methodName, argDescriptors, args)+" is not static. It cannot be called on a null object.");
- }
- object = ReflectUtil.invoke(method, object, args);
+ object = invokeMethod(methodName, argDescriptors, wireContext, object, clazz);
} catch (WireException e) {
throw e;
@@ -209,6 +194,26 @@
return object;
}
+ public static Object invokeMethod(String methodName, List<ArgDescriptor> argDescriptors, WireContext wireContext, Object object, Class< ? > clazz) throws Exception {
+ // method invocation on object or static method invocation in case object is null
+ if (object!=null) {
+ clazz = object.getClass();
+ }
+ Object[] args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
+ Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
+ if (method==null) {
+ // throw exception but first, generate decent message
+ throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" is not available on "+
+ (object!=null ? "object "+object+" ("+clazz.getName()+")" : "class "+clazz.getName()));
+ }
+ if (object == null && (!Modifier.isStatic(method.getModifiers()))) {
+ // A non static method is invoked on a null object
+ throw new WireException("method "+ clazz.getName() + "." + ReflectUtil.getSignature(methodName, argDescriptors, args)+" is not static. It cannot be called on a null object.");
+ }
+ object = ReflectUtil.invoke(method, object, args);
+ return object;
+ }
+
/**
* Initializes the specified object.
* If auto-wiring was set to <code>true</code>, auto-wiring is performed (see {@link #autoWire(Object, WireContext)}). Fields and properties injections are then performed.
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeReference.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeReference.java 2009-10-07 13:53:48 UTC (rev 5710)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeReference.java 2009-10-07 15:01:42 UTC (rev 5711)
@@ -91,4 +91,7 @@
public void setDescriptor(Descriptor descriptor) {
this.descriptor = descriptor;
}
+ public Descriptor getDescriptor() {
+ return descriptor;
+ }
}
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-10-07 13:53:48 UTC (rev 5710)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-10-07 15:01:42 UTC (rev 5711)
@@ -2912,7 +2912,7 @@
<entry></entry>
<entry>one of {class|expr} is required</entry>
<entry>The fully qualified classname. Instantiation is done only once and
- the user object is cached as part of the process definition.
+ the user object is cached as part of the process definition.
</entry>
</row>
<row>
@@ -2920,7 +2920,10 @@
<entry>expression</entry>
<entry></entry>
<entry>one of {class|expr} is required</entry>
- <entry>Expression for which the resulting value will be taken as the target object.</entry>
+ <entry>Expression for which the resulting value will be taken as the target object.
+ Expressions will be evaluated for every usage. In other words, the resulting
+ value of the evaluation will not be cached.
+ </entry>
</row>
</tbody>
</tgroup>
16 years, 6 months
JBoss JBPM SVN: r5710 - in jbpm4/trunk/modules: migration and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-07 09:53:48 -0400 (Wed, 07 Oct 2009)
New Revision: 5710
Modified:
jbpm4/trunk/modules/jpdl/pom.xml
jbpm4/trunk/modules/migration/pom.xml
jbpm4/trunk/modules/pvm/pom.xml
jbpm4/trunk/modules/test-pojo/pom.xml
Log:
fixed exclusion of modules in case of db tests
Modified: jbpm4/trunk/modules/jpdl/pom.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/pom.xml 2009-10-07 12:33:10 UTC (rev 5709)
+++ jbpm4/trunk/modules/jpdl/pom.xml 2009-10-07 13:53:48 UTC (rev 5710)
@@ -50,29 +50,15 @@
</dependency>
</dependencies>
- <!-- Plugins -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>org/jbpm/test/xml/DbGenTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
<!-- Profiles -->
<profiles>
<!-- skip tests if this is an integration test run
(only examples and test-db are part of the integration test runs) -->
<profile>
- <id>integration.test</id>
+ <id>skip.tests.during.database.testrun</id>
<activation>
<property>
- <name>jboss.bind.address</name>
+ <name>database</name>
</property>
</activation>
<properties>
Modified: jbpm4/trunk/modules/migration/pom.xml
===================================================================
--- jbpm4/trunk/modules/migration/pom.xml 2009-10-07 12:33:10 UTC (rev 5709)
+++ jbpm4/trunk/modules/migration/pom.xml 2009-10-07 13:53:48 UTC (rev 5710)
@@ -76,18 +76,22 @@
<!-- Profiles -->
<profiles>
+
+ <!-- skip tests if this is an integration test run
+ (only examples and test-db are part of the integration test runs) -->
+ <profile>
+ <id>skip.tests.during.database.testrun</id>
+ <activation>
+ <property>
+ <name>database</name>
+ </property>
+ </activation>
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+ </profile>
+
<profile>
- <id>integration.test</id>
- <activation>
- <property>
- <name>jboss.bind.address</name>
- </property>
- </activation>
- <properties>
- <skipTests>true</skipTests>
- </properties>
- </profile>
- <profile>
<id>distro</id>
<build>
<plugins>
Modified: jbpm4/trunk/modules/pvm/pom.xml
===================================================================
--- jbpm4/trunk/modules/pvm/pom.xml 2009-10-07 12:33:10 UTC (rev 5709)
+++ jbpm4/trunk/modules/pvm/pom.xml 2009-10-07 13:53:48 UTC (rev 5710)
@@ -201,10 +201,10 @@
<!-- skip tests if this is an integration test run
(only examples and test-db are part of the integration test runs) -->
<profile>
- <id>integration.test</id>
+ <id>skip.tests.during.database.testrun</id>
<activation>
<property>
- <name>jboss.bind.address</name>
+ <name>database</name>
</property>
</activation>
<properties>
@@ -212,5 +212,5 @@
</properties>
</profile>
</profiles>
-
+
</project>
Modified: jbpm4/trunk/modules/test-pojo/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-pojo/pom.xml 2009-10-07 12:33:10 UTC (rev 5709)
+++ jbpm4/trunk/modules/test-pojo/pom.xml 2009-10-07 13:53:48 UTC (rev 5710)
@@ -65,15 +65,13 @@
</build>
<profiles>
- <!--
- skip tests if this is an integration test run
- (only examples and test-db are part of the integration test runs)
- -->
+ <!-- skip tests if this is an integration test run
+ (only examples and test-db are part of the integration test runs) -->
<profile>
- <id>integration.test</id>
+ <id>skip.tests.during.database.testrun</id>
<activation>
<property>
- <name>jboss.bind.address</name>
+ <name>database</name>
</property>
</activation>
<properties>
16 years, 6 months
JBoss JBPM SVN: r5709 - in jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal: xml and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-07 08:33:10 -0400 (Wed, 07 Oct 2009)
New Revision: 5709
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
Log:
removed static methods from JpdlParser
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-10-07 12:24:14 UTC (rev 5708)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-10-07 12:33:10 UTC (rev 5709)
@@ -62,7 +62,7 @@
}
if (element.hasAttribute("class")) {
- ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
+ ObjectDescriptor objectDescriptor = parser.parseObjectDescriptor(element, parse);
Object target = WireContext.create(objectDescriptor);
javaActivity.setTarget(target);
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java 2009-10-07 12:24:14 UTC (rev 5708)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java 2009-10-07 12:33:10 UTC (rev 5709)
@@ -36,7 +36,7 @@
public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
MailActivity activity = new MailActivity();
- activity.setMailProducer(JpdlParser.parseMailProducer(element, parse, null));
+ activity.setMailProducer(parser.parseMailProducer(element, parse, null));
return activity;
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-07 12:24:14 UTC (rev 5708)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-07 12:33:10 UTC (rev 5709)
@@ -567,7 +567,7 @@
return taskDefinition;
}
- public static ObjectDescriptor parseObjectDescriptor(Element element, Parse parse) {
+ public ObjectDescriptor parseObjectDescriptor(Element element, Parse parse) {
ObjectDescriptor objectDescriptor = new ObjectDescriptor();
String className = XmlUtil.attribute(element, "class");
@@ -600,7 +600,7 @@
}
- public static List<VariableDefinitionImpl> parseVariableDefinitions(Element element, Parse parse, boolean initRequired) {
+ public List<VariableDefinitionImpl> parseVariableDefinitions(Element element, Parse parse, boolean initRequired) {
List<VariableDefinitionImpl> variableDefinitions = new ArrayList<VariableDefinitionImpl>();
for (Element inElement: XmlUtil.elements(element, "variable")) {
@@ -637,7 +637,7 @@
return variableDefinitions;
}
- public static VariableOutDefinitionSet parseVariableOutDefinitionSet(Element element, Parse parse) {
+ public VariableOutDefinitionSet parseVariableOutDefinitionSet(Element element, Parse parse) {
VariableOutDefinitionSet variableOutDefinitionSet = new VariableOutDefinitionSet();
for (Element inElement: XmlUtil.elements(element, "out-variable")) {
@@ -655,7 +655,7 @@
return variableOutDefinitionSet;
}
- public static void parseMailEvent(Element element, Parse parse,
+ public void parseMailEvent(Element element, Parse parse,
ObservableElementImpl observableElement, String eventName) {
// obtain assign event
EventImpl event = observableElement.getEvent(eventName);
@@ -687,7 +687,7 @@
eventListener.setMailProducer(mailProducer);
}
- public static MailProducer parseMailProducer(Element element, Parse parse, String defaultTemplateName) {
+ public MailProducer parseMailProducer(Element element, Parse parse, String defaultTemplateName) {
// check whether the element is a generic object descriptor
if (ObjectBinding.isObjectDescriptor(element)) {
// TODO test custom mail producer
@@ -701,7 +701,7 @@
return mailProducer;
}
- private static MailTemplate parseMailTemplate(Element element, Parse parse,
+ private MailTemplate parseMailTemplate(Element element, Parse parse,
String defaultTemplateName) {
if (element.hasAttribute("template")) {
// fetch template from configuration
@@ -720,7 +720,7 @@
return null;
}
- private static MailTemplate findTemplate(Element element, Parse parse, String templateName) {
+ private MailTemplate findTemplate(Element element, Parse parse, String templateName) {
MailTemplateRegistry templateRegistry = EnvironmentImpl.getFromCurrent(MailTemplateRegistry.class);
if (templateRegistry != null) {
MailTemplate template = templateRegistry.getTemplate(templateName);
16 years, 6 months
JBoss JBPM SVN: r5708 - in jbpm4/trunk/modules: bpmn/src/main/java/org/jbpm/bpmn/flownodes and 18 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-07 08:24:14 -0400 (Wed, 07 Oct 2009)
New Revision: 5708
Added:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluator.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluatorDescriptor.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionDescriptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeActivityBehaviour.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeCondition.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeEventListener.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeReference.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/decision/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/decision/DecisionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskAssignmentHandlerExprTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCandidatesTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCompletionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskOutcomesTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskReassignTest.java
Removed:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/DecisionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/taskactivity/
Modified:
jbpm4/trunk/modules/bpmn/pom.xml
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ActivityResource.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/JavaServiceTaskActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ScriptTaskActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ScriptTaskBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ScriptTaskTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/ContentEvaluation.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
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/TransitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java
jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/AllIntegrationTests.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2565 refactored usercode handling of event listeners, assignment handlers, decision handlers and decision conditions
Modified: jbpm4/trunk/modules/bpmn/pom.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/pom.xml 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/pom.xml 2009-10-07 12:24:14 UTC (rev 5708)
@@ -64,11 +64,13 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+ <!-- EXCLUDED THIS DEPENDENCY BECAUSE IT FAILED TO RESOLVE
+ IF YOU REINTRODUCE IT, MAKE SURE IT RESOLVES
<dependency>
<groupId>com.sun.script</groupId>
<artifactId>bsh-engine</artifactId>
<version>1.0.1</version>
- </dependency>
+ </dependency -->
</dependencies>
<!-- Plugins -->
@@ -79,6 +81,7 @@
<configuration>
<excludes>
<exclude>org/jbpm/test/xml/DbGenTest.java</exclude>
+ <exclude>org/jbpm/bpmn/flownodes/ScriptTaskTest.java</exclude>
</excludes>
</configuration>
</plugin>
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/AbstractGatewayBinding.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -4,8 +4,6 @@
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-
import org.w3c.dom.Element;
public abstract class AbstractGatewayBinding extends BpmnBinding {
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ActivityResource.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ActivityResource.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ActivityResource.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -1,7 +1,7 @@
package org.jbpm.bpmn.flownodes;
import org.jbpm.bpmn.common.Resource;
-import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
+import org.jbpm.bpmn.parser.ExpressionEvaluatorDescriptor;
public class ActivityResource {
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/JavaServiceTaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/JavaServiceTaskActivity.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/JavaServiceTaskActivity.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -26,7 +26,6 @@
import org.jbpm.api.JbpmException;
import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.env.EnvironmentDefaults;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.script.ScriptManager;
import org.jbpm.pvm.internal.util.ReflectUtil;
@@ -62,7 +61,7 @@
invocationTarget = target;
} else if (targetExpression!=null) {
- ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
+ ScriptManager scriptManager = ScriptManager.getScriptManager();
invocationTarget = scriptManager.evaluateExpression(targetExpression, targetLanguage);
} else {
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ParallelGatewayActivity.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -29,11 +29,9 @@
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.bpmn.parser.BpmnParser;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.Condition;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.Transition;
@@ -90,7 +88,7 @@
} else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
// force version increment in the parent execution
- Session session = Environment.getFromCurrent(Session.class);
+ Session session = EnvironmentImpl.getFromCurrent(Session.class);
session.lock(execution.getParent(), lockMode);
execution.setState(Execution.STATE_INACTIVE_JOIN);
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ScriptTaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ScriptTaskActivity.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ScriptTaskActivity.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -22,11 +22,11 @@
package org.jbpm.bpmn.flownodes;
import org.jbpm.api.model.OpenExecution;
+import org.jbpm.bpmn.parser.ExpressionEvaluator;
+import org.jbpm.bpmn.parser.ExpressionEvaluatorDescriptor;
import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ExpressionEvaluator;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireException;
-import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
public class ScriptTaskActivity extends BpmnAutomaticActivity {
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ScriptTaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ScriptTaskBinding.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/ScriptTaskBinding.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -21,8 +21,8 @@
*/
package org.jbpm.bpmn.flownodes;
+import org.jbpm.bpmn.parser.ExpressionEvaluatorDescriptor;
import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/TaskActivity.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -21,28 +21,10 @@
*/
package org.jbpm.bpmn.flownodes;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.task.Task;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.events.TaskActivityStart;
-import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.Condition;
import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.Transition;
-import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.ParticipationImpl;
-import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
-import org.jbpm.pvm.internal.task.SwimlaneImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.task.TaskImpl;
/**
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskActivity.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -21,29 +21,21 @@
*/
package org.jbpm.bpmn.flownodes;
-import java.util.List;
import java.util.Map;
-import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.task.Task;
+import org.jbpm.bpmn.parser.ExpressionEvaluator;
+import org.jbpm.bpmn.parser.ExpressionEvaluatorDescriptor;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.history.HistoryEvent;
import org.jbpm.pvm.internal.history.events.TaskActivityStart;
import org.jbpm.pvm.internal.model.Activity;
-import org.jbpm.pvm.internal.model.Condition;
import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ExpressionEvaluator;
-import org.jbpm.pvm.internal.model.Transition;
import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.ParticipationImpl;
-import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
-import org.jbpm.pvm.internal.task.SwimlaneImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
/**
* @author Tom Baeyens
@@ -61,7 +53,7 @@
}
public void execute(ExecutionImpl execution) {
- DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+ DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class);
TaskImpl task = (TaskImpl) dbSession.createTask();
task.setTaskDefinition(taskDefinition);
task.setExecution(execution);
@@ -121,7 +113,7 @@
execution.fire(signalName, activity);
- DbSession taskDbSession = Environment.getFromCurrent(DbSession.class);
+ DbSession taskDbSession = EnvironmentImpl.getFromCurrent(DbSession.class);
TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
task.setSignalling(false);
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/UserTaskBinding.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -21,8 +21,6 @@
*/
package org.jbpm.bpmn.flownodes;
-import java.util.List;
-
import org.jbpm.bpmn.model.BpmnProcessDefinition;
import org.jbpm.bpmn.parser.BpmnParser;
import org.jbpm.pvm.internal.model.ScopeElementImpl;
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BindingsParser.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -59,7 +59,8 @@
if (bindingClassName != null) {
try {
- Class< ? > bindingClass = ReflectUtil.loadClass(classLoader, bindingClassName);
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ Class< ? > bindingClass = Class.forName(bindingClassName, true, classLoader);
return (Binding) bindingClass.newInstance();
} catch (Exception e) {
parse.addProblem("couldn't instantiate activity binding " + bindingClassName, e);
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -35,9 +35,7 @@
import org.jbpm.bpmn.flownodes.BpmnBinding;
import org.jbpm.bpmn.flownodes.ExclusiveGatewayActivity;
import org.jbpm.bpmn.model.BpmnProcessDefinition;
-
import org.jbpm.internal.log.Log;
-
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.CompositeElementImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
@@ -45,11 +43,9 @@
import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.TagBinding;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Bindings;
import org.jbpm.pvm.internal.xml.Parse;
@@ -149,7 +145,7 @@
setBindings(bindings);
for (String activityResource : DEFAULT_ACTIVITIES_RESOURCES) {
- Enumeration<URL> resourceUrls = ReflectUtil.getResources(null, activityResource);
+ Enumeration<URL> resourceUrls = getResources(activityResource);
if (resourceUrls.hasMoreElements()) {
while (resourceUrls.hasMoreElements()) {
URL resourceUrl = resourceUrls.nextElement();
@@ -168,6 +164,17 @@
}
}
+ protected Enumeration<URL> getResources(String resourceName) {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ Enumeration<URL> resourceUrls;
+ try {
+ resourceUrls = classLoader.getResources(resourceName);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't get resource urls for "+resourceName, e);
+ }
+ return resourceUrls;
+ }
+
private void parseDataObjects(Element element, Parse parse, BpmnProcessDefinition processDefinition) {
List<VariableDefinitionImpl> variableDefinitions = new ArrayList<VariableDefinitionImpl>();
@@ -209,7 +216,7 @@
activity.setDescription(name);
log.debug("Parse Activity: " + name);
ActivityBehaviour activityBehaviour = (ActivityBehaviour) activityBinding.parse(nestedElement, parse, this);
- activity.setBehaviour(activityBehaviour);
+ activity.setActivityBehaviour(activityBehaviour);
} finally {
parse.contextStackPop();
}
@@ -233,7 +240,7 @@
try {
// If something went wrong parsing the activity, there is no behaviour and an exception is thrown in .getBehaviour()
- ActivityBehaviour a = compositeElement.findActivity(sourceRef).getBehaviour();
+ ActivityBehaviour a = compositeElement.findActivity(sourceRef).getActivityBehaviour();
if (a instanceof ExclusiveGatewayActivity) {
if (transitionId.equals(((ExclusiveGatewayActivity) a).getDefault())) {
compositeElement.findActivity(sourceRef).setDefaultOutgoingTransition(transition);
@@ -258,8 +265,10 @@
String lang = XmlUtil.attribute(conditionElement, "language");
// TODO: add looking up the default language in the document if lang
// is null.
- ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
- transition.setConditionDescriptor(expressionDescriptor);
+
+// TODO refactor according to PVM updates. see package org.jbpm.pvm.internal.wire.usercode
+// ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
+// transition.setConditionDescriptor(expressionDescriptor);
} else {
parse.addProblem("Type of the conditionExpression on sequenceFlow with id=" + transitionId + " is of onsupported type 'bpmn:tExpression'",
Copied: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluator.java (from rev 5705, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java)
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluator.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluator.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.bpmn.parser;
+
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.model.Condition;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExpressionEvaluator implements Condition {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+ protected String expr;
+ protected String lang;
+
+ public ExpressionEvaluator(String name, String expr, String lang) {
+ this.name = name;
+ this.expr = expr;
+ this.lang = lang;
+ }
+
+ public boolean evaluate(OpenExecution execution) {
+ return (Boolean) evaluateExpression(execution);
+ }
+
+ public Object evaluateExpression(OpenExecution execution) {
+ ScriptManager scriptManager = ScriptManager.getScriptManager();
+ return scriptManager.evaluateExpression(expr, lang);
+ }
+
+ public String getName() {
+ return name;
+ }
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluatorDescriptor.java (from rev 5705, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java)
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluatorDescriptor.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluatorDescriptor.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.bpmn.parser;
+
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ *
+ * @deprecated to be replaced by {@link UserCodeReference} see also package org.jbpm.pvm.internal.wire.usercode
+ */
+public class ExpressionEvaluatorDescriptor extends AbstractDescriptor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String expr;
+ protected String lang;
+
+ public ExpressionEvaluatorDescriptor() {
+ }
+
+ public ExpressionEvaluatorDescriptor(String expr, String lang) {
+ this.expr = expr;
+ this.lang = lang;
+ }
+
+ public Object construct(WireContext wireContext) {
+ return new ExpressionEvaluator(getName(), expr, lang);
+ }
+
+}
Property changes on: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/ExpressionEvaluatorDescriptor.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ScriptTaskTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ScriptTaskTest.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ScriptTaskTest.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -21,24 +21,14 @@
*/
package org.jbpm.bpmn.flownodes;
-import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.dom4j.DocumentFactory;
import org.jbpm.api.ProcessInstance;
-import org.jbpm.api.TaskQuery;
-import org.jbpm.api.task.Task;
import org.jbpm.bpmn.parser.BpmnParser;
-import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Problem;
import org.jbpm.test.JbpmTestCase;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
/**
* @author Tom Baeyens
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/ContentEvaluation.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/ContentEvaluation.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/decision/handler/ContentEvaluation.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -26,6 +26,8 @@
public class ContentEvaluation implements DecisionHandler {
+ private static final long serialVersionUID = 1L;
+
public String decide(OpenExecution execution) {
String content = (String) execution.getVariable("content");
if (content.equals("you're great")) {
Deleted: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.jpdl.internal.activity;
-
-import java.util.Map;
-
-import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.activity.ExternalActivityBehaviour;
-import org.jbpm.pvm.internal.wire.UserCodeReference;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CustomActivity extends JpdlExternalActivity {
-
- private static final long serialVersionUID = 1L;
-
- protected UserCodeReference customActivityReference;
-
- public void execute(ActivityExecution execution) throws Exception {
- ActivityBehaviour activityBehaviour = (ActivityBehaviour) customActivityReference.getObject(execution);
- activityBehaviour.execute(execution);
- }
-
- public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
- ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour) customActivityReference.getObject(execution);
- externalActivityBehaviour.signal(execution, signalName, parameters);
- }
-
- public void setCustomActivityReference(UserCodeReference customActivityReference) {
- this.customActivityReference = customActivityReference;
- }
-}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -22,9 +22,10 @@
package org.jbpm.jpdl.internal.activity;
import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.wire.UserCodeReference;
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeActivityBehaviour;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeReference;
import org.jbpm.pvm.internal.xml.Parse;
import org.w3c.dom.Element;
@@ -41,9 +42,9 @@
}
public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
- CustomActivity customActivity = new CustomActivity();
+ UserCodeActivityBehaviour userCodeActivityBehaviour = new UserCodeActivityBehaviour();
UserCodeReference customActivityReference = parser.parseUserCodeReference(element, parse);
- customActivity.setCustomActivityReference(customActivityReference);
- return customActivity;
+ userCodeActivityBehaviour.setCustomActivityReference(customActivityReference);
+ return userCodeActivityBehaviour;
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -27,11 +27,8 @@
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ExpressionEvaluatorDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
-import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeCondition;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeReference;
import org.jbpm.pvm.internal.xml.Parse;
import org.w3c.dom.Element;
@@ -41,9 +38,6 @@
*/
public class DecisionBinding extends JpdlBinding {
- static ObjectBinding objectBinding = new ObjectBinding();
- static WireParser wireParser = WireParser.getInstance();
-
public DecisionBinding() {
super("decision");
}
@@ -52,23 +46,16 @@
if (element.hasAttribute("expr")) {
DecisionExpressionActivity decisionExpressionActivity = new DecisionExpressionActivity();
String expr = element.getAttribute("expr");
- decisionExpressionActivity.setExpr(expr);
+ decisionExpressionActivity.setExpression(expr);
+ decisionExpressionActivity.setLanguage(XmlUtil.attribute(element, "lang"));
return decisionExpressionActivity;
}
- if (element.hasAttribute("handler-ref")) {
- String decisionHandlerName = element.getAttribute("handler-ref");
- DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
- decisionHandlerActivity.setDecisionHandlerName(decisionHandlerName);
- return decisionHandlerActivity;
- }
-
Element handlerElement = XmlUtil.element(element, "handler");
if (handlerElement!=null) {
DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
- ObjectDescriptor decisionHandlerDescriptor = (ObjectDescriptor)
- objectBinding.parse(handlerElement, parse, wireParser);
- decisionHandlerActivity.setDecisionHandlerDescriptor(decisionHandlerDescriptor);
+ UserCodeReference decisionHandlerReference = parser.parseUserCodeReference(handlerElement, parse);
+ decisionHandlerActivity.setDecisionHandlerReference(decisionHandlerReference);
return decisionHandlerActivity;
}
@@ -86,19 +73,21 @@
hasConditions = true;
if (conditionElement.hasAttribute("expr")) {
- String expr = conditionElement.getAttribute("expr");
- String lang = XmlUtil.attribute(conditionElement, "expr-lang");
- ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
- transition.setConditionDescriptor(expressionDescriptor);
+ ExpressionCondition expressionCondition = new ExpressionCondition();
+ expressionCondition.setExpression(conditionElement.getAttribute("expr"));
+ expressionCondition.setLanguage(XmlUtil.attribute(conditionElement, "lang"));
+ transition.setCondition(expressionCondition);
- } else if (conditionElement.hasAttribute("ref")) {
- String expr = conditionElement.getAttribute("ref");
- ReferenceDescriptor refDescriptor = new ReferenceDescriptor(expr);
- transition.setConditionDescriptor(refDescriptor);
-
- } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
- ObjectDescriptor conditionDescriptor = (ObjectDescriptor) objectBinding.parse(conditionElement, parse, parser);
- transition.setConditionDescriptor(conditionDescriptor);
+ } else {
+ Element conditionHandlerElement = XmlUtil.element(conditionElement, "handler");
+ if (handlerElement!=null) {
+ UserCodeCondition userCodeCondition = new UserCodeCondition();
+
+ UserCodeReference conditionReference = parser.parseUserCodeReference(conditionHandlerElement, parse);
+ userCodeCondition.setConditionReference(conditionReference);
+
+ transition.setCondition(userCodeCondition);
+ }
}
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionExpressionActivity.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -35,8 +35,8 @@
private static final long serialVersionUID = 1L;
- protected String expr;
- protected String lang;
+ protected String expression;
+ protected String language;
public void execute(ActivityExecution execution) {
execute((ExecutionImpl) execution);
@@ -47,17 +47,17 @@
String transitionName = null;
ScriptManager scriptManager = ScriptManager.getScriptManager();
- Object result = scriptManager.evaluateExpression(expr, lang);
+ Object result = scriptManager.evaluateExpression(expression, language);
if ( (result!=null)
&& (! (result instanceof String))
) {
- throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned "+result.getClass().getName()+" instead of a transitionName (String): "+result);
+ throw new JbpmException("expression '"+expression+"' in decision '"+activity.getName()+"' returned "+result.getClass().getName()+" instead of a transitionName (String): "+result);
}
transitionName = (String) result;
Transition transition = activity.getOutgoingTransition(transitionName);
if (transition==null) {
- throw new JbpmException("expression '"+expr+"' in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
+ throw new JbpmException("expression '"+expression+"' in decision '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
}
execution.historyDecision(transitionName);
@@ -65,10 +65,10 @@
execution.take(transition);
}
- public void setExpr(String expr) {
- this.expr = expr;
+ public void setExpression(String expr) {
+ this.expression = expr;
}
- public void setLang(String lang) {
- this.lang = lang;
+ public void setLanguage(String lang) {
+ this.language = lang;
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionHandlerActivity.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -22,16 +22,12 @@
package org.jbpm.jpdl.internal.activity;
import org.jbpm.api.JbpmException;
-import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.jpdl.DecisionHandler;
-import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.model.Activity;
import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.model.Transition;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeReference;
/**
* @author Tom Baeyens
@@ -40,9 +36,7 @@
private static final long serialVersionUID = 1L;
- protected String decisionHandlerName;
- protected Descriptor decisionHandlerDescriptor;
- protected DecisionHandler decisionHandler;
+ UserCodeReference decisionHandlerReference;
public void execute(ActivityExecution execution) {
execute((ExecutionImpl) execution);
@@ -53,26 +47,17 @@
String transitionName = null;
- DecisionHandler usedDecisionHandler = null;
- if (decisionHandlerDescriptor!=null) {
-
- usedDecisionHandler = getDecisionHandler(activity.getProcessDefinition());
-
- } else if (decisionHandlerName!=null) {
- EnvironmentImpl environment = EnvironmentImpl.getCurrent();
- Object object = environment.get(decisionHandlerName);
- if (object==null) {
- throw new JbpmException("decision handler for "+activity+" is null");
- }
- if (! (object instanceof DecisionHandler)) {
- throw new JbpmException("handler for decision is not a "+DecisionHandler.class.getName()+": "+object.getClass().getName());
- }
- usedDecisionHandler = (DecisionHandler) object;
- } else {
+ DecisionHandler decisionHandler = null;
+
+ if (decisionHandlerReference!=null) {
+ decisionHandler = (DecisionHandler) decisionHandlerReference.getObject(execution);
+ }
+
+ if (decisionHandler==null) {
throw new JbpmException("no decision handler specified");
}
- transitionName = usedDecisionHandler.decide(execution);
+ transitionName = decisionHandler.decide(execution);
Transition transition = activity.getOutgoingTransition(transitionName);
if (transition==null) {
@@ -84,22 +69,7 @@
execution.take(transition);
}
- public synchronized DecisionHandler getDecisionHandler(ProcessDefinition processDefinition) {
- if ( (decisionHandlerDescriptor!=null)
- && (decisionHandler==null)
- ) {
- decisionHandler = (DecisionHandler) ReflectUtil.instantiateUserCode(decisionHandlerDescriptor, (ProcessDefinitionImpl) processDefinition);
- }
- return decisionHandler;
+ public void setDecisionHandlerReference(UserCodeReference decisionHandlerReference) {
+ this.decisionHandlerReference = decisionHandlerReference;
}
-
- public void setDecisionHandlerName(String decisionHandlerName) {
- this.decisionHandlerName = decisionHandlerName;
- }
- public void setDecisionHandler(DecisionHandler decisionHandler) {
- this.decisionHandler = decisionHandler;
- }
- public void setDecisionHandlerDescriptor(Descriptor decisionHandlerDescriptor) {
- this.decisionHandlerDescriptor = decisionHandlerDescriptor;
- }
-}
+}
\ No newline at end of file
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -21,11 +21,9 @@
*/
package org.jbpm.jpdl.internal.activity;
-import org.jbpm.api.listener.EventListener;
import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.JbpmClassNotFoundException;
-import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeEventListener;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeReference;
import org.jbpm.pvm.internal.xml.Parse;
import org.w3c.dom.Element;
@@ -40,14 +38,12 @@
}
public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
- Descriptor eventListenerDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
- try {
- EventListener eventListener = (EventListener) WireContext.create(eventListenerDescriptor);
- return eventListener;
-
- } catch (JbpmClassNotFoundException e) {
- return eventListenerDescriptor;
- }
+ UserCodeEventListener userCodeEventListener = new UserCodeEventListener();
+
+ UserCodeReference eventListenerReference = parser.parseUserCodeReference(element, parse);
+ userCodeEventListener.setEventListenerReference(eventListenerReference);
+
+ return userCodeEventListener;
}
}
Added: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,55 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.model.Condition;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExpressionCondition implements Condition {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String expression;
+ protected String language;
+
+ public boolean evaluate(OpenExecution execution) {
+ ScriptManager scriptManager = ScriptManager.getScriptManager();
+ Object result = scriptManager.evaluateExpression(expression, language);
+ if (result instanceof Boolean) {
+ return ((Boolean) result).booleanValue();
+ }
+ throw new JbpmException("expression condition '"+expression+"' did not return a boolean: "+result);
+ }
+
+ public void setExpression(String expression) {
+ this.expression = expression;
+ }
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -42,7 +42,7 @@
TaskActivity taskActivity = new TaskActivity();
ScopeElementImpl scopeElement = parse.contextStackFind(ScopeElementImpl.class);
- TaskDefinitionImpl taskDefinition = JpdlParser.parseTaskDefinition(element, parse, scopeElement);
+ TaskDefinitionImpl taskDefinition = parser.parseTaskDefinition(element, parse, scopeElement);
taskActivity.setTaskDefinition(taskDefinition);
return taskActivity;
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -35,7 +35,6 @@
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.listener.EventListener;
import org.jbpm.api.model.Event;
-import org.jbpm.api.task.AssignmentHandler;
import org.jbpm.internal.log.Log;
import org.jbpm.jpdl.internal.activity.JpdlBinding;
import org.jbpm.jpdl.internal.activity.MailListener;
@@ -66,12 +65,12 @@
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.UserCodeReference;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.binding.MailTemplateBinding;
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.wire.operation.Operation;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeReference;
import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Bindings;
import org.jbpm.pvm.internal.xml.Parse;
@@ -116,9 +115,7 @@
public JpdlParser() {
initialize();
-
parseBindings();
-
setSchemaResources(SCHEMA_RESOURCES);
}
@@ -240,7 +237,7 @@
if (swimlaneName!=null) {
SwimlaneDefinitionImpl swimlaneDefinition =
processDefinition.createSwimlaneDefinition(swimlaneName);
- JpdlParser.parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
+ parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
}
}
@@ -358,7 +355,7 @@
}
}
- public static TimerDefinitionImpl parseTimerDefinition(Element timerElement, Parse parse, ScopeElementImpl scopeElement) {
+ public TimerDefinitionImpl parseTimerDefinition(Element timerElement, Parse parse, ScopeElementImpl scopeElement) {
TimerDefinitionImpl timerDefinition = scopeElement.createTimerDefinition();
String duedate = XmlUtil.attribute(timerElement, "duedate");
@@ -492,7 +489,7 @@
}
}
- public static void parseAssignmentAttributes(Element element, AssignableDefinitionImpl assignableDefinition, Parse parse) {
+ public void parseAssignmentAttributes(Element element, AssignableDefinitionImpl assignableDefinition, Parse parse) {
Element descriptionElement = XmlUtil.element(element, "description");
if (descriptionElement!=null) {
String description = XmlUtil.getContentText(descriptionElement);
@@ -501,9 +498,8 @@
Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
if (assignmentHandlerElement!=null) {
- ObjectDescriptor objectDescriptor = parseObjectDescriptor(assignmentHandlerElement, parse);
- AssignmentHandler assignmentHandler = (AssignmentHandler) WireContext.create(objectDescriptor);
- assignableDefinition.setAssignmentHandler(assignmentHandler);
+ UserCodeReference assignmentHandlerReference = parseUserCodeReference(assignmentHandlerElement, parse);
+ assignableDefinition.setAssignmentHandlerReference(assignmentHandlerReference);
}
String assigneeExpression = XmlUtil.attribute(element, "assignee");
@@ -525,7 +521,7 @@
assignableDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
}
- public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, ScopeElementImpl scopeElement) {
+ public TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, ScopeElementImpl scopeElement) {
TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
String taskName = XmlUtil.attribute(element, "name");
@@ -552,7 +548,7 @@
}
}
- JpdlParser.parseAssignmentAttributes(element, taskDefinition, parse);
+ parseAssignmentAttributes(element, taskDefinition, parse);
// parse notification mail producer
Element notificationElement = XmlUtil.element(element, "notification");
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 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -75,6 +75,7 @@
import org.jbpm.pvm.internal.type.Variable;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeReference;
/**
* @author Tom Baeyens
@@ -752,12 +753,15 @@
}
}
- AssignmentHandler assignmentHandler = assignableDefinition.getAssignmentHandler();
- if (assignmentHandler!=null) {
- try {
- assignmentHandler.assign(assignable, this);
- } catch (Exception e) {
- throw new JbpmException("assignment handler threw exception: " + e, e);
+ UserCodeReference assignmentHandlerReference = assignableDefinition.getAssignmentHandlerReference();
+ if (assignmentHandlerReference!=null) {
+ AssignmentHandler assignmentHandler = (AssignmentHandler) assignmentHandlerReference.getObject(processDefinition);
+ if (assignmentHandler!=null) {
+ try {
+ assignmentHandler.assign(assignable, this);
+ } catch (Exception e) {
+ throw new JbpmException("assignment handler threw exception: " + e, e);
+ }
}
}
}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionEvaluator.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.model;
-
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
-/**
- * @author Tom Baeyens
- */
-public class ExpressionEvaluator implements Condition {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
- protected String expr;
- protected String lang;
-
- public ExpressionEvaluator(String name, String expr, String lang) {
- this.name = name;
- this.expr = expr;
- this.lang = lang;
- }
-
- public boolean evaluate(OpenExecution execution) {
- return (Boolean) evaluateExpression(execution);
- }
-
- public Object evaluateExpression(OpenExecution execution) {
- ScriptManager scriptManager = ScriptManager.getScriptManager();
- return scriptManager.evaluateExpression(expr, lang);
- }
-
- public String getName() {
- return name;
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -24,8 +24,6 @@
import java.util.List;
import org.jbpm.api.model.Event;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
/**
@@ -38,8 +36,7 @@
protected ActivityImpl source;
protected Integer sourceIndex;
protected ActivityImpl destination;
- protected Descriptor conditionDescriptor;
- protected Descriptor waitConditionDescriptor;
+ protected Condition condition;
/* Use one of the ActivityImpl.createOutgoingTransition methods instead. */
TransitionImpl() {
@@ -111,20 +108,6 @@
}
}
- public Condition getCondition() {
- if (conditionDescriptor==null) {
- return null;
- }
- return (Condition) WireContext.create(conditionDescriptor);
- }
-
- public Condition getWaitCondition() {
- if (waitConditionDescriptor==null) {
- return null;
- }
- return (Condition) WireContext.create(waitConditionDescriptor);
- }
-
public ActivityImpl getSource() {
return source;
}
@@ -137,26 +120,16 @@
public void setDestination(ActivityImpl destination) {
this.destination = destination;
}
- /** see <a href="#conditions">Conditions</a> */
- public Descriptor getConditionDescriptor() {
- return conditionDescriptor;
- }
- /** see <a href="#conditions">Conditions</a> */
- public void setConditionDescriptor(Descriptor conditionDescriptor) {
- this.conditionDescriptor = conditionDescriptor;
- }
- /** see <a href="#waitconditions">Wait conditions</a> */
- public Descriptor getWaitConditionDescriptor() {
- return waitConditionDescriptor;
- }
- /** see <a href="#waitconditions">Wait conditions</a> */
- public void setWaitConditionDescriptor(Descriptor waitConditionDescriptor) {
- this.waitConditionDescriptor = waitConditionDescriptor;
- }
public Integer getSourceIndex() {
return sourceIndex;
}
public void setSourceIndex(Integer sourceIndex) {
this.sourceIndex = sourceIndex;
}
+ public Condition getCondition() {
+ return condition;
+ }
+ public void setCondition(Condition condition) {
+ this.condition = condition;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/AssignableDefinitionImpl.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -21,9 +21,9 @@
*/
package org.jbpm.pvm.internal.task;
-import org.jbpm.api.task.AssignmentHandler;
import org.jbpm.pvm.internal.model.ProcessElementImpl;
import org.jbpm.pvm.internal.util.EqualsUtil;
+import org.jbpm.pvm.internal.wire.usercode.UserCodeReference;
/**
* @author Tom Baeyens
@@ -41,7 +41,7 @@
protected String candidateUsersExpressionLanguage;
protected String candidateGroupsExpression;
protected String candidateGroupsExpressionLanguage;
- protected AssignmentHandler assignmentHandler;
+ protected UserCodeReference assignmentHandlerReference;
// equals ///////////////////////////////////////////////////////////////////
// hack to support comparing hibernate proxies against the real objects
@@ -70,11 +70,11 @@
public void setAssigneeExpression(String assigneeExpression) {
this.assigneeExpression = assigneeExpression;
}
- public AssignmentHandler getAssignmentHandler() {
- return assignmentHandler;
+ public UserCodeReference getAssignmentHandlerReference() {
+ return assignmentHandlerReference;
}
- public void setAssignmentHandler(AssignmentHandler assignmentHandler) {
- this.assignmentHandler = assignmentHandler;
+ public void setAssignmentHandlerReference(UserCodeReference assignmentHandlerReference) {
+ this.assignmentHandlerReference = assignmentHandlerReference;
}
public String getAssigneeExpressionLanguage() {
return assigneeExpressionLanguage;
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire;
-
-import java.io.Serializable;
-
-import org.jbpm.api.Execution;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-
-
-/**
- * @author Tom Baeyens
- */
-public class UserCodeReference implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- protected boolean isCached = true;
- protected Object cachedObject;
- protected Descriptor descriptor;
-
- public Object getObject(Execution execution) {
- return getObject(null, execution);
- }
-
- public Object getObject(ProcessDefinitionImpl processDefinition) {
- return getObject(processDefinition, null);
- }
-
- protected Object getObject(ProcessDefinitionImpl processDefinition, Execution execution) {
- if (cachedObject!=null) {
- return cachedObject;
- }
- if (descriptor!=null) {
- if (processDefinition==null) {
- processDefinition = getProcessDefinition(execution);
- }
-
- Object usedObject = ReflectUtil.instantiateUserCode(descriptor, processDefinition);
- if (isCached) {
- cachedObject = usedObject;
- }
- return usedObject;
- }
- return null;
- }
-
- protected ProcessDefinitionImpl getProcessDefinition(Execution execution) {
- ProcessDefinitionImpl processDefinition = null;
- ExecutionImpl executionImpl = (ExecutionImpl) execution;
- ActivityImpl activity = executionImpl.getActivity();
- TransitionImpl transition = executionImpl.getTransition();
- if (activity!=null) {
- processDefinition = activity.getProcessDefinition();
- }
- if ( (processDefinition==null)
- && (transition!=null)
- ) {
- processDefinition = transition.getProcessDefinition();
- }
- return processDefinition;
- }
-
- public void setCached(boolean isCached) {
- this.isCached = isCached;
- }
- public void setDescriptor(Descriptor descriptor) {
- this.descriptor = descriptor;
- }
-}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionDescriptor.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionDescriptor.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -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.pvm.internal.wire.descriptor;
+
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.wire.WireContext;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExpressionDescriptor extends AbstractDescriptor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String expression;
+ protected String language;
+
+ public Object construct(WireContext wireContext) {
+ ScriptManager scriptManager = ScriptManager.getScriptManager();
+ Object result = scriptManager.evaluateExpression(expression, language);
+ return result;
+ }
+
+ public void setExpression(String expression) {
+ this.expression = expression;
+ }
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionDescriptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ExpressionEvaluatorDescriptor.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.descriptor;
-
-import org.jbpm.pvm.internal.model.ExpressionEvaluator;
-import org.jbpm.pvm.internal.wire.WireContext;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ExpressionEvaluatorDescriptor extends AbstractDescriptor {
-
- private static final long serialVersionUID = 1L;
-
- protected String expr;
- protected String lang;
-
- public ExpressionEvaluatorDescriptor() {
- }
-
- public ExpressionEvaluatorDescriptor(String expr, String lang) {
- this.expr = expr;
- this.lang = lang;
- }
-
- public Object construct(WireContext wireContext) {
- return new ExpressionEvaluator(getName(), expr, lang);
- }
-
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeActivityBehaviour.java (from rev 5706, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeActivityBehaviour.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeActivityBehaviour.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,52 @@
+/*
+ * 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.pvm.internal.wire.usercode;
+
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserCodeActivityBehaviour implements ExternalActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ protected UserCodeReference customActivityReference;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ ActivityBehaviour activityBehaviour = (ActivityBehaviour) customActivityReference.getObject(execution);
+ activityBehaviour.execute(execution);
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
+ ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour) customActivityReference.getObject(execution);
+ externalActivityBehaviour.signal(execution, signalName, parameters);
+ }
+
+ public void setCustomActivityReference(UserCodeReference customActivityReference) {
+ this.customActivityReference = customActivityReference;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeActivityBehaviour.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeCondition.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeCondition.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeCondition.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,45 @@
+/*
+ * 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.pvm.internal.wire.usercode;
+
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.model.Condition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserCodeCondition implements Condition {
+
+ private static final long serialVersionUID = 1L;
+
+ protected UserCodeReference conditionReference;
+
+ public boolean evaluate(OpenExecution execution) {
+ Condition condition = (Condition) conditionReference.getObject(execution);
+ return condition.evaluate(execution);
+ }
+
+ public void setConditionReference(UserCodeReference conditionReference) {
+ this.conditionReference = conditionReference;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeCondition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeEventListener.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeEventListener.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeEventListener.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,45 @@
+/*
+ * 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.pvm.internal.wire.usercode;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserCodeEventListener implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ protected UserCodeReference eventListenerReference;
+
+ public void notify(EventListenerExecution execution) throws Exception {
+ EventListener eventListener = (EventListener) eventListenerReference.getObject(execution);
+ eventListener.notify(execution);
+ }
+
+ public void setEventListenerReference(UserCodeReference eventListenerReference) {
+ this.eventListenerReference = eventListenerReference;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeEventListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeReference.java (from rev 5706, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeReference.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeReference.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,94 @@
+/*
+ * 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.pvm.internal.wire.usercode;
+
+import java.io.Serializable;
+
+import org.jbpm.api.Execution;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserCodeReference implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected boolean isCached = true;
+ protected Object cachedObject;
+ protected Descriptor descriptor;
+
+ public Object getObject(Execution execution) {
+ return getObject(null, execution);
+ }
+
+ public Object getObject(ProcessDefinitionImpl processDefinition) {
+ return getObject(processDefinition, null);
+ }
+
+ protected Object getObject(ProcessDefinitionImpl processDefinition, Execution execution) {
+ if (cachedObject!=null) {
+ return cachedObject;
+ }
+ if (descriptor!=null) {
+ if (processDefinition==null) {
+ processDefinition = getProcessDefinition(execution);
+ }
+
+ Object usedObject = ReflectUtil.instantiateUserCode(descriptor, processDefinition);
+ if (isCached) {
+ cachedObject = usedObject;
+ }
+ return usedObject;
+ }
+ return null;
+ }
+
+ protected ProcessDefinitionImpl getProcessDefinition(Execution execution) {
+ ProcessDefinitionImpl processDefinition = null;
+ ExecutionImpl executionImpl = (ExecutionImpl) execution;
+ ActivityImpl activity = executionImpl.getActivity();
+ TransitionImpl transition = executionImpl.getTransition();
+ if (activity!=null) {
+ processDefinition = activity.getProcessDefinition();
+ }
+ if ( (processDefinition==null)
+ && (transition!=null)
+ ) {
+ processDefinition = transition.getProcessDefinition();
+ }
+ return processDefinition;
+ }
+
+ public void setCached(boolean isCached) {
+ this.isCached = isCached;
+ }
+ public void setDescriptor(Descriptor descriptor) {
+ this.descriptor = descriptor;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/usercode/UserCodeReference.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/AllIntegrationTests.java
===================================================================
--- jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/AllIntegrationTests.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/AllIntegrationTests.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -49,7 +49,7 @@
suite.addTestSuite(org.jbpm.examples.goup.multipleentries.MultipleEntriesTest.class);
suite.addTestSuite(org.jbpm.examples.goup.simple.GroupSimpleTest.class);
suite.addTestSuite(org.jbpm.examples.goup.timer.GroupTimerTest.class);
- suite.addTestSuite(org.jbpm.test.activities.DecisionTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.decision.DecisionTest.class);
suite.addTestSuite(org.jbpm.test.activities.ForkJoinInSameTransactionTest.class);
suite.addTestSuite(org.jbpm.test.activities.ForkTest.class);
suite.addTestSuite(org.jbpm.test.activities.ForkToTaskTest.class);
@@ -107,10 +107,10 @@
suite.addTestSuite(org.jbpm.test.task.TaskQueryCandidatesTest.class);
suite.addTestSuite(org.jbpm.test.task.TaskQueryProcessTest.class);
suite.addTestSuite(org.jbpm.test.task.TaskVariablesTest.class);
- suite.addTestSuite(org.jbpm.test.taskactivity.TaskCandidatesTest.class);
- suite.addTestSuite(org.jbpm.test.taskactivity.TaskCompletionTest.class);
- suite.addTestSuite(org.jbpm.test.taskactivity.TaskOutcomesTest.class);
- suite.addTestSuite(org.jbpm.test.taskactivity.TaskReassignTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.task.TaskCandidatesTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.task.TaskCompletionTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.task.TaskOutcomesTest.class);
+ suite.addTestSuite(org.jbpm.test.activity.task.TaskReassignTest.class);
suite.addTestSuite(org.jbpm.test.timer.TaskTimerTaskTest.class);
suite.addTestSuite(org.jbpm.test.timer.TimerTest.class);
suite.addTestSuite(org.jbpm.test.variables.BasicVariablesTest.class);
Deleted: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/DecisionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/DecisionTest.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/DecisionTest.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test.activities;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.ProcessInstance;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DecisionTest extends JbpmTestCase {
-
- public void testDecisionExpression() {
- deployJpdlXmlString(
- "<process name='Poolcar'>" +
- " <start>" +
- " <transition to='How far?' />" +
- " </start>" +
- " <decision name='How far?' expr='#{distance}'>" +
- " <transition name='far' to='Big car' />" +
- " <transition name='nearby' to='Small car' />" +
- " </decision>" +
- " <state name='Big car' />" +
- " <state name='Small car' />" +
- "</process>"
- );
-
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("distance", "far");
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertTrue(processInstance.isActive("Big car"));
-
- variables.put("distance", "nearby");
- processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertTrue(processInstance.isActive("Small car"));
- }
-
- public void testDecisionWithConditions() {
- deployJpdlXmlString(
- "<process name='Poolcar'>" +
- " <start>" +
- " <transition to='How far?' />" +
- " </start>" +
- " <decision name='How far?'>" +
- " <transition to='Big car'>" +
- " <condition expr='#{distance > 10}' />" +
- " </transition>" +
- " <transition to='Small car'>" +
- " <condition expr='#{distance >= 3}' />" +
- " </transition>" +
- " <transition to='No car' />" +
- " </decision>" +
- " <state name='Big car' />" +
- " <state name='Small car' />" +
- " <state name='No car' />" +
- "</process>"
- );
-
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("distance", new Integer(69));
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertTrue(processInstance.isActive("Big car"));
-
- variables.put("distance", new Integer(6));
- processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertTrue(processInstance.isActive("Small car"));
-
- variables.put("distance", new Integer(2));
- processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
- assertTrue(processInstance.isActive("No car"));
- }
-}
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/decision/DecisionTest.java (from rev 5705, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/DecisionTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/decision/DecisionTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/decision/DecisionTest.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,95 @@
+/*
+ * 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.test.activity.decision;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionTest extends JbpmTestCase {
+
+ public void testDecisionExpression() {
+ deployJpdlXmlString(
+ "<process name='Poolcar'>" +
+ " <start>" +
+ " <transition to='How far?' />" +
+ " </start>" +
+ " <decision name='How far?' expr='#{distance}'>" +
+ " <transition name='far' to='Big car' />" +
+ " <transition name='nearby' to='Small car' />" +
+ " </decision>" +
+ " <state name='Big car' />" +
+ " <state name='Small car' />" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("distance", "far");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("Big car"));
+
+ variables.put("distance", "nearby");
+ processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("Small car"));
+ }
+
+ public void testDecisionWithConditions() {
+ deployJpdlXmlString(
+ "<process name='Poolcar'>" +
+ " <start>" +
+ " <transition to='How far?' />" +
+ " </start>" +
+ " <decision name='How far?'>" +
+ " <transition to='Big car'>" +
+ " <condition expr='#{distance > 10}' />" +
+ " </transition>" +
+ " <transition to='Small car'>" +
+ " <condition expr='#{distance >= 3}' />" +
+ " </transition>" +
+ " <transition to='No car' />" +
+ " </decision>" +
+ " <state name='Big car' />" +
+ " <state name='Small car' />" +
+ " <state name='No car' />" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("distance", new Integer(69));
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("Big car"));
+
+ variables.put("distance", new Integer(6));
+ processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("Small car"));
+
+ variables.put("distance", new Integer(2));
+ processInstance = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertTrue(processInstance.isActive("No car"));
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/decision/DecisionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskAssignmentHandlerExprTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskAssignmentHandlerExprTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskAssignmentHandlerExprTest.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,74 @@
+/*
+ * 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.test.activity.task;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.api.task.Assignable;
+import org.jbpm.api.task.AssignmentHandler;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskAssignmentHandlerExprTest extends JbpmTestCase {
+
+ public static class MyAssignmentHandler implements AssignmentHandler {
+ private static final long serialVersionUID = 1L;
+ public void assign(Assignable assignable, OpenExecution execution) throws Exception {
+ assignable.setAssignee("johndoe");
+ }
+ }
+
+ public void testTaskAssignmentHandlerExpr() {
+ deployJpdlXmlString(
+ "<process name='TaskAssignmentHandlerExpr'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review'>" +
+ " <assignment-handler expr='#{myassignmenthandler}' />" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("myassignmenthandler", new MyAssignmentHandler());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskAssignmentHandlerExpr", variables);
+
+ // both johndoe and joesmoe will see the task in their *group* task list
+ List<Task> taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals("Expected a single task being created", 1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+ }
+
+
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskAssignmentHandlerExprTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCandidatesTest.java (from rev 5705, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskCandidatesTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCandidatesTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCandidatesTest.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,239 @@
+/*
+ * 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.test.activity.task;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskCandidatesTest extends JbpmTestCase {
+
+ public void testCommaSeparatedTaskCandidates() {
+ deployJpdlXmlString(
+ "<process name='TaskCandidates'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " candidate-users='johndoe, joesmoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskCandidates");
+ String pid = processInstance.getId();
+
+ // both johndoe and joesmoe will see the task in their *group* task list
+ List<Task> taskList = taskService.findGroupTasks("johndoe");
+ assertEquals("Expected a single task being created", 1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ taskList = taskService.findGroupTasks("joesmoe");
+ assertEquals("Expected a single task being created", 1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ // johndoe and joesmoe will NOT see the task in their *assigned* task list
+
+ taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals(0, taskList.size());
+
+ taskList = taskService.findPersonalTasks("joesmoe");
+ assertEquals(0, taskList.size());
+
+ // lets assume that johndoe takes the task
+ taskService.takeTask(task.getId(), "johndoe");
+
+ // johndoe's and joesmoe's group task list is now empty
+ taskList = taskService.findGroupTasks("johndoe");
+ assertEquals(0, taskList.size());
+
+ taskList = taskService.findGroupTasks("joesmoe");
+ assertEquals(0, taskList.size());
+
+ // johndoe's assigned task list has the task in it
+ taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals("Expected a single task being created", 1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+ assertEquals("johndoe", task.getAssignee());
+
+ // joesmoe will not see the task in the assigned task list
+ taskList = taskService.findPersonalTasks("joesmoe");
+ assertEquals(0, taskList.size());
+
+ // now johndoe completes the task
+ taskService.completeTask(task.getId());
+
+ // verify that the task list is now empty
+ taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals(0, taskList.size());
+
+ // verify that process moved to the next state
+ processInstance = executionService.findProcessInstanceById(pid);
+ assertTrue(processInstance.isActive("wait"));
+ }
+
+ public void testTaskCandidatesExpression() {
+ deployJpdlXmlString(
+ "<process name='TaskCandidates'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " candidate-users='#{userone}, #{usertwo}'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("userone", "johndoe");
+ variables.put("usertwo", "joesmoe");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskCandidates", variables);
+ String executionId = processInstance.getId();
+
+ // both johndoe and joesmoe will see the task in their *group* task list
+ List<Task> taskList = taskService.findGroupTasks("johndoe");
+ assertEquals("Expected a single task being created", 1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ taskList = taskService.findGroupTasks("joesmoe");
+ assertEquals("Expected a single task being created", 1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ // johndoe and joesmoe will NOT see the task in their *assigned* task list
+
+ taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals(0, taskList.size());
+
+ taskList = taskService.findPersonalTasks("joesmoe");
+ assertEquals(0, taskList.size());
+
+ // lets assume that johndoe takes the task
+ taskService.takeTask(task.getId(), "johndoe");
+
+ // johndoe's and joesmoe's group task list is now empty
+ taskList = taskService.findGroupTasks("johndoe");
+ assertEquals(0, taskList.size());
+
+ taskList = taskService.findGroupTasks("joesmoe");
+ assertEquals(0, taskList.size());
+
+ // johndoe's assigned task list has the task in it
+ taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals("Expected a single task being created", 1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+ assertEquals("johndoe", task.getAssignee());
+
+ // joesmoe will not see the task in the assigned task list
+ taskList = taskService.findPersonalTasks("joesmoe");
+ assertEquals(0, taskList.size());
+
+ // now johndoe completes the task
+ taskService.completeTask(task.getId());
+
+ // verify that the task list is now empty
+ taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals(0, taskList.size());
+
+ // verify that process moved to the next state
+ processInstance = executionService.findProcessInstanceById(executionId);
+ assertTrue(processInstance.isActive("wait"));
+ }
+
+ public void testCandidatePutsTaskBackInGroup() {
+ deployJpdlXmlString(
+ "<process name='CandidatePutsTaskBackInGroup'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " candidate-groups='sales-dept'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("CandidatePutsTaskBackInGroup");
+ String pid = processInstance.getId();
+
+ Task task = taskService.createTaskQuery().processInstanceId(pid).uniqueResult();
+ assertNull(task.getAssignee());
+
+ taskService.takeTask(task.getId(), "johndoe");
+
+ task = taskService.createTaskQuery().processInstanceId(pid).uniqueResult();
+ assertEquals("johndoe", task.getAssignee());
+
+ taskService.assignTask(task.getId(), null);
+
+ task = taskService.getTask(task.getId());
+ assertNull(task.getAssignee());
+ }
+
+ public void testDoubleTake() {
+ deployJpdlXmlString(
+ "<process name='DoubleTake'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " candidate-users='johndoe, joesmoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("DoubleTake");
+ String pid = processInstance.getId();
+
+ // both johndoe and joesmoe will see the task in their *group* task list
+ String taskId = taskService.findGroupTasks("johndoe").get(0).getId();
+
+ taskService.takeTask(taskId, "johndoe");
+
+ try {
+ taskService.takeTask(taskId, "joesmoe");
+ } catch (JbpmException e) {
+ assertTextPresent("task already taken by johndoe", e.getMessage());
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCandidatesTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCompletionTest.java (from rev 5705, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskCompletionTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCompletionTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCompletionTest.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,169 @@
+/*
+ * 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.test.activity.task;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.history.HistoryTask;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * Testcase for the several ways of completing a task.
+ *
+ * @author jbarrez
+ */
+public class TaskCompletionTest extends JbpmTestCase {
+
+ private static final String PROCESS =
+ "<process name='taskCompletion'>" +
+ " <start>" +
+ " <transition to='theTask' />" +
+ " </start>" +
+ " <task name='theTask' assignee='johndoe'>" +
+ " <transition name='one' to='stateOne' />" +
+ " <transition name='two' to='stateTwo' />" +
+ " </task>" +
+ " <state name='stateOne'>" +
+ " <transition to='theEnd' />" +
+ " </state>" +
+ " <state name='stateTwo'>" +
+ " <transition to='theEnd' />" +
+ " </state>" +
+ " <end name='theEnd' />" +
+ "</process>";
+
+ public void testCompletionWithNoOutcome() {
+ Ids ids = deployAndStartProcessInstance();
+ taskService.completeTask(ids.taskId);
+ assertExecutionInOneOrMoreActivitiesActive(ids.processInstanceId, "stateOne", "stateTwo");
+ assertNoOpenTasks(ids.processInstanceId);
+ assertHistoryTaskCreated(ids.processInstanceId, null);
+ }
+
+ public void testCompletionWithNullOrEmptyId() {
+ try {
+ taskService.completeTask(null);
+ fail();
+ } catch (JbpmException e) {
+ // exception should be thrown
+ }
+ try {
+ taskService.completeTask("");
+ fail();
+ } catch (JbpmException e) {
+ // exception should be thrown
+ }
+ }
+
+ public void testCompletionWithInvalidTaskId() {
+ try {
+ taskService.completeTask(Long.toString(-123456789L));
+ fail();
+ } catch (JbpmException e) {
+ // exception should be thrown
+ }
+ }
+
+ public void testCompletionWithOutcome() {
+ Ids ids = deployAndStartProcessInstance();
+ taskService.completeTask(ids.taskId, "one");
+
+ assertActivityActive(ids.processInstanceId, "stateOne");
+ assertNotActivityActive(ids.processInstanceId, "stateTwo");
+
+ assertNoOpenTasks(ids.processInstanceId);
+ assertHistoryTaskCreated(ids.processInstanceId, "one");
+ }
+
+ // Test for JBPM-2425
+ public void testCompletionWithInvalidOutcome() {
+ Ids ids = deployAndStartProcessInstance();
+
+ try {
+ taskService.completeTask(ids.taskId, "doesn't exist");
+ fail();
+ } catch (JbpmException e) {
+ // exception should be thrown
+ }
+
+ // Task should still be open now (rollback in db)
+ assertNotNull("After completion with an invalid outcome, the task should remain unchanged",
+ taskService.createTaskQuery().processInstanceId(ids.processInstanceId).uniqueResult());
+ }
+
+ public void testCompletionWithVariables() {
+ Ids ids = deployAndStartProcessInstance();
+ Map<String, Object> vars = new HashMap<String, Object>();
+ vars.put("testVar", "testValue");
+ taskService.completeTask(ids.taskId, vars);
+
+ assertEquals("testValue", executionService.getVariable(ids.processInstanceId, "testVar"));
+ assertNoOpenTasks(ids.processInstanceId);
+ assertHistoryTaskCreated(ids.processInstanceId, null);
+ }
+
+ public void testCompletionWithOutcomeAndVariables() {
+ Ids ids = deployAndStartProcessInstance();
+ Map<String, Object> vars = new HashMap<String, Object>();
+ vars.put("testVar", "testValue");
+ taskService.completeTask(ids.taskId, "two",vars);
+
+ assertEquals("testValue", executionService.getVariable(ids.processInstanceId, "testVar"));
+ assertActivityActive(ids.processInstanceId, "stateTwo");
+
+ assertNoOpenTasks(ids.processInstanceId);
+ assertHistoryTaskCreated(ids.processInstanceId, "two");
+ }
+
+ /**
+ * Returns the process instance id and the taskId of the single task
+ * that is open after process start
+ */
+ private Ids deployAndStartProcessInstance() {
+ deployJpdlXmlString(PROCESS);
+ Ids result = new Ids();
+ result.processInstanceId = executionService.startProcessInstanceByKey("taskCompletion").getId();
+ result.taskId = taskService.createTaskQuery().processInstanceId(result.processInstanceId).uniqueResult().getId();
+ return result;
+ }
+
+ private void assertHistoryTaskCreated(String executionId, String historicalOutcome) {
+ HistoryTask historyTask = historyService.createHistoryTaskQuery()
+ .executionId(executionId)
+ .uniqueResult();
+ assertNotNull(historyTask);
+ if (historicalOutcome != null) {
+ assertEquals(historicalOutcome, historyTask.getOutcome());
+ }
+ }
+
+ /* Just a wrapper for two ids, since Java doesnt allow to return multiple values */
+ private class Ids {
+
+ private String processInstanceId;
+ private String taskId;
+
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskCompletionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskOutcomesTest.java (from rev 5705, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskOutcomesTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskOutcomesTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskOutcomesTest.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,273 @@
+/*
+ * 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.test.activity.task;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskOutcomesTest extends JbpmTestCase {
+
+ public void testTaskSingleUnnamedTransition() {
+ deployJpdlXmlString(
+ "<process name='UnnamedTransition'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("UnnamedTransition");
+
+ Task task = taskService
+ .createTaskQuery()
+ .assignee("johndoe")
+ .uniqueResult();
+
+ taskService.completeTask(task.getId());
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+
+ assertNotNull(processInstance.findActiveExecutionIn("wait"));
+ }
+
+ public void testTaskTakeSingleNamedTransition() {
+ deployJpdlXmlString(
+ "<process name='NamedTransition'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition name='theOneAndOnly' to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("NamedTransition");
+
+ Task task = taskService
+ .createTaskQuery()
+ .assignee("johndoe")
+ .uniqueResult();
+
+ taskService.completeTask(task.getId());
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+
+ assertNotNull(processInstance.findActiveExecutionIn("wait"));
+ }
+
+ public void testTaskTakeSingleNamedTransitionWithMatchingOutcome() {
+ deployJpdlXmlString(
+ "<process name='MatchingOutdome'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition name='theOneAndOnly' to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("MatchingOutdome");
+
+ Task task = taskService
+ .createTaskQuery()
+ .assignee("johndoe")
+ .uniqueResult();
+
+ taskService.completeTask(task.getId(), "theOneAndOnly");
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+
+ assertNotNull(processInstance.findActiveExecutionIn("wait"));
+ }
+
+ public void testTaskTakeSingleNamedTransitionWithUnmatchingOutcome() {
+ deployJpdlXmlString(
+ "<process name='UnmatchingOutcome'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("UnmatchingOutcome");
+
+ Task task = taskService
+ .createTaskQuery()
+ .assignee("johndoe")
+ .uniqueResult();
+
+ try {
+ taskService.completeTask(task.getId(), "Refused");
+ fail();
+ } catch (JbpmException e) {
+ // exception should be thrown
+ }
+
+ }
+
+ public void testGetOutcomesNoTransition() {
+ deployJpdlXmlString(
+ "<process name='UnmatchingOutcome'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("UnmatchingOutcome");
+
+ Task task = taskService
+ .createTaskQuery()
+ .assignee("johndoe")
+ .uniqueResult();
+
+ Set<String> outcomes = taskService.getOutcomes(task.getId());
+
+ Set<String> expectedOutcomes = new HashSet<String>();
+ expectedOutcomes.add(Task.STATE_COMPLETED);
+
+ assertEquals(expectedOutcomes, outcomes);
+ }
+
+ public void testGetOutcomesSingleUnnamedTransition() {
+ deployJpdlXmlString(
+ "<process name='UnmatchingOutcome'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("UnmatchingOutcome");
+
+ Task task = taskService
+ .createTaskQuery()
+ .assignee("johndoe")
+ .uniqueResult();
+
+ Set<String> outcomes = taskService.getOutcomes(task.getId());
+
+ Set<String> expectedOutcomes = new HashSet<String>();
+ expectedOutcomes.add(Task.STATE_COMPLETED);
+ expectedOutcomes.add(null);
+
+ assertEquals(expectedOutcomes, outcomes);
+ }
+
+ public void testGetOutcomesSingleNamedTransition() {
+ deployJpdlXmlString(
+ "<process name='UnmatchingOutcome'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition name='toedeloe' to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("UnmatchingOutcome");
+
+ Task task = taskService
+ .createTaskQuery()
+ .assignee("johndoe")
+ .uniqueResult();
+
+ Set<String> outcomes = taskService.getOutcomes(task.getId());
+
+ Set<String> expectedOutcomes = new HashSet<String>();
+ expectedOutcomes.add(Task.STATE_COMPLETED);
+ expectedOutcomes.add("toedeloe");
+
+ assertEquals(expectedOutcomes, outcomes);
+ }
+
+ public void testGetOutcomesMultipleTransitions() {
+ deployJpdlXmlString(
+ "<process name='UnmatchingOutcome'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition name='left' to='wait' />" +
+ " <transition name='right' to='wait' />" +
+ " <transition name='middle' to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("UnmatchingOutcome");
+
+ Task task = taskService
+ .createTaskQuery()
+ .assignee("johndoe")
+ .uniqueResult();
+
+ Set<String> outcomes = taskService.getOutcomes(task.getId());
+
+ Set<String> expectedOutcomes = new HashSet<String>();
+ expectedOutcomes.add(Task.STATE_COMPLETED);
+ expectedOutcomes.add("left");
+ expectedOutcomes.add("right");
+ expectedOutcomes.add("middle");
+
+ assertEquals(expectedOutcomes, outcomes);
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskOutcomesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskReassignTest.java (from rev 5705, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskReassignTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskReassignTest.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.activity.task;
+
+import java.util.List;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.history.HistoryTask;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskReassignTest extends JbpmTestCase {
+
+ public void testReassignHistory() {
+ deployJpdlXmlString(
+ "<process name='ReassignTest'>" +
+ " <start>" +
+ " <transition to='write email'/>" +
+ " </start>" +
+ " <task name='write email' assignee='shekharv'>" +
+ " <transition to='end'/>" +
+ " </task>" +
+ " <end name='end'/>" +
+ "</process>"
+ );
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ReassignTest");
+
+ List<Task> tasks = taskService.findPersonalTasks("shekharv");
+ assertTrue(tasks.size() == 1);
+
+ String taskId = tasks.get(0).getId();
+
+ taskService.assignTask(taskId, "johndoe");
+
+ List<Task> tasksAfterReassignment = taskService.findPersonalTasks("shekharv");
+ assertTrue("shekharv should not have any tasks.", tasksAfterReassignment.size() == 0);
+
+ List<Task> tasksForNewAssignee = taskService.findPersonalTasks("johndoe");
+ assertTrue("johndoe should have 1 task.", tasksForNewAssignee.size() == 1);
+
+ assertEquals("johndoe", taskService.getTask(taskId).getAssignee());
+
+ taskService.completeTask(taskId);
+
+ HistoryTask historyTask = historyService
+ .createHistoryTaskQuery()
+ .taskId(taskId)
+ .uniqueResult();
+
+ assertEquals("John Doe completed the Task, but someone else got the credit", "johndoe", historyTask.getAssignee());
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskReassignTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-10-07 12:24:14 UTC (rev 5708)
@@ -242,31 +242,82 @@
assertEquals(expectedOrder, executionService.getVariable(processInstanceId, "order"));
}
-//
-// public void testProcessStartListenerExpr() {
-// deployJpdlXmlString(
-// "<process name='Insurance claim' key='ICL'>" +
-// " <on event='start'>" +
-// " <event-listener expr='#{processstartlistener}' />" +
-// " </on>" +
-// " <start>" +
-// " <transition to='a' />" +
-// " </start>" +
-// " <state name='a' />" +
-// "</process>"
-// );
-//
-// Map<String, Object> variables = new HashMap<String, Object>();
-// variables.put("processstartlistener", new ProcessStartListener());
-// String processInstanceId = executionService.startProcessInstanceByKey("ICL", variables).getId();
-//
-// assertEquals("true", executionService.getVariable(processInstanceId, "isInvoked"));
-//
-// executionService.setVariable(processInstanceId, "isInvoked", "false");
-//
-// executionService.signalExecutionById(processInstanceId);
-//
-// assertEquals("false", executionService.getVariable(processInstanceId, "isInvoked"));
-// }
-//
+
+ public void testProcessStartListenerExpr() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <on event='start'>" +
+ " <event-listener expr='#{processstartlistener}' />" +
+ " </on>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("processstartlistener", new ProcessStartListener());
+ String processInstanceId = executionService.startProcessInstanceByKey("ICL", variables).getId();
+
+ assertEquals("true", executionService.getVariable(processInstanceId, "isInvoked"));
+
+ executionService.setVariable(processInstanceId, "isInvoked", "false");
+
+ executionService.signalExecutionById(processInstanceId);
+
+ assertEquals("false", executionService.getVariable(processInstanceId, "isInvoked"));
+ }
+
+ public void testActivityStartListenerExpr() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='s' />" +
+ " </start>" +
+ " <state name='s'>" +
+ " <on event='start'>" +
+ " <event-listener expr='#{activitystartlistener}' />" +
+ " </on>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <state name='end' />" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("activitystartlistener", new ActivityStartListener());
+ String processInstanceId = executionService.startProcessInstanceByKey("ICL", variables).getId();
+
+ assertEquals("true", executionService.getVariable(processInstanceId, "isInvoked"));
+ }
+
+ public void testActivityEndListenerExpr() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='s' />" +
+ " </start>" +
+ " <state name='s'>" +
+ " <on event='end'>" +
+ " <event-listener expr='#{activityendlistener}' />" +
+ " </on>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <state name='end' />" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("activityendlistener", new ActivityEndListener());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL", variables);
+ String processInstanceId = processInstance.getId();
+
+ assertNull(executionService.getVariable(processInstanceId, "isInvoked"));
+
+ executionService.signalExecutionById(processInstance.getId());
+
+ assertEquals("true", executionService.getVariable(processInstanceId, "isInvoked"));
+ }
+
}
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-10-07 00:32:13 UTC (rev 5707)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-10-07 12:24:14 UTC (rev 5708)
@@ -2,9 +2,13 @@
<title>jPDL</title>
<para>This chapter will explain the jPDL file format for describing
- process definitions. The schemadocs can also serve as a quick reference for this
- information.
+ process definitions.
</para>
+ <para>The jPDL schema file contains more attributes and elements then this
+ documentation. This documentation explains the stable and supported part of jPDL.
+ So use this documentation as a reference to know what attributes and elements
+ are stable and supported.
+ </para>
<para>An example jPDL process file looks like this:
</para>
<programlisting><?xml version="1.0" encoding="UTF-8"?>
@@ -436,30 +440,10 @@
<programlisting>public interface DecisionHandler {
String decide(OpenExecution execution);
}</programlisting>
- <para>The handler is specified as a sub element of the decision</para>
- <table><title><literal>decision.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>The handler is specified as a sub element of the decision.
+ The configuration attributes and content of a decision <literal>handler</literal>
+ element can be found in <xref linkend="usercode" />.
+ </para>
<para>Here's an example process of a decision using a DecisionHandler:</para>
<figure id="process.decision.handler">
<title>The decision handler example process</title>
@@ -2536,6 +2520,12 @@
</tgroup>
</table>
<table><title>event listener attributes:</title>
+ <para><literal>event-listener</literal> is user code so it can be configured
+ like described in <xref linkend="usercode" />.
+ </para>
+ <para>Any automatic activities (including event-listener) that are placed on
+ events can specify following additional attributes:
+ </para>
<tgroup cols="5" rowsep="1" colsep="1">
<thead>
<row>
16 years, 6 months
JBoss JBPM SVN: r5707 - in jbpm3/branches/jbpm-3.2-soa: modules/core/src/main/java/org/jbpm/command and 1 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-10-06 20:32:13 -0400 (Tue, 06 Oct 2009)
New Revision: 5707
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/profiles.redhat.qa.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java
jbpm3/branches/jbpm-3.2-soa/modules/db/scripts/antrun-jbpmschema.xml
Log:
[JBPM-2563] switch to sybase server at vmg07, append "go" to sybase scripts
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/profiles.redhat.qa.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/profiles.redhat.qa.xml 2009-10-06 15:38:04 UTC (rev 5706)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/profiles.redhat.qa.xml 2009-10-07 00:32:13 UTC (rev 5707)
@@ -46,8 +46,8 @@
<jdbc.postgresql.username>jbpm3</jdbc.postgresql.username>
<jdbc.postgresql.password>jbpm3</jdbc.postgresql.password>
- <jdbc.sybase.server>dev77.qa.atl2.redhat.com</jdbc.sybase.server>
- <jdbc.sybase.port>4100</jdbc.sybase.port>
+ <jdbc.sybase.server>vmg07.mw.lab.eng.bos.redhat.com</jdbc.sybase.server>
+ <jdbc.sybase.port>5000</jdbc.sybase.port>
<jdbc.sybase.database>jbpm3</jdbc.sybase.database>
<jdbc.sybase.url>jdbc:jtds:sybase://${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
<!-- jconnect.url jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database} -->
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java 2009-10-06 15:38:04 UTC (rev 5706)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java 2009-10-07 00:32:13 UTC (rev 5707)
@@ -26,8 +26,7 @@
/**
* <b>THIS COMMAND IS NOT YET STABLE, BUT FEEL FREE TO TEST :-)</b><br>
- * Status update: Still not complete, but refactored and added simple test cases:
- * {@link ChangeProcessInstanceVersionCommandTest}.<br>
+ * Status update: Still not complete, but refactored and added simple test cases.<br>
* Change the version of a running process instance. This works only, if the current node is also
* available in the new version of the process definition or a name mapping has to be provided.<br>
* <b>Currently known limitations:</b>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/db/scripts/antrun-jbpmschema.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/db/scripts/antrun-jbpmschema.xml 2009-10-06 15:38:04 UTC (rev 5706)
+++ jbpm3/branches/jbpm-3.2-soa/modules/db/scripts/antrun-jbpmschema.xml 2009-10-07 00:32:13 UTC (rev 5707)
@@ -44,6 +44,7 @@
<jbpmschema output="${scriptsdir}/jbpm.sybase.create.sql"
config="hibernate.cfg.sybase.xml"
action="create" />
+ <concat destfile="${scriptsdir}/jbpm.sybase.create.sql" append="yes">go</concat>
</target>
<target name="drop-schema"
@@ -73,6 +74,7 @@
<jbpmschema output="${scriptsdir}/jbpm.sybase.drop.sql"
config="hibernate.cfg.sybase.xml"
action="drop" />
+ <concat destfile="${scriptsdir}/jbpm.sybase.drop.sql" append="yes">go</concat>
</target>
<target name="update-schema"
@@ -106,6 +108,7 @@
config="hibernate.cfg.sybase.xml"
properties="sybase.properties"
action="update" />
+ <concat destfile="${scriptsdir}/jbpm.sybase.update.sql" append="yes">go</concat>
</target>
</project>
16 years, 6 months
JBoss JBPM SVN: r5706 - in jbpm4/trunk/modules: jpdl/src/main/java/org/jbpm/jpdl/internal/activity and 11 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-06 11:38:04 -0400 (Tue, 06 Oct 2009)
New Revision: 5706
Added:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/custom/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/custom/CustomConfigurationsTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/Hand.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JavaActivity40Test.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JoeSmoe.java
Modified:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Bindings.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
jbpm4/trunk/modules/test-db/src/test/resources/logging.properties
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2565 refactored custom parsing to use UserCodeReference
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-10-06 15:38:04 UTC (rev 5706)
@@ -692,4 +692,20 @@
</section>
</section>
+ <section>
+ <title>User object caching</title>
+ <para>As indicated in section "User code" in the Users guide, instantiated user objects
+ are by default cached as part of the process definition. So the single user object will
+ be used to serve all requests. So you have to make sure that when your user code is used,
+ that it doesn't change the member fields of the user object. In that case it will be safe
+ for your user object to be used by all threads/requests. This is also called stateless
+ user objects.
+ </para>
+ <para>In case you do have a need for stateful user objects, you can specify
+ parameter <literal>cache="disabled"</literal> on the definition of the user
+ code. In that case a new user code object will be instatiated for every
+ usage.
+ </para>
+ </section>
+
</chapter>
Added: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -0,0 +1,54 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.Map;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected UserCodeReference customActivityReference;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ ActivityBehaviour activityBehaviour = (ActivityBehaviour) customActivityReference.getObject(execution);
+ activityBehaviour.execute(execution);
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
+ ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour) customActivityReference.getObject(execution);
+ externalActivityBehaviour.signal(execution, signalName, parameters);
+ }
+
+ public void setCustomActivityReference(UserCodeReference customActivityReference) {
+ this.customActivityReference = customActivityReference;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomActivity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/CustomBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -21,13 +21,11 @@
*/
package org.jbpm.jpdl.internal.activity;
-import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.pvm.internal.wire.JbpmClassNotFoundException;
-import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -42,14 +40,10 @@
super("custom");
}
- public Object parse(Element element, Parse parse, Parser parser) {
- ObjectDescriptor customActivitydescriptor = (ObjectDescriptor) objectBinding.parse(element, parse, wireParser);
- try {
- ActivityBehaviour customActivityBehaviour = (ActivityBehaviour) WireContext.create(customActivitydescriptor);
- return customActivityBehaviour;
-
- } catch (JbpmClassNotFoundException e) {
- return customActivitydescriptor;
- }
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
+ CustomActivity customActivity = new CustomActivity();
+ UserCodeReference customActivityReference = parser.parseUserCodeReference(element, parse);
+ customActivity.setCustomActivityReference(customActivityReference);
+ return customActivity;
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
@@ -32,7 +33,6 @@
import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -48,7 +48,7 @@
super("decision");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
if (element.hasAttribute("expr")) {
DecisionExpressionActivity decisionExpressionActivity = new DecisionExpressionActivity();
String expr = element.getAttribute("expr");
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -21,9 +21,9 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
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;
@@ -40,7 +40,7 @@
super(tag);
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
boolean endProcessInstance = true;
String ends = XmlUtil.attribute(element, "ends", false, parse);
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -21,8 +21,8 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -35,8 +35,8 @@
super("end-cancel");
}
- public Object parse(Element element, Parse parse, Parser parser) {
- EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
+ EndActivity endActivity = (EndActivity) super.parseJpdl(element, parse, parser);
endActivity.setState("cancel");
return endActivity;
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -21,8 +21,8 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -35,8 +35,8 @@
super("end-error");
}
- public Object parse(Element element, Parse parse, Parser parser) {
- EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
+ EndActivity endActivity = (EndActivity) super.parseJpdl(element, parse, parser);
endActivity.setState("error");
return endActivity;
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EventListenerBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -27,7 +27,6 @@
import org.jbpm.pvm.internal.wire.JbpmClassNotFoundException;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -40,7 +39,7 @@
super("event-listener");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
Descriptor eventListenerDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
try {
EventListener eventListener = (EventListener) WireContext.create(eventListenerDescriptor);
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -21,8 +21,8 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -35,7 +35,7 @@
super("fork");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
return new ForkActivity();
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -24,7 +24,6 @@
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -37,13 +36,12 @@
super("group");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
GroupActivity groupActivity = new GroupActivity();
ActivityImpl activity = parse.contextStackFind(ActivityImpl.class);
- JpdlParser jpdlParser = (JpdlParser) parser;
- jpdlParser.parseActivities(element, parse, activity);
+ parser.parseActivities(element, parse, activity);
return groupActivity;
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -24,12 +24,12 @@
import java.util.ArrayList;
import java.util.List;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -48,7 +48,7 @@
super(tagName);
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
HqlActivity hqlActivity = createHqlActivity();
Element queryElement = XmlUtil.element(element, "query", true, parse);
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -30,7 +30,6 @@
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -45,7 +44,7 @@
super(TAG);
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
JavaActivity javaActivity = new JavaActivity();
String methodName = XmlUtil.attribute(element, "method", true, parse, null);
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -22,8 +22,8 @@
package org.jbpm.jpdl.internal.activity;
import org.hibernate.LockMode;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -40,7 +40,7 @@
super("join");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
JoinActivity joinActivity = new JoinActivity();
if (element.hasAttribute(MULTIPLICITY)) {
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -34,6 +34,7 @@
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -48,6 +49,12 @@
super(tagName, null, null);
}
+ public abstract Object parseJpdl(Element element, Parse parse, JpdlParser parser);
+
+ public final Object parse(Element element, Parse parse, Parser parser) {
+ return parseJpdl(element, parse, (JpdlParser) parser);
+ }
+
public void parseName(Element element, ActivityImpl activity, Parse parse) {
String name = XmlUtil.attribute(element, "name", isNameRequired(), parse);
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -21,11 +21,9 @@
*/
package org.jbpm.jpdl.internal.activity;
-import org.w3c.dom.Element;
-
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
/**
* @author Alejandro Guizar
@@ -36,7 +34,7 @@
super("mail");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
MailActivity activity = new MailActivity();
activity.setMailProducer(JpdlParser.parseMailProducer(element, parse, null));
return activity;
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -21,11 +21,11 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.script.ScriptManager;
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;
@@ -40,7 +40,7 @@
super(TAG);
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
String language = null;
String script = XmlUtil.attribute(element, "expr");
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -22,10 +22,10 @@
package org.jbpm.jpdl.internal.activity;
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.model.ActivityImpl;
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;
@@ -38,7 +38,7 @@
super("start");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
ActivityImpl startActivity = parse.contextStackFind(ActivityImpl.class);
JpdlProcessDefinition processDefinition = parse.contextStackFind(JpdlProcessDefinition.class);
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -21,8 +21,8 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -35,7 +35,7 @@
super("state");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
return new StateActivity();
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -26,12 +26,12 @@
import java.util.List;
import java.util.Map;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.xml.WireParser;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -44,7 +44,7 @@
super("sub-process");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
SubProcessActivity subProcessActivity = new SubProcessActivity();
String subProcessKey = XmlUtil.attribute(element, "sub-process-key");
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -25,7 +25,6 @@
import org.jbpm.pvm.internal.model.ScopeElementImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
/**
@@ -39,7 +38,7 @@
super(TAG);
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
TaskActivity taskActivity = new TaskActivity();
ScopeElementImpl scopeElement = parse.contextStackFind(ScopeElementImpl.class);
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -66,6 +66,7 @@
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.UserCodeReference;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.binding.MailTemplateBinding;
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
@@ -99,6 +100,7 @@
}
public static final WireParser wireParser = WireParser.getInstance();
+ public static final ObjectBinding objectBinding = ObjectBinding.INSTANCE;
// array elements are mutable, even when final
// never make a static array public
@@ -167,23 +169,38 @@
// make the process language version available for bindings
// to allow for specific parsing behaviour per version
+
+ // first check if the langid is available as a deployment property
DeploymentImpl deployment = (DeploymentImpl) parse.contextMapGet(Parse.CONTEXT_KEY_DEPLOYMENT);
if (deployment!=null) {
String processLanguageId = deployment.getProcessLanguageId(name);
if (processLanguageId==null) {
+ // if it is not available as a deployment property, check if the
+ // jpdlparser attribute specifies a specific jpdl version.
+ // this is the case for certain compatibility tests in our test suite
String jpdlParser = XmlUtil.attribute(documentElement, "jpdlparser");
if (jpdlParser!=null) {
processLanguageId = "jpdl-"+jpdlParser;
} else {
- // specify the jpdltestversion with "mvn -Djpdltestversion=jpdl-4.3 clean install"
+ // if none of the above, check if this is a parser test run for a specific verion
+ // specify the jpdltestversion with "mvn -Djpdlparser=jpdl-4.3 clean install"
// that way, the whole test suite will be use the specified parser
jpdlParser = System.getProperty("jpdlparser");
if (jpdlParser!=null) {
processLanguageId = "jpdl-"+jpdlParser;
} else {
- processLanguageId = CURRENT_VERSION_PROCESS_LANGUAGE_ID;
+ // if this process has a namespace, then use the namespace
+ // to see what jpdl parser version should be used
+ String namespaceUri = documentElement.getNamespaceURI();
+ if (namespaceUri!=null) {
+ processLanguageId = "jpdl-"+namespaceUri.substring(16, 19);
+
+ } else {
+ // if none of the above, just deploy it as the current library version
+ processLanguageId = CURRENT_VERSION_PROCESS_LANGUAGE_ID;
+ }
}
}
// saving the process language will make sure that
@@ -716,5 +733,20 @@
parse.addProblem("mail template not found: " + templateName, element);
return null;
}
+
+ // generic helper methods for jpdl activity and event listener bindings /////
+ public UserCodeReference parseUserCodeReference(Element element, Parse parse) {
+ UserCodeReference userCodeReference = new UserCodeReference();
+
+ ObjectDescriptor objectDescriptor = (ObjectDescriptor) objectBinding.parse(element, parse, wireParser);
+ userCodeReference.setDescriptor(objectDescriptor);
+
+ Boolean isCached = XmlUtil.attributeBoolean(element, "cache", false, parse, null);
+ if (isCached!=null) {
+ userCodeReference.setCached(isCached.booleanValue());
+ }
+
+ return userCodeReference;
+ }
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -0,0 +1,93 @@
+/*
+ * 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.pvm.internal.wire;
+
+import java.io.Serializable;
+
+import org.jbpm.api.Execution;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserCodeReference implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected boolean isCached = true;
+ protected Object cachedObject;
+ protected Descriptor descriptor;
+
+ public Object getObject(Execution execution) {
+ return getObject(null, execution);
+ }
+
+ public Object getObject(ProcessDefinitionImpl processDefinition) {
+ return getObject(processDefinition, null);
+ }
+
+ protected Object getObject(ProcessDefinitionImpl processDefinition, Execution execution) {
+ if (cachedObject!=null) {
+ return cachedObject;
+ }
+ if (descriptor!=null) {
+ if (processDefinition==null) {
+ processDefinition = getProcessDefinition(execution);
+ }
+
+ Object usedObject = ReflectUtil.instantiateUserCode(descriptor, processDefinition);
+ if (isCached) {
+ cachedObject = usedObject;
+ }
+ return usedObject;
+ }
+ return null;
+ }
+
+ protected ProcessDefinitionImpl getProcessDefinition(Execution execution) {
+ ProcessDefinitionImpl processDefinition = null;
+ ExecutionImpl executionImpl = (ExecutionImpl) execution;
+ ActivityImpl activity = executionImpl.getActivity();
+ TransitionImpl transition = executionImpl.getTransition();
+ if (activity!=null) {
+ processDefinition = activity.getProcessDefinition();
+ }
+ if ( (processDefinition==null)
+ && (transition!=null)
+ ) {
+ processDefinition = transition.getProcessDefinition();
+ }
+ return processDefinition;
+ }
+
+ public void setCached(boolean isCached) {
+ this.isCached = isCached;
+ }
+ public void setDescriptor(Descriptor descriptor) {
+ this.descriptor = descriptor;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/UserCodeReference.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -47,6 +47,7 @@
public class ObjectBinding extends WireDescriptorBinding {
public static final String TAG = "object";
+ public static final ObjectBinding INSTANCE = new ObjectBinding();
public ObjectBinding() {
super(TAG);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Bindings.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Bindings.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Bindings.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -117,11 +117,15 @@
/** the set of all tagNames for which there is a binding specified in the given category */
public Set<String> getTagNames(String category) {
+ Set<String> tagNames = new HashSet<String>();
+
List<Binding> categoryBindings = (bindings!=null ? bindings.get(category) : null );
- Set<String> tagNames = new HashSet<String>();
- for (Binding binding: categoryBindings) {
- tagNames.add(binding.toString());
+ if (categoryBindings!=null) {
+ for (Binding binding: categoryBindings) {
+ tagNames.add(binding.toString());
+ }
}
+
return tagNames;
}
}
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/custom/CustomConfigurationsTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/custom/CustomConfigurationsTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/custom/CustomConfigurationsTest.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -0,0 +1,292 @@
+/*
+ * 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.test.activity.custom;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomConfigurationsTest extends JbpmTestCase {
+
+ public static class MyCustomAutomatic implements ActivityBehaviour {
+ private static final long serialVersionUID = 1L;
+ public void execute(ActivityExecution execution) throws Exception {
+ }
+ }
+
+ public void testCustomAutomaticClass() {
+ deployJpdlXmlString(
+ "<process name='CustomClass'>" +
+ " <start>" +
+ " <transition to='c' />" +
+ " </start>" +
+ " <custom name='c' class='"+MyCustomAutomatic.class.getName()+"'>" +
+ " <transition to='wait' />" +
+ " </custom>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("CustomClass");
+
+ assertTrue(processInstance.findActiveActivityNames().contains("wait"));
+ }
+
+ public static class MyCustomWait implements ExternalActivityBehaviour {
+ private static final long serialVersionUID = 1L;
+ public void execute(ActivityExecution execution) throws Exception {
+ execution.waitForSignal();
+ }
+ public void signal(ActivityExecution execution, String signalName, Map<String, ? > parameters) throws Exception {
+ execution.take("3");
+ }
+ }
+
+ public void testCustomWaitClass() {
+ deployJpdlXmlString(
+ "<process name='CustomClass'>" +
+ " <start>" +
+ " <transition to='c' />" +
+ " </start>" +
+ " <custom name='c' class='"+MyCustomWait.class.getName()+"'>" +
+ " <transition name='1' to='the 1st way' />" +
+ " <transition name='2' to='the 2nd way' />" +
+ " <transition name='3' to='the 3rd way' />" +
+ " </custom>" +
+ " <state name='the 1st way' />" +
+ " <state name='the 2nd way' />" +
+ " <state name='the 3rd way' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("CustomClass");
+
+ Set<String> findActiveActivityNames = processInstance.findActiveActivityNames();
+ assertTrue(findActiveActivityNames.contains("c"));
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+
+ findActiveActivityNames = processInstance.findActiveActivityNames();
+ assertTrue(findActiveActivityNames.contains("the 3rd way"));
+ }
+
+ public static class MyCustomAutomaticWithFieldAndProperty implements ActivityBehaviour {
+ private static final long serialVersionUID = 1L;
+ String text;
+ Long objectLong;
+
+ int basicInt;
+ Integer objectInt;
+ long basicLong;
+ float basicFloat;
+ Float objectFloat;
+ double basicDouble;
+ Double objectDouble;
+ boolean basicBooleanTrue;
+ boolean basicBooleanFalse;
+ Boolean objectBooleanTrue;
+ Boolean objectBooleanFalse;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ execution.setVariable("text", text);
+ execution.setVariable("number", objectLong);
+ execution.setVariable("basicInt", basicInt);
+ execution.setVariable("objectInt", objectInt);
+ execution.setVariable("basicLong", basicLong);
+ execution.setVariable("basicFloat", basicFloat);
+ execution.setVariable("objectFloat", objectFloat);
+ execution.setVariable("basicDouble", basicDouble);
+ execution.setVariable("objectDouble", objectDouble);
+ execution.setVariable("basicBooleanTrue", basicBooleanTrue);
+ execution.setVariable("basicBooleanFalse", basicBooleanFalse);
+ execution.setVariable("objectBooleanTrue", objectBooleanTrue);
+ execution.setVariable("objectBooleanFalse", objectBooleanFalse);
+ }
+ public void setNumberProperty(Long number) {
+ this.objectLong = number;
+ }
+ }
+
+ public void testCustomAutomaticClassWithInjections() {
+ deployJpdlXmlString(
+ "<process name='CustomClass'>" +
+ " <start>" +
+ " <transition to='c' />" +
+ " </start>" +
+ " <custom name='c' class='"+MyCustomAutomaticWithFieldAndProperty.class.getName()+"'>" +
+ " <field name='text'><string value='hi' /></field>" +
+ " <property name='numberProperty'><long value='5' /></property>" +
+ " <field name='basicInt'><int value='6' /></field>" +
+ " <field name='objectInt'><int value='7' /></field>" +
+ " <field name='basicLong'><long value='99999999999' /></field>" +
+ " <field name='basicFloat'><float value='99.99' /></field>" +
+ " <field name='objectFloat'><float value='88.88' /></field>" +
+ " <field name='basicDouble'><double value='9999999999.99' /></field>" +
+ " <field name='objectDouble'><double value='8888888888.88' /></field>" +
+ " <field name='basicBooleanTrue'><true /></field>" +
+ " <field name='basicBooleanFalse'><false /></field>" +
+ " <field name='objectBooleanTrue'><true /></field>" +
+ " <field name='objectBooleanFalse'><false /></field>" +
+ " <transition to='wait' />" +
+ " </custom>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("CustomClass");
+
+ assertTrue(processInstance.findActiveActivityNames().contains("wait"));
+
+ assertEquals("hi", executionService.getVariable(processInstance.getId(), "text"));
+ assertEquals(new Long(5), executionService.getVariable(processInstance.getId(), "number"));
+
+ assertEquals(new Integer("6"), executionService.getVariable(processInstance.getId(), "basicInt"));
+ assertEquals(new Integer("7"), executionService.getVariable(processInstance.getId(), "objectInt"));
+ assertEquals(99999999999L, executionService.getVariable(processInstance.getId(), "basicLong"));
+ assertEquals(new Float("99.99"), executionService.getVariable(processInstance.getId(), "basicFloat"));
+ assertEquals(new Float("88.88"), executionService.getVariable(processInstance.getId(), "objectFloat"));
+ assertEquals(new Double("9999999999.99"), executionService.getVariable(processInstance.getId(), "basicDouble"));
+ assertEquals(new Double("8888888888.88"), executionService.getVariable(processInstance.getId(), "objectDouble"));
+ assertEquals(Boolean.TRUE, executionService.getVariable(processInstance.getId(), "basicBooleanTrue"));
+ assertEquals(Boolean.FALSE, executionService.getVariable(processInstance.getId(), "basicBooleanFalse"));
+ assertEquals(Boolean.TRUE, executionService.getVariable(processInstance.getId(), "objectBooleanTrue"));
+ assertEquals(Boolean.FALSE, executionService.getVariable(processInstance.getId(), "objectBooleanFalse"));
+ }
+
+
+ public void testCustomAutomaticExpr() {
+ deployJpdlXmlString(
+ "<process name='CustomExpr'>" +
+ " <start>" +
+ " <transition to='c' />" +
+ " </start>" +
+ " <custom name='c' expr='#{custombehaviour}'>" +
+ " <transition to='wait' />" +
+ " </custom>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("custombehaviour", new MyCustomAutomatic());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("CustomExpr", variables);
+
+ assertTrue(processInstance.findActiveActivityNames().contains("wait"));
+ }
+
+ public void testCustomWaitExpr() {
+ deployJpdlXmlString(
+ "<process name='CustomExpr'>" +
+ " <start>" +
+ " <transition to='c' />" +
+ " </start>" +
+ " <custom name='c' expr='#{custombehaviour}'>" +
+ " <transition name='1' to='the 1st way' />" +
+ " <transition name='2' to='the 2nd way' />" +
+ " <transition name='3' to='the 3rd way' />" +
+ " </custom>" +
+ " <state name='the 1st way' />" +
+ " <state name='the 2nd way' />" +
+ " <state name='the 3rd way' />" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("custombehaviour", new MyCustomWait());
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("CustomExpr", variables);
+
+ Set<String> findActiveActivityNames = processInstance.findActiveActivityNames();
+ assertTrue(findActiveActivityNames.contains("c"));
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+
+ findActiveActivityNames = processInstance.findActiveActivityNames();
+ assertTrue(findActiveActivityNames.contains("the 3rd way"));
+ }
+
+ public static class ActivityBehaviourWithId implements ActivityBehaviour {
+ private static final long serialVersionUID = 1L;
+ private static int nextObjectId = 1;
+ int objectId = nextObjectId++;
+ public void execute(ActivityExecution execution) throws Exception {
+ execution.setVariable("objectId", objectId);
+ }
+ }
+
+ public void testCustomUserObjectCachingDefault() {
+ ActivityBehaviourWithId.nextObjectId = 1;
+ deployJpdlXmlString(
+ "<process name='CustomClass'>" +
+ " <start>" +
+ " <transition to='c' />" +
+ " </start>" +
+ " <custom name='c' class='"+ActivityBehaviourWithId.class.getName()+"'>" +
+ " <transition to='wait' />" +
+ " </custom>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ String pid = executionService.startProcessInstanceByKey("CustomClass").getId();
+ assertEquals(1, executionService.getVariable(pid, "objectId"));
+
+ pid = executionService.startProcessInstanceByKey("CustomClass").getId();
+ assertEquals(1, executionService.getVariable(pid, "objectId"));
+
+ pid = executionService.startProcessInstanceByKey("CustomClass").getId();
+ assertEquals(1, executionService.getVariable(pid, "objectId"));
+ }
+
+ public void testCustomUserObjectCachingDisabled() {
+ ActivityBehaviourWithId.nextObjectId = 1;
+ deployJpdlXmlString(
+ "<process name='CustomClass'>" +
+ " <start>" +
+ " <transition to='c' />" +
+ " </start>" +
+ " <custom name='c' cache='false' class='"+ActivityBehaviourWithId.class.getName()+"'>" +
+ " <transition to='wait' />" +
+ " </custom>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ String pid = executionService.startProcessInstanceByKey("CustomClass").getId();
+ assertEquals(1, executionService.getVariable(pid, "objectId"));
+
+ pid = executionService.startProcessInstanceByKey("CustomClass").getId();
+ assertEquals(2, executionService.getVariable(pid, "objectId"));
+
+ pid = executionService.startProcessInstanceByKey("CustomClass").getId();
+ assertEquals(3, executionService.getVariable(pid, "objectId"));
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/custom/CustomConfigurationsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/Hand.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/Hand.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/Hand.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -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.test.activity.java;
+
+import java.io.Serializable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Hand implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private boolean isShaken;
+
+ public String shake(Integer force, Integer duration) {
+ if (force>3 && duration>7) {
+ return "Nice to meet you. Wow, what a grip!";
+ }
+
+ return "Nice to meet you";
+ }
+
+ public boolean isShaken() {
+ return isShaken;
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/Hand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JavaActivity40Test.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JavaActivity40Test.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JavaActivity40Test.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -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.test.activity.java;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaActivity40Test extends JbpmTestCase {
+
+ public void testJavaActivityExpressionJpdl40() {
+ deployJpdlXmlString(
+ "<process name='JavaExpr40' xmlns='http://jbpm.org/4.0/jpdl' jpdlparser='4.0'>" +
+ " <start>" +
+ " <transition to='shake hand' />" +
+ " </start>" +
+ " <java name='shake hand' " +
+ " expr='#{hand}'" +
+ " method='shake'" +
+ " var='answer'>" +
+ " <arg><object expr='#{joesmoe.handshakes.force}'/></arg>" +
+ " <arg><object expr='#{joesmoe.handshakes.duration}'/></arg>" +
+ " <transition to='wait' />" +
+ " </java>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("hand", new Hand());
+ variables.put("joesmoe", new JoeSmoe());
+ String pid = executionService
+ .startProcessInstanceByKey("JavaExpr40", variables)
+ .getId();
+
+ String answer = (String) executionService.getVariable(pid, "answer");
+ assertEquals("Nice to meet you. Wow, what a grip!", answer);
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JavaActivity40Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JoeSmoe.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JoeSmoe.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JoeSmoe.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -0,0 +1,42 @@
+/*
+ * 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.test.activity.java;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JoeSmoe implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public Map<String, Integer> getHandshakes() {
+ Map<String, Integer> handshakes = new HashMap<String, Integer>();
+ handshakes.put("force", 5);
+ handshakes.put("duration", 12);
+ return handshakes;
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/java/JoeSmoe.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-10-06 15:38:04 UTC (rev 5706)
@@ -242,4 +242,31 @@
assertEquals(expectedOrder, executionService.getVariable(processInstanceId, "order"));
}
+//
+// public void testProcessStartListenerExpr() {
+// deployJpdlXmlString(
+// "<process name='Insurance claim' key='ICL'>" +
+// " <on event='start'>" +
+// " <event-listener expr='#{processstartlistener}' />" +
+// " </on>" +
+// " <start>" +
+// " <transition to='a' />" +
+// " </start>" +
+// " <state name='a' />" +
+// "</process>"
+// );
+//
+// Map<String, Object> variables = new HashMap<String, Object>();
+// variables.put("processstartlistener", new ProcessStartListener());
+// String processInstanceId = executionService.startProcessInstanceByKey("ICL", variables).getId();
+//
+// assertEquals("true", executionService.getVariable(processInstanceId, "isInvoked"));
+//
+// executionService.setVariable(processInstanceId, "isInvoked", "false");
+//
+// executionService.signalExecutionById(processInstanceId);
+//
+// assertEquals("false", executionService.getVariable(processInstanceId, "isInvoked"));
+// }
+//
}
Modified: jbpm4/trunk/modules/test-db/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/logging.properties 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/test-db/src/test/resources/logging.properties 2009-10-06 15:38:04 UTC (rev 5706)
@@ -12,7 +12,7 @@
org.hibernate.level=INFO
org.hibernate.cfg.SettingsFactory.level=SEVERE
org.hibernate.cfg.HbmBinder.level=SEVERE
-org.hibernate.SQL.level=FINEST
-org.hibernate.type.level=FINEST
+# org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
# org.hibernate.transaction.level=FINEST
\ No newline at end of file
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-10-06 06:19:58 UTC (rev 5705)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-10-06 15:38:04 UTC (rev 5706)
@@ -1829,8 +1829,9 @@
<entry>classname</entry>
<entry></entry>
<entry>either 'class' or 'expr' has to be specified</entry>
- <entry>The fully qualified classname. The class will be instantiated
- and the object will be disposed after this method invocation.
+ <entry>The fully qualified classname. See <xref linkend="usercodeclassloading"/>
+ for classloading information. The user code object will be lazy initialized
+ and cached as part of the process definition.
</entry>
</row>
<row>
@@ -2890,106 +2891,193 @@
<section id="usercode">
<title>User code</title>
<para>Various elements in the jPDL process language refer to a an
- object on which an interface method will be invoked.
+ object on which an interface method will be invoked. This section
+ describes the common attributes and elements for the instantiation and
+ configuration of such user code objects.
</para>
<itemizedlist>
+ <listitem><literal>custom</literal></listitem>
<listitem><literal>event-listener</literal></listitem>
- <listitem><literal>custom</literal></listitem>
- <listitem><literal>java</literal></listitem>
<listitem><literal>assignment-handler</literal> in task</listitem>
<listitem><literal>handler</literal> in decision</listitem>
+ <listitem><literal>condition</literal> in transition</listitem>
</itemizedlist>
- <para>For all objects that are referenced by a class name, will be
- instantiated during parsing time. Which implies that the objects aren't
- allowed to store non-stateless data (ie which can change).
- This is typically OK since those objects are in practice almost always immutable.
- If you do need to use 'dynamic' data in your user code, you can always
- fall back to process variables (or Environment.get(xxx) calls).
- </para>
- <para>Objects that are referenced by an expression are calculated
- dynamically.
- </para>
- <table><title>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>one of {class|expr} is required</entry>
- <entry>The fully qualified classname.</entry>
- </row>
- <row>
- <entry><literal>expr</literal></entry>
- <entry>expression</entry>
- <entry></entry>
- <entry>one of {class|expr} is required</entry>
- <entry>Expression for which the resulting value will be taken as the target object.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table><title>sub elements:</title>
- <tgroup cols="3" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Element</entry>
- <entry>Multiplicity</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>field</literal></entry>
- <entry>0..*</entry>
- <entry>describes a configuration value to be injected directly in
- a memberfield before this user class is used.</entry>
- </row>
- <row>
- <entry><literal>property</literal></entry>
- <entry>0..*</entry>
- <entry>describes a configuration value to injected through a setter
- method before this user object is used.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table><title><literal>field</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>name</literal></entry>
- <entry>string</entry>
- <entry></entry>
- <entry><emphasis role="bold">required</emphasis></entry>
- <entry>the name of the field</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>Inside <literal>field</literal> or <literal>property</literal> injections,
- a lot of different value types can be specified, like <literal>string</literal>,
- <literal>object</literal>, <literal>map</literal>, <literal>list</literal>
- <literal>ref</literal> and so on. See jpdl schema docs for more options
- </para>
+ <section id="usercodeconfiguration">
+ <title>User code configuration</title>
+ <table><title>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>one of {class|expr} is required</entry>
+ <entry>The fully qualified classname. Instantiation is done only once and
+ the user object is cached as part of the process definition.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>expr</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>one of {class|expr} is required</entry>
+ <entry>Expression for which the resulting value will be taken as the target object.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title>user code configuration elements:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>field</literal></entry>
+ <entry>0..*</entry>
+ <entry>describes a configuration value to be injected directly in
+ a memberfield before this user class is used.</entry>
+ </row>
+ <row>
+ <entry><literal>property</literal></entry>
+ <entry>0..*</entry>
+ <entry>describes a configuration value to injected through a setter
+ method before this user object is used.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title><literal>field</literal> and <literal>property</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>name</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>the name of the field or property.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title>field and property contained element:</title>
+ <para><literal>field</literal> and <literal>property</literal> elements
+ have exactly one child element that represents the value that will be
+ injected.
+ </para>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>string</literal></entry>
+ <entry>0..1</entry>
+ <entry>a java.lang.String</entry>
+ </row>
+ <row>
+ <entry><literal>int</literal></entry>
+ <entry>0..1</entry>
+ <entry>a java.lang.Integer</entry>
+ </row>
+ <row>
+ <entry><literal>long</literal></entry>
+ <entry>0..1</entry>
+ <entry>a java.lang.Long</entry>
+ </row>
+ <row>
+ <entry><literal>float</literal></entry>
+ <entry>0..1</entry>
+ <entry>a java.lang.Float</entry>
+ </row>
+ <row>
+ <entry><literal>double</literal></entry>
+ <entry>0..1</entry>
+ <entry>a java.lang.Double</entry>
+ </row>
+ <row>
+ <entry><literal>true</literal></entry>
+ <entry>0..1</entry>
+ <entry>Boolean.TRUE</entry>
+ </row>
+ <row>
+ <entry><literal>false</literal></entry>
+ <entry>0..1</entry>
+ <entry>Boolean.FALSE</entry>
+ </row>
+ <row>
+ <entry><literal>object</literal></entry>
+ <entry>0..1</entry>
+ <entry>a object that will be instantiated with reflection</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title>Attribute for basic type <literal>string</literal>, <literal>int</literal>, <literal>long</literal>, <literal>float</literal>and <literal>double</literal>:</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>value</literal></entry>
+ <entry>text</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>text value that will be parsed to the respective type</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ <section id="usercodeclassloading">
+ <title>User code classloading</title>
+ <para>Process definitions are cached. By default, all user code objects are
+ cached as part of those process definitions.
+
+ For all objects that are referenced by a class name, will be
+ instantiated during parsing time. Which implies that the objects aren't
+ allowed to store non-stateless data (ie which can change).
+ This is typically OK since those objects are in practice almost always immutable.
+ If you do need to use 'dynamic' data in your user code, you can always
+ fall back to process variables (or Environment.get(xxx) calls).
+ </para>
+ <para>Objects that are referenced by an expression are calculated
+ dynamically.
+ </para>
+ </section>
</section>
</chapter>
16 years, 6 months
JBoss JBPM SVN: r5705 - in jbpm3/branches/jbpm-3.2-soa: hudson and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-10-06 02:19:58 -0400 (Tue, 06 Oct 2009)
New Revision: 5705
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/profiles.local.qa.xml
jbpm3/branches/jbpm-3.2-soa/hudson/profiles.redhat.qa.xml
jbpm3/branches/jbpm-3.2-soa/pom.xml
jbpm3/branches/jbpm-3.2-soa/profiles.example.xml
Log:
[JBPM-2563] switch to jtds for standalone tests as jconnect does not provide database metadata
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/profiles.local.qa.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/profiles.local.qa.xml 2009-10-06 05:21:34 UTC (rev 5704)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/profiles.local.qa.xml 2009-10-06 06:19:58 UTC (rev 5705)
@@ -49,10 +49,12 @@
<jdbc.sybase.server>localhost</jdbc.sybase.server>
<jdbc.sybase.port>5000</jdbc.sybase.port>
<jdbc.sybase.database>jbpmtest</jdbc.sybase.database>
- <jdbc.sybase.url>jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
+ <jdbc.sybase.url>jdbc:jtds:sybase://${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
+ <!-- jconnect.url jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database} -->
<jdbc.sybase.username>jbpmtest</jdbc.sybase.username>
<jdbc.sybase.password>jbpmtest</jdbc.sybase.password>
- <jdbc.sybase.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.sybase.driver>
+ <jdbc.sybase.driver>net.sourceforge.jtds.jdbc.Driver</jdbc.sybase.driver>
+ <!-- jconnect.driver com.sybase.jdbc3.jdbc.SybDriver -->
<jdbc.sybase.datasource>com.sybase.jdbc3.jdbc.SybXADataSource</jdbc.sybase.datasource>
</properties>
</profile>
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/profiles.redhat.qa.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/profiles.redhat.qa.xml 2009-10-06 05:21:34 UTC (rev 5704)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/profiles.redhat.qa.xml 2009-10-06 06:19:58 UTC (rev 5705)
@@ -49,10 +49,12 @@
<jdbc.sybase.server>dev77.qa.atl2.redhat.com</jdbc.sybase.server>
<jdbc.sybase.port>4100</jdbc.sybase.port>
<jdbc.sybase.database>jbpm3</jdbc.sybase.database>
- <jdbc.sybase.url>jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
+ <jdbc.sybase.url>jdbc:jtds:sybase://${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
+ <!-- jconnect.url jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database} -->
<jdbc.sybase.username>jbpm3xa</jdbc.sybase.username>
<jdbc.sybase.password>jbpm3xa</jdbc.sybase.password>
- <jdbc.sybase.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.sybase.driver>
+ <jdbc.sybase.driver>net.sourceforge.jtds.jdbc.Driver</jdbc.sybase.driver>
+ <!-- jconnect.driver com.sybase.jdbc3.jdbc.SybDriver -->
<jdbc.sybase.datasource>com.sybase.jdbc3.jdbc.SybXADataSource</jdbc.sybase.datasource>
</properties>
</profile>
Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml 2009-10-06 05:21:34 UTC (rev 5704)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml 2009-10-06 06:19:58 UTC (rev 5705)
@@ -80,6 +80,7 @@
<db2jcc.version>3.1.57</db2jcc.version>
<hsqldb.version>1.8.0.7</hsqldb.version>
<jconnect.version>6.0.5</jconnect.version>
+ <jtds.version>1.2.2</jtds.version>
<msjdbc.version>1.2.2828.100</msjdbc.version>
<mysql.connector.version>5.0.7</mysql.connector.version>
<ojdbc.version>10.2.0.4</ojdbc.version>
@@ -254,6 +255,11 @@
<version>${hsqldb.version}</version>
</dependency>
<dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <version>${jtds.version}</version>
+ </dependency>
+ <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector.version}</version>
@@ -562,6 +568,11 @@
</activation>
<dependencies>
<dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>com.sybase</groupId>
<artifactId>jconnect</artifactId>
<version>${jconnect.version}</version>
Modified: jbpm3/branches/jbpm-3.2-soa/profiles.example.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/profiles.example.xml 2009-10-06 05:21:34 UTC (rev 5704)
+++ jbpm3/branches/jbpm-3.2-soa/profiles.example.xml 2009-10-06 06:19:58 UTC (rev 5705)
@@ -56,10 +56,12 @@
<jdbc.sybase.server>localhost</jdbc.sybase.server>
<jdbc.sybase.port>5000</jdbc.sybase.port>
<jdbc.sybase.database>jbpmtest</jdbc.sybase.database>
- <jdbc.sybase.url>jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
+ <jdbc.sybase.url>jdbc:jtds:sybase://${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
+ <!-- jconnect.url jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database} -->
<jdbc.sybase.username>jbpmtest</jdbc.sybase.username>
<jdbc.sybase.password>jbpmtest</jdbc.sybase.password>
- <jdbc.sybase.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.sybase.driver>
+ <jdbc.sybase.driver>net.sourceforge.jtds.jdbc.Driver</jdbc.sybase.driver>
+ <!-- jconnect.driver com.sybase.jdbc3.jdbc.SybDriver -->
<jdbc.sybase.datasource>com.sybase.jdbc3.jdbc.SybXADataSource</jdbc.sybase.datasource>
<altDeploymentRepository>repository.jboss.org::default::file:${user.home}/jbpm/repository</altDeploymentRepository>
16 years, 6 months
JBoss JBPM SVN: r5704 - jbpm4/trunk/modules/integration/tomcat.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-10-06 01:21:34 -0400 (Tue, 06 Oct 2009)
New Revision: 5704
Added:
jbpm4/trunk/modules/integration/tomcat/.classpath
jbpm4/trunk/modules/integration/tomcat/.project
Modified:
jbpm4/trunk/modules/integration/tomcat/
Log:
provide eclipse project files for tomcat module
Property changes on: jbpm4/trunk/modules/integration/tomcat
___________________________________________________________________
Name: svn:ignore
- target
+ target
.settings
Added: jbpm4/trunk/modules/integration/tomcat/.classpath
===================================================================
--- jbpm4/trunk/modules/integration/tomcat/.classpath (rev 0)
+++ jbpm4/trunk/modules/integration/tomcat/.classpath 2009-10-06 05:21:34 UTC (rev 5704)
@@ -0,0 +1,8 @@
+<?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="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"/>
+</classpath>
Added: jbpm4/trunk/modules/integration/tomcat/.project
===================================================================
--- jbpm4/trunk/modules/integration/tomcat/.project (rev 0)
+++ jbpm4/trunk/modules/integration/tomcat/.project 2009-10-06 05:21:34 UTC (rev 5704)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jbpm-tomcat6</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
16 years, 6 months
JBoss JBPM SVN: r5703 - jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-10-05 22:59:11 -0400 (Mon, 05 Oct 2009)
New Revision: 5703
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh
Log:
[JBPM-2563] Prevent test suite from continously recreating database schema
fix small error in CI script
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh 2009-10-06 02:36:36 UTC (rev 5702)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/command.sh 2009-10-06 02:59:11 UTC (rev 5703)
@@ -5,13 +5,8 @@
#
# $Id$
-#
-# Determine jBPM project version
-#
-WORKSPACE=`pwd`
+WORKSPACE=$PWD
JBPMDIR=$WORKSPACE/jbpm
-JBPM_VERSION=`echo project version \${project.version} | mvn help:evaluate | grep 'project version' | awk '{ print $3 }'`
-echo jbpm version $JBPM_VERSION
#
# Extract JBoss distro
@@ -76,6 +71,8 @@
#
# Install distro
#
+JBPM_VERSION=`echo project version \$\{project.version\} | mvn help:evaluate | grep 'project version' | awk '{ print $3 }'`
+echo jbpm version $JBPM_VERSION
AUTO_INSTALL=modules/distribution/target/resources/auto-install-template.xml; cat $AUTO_INSTALL;
JAVA_CMD="$JAVA -jar modules/distribution/target/jbpm-installer-$JBPM_VERSION.jar $AUTO_INSTALL"
echo $JAVA_CMD; $JAVA_CMD
16 years, 6 months