JBoss JBPM SVN: r6626 - /.
by do-not-reply@jboss.org
Author: KrisVerlaenen
Date: 2010-08-25 08:49:00 -0400 (Wed, 25 Aug 2010)
New Revision: 6626
Added:
jbpm5/
Log:
- starting jbpm5
13 years, 10 months
JBoss JBPM SVN: r6624 - in jbpm3/branches/jbpm-3.2-soa: modules/core/src/main/java/org/jbpm/context/exe and 5 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-08-24 17:38:53 -0400 (Tue, 24 Aug 2010)
New Revision: 6624
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java
Modified:
jbpm3/branches/jbpm-3.2-soa/eclipse/jbpm.code.templates.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BooleanToStringConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ByteToLongConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BytesToByteArrayConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/CharacterToStringConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DateToLongConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DoubleToStringConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToDoubleConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToStringConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/IntegerToLongConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/SerializableToByteArrayConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ShortToLongConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DateInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DoubleInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/JcrNodeInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/LongInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/StringInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java
Log:
JBPM-2069 converters do not handle null values consistently
Modified: jbpm3/branches/jbpm-3.2-soa/eclipse/jbpm.code.templates.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/eclipse/jbpm.code.templates.xml 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/eclipse/jbpm.code.templates.xml 2010-08-24 21:38:53 UTC (rev 6624)
@@ -1,33 +1,15 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<templates>
+<template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
* @return the ${bare_field_name}
- */</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name="settercomment">/**
+ */</template>
+<template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**
* @param ${param} the ${bare_field_name} to set
- */</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**
+ */</template>
+<template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**
* ${tags}
- */</template><template autoinsert="true" context="filecomment_context" deleted="false" description="Comment for created JavaScript files" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name="filecomment">/**
- *
- */</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name="typecomment">/**
- * @author ${user}
- */</template><template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for vars" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name="fieldcomment"/><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
- * ${tags}
- */</template><template autoinsert="false" context="overridecomment_context" deleted="false" description="Comment for overriding functions" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name="overridecomment"/><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate functions" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
- * ${tags}
- * ${see_to_target}
- */</template><template autoinsert="true" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}
-${package_declaration}
-
-${typecomment}
-${type_declaration}</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name="classbody">
-</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
-${exception_var}.printStackTrace();</template><template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created function stubs" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated function stub
-${body_statement}</template><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
-// ${todo} Auto-generated constructor stub</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
- * @return the ${bare_field_name}
- */</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**
- * @param ${param} the ${bare_field_name} to set
- */</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**
- * ${tags}
- */</template><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/*
+ */</template>
+<template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/*
* 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
@@ -47,22 +29,34 @@
* 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.
- */</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
+ */</template>
+<template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
* @author ${user}
- */</template><template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment"/><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
+ */</template>
+<template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment"/>
+<template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
* ${tags}
- */</template><template autoinsert="false" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment"/><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
+ */</template>
+<template autoinsert="false" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment"/>
+<template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
* ${tags}
* ${see_to_target}
- */</template><template autoinsert="true" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}
+ */</template>
+<template autoinsert="true" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}
${package_declaration}
${typecomment}
-${type_declaration}</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
-</template><template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
-</template><template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
-</template><template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
-</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
-${exception_var}.printStackTrace();</template><template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated method stub
-${body_statement}</template><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
-// ${todo} Auto-generated constructor stub</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>
\ No newline at end of file
+${type_declaration}</template>
+<template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody"/>
+<template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody"/>
+<template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody"/>
+<template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody"/>
+<template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
+${exception_var}.printStackTrace();</template>
+<template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated method stub
+${body_statement}</template>
+<template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
+// ${todo} Auto-generated constructor stub</template>
+<template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template>
+<template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template>
+</templates>
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableInstance.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableInstance.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -111,8 +111,8 @@
if (converter != null) {
if (!converter.supports(value)) {
- throw new JbpmException("converter '" + converter.getClass().getName()
- + " does not support values of type " + value.getClass().getName());
+ throw new JbpmException("converter " + converter.getClass().getName()
+ + " does not support value: " + value);
}
value = converter.convert(value);
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BooleanToStringConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BooleanToStringConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BooleanToStringConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,33 +21,27 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class BooleanToStringConverter implements Converter {
-
+
private static final long serialVersionUID = 1L;
-
+
public static final String TRUE_TEXT = "T";
public static final String FALSE_TEXT = "F";
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Boolean.class);
+ return value instanceof Boolean || value == null;
}
public Object convert(Object o) {
- String convertedValue = FALSE_TEXT;
- if (((Boolean)o).booleanValue()) {
- convertedValue = TRUE_TEXT;
- }
- return convertedValue;
+ if (o == null) return null;
+
+ Boolean bool = (Boolean) o;
+ return bool.booleanValue() ? TRUE_TEXT : FALSE_TEXT;
}
public Object revert(Object o) {
- Boolean revertedValue = Boolean.FALSE;
- if (TRUE_TEXT.equals(o)) {
- revertedValue = Boolean.TRUE;
- }
- return revertedValue;
+ return o != null ? TRUE_TEXT.equals(o) ? Boolean.TRUE : Boolean.FALSE : null;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ByteToLongConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ByteToLongConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ByteToLongConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,22 +21,27 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class ByteToLongConverter implements Converter {
-
+
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Byte.class);
+ return value instanceof Byte || value == null;
}
public Object convert(Object o) {
- return new Long( ((Number)o).longValue() );
+ if (o == null) return null;
+
+ Byte number = (Byte) o;
+ return new Long(number.longValue());
}
public Object revert(Object o) {
- return new Byte(((Long)o).byteValue());
+ if (o == null) return null;
+
+ Long number = (Long) o;
+ return new Byte(number.byteValue());
}
}
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BytesToByteArrayConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BytesToByteArrayConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BytesToByteArrayConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -29,16 +29,18 @@
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==byte[].class);
+ return value instanceof byte[] || value == null;
}
public Object convert(Object o) {
- return new ByteArray((byte[]) o);
+ return o != null ? new ByteArray((byte[]) o) : null;
}
public Object revert(Object o) {
- return ((ByteArray)o).getBytes();
+ if (o == null) return null;
+
+ ByteArray byteArray = (ByteArray) o;
+ return byteArray.getBytes();
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/CharacterToStringConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/CharacterToStringConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/CharacterToStringConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,22 +21,24 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class CharacterToStringConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Character.class);
+ return value instanceof Character || value == null;
}
public Object convert(Object o) {
- return o.toString();
+ return o != null ? o.toString() : null;
}
public Object revert(Object o) {
- return new Character(((String)o).charAt(0));
+ if (o == null) return null;
+
+ String str = (String) o;
+ return new Character(str.charAt(0));
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DateToLongConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DateToLongConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DateToLongConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,23 +21,29 @@
*/
package org.jbpm.context.exe.converter;
-import java.util.*;
-import org.jbpm.context.exe.*;
+import java.util.Date;
+import org.jbpm.context.exe.Converter;
+
public class DateToLongConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (Date.class.isAssignableFrom(value.getClass()));
+ return value instanceof Date || value == null;
}
public Object convert(Object o) {
- return new Long(((Date)o).getTime());
+ if (o == null) return null;
+
+ Date date = (Date) o;
+ return new Long(date.getTime());
}
public Object revert(Object o) {
- return new Date(((Long)o).longValue());
+ if (o == null) return null;
+
+ Long number = (Long) o;
+ return new Date(number.longValue());
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DoubleToStringConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DoubleToStringConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DoubleToStringConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,23 +21,22 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class DoubleToStringConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Double.class);
+ return value instanceof Double || value == null;
}
public Object convert(Object o) {
- return o.toString();
+ return o != null ? o.toString() : null;
}
public Object revert(Object o) {
- return new Double((String)o);
+ return o != null ? new Double((String) o) : null;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToDoubleConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToDoubleConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToDoubleConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -28,16 +28,21 @@
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Float.class);
+ return value instanceof Float || value == null;
}
public Object convert(Object o) {
- return new Double(((Float)o).doubleValue());
+ if (o == null) return null;
+
+ Float number = (Float) o;
+ return new Double(number.doubleValue());
}
public Object revert(Object o) {
- return new Float(((Double)o).floatValue());
+ if (o == null) return null;
+
+ Double number = (Double) o;
+ return new Float(number.floatValue());
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToStringConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToStringConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToStringConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,23 +21,22 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class FloatToStringConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Float.class);
+ return value instanceof Float || value == null;
}
public Object convert(Object o) {
- return o.toString();
+ return o != null ? o.toString() : null;
}
public Object revert(Object o) {
- return new Float((String)o);
+ return o != null ? new Float((String) o) : null;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/IntegerToLongConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/IntegerToLongConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/IntegerToLongConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,22 +21,27 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class IntegerToLongConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (Integer.class.equals(value.getClass()));
+ return value instanceof Integer || value == null;
}
public Object convert(Object o) {
- return new Long( ((Number)o).longValue() );
+ if (o == null) return null;
+
+ Integer number = (Integer) o;
+ return new Long(number.longValue());
}
public Object revert(Object o) {
- return new Integer(((Long)o).intValue());
+ if (o == null) return null;
+
+ Long number = (Long) o;
+ return new Integer(number.intValue());
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/SerializableToByteArrayConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/SerializableToByteArrayConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/SerializableToByteArrayConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -27,6 +27,7 @@
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
import java.io.Serializable;
import org.jbpm.JbpmConfiguration;
@@ -34,32 +35,33 @@
import org.jbpm.bytes.ByteArray;
import org.jbpm.context.exe.Converter;
import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.util.CustomLoaderObjectInputStream;
public class SerializableToByteArrayConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- return value == null || value instanceof Serializable;
+ return value instanceof Serializable || value == null;
}
public Object convert(Object o) {
- byte[] bytes = null;
+ if (o == null) return null;
+
try {
ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
ObjectOutputStream objectStream = new ObjectOutputStream(memoryStream);
objectStream.writeObject(o);
objectStream.flush();
- bytes = memoryStream.toByteArray();
+ return new ByteArray(memoryStream.toByteArray());
}
catch (IOException e) {
throw new JbpmException("failed to serialize: " + o, e);
}
- return new ByteArray(bytes);
}
public Object revert(Object o) {
+ if (o == null) return o;
+
ByteArray byteArray = (ByteArray) o;
InputStream memoryStream = new ByteArrayInputStream(byteArray.getBytes());
try {
@@ -74,12 +76,22 @@
}
}
- public Object revert(Object o, ProcessDefinition processDefinition) {
+ public Object revert(Object o, final ProcessDefinition processDefinition) {
ByteArray byteArray = (ByteArray) o;
InputStream memoryStream = new ByteArrayInputStream(byteArray.getBytes());
try {
- ObjectInputStream objectStream = new CustomLoaderObjectInputStream(memoryStream,
- JbpmConfiguration.getProcessClassLoader(processDefinition));
+ ObjectInputStream objectStream = new ObjectInputStream(memoryStream) {
+ protected Class resolveClass(ObjectStreamClass desc) throws IOException,
+ ClassNotFoundException {
+ try {
+ return super.resolveClass(desc);
+ }
+ catch (ClassNotFoundException e) {
+ return Class.forName(desc.getName(), false,
+ JbpmConfiguration.getProcessClassLoader(processDefinition));
+ }
+ }
+ };
return objectStream.readObject();
}
catch (IOException ex) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ShortToLongConverter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ShortToLongConverter.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ShortToLongConverter.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,22 +21,27 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class ShortToLongConverter implements Converter {
-
+
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Short.class);
+ return value instanceof Short || value == null;
}
public Object convert(Object o) {
- return new Long( ((Number)o).longValue() );
+ if (o == null) return null;
+
+ Short number = (Short) o;
+ return new Long(number.longValue());
}
-
+
public Object revert(Object o) {
- return new Short(((Long)o).shortValue());
+ if (o == null) return null;
+
+ Long number = (Long) o;
+ return new Short(number.shortValue());
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -27,15 +27,14 @@
import org.jbpm.context.exe.VariableInstance;
import org.jbpm.context.log.variableinstance.ByteArrayUpdateLog;
-public class ByteArrayInstance extends VariableInstance {
+public class ByteArrayInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
-
- protected ByteArray value = null;
+ protected ByteArray value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (ByteArray.class.isAssignableFrom(value.getClass()));
+ return value instanceof ByteArray || value == null;
}
protected Object getObject() {
@@ -43,14 +42,16 @@
}
protected void setObject(Object value) {
- if (token!=null) token.addLog(new ByteArrayUpdateLog(this, this.value, (ByteArray) value));
+ if (token != null) {
+ token.addLog(new ByteArrayUpdateLog(this, this.value, (ByteArray) value));
+ }
// delete old value, otherwise it will be unreachable
if (this.value != null) {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
if (jbpmContext != null) {
Session session = jbpmContext.getSession();
if (session != null) session.delete(this.value);
- }
+ }
}
// set new value
this.value = (ByteArray) value;
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DateInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DateInstance.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DateInstance.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,20 +21,19 @@
*/
package org.jbpm.context.exe.variableinstance;
-import java.util.*;
+import java.util.Date;
-import org.jbpm.context.exe.*;
-import org.jbpm.context.log.variableinstance.*;
+import org.jbpm.context.exe.VariableInstance;
+import org.jbpm.context.log.variableinstance.DateUpdateLog;
public class DateInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
-
- protected Date value = null;
+ protected Date value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (Date.class.isAssignableFrom(value.getClass()));
+ return value instanceof Date || value == null;
}
protected Object getObject() {
@@ -42,7 +41,7 @@
}
protected void setObject(Object value) {
- if (token!=null) token.addLog(new DateUpdateLog(this, this.value, (Date) value));
+ if (token != null) token.addLog(new DateUpdateLog(this, this.value, (Date) value));
this.value = (Date) value;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DoubleInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DoubleInstance.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DoubleInstance.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,18 +21,17 @@
*/
package org.jbpm.context.exe.variableinstance;
-import org.jbpm.context.exe.*;
-import org.jbpm.context.log.variableinstance.*;
+import org.jbpm.context.exe.VariableInstance;
+import org.jbpm.context.log.variableinstance.DoubleUpdateLog;
public class DoubleInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
-
- protected Double value = null;
+ protected Double value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (Double.class==value.getClass());
+ return value instanceof Double || value == null;
}
protected Object getObject() {
@@ -40,7 +39,7 @@
}
protected void setObject(Object value) {
- if (token!=null) token.addLog(new DoubleUpdateLog(this, this.value, (Double) value));
+ if (token != null) token.addLog(new DoubleUpdateLog(this, this.value, (Double) value));
this.value = (Double) value;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/JcrNodeInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/JcrNodeInstance.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/JcrNodeInstance.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -22,6 +22,7 @@
package org.jbpm.context.exe.variableinstance;
import java.util.Iterator;
+import java.util.Map;
import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
@@ -31,35 +32,32 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
import org.jbpm.context.exe.VariableInstance;
import org.jbpm.jcr.JcrService;
-import org.jbpm.svc.Service;
import org.jbpm.svc.Services;
public class JcrNodeInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
- String repository;
- String workspace;
- String path;
+ private String repository;
+ private String workspace;
+ private String path;
public boolean isStorable(Object value) {
- if (value == null) return true;
- return Node.class.isAssignableFrom(value.getClass());
+ return value instanceof Node || value == null;
}
protected Object getObject() {
if (path == null) return null;
- // THE NODE REPOSITORY AND WORKSPACE NAME GOT TO CORRESPOND WITH A JBPM
- // SERVICE NAME
JcrService jcrService = findService();
if (jcrService == null) {
- throw new JbpmException("couldn't find jBPM service for JCR repository '" + repository
- + "', workspace '" + workspace + "'");
+ throw new JbpmException("could not find service for JCR repository '" + repository
+ + "' and workspace '" + workspace + "'");
}
try {
return jcrService.getSession().getItem(path);
@@ -85,19 +83,18 @@
* @throws JbpmException if no matching service is found
*/
private JcrService findService() {
- JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
- Services services = jbpmContext.getServices();
+ Services services = JbpmContext.getCurrentJbpmContext().getServices();
+ Map serviceFactories = services.getServiceFactories();
// if there is a service called jcr
- Service service = services.getService("jcr");
- if (service != null) {
+ if (serviceFactories.containsKey("jcr")) {
// use that one
- return (JcrService) service;
+ return (JcrService) services.getService("jcr");
}
- // start matching the JCR workspace name with the jbpm service names
+ // compare the repository and workspace names with the service names
String serviceName = null;
- for (Iterator iter = services.getServiceFactories().keySet().iterator(); iter.hasNext();) {
+ for (Iterator iter = serviceFactories.keySet().iterator(); iter.hasNext();) {
String candidate = (String) iter.next();
if (candidate.startsWith(repository)) {
if (candidate.length() == repository.length()) {
@@ -109,10 +106,6 @@
}
}
}
- if (serviceName == null) {
- throw new JbpmException("could not find JCR service for repository '" + repository
- + "' and workspace '" + workspace + '\'');
- }
return (JcrService) services.getService(serviceName);
}
@@ -125,10 +118,8 @@
}
else {
try {
- // node repo and workspace got to correspond with a jbpm service name,
- // as described in findService, unless a global "jcr" service
- // THE NODE REPOSITORY AND WORKSPACE NAME GOT TO CORRESPOND WITH A JBPM
- // SERVICE NAME
+ // repository and workspace have to correspond with a service name,
+ // as described in findService, unless there is a global "jcr" service
Session session = node.getSession();
repository = session.getRepository().getDescriptor(Repository.REP_NAME_DESC);
workspace = session.getWorkspace().getName();
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/LongInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/LongInstance.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/LongInstance.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,26 +21,25 @@
*/
package org.jbpm.context.exe.variableinstance;
-import org.jbpm.context.exe.*;
-import org.jbpm.context.log.variableinstance.*;
+import org.jbpm.context.exe.VariableInstance;
+import org.jbpm.context.log.variableinstance.LongUpdateLog;
public class LongInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
-
- protected Long value = null;
+ protected Long value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (Long.class==value.getClass());
+ return value instanceof Long || value == null;
}
- protected Object getObject() {
+ protected Object getObject() {
return value;
}
- protected void setObject(Object value) {
- if (token!=null) token.addLog(new LongUpdateLog(this, this.value, (Long)value));
+ protected void setObject(Object value) {
+ if (token != null) token.addLog(new LongUpdateLog(this, this.value, (Long) value));
this.value = (Long) value;
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/StringInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/StringInstance.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/StringInstance.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -21,18 +21,17 @@
*/
package org.jbpm.context.exe.variableinstance;
-import org.jbpm.context.exe.*;
-import org.jbpm.context.log.variableinstance.*;
+import org.jbpm.context.exe.VariableInstance;
+import org.jbpm.context.log.variableinstance.StringUpdateLog;
public class StringInstance extends VariableInstance {
-
+
private static final long serialVersionUID = 1L;
-
- protected String value = null;
+ protected String value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (String.class==value.getClass());
+ return value instanceof String || value == null;
}
protected Object getObject() {
@@ -40,7 +39,7 @@
}
protected void setObject(Object value) {
- if (token!=null) token.addLog(new StringUpdateLog(this, this.value, (String)value));
+ if (token != null) token.addLog(new StringUpdateLog(this, this.value, (String) value));
this.value = (String) value;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -34,6 +34,7 @@
* manner.
*
* @author Alejandro Guizar
+ * @deprecated no use for this class
*/
public class CustomLoaderObjectInputStream extends ObjectInputStream {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java 2010-08-24 18:30:53 UTC (rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -33,7 +33,7 @@
* hack to support comparing hibernate proxies against the real objects.
* since it falls back to ==, clients don't need to override hashcode.
* @deprecated hack does not work
- * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2489f">JBPM-2489</a>
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2489">JBPM-2489</a>
*/
public static boolean equals(Object thisObject, Object otherObject) {
return thisObject == otherObject || otherObject instanceof HibernateProxy
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java 2010-08-24 21:38:53 UTC (rev 6624)
@@ -0,0 +1,96 @@
+/*
+ * 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.jbpm2069;
+
+import java.util.BitSet;
+
+import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * IntegerToLongConverter not consistent when dealing with null-values
+ *
+ * @see <a href="https://jira.jboss.org/browse/JBPM-2069">JBPM-2069</a>
+ * @author Alejandro Guizar
+ */
+public class JBPM2069Test extends AbstractJbpmTestCase {
+
+ ContextInstance contextInstance;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ProcessDefinition processDefinition = ProcessDefinition.createNewProcessDefinition();
+ ProcessInstance processInstance = processDefinition.createProcessInstance();
+ contextInstance = processInstance.getContextInstance();
+ }
+
+ public void testIntegerVariable() {
+ contextInstance.setVariable("i", new Integer(Integer.MAX_VALUE));
+ contextInstance.setVariable("i", null);
+
+ assertNull(contextInstance.getVariable("i"));
+ }
+
+ public void testShortVariable() {
+ contextInstance.setVariable("s", new Short(Short.MAX_VALUE));
+ contextInstance.setVariable("s", null);
+
+ assertNull(contextInstance.getVariable("s"));
+ }
+
+ public void testByteVariable() {
+ contextInstance.setVariable("b", new Short(Byte.MAX_VALUE));
+ contextInstance.setVariable("b", null);
+
+ assertNull(contextInstance.getVariable("b"));
+ }
+
+ public void testFloatVariable() {
+ contextInstance.setVariable("f", new Float(Float.MAX_VALUE));
+ contextInstance.setVariable("f", null);
+
+ assertNull(contextInstance.getVariable("f"));
+ }
+
+ public void testBooleanVariable() {
+ contextInstance.setVariable("z", Boolean.TRUE);
+ contextInstance.setVariable("z", null);
+
+ assertNull(contextInstance.getVariable("z"));
+ }
+
+ public void testCharacterVariable() {
+ contextInstance.setVariable("c", new Character(Character.MAX_VALUE));
+ contextInstance.setVariable("c", null);
+
+ assertNull(contextInstance.getVariable("c"));
+ }
+
+ public void testSerializableVariable() {
+ contextInstance.setVariable("l", new BitSet());
+ contextInstance.setVariable("l", null);
+
+ assertNull(contextInstance.getVariable("l"));
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java
___________________________________________________________________
Name: svn:eol-style
+ native
13 years, 10 months
JBoss JBPM SVN: r6623 - in jbpm3/branches/jbpm-3.2-soa/modules: core/src/main/java/org/jbpm/jpdl and 5 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-08-24 14:30:53 -0400 (Tue, 24 Aug 2010)
New Revision: 6623
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/DbSubProcessResolver.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessState.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/SubProcessResolver.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/JpdlException.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/par/JpdlArchiveParser.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd
jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/jpdl.xml
Log:
JBPM-2473 amend description about coexistence of version and binding attribute in sub-process element;
remove duplicate binding attribute from process-state element schema;
document SubProcessResolver interface
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/DbSubProcessResolver.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/DbSubProcessResolver.java 2010-08-24 03:07:12 UTC (rev 6622)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/DbSubProcessResolver.java 2010-08-24 18:30:53 UTC (rev 6623)
@@ -2,7 +2,6 @@
import org.dom4j.Element;
import org.jbpm.JbpmContext;
-import org.jbpm.db.GraphSession;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.jpdl.JpdlException;
@@ -11,36 +10,33 @@
private static final long serialVersionUID = 1L;
public ProcessDefinition findSubProcess(Element subProcessElement) {
- // if this parsing is done in the context of a process deployment,
+ // if subprocess resolution is done within an active context,
// there is a database connection to look up the subprocess.
- // when there is no jbpmSession, the definition will be left null...
- // the test case can set it as appropriate.
+ // otherwise, the subprocess will be left null and
+ // it is up to client code to set the subprocess as appropriate.
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
if (jbpmContext != null) {
- GraphSession graphSession = jbpmContext.getGraphSession();
-
- // now, we must be able to find the sub-process
+ // within an active context it is possible to find the sub-process
String subProcessName = subProcessElement.attributeValue("name");
if (subProcessName == null) {
- throw new JpdlException("subprocess name is not specified: "
- + subProcessElement.getPath());
+ throw new JpdlException("missing sub-process name");
}
// if only the name is specified,
String subProcessVersion = subProcessElement.attributeValue("version");
if (subProcessVersion == null) {
// select the latest version of the subprocess definition
- return graphSession.findLatestProcessDefinition(subProcessName);
+ return jbpmContext.getGraphSession().findLatestProcessDefinition(subProcessName);
}
// if the name and the version are specified
try {
// select the exact version of the subprocess definition
int version = Integer.parseInt(subProcessVersion);
- return graphSession.findProcessDefinition(subProcessName, version);
+ return jbpmContext.getGraphSession().findProcessDefinition(subProcessName, version);
}
catch (NumberFormatException e) {
- throw new JpdlException("bad subprocess version: " + subProcessVersion);
+ throw new JpdlException("bad sub-process version value: " + subProcessVersion);
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessState.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessState.java 2010-08-24 03:07:12 UTC (rev 6622)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessState.java 2010-08-24 18:30:53 UTC (rev 6623)
@@ -30,7 +30,6 @@
import org.dom4j.Element;
import org.dom4j.tree.DefaultElement;
-import org.jbpm.JbpmException;
import org.jbpm.JbpmConfiguration.Configs;
import org.jbpm.context.def.VariableAccess;
import org.jbpm.context.exe.ContextInstance;
@@ -42,6 +41,7 @@
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.graph.log.ProcessStateLog;
+import org.jbpm.jpdl.JpdlException;
import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
import org.jbpm.jpdl.xml.JpdlXmlReader;
import org.jbpm.util.Clock;
@@ -50,13 +50,18 @@
private static final long serialVersionUID = 1L;
- private static SubProcessResolver defaultSubProcessResolver = new DbSubProcessResolver();
+ private static SubProcessResolver defaultSubProcessResolver;
/** @deprecated set configuration entry <code>jbpm.sub.process.resolver</code> instead */
public static void setDefaultSubProcessResolver(SubProcessResolver subProcessResolver) {
defaultSubProcessResolver = subProcessResolver;
}
+ public static SubProcessResolver getSubProcessResolver() {
+ return defaultSubProcessResolver != null ? defaultSubProcessResolver
+ : (SubProcessResolver) Configs.getObject("jbpm.sub.process.resolver");
+ }
+
protected ProcessDefinition subProcessDefinition;
protected Set variableAccesses;
protected String subProcessName;
@@ -119,8 +124,8 @@
return subProcess;
}
}
- catch (JbpmException e) {
- jpdlReader.addError("failed to resolve subprocess", e);
+ catch (JpdlException e) {
+ jpdlReader.addError(e.getMessage());
}
// check whether this is a recursive process invocation
@@ -134,11 +139,6 @@
return null;
}
- private SubProcessResolver getSubProcessResolver() {
- return Configs.hasObject("jbpm.sub.process.resolver") ? (SubProcessResolver) Configs
- .getObject("jbpm.sub.process.resolver") : defaultSubProcessResolver;
- }
-
public void execute(ExecutionContext executionContext) {
Token superProcessToken = executionContext.getToken();
@@ -227,20 +227,18 @@
// remove the subprocess reference
superProcessToken.setSubProcessInstance(null);
- // We replaced the normal log generation of super.leave()
- // by creating the log here
- // and overriding the addNodeLog method with an empty version
- superProcessToken.addLog(new ProcessStateLog(this, superProcessToken.getNodeEnter(), Clock
- .getCurrentTime(), subProcessInstance));
+ // override the normal log generation in super.leave() by creating the log here
+ // and replacing addNodeLog() with an empty version
+ superProcessToken.addLog(new ProcessStateLog(this, superProcessToken.getNodeEnter(),
+ Clock.getCurrentTime(), subProcessInstance));
// call the subProcessEndAction
super.leave(executionContext, getDefaultLeavingTransition());
}
- // We replaced the normal log generation of super.leave()
- // by creating the log above in the leave method
- // and overriding the addNodeLog method with an empty version
protected void addNodeLog(Token token) {
+ // override the normal log generation in super.leave() by creating the log in this.leave()
+ // and replacing this method with an empty version
}
public ProcessDefinition getSubProcessDefinition() {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/SubProcessResolver.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/SubProcessResolver.java 2010-08-24 03:07:12 UTC (rev 6622)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/SubProcessResolver.java 2010-08-24 18:30:53 UTC (rev 6623)
@@ -5,8 +5,16 @@
import org.dom4j.Element;
import org.jbpm.graph.def.ProcessDefinition;
+/**
+ * An agent capable of resolving sub-process definitions given the information items in the
+ * <code>sub-process</code> element taken from a process definition document.
+ */
public interface SubProcessResolver extends Serializable {
+ /**
+ * Resolves a sub-process definition given the information items in the
+ * <code>sub-process</code> element.
+ */
ProcessDefinition findSubProcess(Element subProcessElement);
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/JpdlException.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/JpdlException.java 2010-08-24 03:07:12 UTC (rev 6622)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/JpdlException.java 2010-08-24 18:30:53 UTC (rev 6623)
@@ -24,16 +24,17 @@
import java.util.Collections;
import java.util.List;
+import org.jbpm.JbpmException;
import org.jbpm.jpdl.xml.Problem;
-public class JpdlException extends RuntimeException {
+public class JpdlException extends JbpmException {
private static final long serialVersionUID = 1L;
protected List problems;
public JpdlException(List problems) {
- super(problems.toString());
+ super(problems.size() + " problems found");
this.problems = problems;
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java 2010-08-24 03:07:12 UTC (rev 6622)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/el/impl/JbpmExpressionEvaluator.java 2010-08-24 18:30:53 UTC (rev 6623)
@@ -12,11 +12,6 @@
private static ExpressionEvaluator expressionEvaluator;
- private static ExpressionEvaluator getExpressionEvaluator() {
- return expressionEvaluator != null ? expressionEvaluator
- : (ExpressionEvaluator) Configs.getObject("jbpm.expression.evaluator");
- }
-
/**
* @deprecated set configuration entry <code>jbpm.expression.evaluator</code> instead
*/
@@ -24,6 +19,11 @@
JbpmExpressionEvaluator.expressionEvaluator = expressionEvaluator;
}
+ public static ExpressionEvaluator getExpressionEvaluator() {
+ return expressionEvaluator != null ? expressionEvaluator
+ : (ExpressionEvaluator) Configs.getObject("jbpm.expression.evaluator");
+ }
+
private static VariableResolver variableResolver;
/**
@@ -33,6 +33,16 @@
JbpmExpressionEvaluator.variableResolver = variableResolver;
}
+ public static VariableResolver getVariableResolver() {
+ return variableResolver != null ? variableResolver
+ : (VariableResolver) Configs.getObject("jbpm.variable.resolver");
+ }
+
+ /** @deprecated call {@link #getVariableResolver()} instead */
+ public static VariableResolver getUsedVariableResolver() {
+ return getVariableResolver();
+ }
+
private static FunctionMapper functionMapper;
/**
@@ -42,6 +52,17 @@
JbpmExpressionEvaluator.functionMapper = functionMapper;
}
+ public static FunctionMapper getFunctionMapper() {
+ return functionMapper != null ? functionMapper
+ : Configs.hasObject("jbpm.function.mapper") ? (FunctionMapper) Configs.getObject("jbpm.function.mapper")
+ : null;
+ }
+
+ /** @deprecated call {@link #getFunctionMapper()} instead */
+ public static FunctionMapper getUsedFunctionMapper() {
+ return getFunctionMapper();
+ }
+
public static Object evaluate(String expression, ExecutionContext executionContext) {
return evaluate(expression, executionContext, Object.class);
}
@@ -75,25 +96,4 @@
private static String translateExpressionToDollars(String expression) {
return hashPattern.matcher(expression).replaceAll("\\${$1}");
}
-
- /** @deprecated call {@link #getVariableResolver()} instead */
- public static VariableResolver getUsedVariableResolver() {
- return getVariableResolver();
- }
-
- public static VariableResolver getVariableResolver() {
- return variableResolver != null ? variableResolver
- : (VariableResolver) Configs.getObject("jbpm.variable.resolver");
- }
-
- /** @deprecated call {@link #getFunctionMapper()} instead */
- public static FunctionMapper getUsedFunctionMapper() {
- return getFunctionMapper();
- }
-
- public static FunctionMapper getFunctionMapper() {
- return functionMapper != null ? functionMapper
- : Configs.hasObject("jbpm.function.mapper") ? (FunctionMapper) Configs.getObject("jbpm.function.mapper")
- : null;
- }
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/par/JpdlArchiveParser.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/par/JpdlArchiveParser.java 2010-08-24 03:07:12 UTC (rev 6622)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/par/JpdlArchiveParser.java 2010-08-24 18:30:53 UTC (rev 6623)
@@ -22,8 +22,6 @@
package org.jbpm.jpdl.par;
import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.jpdl.JpdlException;
@@ -34,30 +32,17 @@
private static final long serialVersionUID = 1L;
- public ProcessDefinition readFromArchive(ProcessArchive processArchive, ProcessDefinition processDefinition) throws JpdlException{
- try {
- // getting the value
- byte[] processBytes = processArchive.getEntry("processdefinition.xml");
-
- if (processBytes==null) {
- throw new JpdlException("no processdefinition.xml inside process archive");
- }
-
- // creating the JpdlXmlReader
- InputStream processInputStream = new ByteArrayInputStream(processBytes);
- InputSource processInputSource = new InputSource(processInputStream);
- JpdlXmlReader jpdlXmlReader = new JpdlXmlReader(processInputSource, processArchive);
-
- processDefinition = jpdlXmlReader.readProcessDefinition();
-
- // close all the streams
- jpdlXmlReader.close();
- processInputStream.close();
-
- } catch (IOException e) {
- throw new JpdlException("io problem while reading processdefinition.xml: "+e.getMessage(), e);
+ public ProcessDefinition readFromArchive(ProcessArchive processArchive,
+ ProcessDefinition processDefinition) throws JpdlException {
+ // getting the value
+ byte[] processBytes = processArchive.getEntry("processdefinition.xml");
+ if (processBytes == null) {
+ throw new JpdlException("no processdefinition.xml inside process archive");
}
-
- return processDefinition;
+
+ ByteArrayInputStream processStream = new ByteArrayInputStream(processBytes);
+ JpdlXmlReader jpdlXmlReader = new JpdlXmlReader(new InputSource(processStream),
+ processArchive);
+ return jpdlXmlReader.readProcessDefinition();
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml 2010-08-24 03:07:12 UTC (rev 6622)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml 2010-08-24 18:30:53 UTC (rev 6623)
@@ -45,12 +45,15 @@
<!-- alternate delegation class loader
<string name="jbpm.class.loader" value="context" />
-->
- <bean name="process.class.loader.factory" class="org.jbpm.instantiation.SharedProcessClassLoaderFactory"
- singleton="true" />
+ <bean name="process.class.loader.factory"
+ class="org.jbpm.instantiation.SharedProcessClassLoaderFactory" singleton="true" />
<!-- make sure the block size matches the length in ByteArray.hbm.xml -->
<int name="jbpm.byte.block.size" value="1024" />
+ <bean name="jbpm.sub.process.resolver" class="org.jbpm.graph.node.DbSubProcessResolver"
+ singleton="true" />
+
<bean name="jbpm.expression.evaluator" class="org.jbpm.jpdl.el.impl.ExpressionEvaluatorImpl"
singleton="true" />
<bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver"
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd 2010-08-24 03:07:12 UTC (rev 6622)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.2.xsd 2010-08-24 18:30:53 UTC (rev 6623)
@@ -118,7 +118,7 @@
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="version" type="xs:integer" />
- <xs:attribute name="binding" type="xs:string" />
+ <xs:attribute name="binding" type="bindingType" />
</xs:complexType>
</xs:element>
<xs:element ref="variable" />
@@ -126,7 +126,6 @@
</xs:choice>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="async" type="asyncType" default="false" />
- <xs:attribute name="binding" type="bindingType" />
</xs:complexType>
</xs:element>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/jpdl.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/jpdl.xml 2010-08-24 03:07:12 UTC (rev 6622)
+++ jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/jpdl.xml 2010-08-24 18:30:53 UTC (rev 6623)
@@ -1052,14 +1052,6 @@
</row>
</thead>
<tbody>
- <row>
- <entry>binding</entry>
- <entry>attribute</entry>
- <entry>optional</entry>
- <entry>This defines the moment at which a sub-process is
- resolved. The options are: <code>{late|*}</code>. It defaults
- to resolving the <property>deploytime</property></entry>
- </row>
<row>
<entry>sub-process</entry>
<entry>element</entry>
@@ -2080,37 +2072,37 @@
<entry><property>name</property></entry>
<entry>attribute</entry>
<entry>required</entry>
- <entry>
- This is the name of the
- <classname>sub-process</classname>. It can be an EL
- expression but it must resolve to a
- <classname>String</classname>.
+ <entry>
+ Name of the sub-process to call.
+ Can be an EL expression which must evaluate to <classname>String</classname>.
</entry>
</row>
<row>
<entry><property>version</property></entry>
<entry>attribute</entry>
<entry>optional</entry>
- <entry>
- This is the version of the <classname>sub-process</classname>. If
- <property>version</property> is not specified, jBPM will use the latest known version of the
- given process whilst it deploys the parent process-state.
- </entry>
+ <entry>
+ Version of the sub-process to call.
+ If <property>version</property> is not specified,
+ the <classname>process-state</classname> takes
+ the latest version of the given process.
+ </entry>
</row>
<row>
- <entry><property>binding</property></entry>
+ <entry><property>binding</property></entry>
<entry>attribute</entry>
<entry>optional</entry>
- <entry>
- Controls when the version of the <classname>sub-process</classname> is determined.
- The default behaviour is to determine the version when deploying the parent
- <classname>process-state</classname>. If <property>binding</property> is defined as
- <code>late</code> (<code>binding="late"</code>) then it is determined
- when the <classname>sub-process</classname> is invoked. If
- <property>binding</property> is set to "late" and <property>version</property> is
- specified, then the value of version will be ignored and the latest version will be
- used.
- </entry>
+ <entry>
+ Defines the moment when the sub-process is resolved.
+ The options are: <code>{early|late}</code>. The default is
+ to resolve <code>early</code>, that is, at deployment time.
+ If <property>binding</property> is defined as <code>late</code>,
+ the <classname>process-state</classname> resolves the latest
+ version of the given process at each execution.
+ Late binding is senseless in combination with a fixed version;
+ therefore, the <property>version</property> attribute is ignored
+ if <code>binding="late"</code>.
+ </entry>
</row>
</tbody>
</tgroup>
13 years, 10 months
JBoss JBPM SVN: r6622 - in jbpm3/branches/jbpm-3.2-soa/modules: core/src/main/java/org/jbpm/command and 7 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-08-23 23:07:12 -0400 (Mon, 23 Aug 2010)
New Revision: 6622
Added:
jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/extras/jpdl_1.java
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/ant/DeployProcessTask.java
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/graph/def/Node.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java
jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/extras/jpdl_1.xmlt
jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/jpdl.xml
Log:
JBPM-2386 update DeployProcessTask description;
improve process instance migration reference and code
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/ant/DeployProcessTask.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/ant/DeployProcessTask.java 2010-08-23 14:14:37 UTC (rev 6621)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/ant/DeployProcessTask.java 2010-08-24 03:07:12 UTC (rev 6622)
@@ -44,91 +44,98 @@
*/
public class DeployProcessTask extends MatchingTask {
- private String jbpmCfg;
- private File process;
- private List fileSets = new ArrayList();
- private boolean failOnError = true;
+ private String jbpmCfg;
+ private File process;
+ private List fileSets;
+ private boolean failOnError = true;
- public void execute() throws BuildException {
- // get the JbpmConfiguration
- JbpmConfiguration jbpmConfiguration = AntHelper.getJbpmConfiguration(jbpmCfg);
+ public void execute() throws BuildException {
+ // get the JbpmConfiguration
+ JbpmConfiguration jbpmConfiguration = AntHelper.getJbpmConfiguration(jbpmCfg);
- // if attribute process is set, deploy that process file
- if (process != null) {
- handleProcessFile(jbpmConfiguration, process);
- }
+ // if attribute process is set, deploy that process file
+ if (process != null) {
+ handleProcessFile(jbpmConfiguration, process);
+ }
- // iterate over file sets
- for (Iterator iter = fileSets.iterator(); iter.hasNext();) {
- FileSet fileSet = (FileSet) iter.next();
- DirectoryScanner dirScanner = fileSet.getDirectoryScanner(getProject());
- File baseDir = dirScanner.getBasedir();
- String[] includedFiles = dirScanner.getIncludedFiles();
- String[] excludedFiles = dirScanner.getExcludedFiles();
+ // iterate over file sets
+ for (Iterator iter = fileSets.iterator(); iter.hasNext();) {
+ FileSet fileSet = (FileSet) iter.next();
+ DirectoryScanner dirScanner = fileSet.getDirectoryScanner(getProject());
+ File baseDir = dirScanner.getBasedir();
+ String[] includedFiles = dirScanner.getIncludedFiles();
+ String[] excludedFiles = dirScanner.getExcludedFiles();
- for (int i = 0; i < includedFiles.length; i++) {
- String fileName = includedFiles[i];
- if (!ArrayUtil.contains(excludedFiles, fileName)) {
- handleProcessFile(jbpmConfiguration, new File(baseDir, fileName));
- }
- }
- }
- }
+ for (int i = 0; i < includedFiles.length; i++) {
+ String fileName = includedFiles[i];
+ if (!ArrayUtil.contains(excludedFiles, fileName)) {
+ handleProcessFile(jbpmConfiguration, new File(baseDir, fileName));
+ }
+ }
+ }
+ }
- private void handleProcessFile(JbpmConfiguration jbpmConfiguration, File processFile) {
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- log("parsing process archive: " + processFile);
- ProcessDefinition processDefinition = parseProcessArchive(processFile);
- deployProcessDefinition(processDefinition, jbpmContext);
- }
- catch (IOException e) {
- log("failed to read process archive: " + processFile, e, Project.MSG_ERR);
- if (failOnError) throw new BuildException(e, getLocation());
- }
- finally {
- jbpmContext.close();
- }
- }
+ private void handleProcessFile(JbpmConfiguration jbpmConfiguration, File processFile) {
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try {
+ ProcessDefinition processDefinition = parseProcessArchive(processFile);
+ deployProcessDefinition(processDefinition, jbpmContext);
+ }
+ catch (IOException e) {
+ if (failOnError) {
+ throw new BuildException("failed to read file " + processFile, e, getLocation());
+ }
+ else {
+ log("failed to read file " + processFile, e, Project.MSG_ERR);
+ }
+ }
+ finally {
+ jbpmContext.close();
+ }
+ }
- private ProcessDefinition parseProcessArchive(File processFile) throws IOException {
- ZipInputStream processStream = new ZipInputStream(new FileInputStream(processFile));
- try {
- ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(processStream);
- log("parsed process definition " + processDefinition.getName());
- return processDefinition;
- }
- finally {
- processStream.close();
- }
- }
+ private ProcessDefinition parseProcessArchive(File processFile) throws IOException {
+ log("parsing process archive " + processFile);
+ ZipInputStream processStream = new ZipInputStream(new FileInputStream(processFile));
+ try {
+ return ProcessDefinition.parseParZipInputStream(processStream);
+ }
+ finally {
+ processStream.close();
+ }
+ }
- private void deployProcessDefinition(ProcessDefinition processDefinition,
- JbpmContext jbpmContext) {
- try {
- jbpmContext.deployProcessDefinition(processDefinition);
- log("process definition " + processDefinition.getName() + " deployed successfully");
- }
- catch (RuntimeException e) {
- jbpmContext.setRollbackOnly();
- log("failed to deploy process " + processDefinition.getName(), e, Project.MSG_ERR);
- if (failOnError) throw new BuildException(e, getLocation());
- }
- }
+ private void deployProcessDefinition(ProcessDefinition processDefinition,
+ JbpmContext jbpmContext) {
+ log("deploying " + processDefinition);
+ try {
+ jbpmContext.deployProcessDefinition(processDefinition);
+ }
+ catch (RuntimeException e) {
+ jbpmContext.setRollbackOnly();
+ if (failOnError) {
+ throw new BuildException("failed to deploy " + processDefinition, e, getLocation());
+ }
+ else {
+ log("failed to deploy " + processDefinition, e, Project.MSG_ERR);
+ }
+ }
+ }
- public void addFileset(FileSet fileSet) {
- this.fileSets.add(fileSet);
- }
+ public void addFileset(FileSet fileSet) {
+ if (fileSets == null) fileSets = new ArrayList();
+ fileSets.add(fileSet);
+ }
- public void setJbpmCfg(String jbpmCfg) {
- this.jbpmCfg = jbpmCfg;
- }
+ public void setJbpmCfg(String jbpmCfg) {
+ this.jbpmCfg = jbpmCfg;
+ }
- public void setProcess(File process) {
- this.process = process;
- }
+ public void setProcess(File process) {
+ this.process = process;
+ }
- public void setFailOnError(boolean failOnError) {
- this.failOnError = failOnError;
- }
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
}
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 2010-08-23 14:14:37 UTC (rev 6621)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java 2010-08-24 03:07:12 UTC (rev 6622)
@@ -8,12 +8,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
-import org.hibernate.Session;
import org.jbpm.JbpmException;
+import org.jbpm.db.GraphSession;
import org.jbpm.graph.def.GraphElement;
import org.jbpm.graph.def.Node;
import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.def.Node.NodeType;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.graph.node.ProcessState;
@@ -25,26 +26,25 @@
import org.jbpm.taskmgmt.exe.TaskInstance;
/**
- * <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.<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>
+ * Migrate a process instance to a different version of its process definition.
+ * <p>
+ * Migration works only if the active nodes are also available in the target process definition
+ * version or a node name mapping is provided.
+ * </p>
+ * <h3>Known limitations</h3>
* <ul>
- * <li> {@link Task}s cannot move "into" another node. If an active {@link TaskInstance} exists,
- * the {@link Task} definition must exist in the {@link TaskNode} with the same (or mapped)
- * name. Otherwise the right node cannot be found easily because it may be ambiguous.</li>
- * <li>Sub processes aren't yet tested. Since the {@link ProcessState} is a {@link Node} like
+ * <li>{@link Task} definitions cannot move to another node. If an active {@link TaskInstance}
+ * exists, the {@link Task} definition must exist in the {@link TaskNode} with the same (or
+ * mapped) name. Otherwise the right node cannot be found easily because it may be ambiguous.</li>
+ * <li>Subprocesses are not tested yet. Since the {@link ProcessState} is a {@link Node} like
* any other, it should work anyway.</li>
- * <li>Can have <b>negative impact on referential integrity</b>! Because one
- * {@link ProcessInstance} can have {@link ProcessLog}s point to old {@link ProcessDefinition}s.
- * Hence, delete a {@link ProcessDefinition} may not work and throw an Exception (Integrity
- * constraint violation)</li>
- * <li>In combination with ESB the ESB uses {@link Token}.id <b>and</b> {@link Node}.id as
- * correlation identifier. After changing the version of a {@link ProcessInstance} the
- * {@link Node} .id has changed, so a signal from ESB will result in an exception and has to be
- * corrected manually.</li>
+ * <li>Migration can have <b>negative impact on referential integrity</b> because the
+ * {@link ProcessInstance} may have {@link ProcessLog}s pointing to the old
+ * {@link ProcessDefinition}. Hence, deleting a {@link ProcessDefinition} may not work and throw
+ * constraint violation exceptions.</li>
+ * <li>The JBoss ESB uses {@link Token}.id <b>and</b> {@link Node}.id as correlation identifier.
+ * After changing the version of a {@link ProcessInstance} the node identifier has changed, so a
+ * signal from ESB will result in an exception and has to be corrected manually.</li>
* </ul>
*
* @author Bernd Ruecker (bernd.ruecker(a)camunda.com)
@@ -52,28 +52,30 @@
public class ChangeProcessInstanceVersionCommand extends AbstractProcessInstanceBaseCommand {
private static final long serialVersionUID = 2277080393930008224L;
+ private static final Log log = LogFactory.getLog(ChangeProcessInstanceVersionCommand.class);
/**
- * new version of process, if <=0, the latest process definition is used
+ * new process definition version. if <=0, the latest process definition is used
*/
private int newVersion = -1;
- private static final Log log = LogFactory.getLog(ChangeProcessInstanceVersionCommand.class);
+ /**
+ * maps node names in the old process definition to node names in the new process definition.
+ * if there is no entry for a node, the old node name is applied.
+ */
+ private Map nodeNameMapping;
/**
- * the map configures for every node-name in the old process definition (as key) which
- * node-name to use in the new process definition. if a node is not mentioned in this Map, old
- * node name = new node name is applied
+ * maps task names in the old process definition to tasks names in the new process definition.
+ * if there is no entry for a task, the old task name is applied.
*/
- private Map nodeNameMapping = new HashMap();
+ private Map taskNameMapping;
- private Map taskNameMapping = new HashMap();
-
public ChangeProcessInstanceVersionCommand() {
}
- public ChangeProcessInstanceVersionCommand(long processId, int newVersion) {
- super.setProcessInstanceId(processId);
+ public ChangeProcessInstanceVersionCommand(long processInstanceId, int newVersion) {
+ super.setProcessInstanceId(processInstanceId);
this.newVersion = newVersion;
}
@@ -81,47 +83,32 @@
return ";newVersion=" + newVersion;
}
- private ProcessDefinition loadNewProcessDefinition(String processName) {
- if (newVersion <= 0)
- return getJbpmContext().getGraphSession().findLatestProcessDefinition(processName);
- else
- return getJbpmContext().getGraphSession().findProcessDefinition(processName, newVersion);
+ private ProcessDefinition findNewProcessDefinition(String processName) {
+ GraphSession graphSession = getJbpmContext().getGraphSession();
+ return newVersion <= 0 ? graphSession.findLatestProcessDefinition(processName)
+ : graphSession.findProcessDefinition(processName, newVersion);
}
public ProcessInstance execute(ProcessInstance pi) {
ProcessDefinition oldDef = pi.getProcessDefinition();
- ProcessDefinition newDef = loadNewProcessDefinition(oldDef.getName());
+ ProcessDefinition newDef = findNewProcessDefinition(oldDef.getName());
- if (newDef == null) {
- throw new JbpmException("Process definition " + oldDef.getName() + " in version "
- + newVersion + " not found.");
- }
-
- if (log.isDebugEnabled()) {
- log.debug("changing " + pi + " from version " + oldDef.getVersion() + " to new version "
+ boolean debug = log.isDebugEnabled();
+ if (debug) {
+ log.debug("migrating " + pi + " from version " + oldDef.getVersion() + " to "
+ newDef.getVersion());
}
pi.setProcessDefinition(newDef);
changeTokenVersion(pi.getRootToken());
- if (log.isDebugEnabled()) {
- log.debug(pi + " changed to version " + newDef.getVersion());
- }
+ if (debug) log.debug(pi + " migrated to version " + newDef.getVersion());
return pi;
}
- private ProcessDefinition getNewProcessDefinition(Token t) {
- return t.getProcessInstance().getProcessDefinition();
- }
-
private void changeTokenVersion(Token token) {
- ProcessDefinition newDef = getNewProcessDefinition(token);
- if (log.isDebugEnabled()) {
- log.debug("changing " + token + " to version " + newDef.getVersion());
- }
-
// change node reference on token (current node)
Node oldNode = token.getNode();
+ ProcessDefinition newDef = token.getProcessInstance().getProcessDefinition();
Node newNode = findReplacementNode(newDef, oldNode);
token.setNode(newNode);
@@ -141,7 +128,7 @@
}
private void adjustTaskInstancesForToken(Token token) {
- ProcessDefinition newDef = getNewProcessDefinition(token);
+ ProcessDefinition newDef = token.getProcessInstance().getProcessDefinition();
boolean debug = log.isDebugEnabled();
for (Iterator i = getTasksForToken(token).iterator(); i.hasNext();) {
@@ -158,7 +145,7 @@
}
private void adjustTimersForToken(Token token) {
- ProcessDefinition newDef = getNewProcessDefinition(token);
+ ProcessDefinition newDef = token.getProcessInstance().getProcessDefinition();
List jobs = getJbpmContext().getJobSession().findJobsByToken(token);
for (Iterator i = jobs.iterator(); i.hasNext();) {
Job job = (Job) i.next();
@@ -166,7 +153,6 @@
// check all timers if connected to a GraphElement
Timer timer = (Timer) job;
if (timer.getGraphElement() != null) {
-
// and change the reference (take name mappings into account!)
if (timer.getGraphElement() instanceof Task) {
// change to new task definition
@@ -177,7 +163,7 @@
else {
// change to new node
GraphElement oldNode = timer.getGraphElement();
- // TODO: What with other GraphElements?
+ // TODO: What about other GraphElements?
timer.setGraphElement(findReplacementNode(newDef, oldNode));
}
}
@@ -189,47 +175,58 @@
String name = getReplacementNodeName(oldNode);
Node newNode = newDef.findNode(name);
if (newNode == null) {
- throw new JbpmException("node with name '" + name
- + "' not found in new process definition");
+ throw new JbpmException("could not find node '" + name + "' in " + newDef);
}
return newNode;
}
private Task findReplacementTask(ProcessDefinition newDef, Node oldNode, Task oldTask) {
- String replacementTaskName = getReplacementTaskName(oldTask);
- Node newTaskNode = findReplacementNode(newDef, oldNode);
+ Node newNode = findReplacementNode(newDef, oldNode);
+ if (newNode.getNodeType() != NodeType.Task) {
+ throw new JbpmException("expected" + newNode + " to be a task node");
+ }
- Session session = getJbpmContext().getSession();
- Long newTaskId = (Long) session.getNamedQuery("TaskMgmtSession.findTaskForNode")
- .setString("taskName", replacementTaskName)
- .setLong("taskNodeId", newTaskNode.getId())
- .uniqueResult();
+ TaskNode newTaskNode;
+ if (newNode instanceof TaskNode) {
+ newTaskNode = (TaskNode) newNode;
+ }
+ else {
+ // acquire proxy of the proper type
+ newTaskNode = (TaskNode) getJbpmContext().getSession().load(TaskNode.class,
+ new Long(newNode.getId()));
+ }
- if (newTaskId == null) {
- throw new JbpmException("Task '" + replacementTaskName + "' for node '"
- + newTaskNode.getName() + "' not found in new process definition");
+ String newTaskName = getReplacementTaskName(oldTask);
+ Task newTask = newTaskNode.getTask(newTaskName);
+
+ if (newTask == null) {
+ throw new JbpmException("could not find task '" + newTaskName + "' for node '"
+ + newTaskNode.getName() + "' in " + newDef);
}
- return (Task) session.load(Task.class, newTaskId);
+ return newTask;
}
/**
- * @param oldNode
- * @return the name of the new node (given in the map or return default value, which is the
- * old node name)
+ * @return the name of the replacement node, if one is given in the node name mapping, or the
+ * old node name
*/
private String getReplacementNodeName(GraphElement oldNode) {
String oldName = oldNode instanceof Node ? ((Node) oldNode).getFullyQualifiedName()
: oldNode.getName();
- if (nodeNameMapping.containsKey(oldName)) {
+ if (nodeNameMapping != null && nodeNameMapping.containsKey(oldName)) {
return (String) nodeNameMapping.get(oldName);
}
// return new node name = old node name as default
return oldName;
}
+ /**
+ * @return the name of the replacement task, if one is given in the task name mapping, or the
+ * old task name
+ */
private String getReplacementTaskName(Task oldTask) {
String oldName = oldTask.getName();
- if (taskNameMapping.containsKey(oldName)) {
+ if (taskNameMapping != null && taskNameMapping.containsKey(oldName)) {
return (String) taskNameMapping.get(oldName);
}
// return new node name = old node name as default
@@ -237,7 +234,7 @@
}
/**
- * We may still have open tasks, even though their parent tokens have been ended. So we'll
+ * There may still be open tasks, even though their parent tokens have been ended. So we'll
* simply get all tasks from this process instance and cancel them if they are still active.
*/
private List getTasksForToken(Token token) {
@@ -245,7 +242,6 @@
.getNamedQuery("TaskMgmtSession.findTaskInstancesByTokenId");
query.setLong("tokenId", token.getId());
return query.list();
-
}
public Map getNodeNameMapping() {
@@ -253,12 +249,7 @@
}
public void setNodeNameMapping(Map nameMapping) {
- if (nameMapping == null) {
- this.nodeNameMapping = new HashMap();
- }
- else {
- this.nodeNameMapping = nameMapping;
- }
+ nodeNameMapping = nameMapping;
}
public int getNewVersion() {
@@ -274,12 +265,7 @@
}
public void setTaskNameMapping(Map nameMapping) {
- if (nameMapping == null) {
- this.taskNameMapping = new HashMap();
- }
- else {
- this.taskNameMapping = nameMapping;
- }
+ taskNameMapping = nameMapping;
}
/**
@@ -332,21 +318,15 @@
public ChangeProcessInstanceVersionCommand nodeNameMappingAdd(String oldNodeName,
String newNodeName) {
- if (nodeNameMapping == null) {
- this.nodeNameMapping = new HashMap();
- }
-
- this.nodeNameMapping.put(oldNodeName, newNodeName);
+ if (nodeNameMapping == null) nodeNameMapping = new HashMap();
+ nodeNameMapping.put(oldNodeName, newNodeName);
return this;
}
public ChangeProcessInstanceVersionCommand taskNameMappingAdd(String oldTaskName,
String newNodeName) {
- if (taskNameMapping == null) {
- this.taskNameMapping = new HashMap();
- }
-
- this.taskNameMapping.put(oldTaskName, newNodeName);
+ if (taskNameMapping == null) taskNameMapping = new HashMap();
+ taskNameMapping.put(oldTaskName, newNodeName);
return this;
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java 2010-08-23 14:14:37 UTC (rev 6621)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java 2010-08-24 03:07:12 UTC (rev 6622)
@@ -100,9 +100,9 @@
return NodeType.Node;
}
- /** @deprecated not in use */
+ /** @deprecated no use for this method */
public String getNameExt() {
- String name = super.getName();
+ String name = getName();
if (name == null) name = "#anonymous" + getNodeType();
return name;
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java 2010-08-23 14:14:37 UTC (rev 6621)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java 2010-08-24 03:07:12 UTC (rev 6622)
@@ -22,6 +22,7 @@
package org.jbpm.instantiation;
import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -38,7 +39,39 @@
private ProcessDefinition processDefinition;
private long processDefinitionId;
+ private final URLStreamHandler urlStreamHandler = new URLStreamHandler() {
+ protected URLConnection openConnection(URL url) throws IOException {
+ return new URLConnection(url) {
+ private FileDefinition fileDefinition;
+
+ public void connect() throws IOException {
+ if (connected) return;
+
+ ProcessDefinition processDefinition = getProcessDefinition();
+ if (processDefinition == null) {
+ throw new IOException("no active jbpm context");
+ }
+ fileDefinition = processDefinition.getFileDefinition();
+
+ connected = true;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ connect();
+
+ String fileName = url.getFile();
+ byte[] fileContent = fileDefinition.getBytes(fileName);
+ if (fileContent == null) {
+ throw new FileNotFoundException(fileName);
+ }
+
+ return new ByteArrayInputStream(fileContent);
+ }
+ };
+ }
+ };
+
public ProcessClassLoader(ClassLoader parent, ProcessDefinition processDefinition) {
super(parent);
// check whether the given process definition is transient
@@ -87,18 +120,17 @@
name = "classes/" + name;
}
- byte[] bytes = fileDefinition.getBytes(name);
- if (bytes == null) return null;
+ if (!fileDefinition.hasFile(name)) return null;
try {
- return new URL("processresource", processDefinition.getName(), -1, "classes/" + name,
- new BytesUrlStreamHandler(bytes));
+ return new URL("processresource", null, -1, name, urlStreamHandler);
}
catch (MalformedURLException e) {
throw new JbpmException("could not create url", e);
}
}
+ /** @deprecated */
public static class BytesUrlStreamHandler extends URLStreamHandler {
private byte[] bytes;
@@ -112,6 +144,7 @@
}
}
+ /** @deprecated */
public static class BytesUrlConnection extends URLConnection {
private byte[] bytes;
@@ -151,8 +184,14 @@
if (getPackage(packageName) == null) {
Package jbpmPackage = ProcessClassLoader.class.getPackage();
- definePackage(packageName, null, null, null, jbpmPackage.getImplementationTitle(),
- jbpmPackage.getImplementationVersion(), jbpmPackage.getImplementationVendor(), null);
+ definePackage(packageName,
+ null,
+ null,
+ null,
+ jbpmPackage.getImplementationTitle(),
+ jbpmPackage.getImplementationVersion(),
+ jbpmPackage.getImplementationVendor(),
+ null);
}
}
return defineClass(className, classBytes, 0, classBytes.length);
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2010-08-23 14:14:37 UTC (rev 6621)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml 2010-08-24 03:07:12 UTC (rev 6622)
@@ -462,13 +462,4 @@
]]>
</query>
- <query name="TaskMgmtSession.findTaskForNode">
- <![CDATA[
- select distinct t.id
- from org.jbpm.taskmgmt.def.Task t
- where t.name = :taskName
- and t.taskNode.id = :taskNodeId
- ]]>
- </query>
-
</hibernate-mapping>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java 2010-08-23 14:14:37 UTC (rev 6621)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java 2010-08-24 03:07:12 UTC (rev 6622)
@@ -32,16 +32,17 @@
// ProcessInstance is deleted
// exceptions look like this: could not delete: [org.jbpm.graph.def.Transition#9]
- // Integrity constraint violation FK_LOG_TRANSITION table: JBPM_LOG in statement [/* delete org.jbpm.graph.def.Transition */ delete from JBPM_TRANSITION where ID_=?]
- // or hibernate batch failed
+ // Integrity constraint violation FK_LOG_TRANSITION table: JBPM_LOG in statement
+ // [delete from JBPM_TRANSITION where ID_=?]
// IMPORTANT: Keep this order of deletions! Otherwise if there is
// more than one ProcessInstance for the ProcessDefinition a HibernateSeassion.flush
- // is called when queriing the seconf ProcessInstance after deleting the first
- // one which may fire a Integrity constraint violation (same problem as described
+ // is called when querying the second ProcessInstance after deleting the first
+ // one which may fire an integrity constraint violation (same problem as described
// above), in this case I got
// could not delete: [org.jbpm.taskmgmt.def.TaskMgmtDefinition#2]
- // Integrity constraint violation FK_TASKMGTINST_TMD table: JBPM_MODULEINSTANCE in statement [/* delete org.jbpm.taskmgmt.def.TaskMgmtDefinition */ delete from JBPM_MODULEDEFINITION where ID_=?]
+ // Integrity constraint violation FK_TASKMGTINST_TMD table: JBPM_MODULEINSTANCE in statement
+ // [delete from JBPM_MODULEDEFINITION where ID_=?]
graphSession.deleteProcessDefinition(pd2.getId());
graphSession.deleteProcessDefinition(pd1.getId());
@@ -95,20 +96,18 @@
// now change all process instances to most current version
try {
- new ChangeProcessInstanceVersionCommand().processName("TestChangeVersion").execute(
- jbpmContext);
+ new ChangeProcessInstanceVersionCommand().processName("TestChangeVersion")
+ .execute(jbpmContext);
fail("Exception expected, saying that state2 is missing in new version");
}
catch (JbpmException ex) {
- assertEquals("node with name 'state2' not found in new process definition",
- ex.getMessage());
+ assert ex.getMessage().indexOf("state2") != -1 : ex.getMessage();
}
- HashMap nameMap = new HashMap();
- nameMap.put("state2", "state2b");
// now supply a mapping for the missing node
- new ChangeProcessInstanceVersionCommand().nodeNameMapping(nameMap).processName(
- "TestChangeVersion").execute(jbpmContext);
+ new ChangeProcessInstanceVersionCommand().nodeNameMappingAdd("state2", "state2b")
+ .processName("TestChangeVersion")
+ .execute(jbpmContext);
newTransaction();
pi1 = graphSession.loadProcessInstance(pi1.getId());
@@ -192,20 +191,18 @@
// now change all process instances to most current version
try {
- new ChangeProcessInstanceVersionCommand().processInstanceId(pi1.getId()).execute(
- jbpmContext);
- fail("Exception expected, saying that phase2 is missing in new version");
+ new ChangeProcessInstanceVersionCommand().processInstanceId(pi1.getId())
+ .execute(jbpmContext);
+ fail("Exception expected, saying that path2 is missing in new version");
}
catch (JbpmException ex) {
- assertEquals("node with name 'path2' not found in new process definition",
- ex.getMessage());
+ assert ex.getMessage().indexOf("path2") != -1 : ex.getMessage();
}
- HashMap nameMap = new HashMap();
- nameMap.put("path2", "path2b");
// now supply a mapping for the missing node
- new ChangeProcessInstanceVersionCommand().nodeNameMapping(nameMap).processInstanceId(
- pi1.getId()).execute(jbpmContext);
+ new ChangeProcessInstanceVersionCommand().nodeNameMappingAdd("path2", "path2b")
+ .processInstanceId(pi1.getId())
+ .execute(jbpmContext);
newTransaction();
@@ -289,8 +286,10 @@
taskNameMap.put("theTask2", "theTask2b");
// now supply a mapping for the missing node
- new ChangeProcessInstanceVersionCommand().nodeNameMapping(nodeNameMap).taskNameMapping(
- taskNameMap).processInstanceId(pi1.getId()).execute(jbpmContext);
+ new ChangeProcessInstanceVersionCommand().nodeNameMapping(nodeNameMap)
+ .taskNameMapping(taskNameMap)
+ .processInstanceId(pi1.getId())
+ .execute(jbpmContext);
newTransaction();
@@ -390,28 +389,24 @@
jbpmContext.deployProcessDefinition(pd2);
// process instance 1 can be updated, state names haven't changed
- new ChangeProcessInstanceVersionCommand().processInstanceId(pi1.getId()).execute(
- jbpmContext);
+ new ChangeProcessInstanceVersionCommand().processInstanceId(pi1.getId())
+ .execute(jbpmContext);
- HashMap nameMap = new HashMap();
- nameMap.put("task2", "task2b");
-
// now change all process instances to most current version
try {
- new ChangeProcessInstanceVersionCommand().nodeNameMapping(nameMap).taskNameMapping(
- nameMap).processName("testTaskInstances").execute(jbpmContext);
+ new ChangeProcessInstanceVersionCommand().nodeNameMappingAdd("task2", "task2b")
+ .processName("testTaskInstances")
+ .execute(jbpmContext);
// fail because task2 is not mapped
- fail("Exception expected, saying that theTask2b is missing in new version");
+ fail("Exception expected, saying that theTask2 is missing in new version");
}
catch (JbpmException ex) {
- assertEquals("Task 'theTask2' for node 'task2b' not found in new process definition",
- ex.getMessage());
+ assert ex.getMessage().indexOf("theTask2") != -1 : ex.getMessage();
}
// now supply a mapping for the missing task
- nameMap.put("theTask2", "theTask2b");
- new ChangeProcessInstanceVersionCommand().nodeNameMapping(nameMap)
- .taskNameMapping(nameMap)
+ new ChangeProcessInstanceVersionCommand().nodeNameMappingAdd("task2", "task2b")
+ .taskNameMappingAdd("theTask2", "theTask2b")
.processName("testTaskInstances")
.execute(jbpmContext);
@@ -492,8 +487,9 @@
// change version
HashMap nameMap = new HashMap();
nameMap.put("timer1", "timer2");
- new ChangeProcessInstanceVersionCommand().nodeNameMapping(nameMap).processInstanceId(
- pi1.getId()).execute(jbpmContext);
+ new ChangeProcessInstanceVersionCommand().nodeNameMapping(nameMap)
+ .processInstanceId(pi1.getId())
+ .execute(jbpmContext);
// load changed stuff
newTransaction();
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java 2010-08-23 14:14:37 UTC (rev 6621)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java 2010-08-24 03:07:12 UTC (rev 6622)
@@ -21,9 +21,9 @@
*/
public class ProcessClassLoaderTest extends AbstractJbpmTestCase {
- public static class TestContextClassLoader extends ClassLoader {
+ public static class TestClassLoader extends ClassLoader {
- public TestContextClassLoader(ClassLoader parent) {
+ public TestClassLoader(ClassLoader parent) {
super(parent);
}
}
@@ -85,10 +85,10 @@
ClassLoader processClassLoader = Thread.currentThread().getContextClassLoader();
assertSame(ProcessClassLoader.class, processClassLoader.getClass());
- ClassLoader testContextClassLoader = processClassLoader.getParent();
- assertSame(TestContextClassLoader.class, testContextClassLoader.getClass());
+ ClassLoader testClassLoader = processClassLoader.getParent();
+ assertSame(TestClassLoader.class, testClassLoader.getClass());
- assertSame(originalClassLoader, testContextClassLoader.getParent());
+ assertSame(originalClassLoader, testClassLoader.getParent());
contextLoadedActionInvocations++;
}
}
@@ -105,9 +105,8 @@
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
- TestContextClassLoader testContextClassLoader = new TestContextClassLoader(
- originalClassLoader);
- Thread.currentThread().setContextClassLoader(testContextClassLoader);
+ ClassLoader testClassLoader = new TestClassLoader(originalClassLoader);
+ Thread.currentThread().setContextClassLoader(testClassLoader);
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ " <start-state name='start'>"
@@ -127,8 +126,7 @@
processInstance.signal();
assertEquals(1, contextLoadedActionInvocations);
- assertSame(testContextClassLoader, Thread.currentThread().getContextClassLoader());
-
+ assertSame(testClassLoader, Thread.currentThread().getContextClassLoader());
}
finally {
Thread.currentThread().setContextClassLoader(originalClassLoader);
@@ -150,10 +148,10 @@
ClassLoader processClassLoader = Thread.currentThread().getContextClassLoader();
assertSame(ProcessClassLoader.class, processClassLoader.getClass());
- ClassLoader testContextClassLoader = processClassLoader.getParent();
- assertSame(TestContextClassLoader.class, testContextClassLoader.getClass());
+ ClassLoader testClassLoader = processClassLoader.getParent();
+ assertSame(TestClassLoader.class, testClassLoader.getClass());
- assertSame(originalClassLoader, testContextClassLoader.getParent());
+ assertSame(originalClassLoader, testClassLoader.getParent());
contextLoadedActionInvocations++;
throw new JbpmException("simulate exception");
@@ -166,10 +164,9 @@
+ "</jbpm-configuration>");
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- TestContextClassLoader testContextClassLoader = new TestContextClassLoader(
- originalClassLoader);
+ ClassLoader testClassLoader = new TestClassLoader(originalClassLoader);
try {
- Thread.currentThread().setContextClassLoader(testContextClassLoader);
+ Thread.currentThread().setContextClassLoader(testClassLoader);
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ " <start-state name='start'>"
@@ -191,7 +188,7 @@
catch (JbpmException ex) {
assertEquals(1, contextLoadedActionInvocations);
assertEquals("simulate exception", ex.getMessage());
- assertSame(testContextClassLoader, Thread.currentThread().getContextClassLoader());
+ assertSame(testClassLoader, Thread.currentThread().getContextClassLoader());
}
finally {
Thread.currentThread().setContextClassLoader(originalClassLoader);
Added: jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/extras/jpdl_1.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/extras/jpdl_1.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/extras/jpdl_1.java 2010-08-24 03:07:12 UTC (rev 6622)
@@ -0,0 +1,4 @@
+new ChangeProcessInstanceVersionCommand()
+ .processName("commute")
+ .nodeNameMappingAdd("drive to destination", "ride bike to destination")
+ .execute(jbpmContext);
\ No newline at end of file
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/extras/jpdl_1.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/extras/jpdl_1.xmlt
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/extras/jpdl_1.xmlt 2010-08-23 14:14:37 UTC (rev 6621)
+++ jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/extras/jpdl_1.xmlt 2010-08-24 03:07:12 UTC (rev 6622)
@@ -1,6 +1,6 @@
-<target name="deploy.par">
- <taskdef name="deploypar" classname="org.jbpm.ant.DeployProcessTask">
- <classpath --make sure the jbpm-[version].jar is in this classpath--/>
+<target name="deploy-process">
+ <taskdef name="deployproc" classname="org.jbpm.ant.DeployProcessTask">
+ <classpath location="jbpm-jpdl.jar" />
</taskdef>
- <deploypar par="build/myprocess.par" />
+ <deployproc process="build/myprocess.par" />
</target>
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/jpdl.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/jpdl.xml 2010-08-23 14:14:37 UTC (rev 6621)
+++ jbpm3/branches/jbpm-3.2-soa/modules/userguide/src/main/docbook/en-US/jpdl.xml 2010-08-24 03:07:12 UTC (rev 6622)
@@ -6,28 +6,31 @@
<chapter id="jpdl">
<title>
- The jBPM Process Definition Language
+ jBPM Process Definition Language
</title>
<para>
- The <firstterm>jBPM Process Definition Language</firstterm> (JPDL)
- specifies both an XML schema and the mechanism through which to
- package all of the process definition-related files into a
- <firstterm>process archive</firstterm>.
+ The <firstterm>jBPM Process Definition Language</firstterm> (jPDL)
+ is the notation to define business processes recognized by the
+ jBPM framework and expressed as an XML schema.
+ Process definitions often require support files in addition to the
+ jPDL document. All these files are packaged into a
+ <firstterm>process archive</firstterm> for deployment.
</para>
- <section id="theprocessarchive">
+ <section id="processarchive">
<title>
- The Process Archive
+ Process Archive
</title>
<para>
- A process archive is a ZIP archive. The central file it contains is
- called <filename>processdefinition.xml</filename>. The main thing
- held within this file is the process graph. (It also contains
- information about actions and tasks.) A process archive can also
- contain other process-related files, such as classes and the user
- interface forms needed by tasks.
+ The process archive is just a ZIP archive with a specific content
+ layout. The central file in the process archive is
+ called <filename>processdefinition.xml</filename> This file defines
+ the business process in the jPDL notation and provides
+ information about automated actions and human tasks.
+ The process archive also contains other files related to the process,
+ such as action handler classes and user interface task forms.
</para>
<section id="deployingaprocessarchive">
@@ -53,7 +56,6 @@
</para>
</listitem>
-
<listitem>
<para>
programatically
@@ -62,108 +64,83 @@
</itemizedlist>
-
-
<para>
- To deploying a process archive with the <application>Process
- Designer Tool</application>, follow this step. (This process is
- supported in the <systemitem>starter's kit</systemitem>.)
+ To deploy a process archive with the <application>Process
+ Designer Tool</application>, right-click on the process
+ archive folder and select the <guimenuitem>Deploy process
+ archive</guimenuitem> option.
</para>
- <orderedlist>
- <listitem>
- <para>
- Right-click on the process archive folder and select
- the <guimenuitem>Deploy process archive</guimenuitem>
- option.
- </para>
-
- <para>
- The <systemitem>starter's kit</systemitem>
- server contains the <application>jBPM</application>
- application, which has a servlet to upload process
- archives, called
- <systemitem>ProcessUploadServlet</systemitem>. This
- servlet is capable of uploading process archives and
- deploying them to the default
- <application>jBPM</application> instance.
- </para>
- </listitem>
-
- </orderedlist>
+ <para>
+ The jBPM application server integration modules
+ include the <application>gpd-deployer</application>
+ web application, which has a servlet to upload process
+ archives, called
+ <systemitem>GPD Deployer Servlet</systemitem>. This
+ servlet is capable of receiving process archives and
+ deploying them to the configured database.
+ </para>
<para>
To deploy a process archive with an <command>ant</command>
- task, use this code:
+ task, define and call the task as follows.
</para>
<programlisting language="XML"><xi:include href="extras/jpdl_1.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<para>
- To deploy more process archives at once, use the nested
- <property>fileset</property> elements. The process attribute
- itself is optional. Here are some of the <command>ant</command>
- task's other attributes:
+ To deploy more process archives at once, use nested
+ <property>fileset</property> elements.
+ Here are the <classname>DeployProcessTask</classname> attributes.
</para>
<table>
- <title>ant Attributes</title>
+ <title><classname>DeployProcessTask</classname> Attributes</title>
<tgroup cols="3" colsep="1" rowsep="1">
- <colspec colwidth="2*"/>
- <colspec colwidth="5*"/>
- <colspec colwidth="2*"/>
+ <colspec colwidth="*"/>
+ <colspec colwidth="3*"/>
+ <colspec colwidth="*"/>
<thead>
<row><entry>Attribute</entry><entry>Description</entry><entry>Required?</entry></row>
</thead>
<tbody>
<row>
+ <entry><property>process</property></entry>
+ <entry><para>Path to process archive.</para></entry>
+ <entry><para>Yes, unless a nested resource collection element is used.</para></entry>
+ </row>
+ <row>
<entry>
<property>jbpmcfg</property>
</entry>
<entry>
<para>
- The default value is <filename>jbpm.cfg.xml</filename>. The JBPM
- configuration file can specify the location of the Hibernate configuration file
- (default value is <filename>hibernate.cfg.xml</filename>) that contains the
- JDBC connection properties for the database and the mapping files.
+ jBPM configuration resource to load during deployment.
</para>
</entry>
- <entry>No</entry>
+ <entry><para>No; defaults to <filename>jbpm.cfg.xml</filename></para></entry>
</row>
<row>
<entry>
- <property>properties</property>
+ <property>failonerror</property>
</entry>
<entry>
<para>
- Overwrites all. Hibernate properties as found in
- the <filename>hibernate.cfg.xml</filename> file.
+ If false, log a warning message, but do not stop the build,
+ when the process definition fails to deploy.
</para>
</entry>
- <entry>No</entry>
+ <entry>No; defaults to true</entry>
</row>
-
- <row>
- <entry>
- <property>createschema</property>
- </entry>
- <entry>
- <para>
- When set to <code>true</code>, the jBPM database
- schema is created before any processes are deployed.
- </para>
- </entry>
- <entry>No</entry>
- </row>
</tbody></tgroup>
</table>
<para>
- To deploy process archives programmatically, use the
- <classname>org.jbpm.jpdl.par.ProcessArchiveDeployer</classname>
- class.
+ To deploy process archives programmatically, call the
+ <classname>org.jbpm.JbpmContext</classname>
+ class' <methodname>deployProcessDefinition</methodname> method.
</para>
</section>
@@ -210,9 +187,8 @@
<para>
To do so, put the delegation
- classes in a <filename>.JAR</filename> file "next to" the
- <filename>jbpm-[version].jar</filename> so
- that
+ classes in a <filename>.jar</filename> file "next to"
+ <filename>jbpm-jpdl.jar</filename> so that
all of the process definitions will see that class
file. The Java classes can also be included in the
process archive. When you include your delegation
@@ -252,31 +228,35 @@
<warning>
<para>
- It is dangerous to change process definitions after they are
- deployed. Red Hat discourages this process. It is better to
- migrate process instances to new definitions.
+ Changing process definitions after they are deployed is not
+ a recommended practice. It is better to migrate process instances
+ to a new version of the process definition.
</para>
</warning>
-
-
<para>
- Consider these factors before undertaking this process:
+ Consider these factors before undertaking this process:
</para>
<itemizedlist>
<listitem>
<para>
- one can simply load a process definition, change it and save it
- with the <application>Hibernate</application> session. (Access
- the <application>Hibernate</application> session via the
- <methodname>JbpmContext.getSession()</methodname> method.)
+ There is no restriction on updating a process definition
+ loaded through the <classname>org.jbpm.db.GraphSession</classname>
+ methods <methodname>loadProcessDefinition</methodname>,
+ <methodname>findProcessDefinition</methodname> or reached
+ through association traversal. Nonetheless, it is
+ <emphasis>very</emphasis> easy to mess up the process
+ with a few calls such as <code>setStartState(null)</code>!
</para>
</listitem>
<listitem>
<para>
- one must remove a process definition from the second level
- cache after having updated the existing definition.
+ Because processs definitions are not supposed to change,
+ the shipped Hibernate configuration specifies the
+ <code>nonstrict-read-write</code> caching strategy for
+ definition classes and collections. This strategy can make
+ uncommitted updates visible to other transactions.
</para>
</listitem>
</itemizedlist>
@@ -289,33 +269,39 @@
</title>
<para>
- An alternative approach is to convert the executions to a new process definition.
- Please take into account that this is not trivial due to the
+ An alternative approach to changing a process definition
+ is to migrate each process instance to a new version.
+ Please consider that migration is not trivial due to the
long-lived nature of business processes.
</para>
<note>
<para>
- Currently, this is an experimental feature and is not supported
- "out-of-the-box."
+ This is an experimental feature.
</para>
</note>
<para>
- There is a clear distinction between process definition
- data, process instance (run-time) data and logging data.
- Because of this distinction, one creates a separate process
- definition in the jBPM database (by, for example, deploying
- a new version of the same process) and then the run-time
- information is transformed into the new process definition.
- (This will involve a translation if tokens in the old
- process point to nodes that have been removed in the new
- version.) Hence, only new data is added to the database.
- Note, though, that one execution of a process is spread over
- two process instance objects. This can present challenges
- when developing tools and making statistics calculations.
- When resources permit, Red Hat will add support for this.
+ There is a clear distinction between definition data,
+ execution data and logging data.
+ Because of this distinction, a new version of the process
+ has to be deployed first, and then process instances
+ are migrated to the new version.
+ Migration involves a translation if tokens or task instances
+ point to nodes or task definitions that have been removed
+ in the target process definition.
+ Be aware that logging data ends up spread over two
+ process definitions. This can present challenges
+ when developing tools and making statistics calculations.
</para>
+
+ <para>
+ To migrate a process instance to a new version, execute the
+ <classname>ChangeProcessInstanceVersionCommand</classname>
+ as shown below.
+ </para>
+
+ <programlisting><xi:include href="extras/jpdl_1.java" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
</section>
</section>
@@ -328,35 +314,34 @@
custom code in process executions.
</para>
- <section id="thejbpmclassloader">
+ <section id="jbpmclassloader">
<title>
- The jBPM Class Loader
+ jBPM Class Loader
</title>
<para>
- The jBPM class loader is that which loads the jBPM classes. It
- can do so as it has the <filename>jbpm-3.x.jar</filename>
- filename in its class-path. To make classes visible to the jBPM
- class loader, place them in a JAR file and put that JAR file
- "besides" the <filename>jbpm-3.x.jar</filename> (in the
- <filename>WEB-INF/lib</filename> directory, for instance, in
- the case of web applications.)
+ The jBPM class loader is the one that loads the jBPM classes.
+ To make classes visible to the jBPM class loader, pack them
+ in a JAR file and co-locate the JAR with <filename>jbpm-jpdl.jar</filename>.
+ In the case of web applications, one would place the
+ custom JAR file in <filename>WEB-INF/lib</filename> alongside
+ <filename>jbpm-jpdl.jar</filename>.
</para>
</section>
- <section id="theprocessclassloader">
+ <section id="processclassloader">
<title>
- The Process Class Loader
+ Process Class Loader
</title>
<para>
- Delegation classes are loaded with their respective process
- definitions' <firstterm>process class loader</firstterm>. (The
- process class loader is a class loader that has the jBPM class
- loader as a parent. It adds all of the classes of one
- particular process definition.) Add classes to a process
- definition by putting them in the process archive's
- <filename>/classes</filename> directory. Note that this is only
+ Delegation classes are loaded through their respective
+ <firstterm>process class loader</firstterm>. The
+ process class loader has the jBPM class loader as its parent.
+ It adds the classes deployed with one
+ particular process definition. To add classes to a process
+ definition, put them in the <filename>classes</filename>
+ directory of the process archive. Note that this is only
useful when one wishes to version the classes that have been
added to the process definition. If versioning is not required,
make the classes available to the jBPM class loader instead.
@@ -365,20 +350,16 @@
<para>
If the resource name does not start with a slash, resources are
also loaded from the process archive's
- <filename>/classes</filename> directory. To load resources that
+ <filename>classes</filename> directory. To load resources that
reside outside this directory, start the path with a double
- forward slash (<code>//</code>). (For example, to load
- <filename>data.xml</filename> which is located "next to" the
- <filename>processdefinition.xml</filename> on the root of the
- process archive file, use
- <methodname>class.getResource("//data.xml")</methodname> or
- <methodname>classLoader.getResourceAsStream("//data.xml")</methodname>
- or any variant of these.)
+ forward slash (<code>//</code>). For example, to load
+ <filename>data.xml</filename>, located in the process archive root,
+ call <methodname>class.getResource("//data.xml")</methodname>.
</para>
</section>
- <section id="configurationofdelegations">
+ <section id="configuringdelegations">
<title>
Configuring Delegations
</title>
@@ -389,8 +370,8 @@
<firstterm>action</firstterm>. In the case of action, an
implementation of the
<interfacename>ActionHandler</interfacename> interface can be
- called on an event in the process. (Delegations are specified
- in the <filename>processdefinition.xml</filename> file.) One
+ called on an event in the process. Delegations are specified
+ in the <filename>processdefinition.xml</filename> file. One
can supply any of these three pieces of data when specifying a
delegation:
</para>
13 years, 10 months
JBoss JBPM SVN: r6620 - jbpm3/branches/jbpm-soa5.1-mavenise/modules/soa-distribution.
by do-not-reply@jboss.org
Author: ryanzhang
Date: 2010-08-22 22:18:01 -0400 (Sun, 22 Aug 2010)
New Revision: 6620
Modified:
jbpm3/branches/jbpm-soa5.1-mavenise/modules/soa-distribution/build.xml
Log:
restore javadocs in jbpm-soa-distribution
Modified: jbpm3/branches/jbpm-soa5.1-mavenise/modules/soa-distribution/build.xml
===================================================================
--- jbpm3/branches/jbpm-soa5.1-mavenise/modules/soa-distribution/build.xml 2010-08-22 04:28:46 UTC (rev 6619)
+++ jbpm3/branches/jbpm-soa5.1-mavenise/modules/soa-distribution/build.xml 2010-08-23 02:18:01 UTC (rev 6620)
@@ -64,7 +64,7 @@
</copy>
<zip destfile="${module_base_dir}/target/${module_build_finalName}.zip" >
- <zipfileset dir="${module_base_dir}/target/dist" prefix="jbpm" includes="**/*" excludes="javadocs/**"/>
+ <zipfileset dir="${module_base_dir}/target/dist" prefix="jbpm" includes="**/*" />
</zip>
</target>
13 years, 10 months
JBoss JBPM SVN: r6619 - in jbpm4/trunk/modules/log: src/main/java/org/jbpm/internal/log and 1 other directory.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-08-22 00:28:46 -0400 (Sun, 22 Aug 2010)
New Revision: 6619
Added:
jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Slf4jLog.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Slf4jLogFactory.java
Modified:
jbpm4/trunk/modules/log/pom.xml
jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Log.java
Log:
JBPM-2530 support slf4j.
Modified: jbpm4/trunk/modules/log/pom.xml
===================================================================
--- jbpm4/trunk/modules/log/pom.xml 2010-08-21 18:14:12 UTC (rev 6618)
+++ jbpm4/trunk/modules/log/pom.xml 2010-08-22 04:28:46 UTC (rev 6619)
@@ -33,5 +33,10 @@
<artifactId>log4j</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Log.java
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Log.java 2010-08-21 18:14:12 UTC (rev 6618)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Log.java 2010-08-22 04:28:46 UTC (rev 6619)
@@ -26,25 +26,29 @@
* @author Tom Baeyens
*/
public abstract class Log {
-
+
static LogFactory logFactory;
public static synchronized Log getLog(String name) {
if (logFactory==null) {
-
+
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// if logging.properties is available on the classpath
if (classLoader.getResource("logging.properties")!=null) {
logFactory = new Jdk14LogFactory();
-
+
+ // if slf4j is available on the classpath
+ } else if (isSlf4jAvailable(classLoader)) {
+ logFactory = new Slf4jLogFactory();
+
// if log4j is available on the classpath
} else if (isLog4jAvailable(classLoader)) {
logFactory = new Log4jLogFactory();
-
+
} else {
logFactory = new Jdk14LogFactory();
-
+
}
}
return logFactory.getLog(name);
@@ -59,7 +63,16 @@
}
}
+ static boolean isSlf4jAvailable(ClassLoader classLoader) {
+ try {
+ Class.forName("org.slf4j.impl.StaticLoggerBinder", false, classLoader);
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ }
+
public abstract void error(String msg);
public abstract void error(String msg, Throwable exception);
@@ -74,9 +87,9 @@
public abstract boolean isTraceEnabled();
public abstract void trace(String msg);
public abstract void trace(String msg, Throwable exception);
-
+
public abstract boolean isWarnEnabled();
public abstract void warn(String msg);
public abstract void warn(String msg, Throwable exception);
-
+
}
Added: jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Slf4jLog.java
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Slf4jLog.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Slf4jLog.java 2010-08-22 04:28:46 UTC (rev 6619)
@@ -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.internal.log;
+
+import org.slf4j.Logger;
+
+/**
+ * @author Huisheng Xu
+ */
+public class Slf4jLog extends Log {
+
+ Logger log;
+
+ public Slf4jLog(Logger log) {
+ this.log = log;
+ }
+
+ public void error(String msg) {
+ log.error(msg);
+ }
+
+ public void error(String msg, Throwable exception) {
+ log.error(msg, exception);
+ }
+
+ public boolean isInfoEnabled() {
+ return log.isInfoEnabled();
+ }
+
+ public void info(String msg) {
+ log.info(msg);
+ }
+
+ public void info(String msg, Throwable exception) {
+ log.info(msg, exception);
+ }
+
+ public boolean isDebugEnabled() {
+ return log.isDebugEnabled();
+ }
+
+ public void debug(String msg) {
+ log.debug(msg);
+ }
+
+ public void debug(String msg, Throwable exception) {
+ log.debug(msg, exception);
+ }
+
+ public boolean isTraceEnabled() {
+ return log.isTraceEnabled();
+ }
+
+ public void trace(String msg) {
+ log.trace(msg);
+ }
+
+ public void trace(String msg, Throwable exception) {
+ log.trace(msg, exception);
+ }
+
+ public boolean isWarnEnabled() {
+ return log.isWarnEnabled();
+ }
+
+ public void warn(String msg) {
+ log.warn(msg);
+ }
+
+ public void warn(String msg, Throwable exception) {
+ log.warn(msg, exception);
+ }
+
+}
Added: jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Slf4jLogFactory.java
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Slf4jLogFactory.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/Slf4jLogFactory.java 2010-08-22 04:28:46 UTC (rev 6619)
@@ -0,0 +1,36 @@
+/*
+ * 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.internal.log;
+
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author Huisheng Xu
+ */
+public class Slf4jLogFactory implements LogFactory {
+
+ public Log getLog(String name) {
+ return new Slf4jLog(LoggerFactory.getLogger(name));
+ }
+
+}
13 years, 10 months
JBoss JBPM SVN: r6618 - in jbpm3/branches/jbpm-3.2-soa: modules/core/src/main/resources and 1 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-08-21 14:14:12 -0400 (Sat, 21 Aug 2010)
New Revision: 6618
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/standalone.sh
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm.mail.templates.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/TaskMailTest.java
Log:
update task list base url in mail templates;
adapt TaskMailTest that relied on old url
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/standalone.sh
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/standalone.sh 2010-08-20 12:58:14 UTC (rev 6617)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/standalone.sh 2010-08-21 18:14:12 UTC (rev 6618)
@@ -33,4 +33,4 @@
# Run standalone test suite
export JAVA_HOME=$ORIG_JAVA_HOME
-mvn --fail-at-end -Dsurefire.jvm.args="-Xms64m -Xmx256m" test
+mvn --fail-at-end -Dsurefire.jvm.args="-Xms64m -Xmx256m" -Dmaven.test.failure.ignore=true test
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm.mail.templates.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm.mail.templates.xml 2010-08-20 12:58:14 UTC (rev 6617)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm.mail.templates.xml 2010-08-21 18:14:12 UTC (rev 6618)
@@ -4,20 +4,19 @@
<mail-template name='task-assign'>
<actors>${taskInstance.actorId}</actors>
- <subject>Task '${taskInstance.name}'</subject>
+ <subject>Task notification: ${taskInstance.name}</subject>
<text><![CDATA[Hi ${taskInstance.actorId},
Task '${taskInstance.name}' has been assigned to you.
Go for it: ${taskListBaseURL}${taskInstance.id}
-Thanks.
Sent by jBPM]]></text>
</mail-template>
<mail-template name='task-reminder'>
<actors>${taskInstance.actorId}</actors>
- <subject>Task '${taskInstance.name}' !</subject>
+ <subject>Task reminder: ${taskInstance.name}</subject>
<text><![CDATA[Hey ${taskInstance.actorId},
-Do not forget about task '${taskInstance.name}'
+Do not forget about task '${taskInstance.name}'.
Get going: ${taskListBaseURL}${taskInstance.id}
Sent by jBPM]]></text>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/TaskMailTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/TaskMailTest.java 2010-08-20 12:58:14 UTC (rev 6617)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/mail/TaskMailTest.java 2010-08-21 18:14:12 UTC (rev 6618)
@@ -72,15 +72,6 @@
return testSetup;
}
- public static class RoundRobinAssigner implements AssignmentHandler {
- private static final long serialVersionUID = 1L;
-
- public void assign(Assignable assignable, ExecutionContext executionContext)
- throws Exception {
- assignable.setActorId("you");
- }
- }
-
public void testTaskInstanceNotification() throws IOException, MessagingException {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ " <start-state>"
@@ -88,9 +79,7 @@
+ " </start-state>"
+ " <task-node name='a'>"
+ " <task name='laundry' notify='yes'>"
- + " <assignment class='"
- + RoundRobinAssigner.class.getName()
- + "' />"
+ + " <assignment actor-id='you' />"
+ " </task>"
+ " <transition to='b' />"
+ " </task-node>"
@@ -105,12 +94,13 @@
WiserMessage message = (WiserMessage) messages.get(0);
MimeMessage email = message.getMimeMessage();
- assert Arrays.equals(InternetAddress.parse("you(a)example.domain"), email.getRecipients(RecipientType.TO));
- assertEquals("Task 'laundry'", email.getSubject());
+ assert Arrays.equals(InternetAddress.parse("you(a)example.domain"),
+ email.getRecipients(RecipientType.TO));
+ assertEquals("Task notification: laundry", email.getSubject());
// just to make sure that all expressions were resolved
String content = (String) email.getContent();
- assertEquals(-1, content.indexOf("#{"));
- assertTrue(content.indexOf("http://localhost:8080/jbpm/home?taskId=0") != -1);
+ assertEquals(-1, content.indexOf("${"));
+ assert content.startsWith("Hi you,") : content;
}
public static class TestSchedulerService implements SchedulerService, ServiceFactory {
@@ -154,9 +144,7 @@
+ " </start-state>"
+ " <task-node name='a'>"
+ " <task name='laundry'>"
- + " <assignment class='"
- + RoundRobinAssigner.class.getName()
- + "' />"
+ + " <assignment actor-id='you' />"
+ " <reminder duedate='0 seconds' repeat='60 seconds' />"
+ " </task>"
+ " <transition to='b' />"
@@ -184,12 +172,13 @@
WiserMessage message = (WiserMessage) messages.get(0);
MimeMessage email = message.getMimeMessage();
- assert Arrays.equals(InternetAddress.parse("you(a)example.domain"), email.getRecipients(RecipientType.TO));
- assertEquals("Task 'laundry' !", email.getSubject());
+ assert Arrays.equals(InternetAddress.parse("you(a)example.domain"),
+ email.getRecipients(RecipientType.TO));
+ assertEquals("Task reminder: laundry", email.getSubject());
// just to make sure that all expressions were resolved
String content = (String) email.getContent();
- assertEquals(-1, content.indexOf("#{"));
- assertTrue(content.indexOf("http://localhost:8080/jbpm/home?taskId=0") != -1);
+ assertEquals(-1, content.indexOf("${"));
+ assert content.startsWith("Hey you,") : content;
TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();
TaskInstance taskInstance = (TaskInstance) taskMgmtInstance.getTaskInstances()
13 years, 10 months
JBoss JBPM SVN: r6617 - jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-08-20 08:58:14 -0400 (Fri, 20 Aug 2010)
New Revision: 6617
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm.mail.templates.xml
Log:
update task list base url in mail templates
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm.mail.templates.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm.mail.templates.xml 2010-08-20 03:21:28 UTC (rev 6616)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm.mail.templates.xml 2010-08-20 12:58:14 UTC (rev 6617)
@@ -1,23 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<mail-templates>
- <variable name="BaseTaskListURL" value="http://localhost:8080/jbpm/home?taskId=" />
+ <variable name="taskListBaseURL" value="http://localhost:8080/jbpm-console/app/task.jsf?id=" />
<mail-template name='task-assign'>
- <actors>#{taskInstance.actorId}</actors>
- <subject>Task '#{taskInstance.name}'</subject>
- <text><![CDATA[Hi,
-Task '#{taskInstance.name}' has been assigned to you.
-Go for it: #{BaseTaskListURL}#{taskInstance.id}
+ <actors>${taskInstance.actorId}</actors>
+ <subject>Task '${taskInstance.name}'</subject>
+ <text><![CDATA[Hi ${taskInstance.actorId},
+Task '${taskInstance.name}' has been assigned to you.
+Go for it: ${taskListBaseURL}${taskInstance.id}
Thanks.
----powered by JBoss jBPM---]]></text>
+
+Sent by jBPM]]></text>
</mail-template>
<mail-template name='task-reminder'>
- <actors>#{taskInstance.actorId}</actors>
- <subject>Task '#{taskInstance.name}' !</subject>
- <text><![CDATA[Hey,
-Don't forget about #{BaseTaskListURL}#{taskInstance.id}
-Get going !
----powered by JBoss jBPM---]]></text>
+ <actors>${taskInstance.actorId}</actors>
+ <subject>Task '${taskInstance.name}' !</subject>
+ <text><![CDATA[Hey ${taskInstance.actorId},
+Do not forget about task '${taskInstance.name}'
+Get going: ${taskListBaseURL}${taskInstance.id}
+
+Sent by jBPM]]></text>
</mail-template>
</mail-templates>
13 years, 10 months
JBoss JBPM SVN: r6616 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/bpmn/event/timerstart and 5 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-08-19 23:21:28 -0400 (Thu, 19 Aug 2010)
New Revision: 6616
Modified:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/timer/IntermediateTimerTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/timerstart/TimerStartTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/cal/cfg/CustomBusinessCalendarCfgTest.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/cal/impl/CustomBusinessCalendarImplTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java
Log:
remove unintended JbpmTestCase dependency on JMS API;
replace deprecated Job.getDuedate() calls with Job.getDueDate()
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/timer/IntermediateTimerTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/timer/IntermediateTimerTest.java 2010-08-20 03:14:27 UTC (rev 6615)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/timer/IntermediateTimerTest.java 2010-08-20 03:21:28 UTC (rev 6616)
@@ -56,7 +56,7 @@
Job timerJob = managementService.createJobQuery()
.processInstanceId(processInstance.getId())
.uniqueResult();
- assertEquals(timerJob.getDuedate().getTime(), new Date(60 * 60 *1000).getTime());
+ assertEquals(timerJob.getDueDate().getTime(), new Date(60 * 60 *1000).getTime());
managementService.executeJob(timerJob.getId());
assertProcessInstanceEnded(processInstance);
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/timerstart/TimerStartTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/timerstart/TimerStartTest.java 2010-08-20 03:14:27 UTC (rev 6615)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/timerstart/TimerStartTest.java 2010-08-20 03:21:28 UTC (rev 6616)
@@ -56,20 +56,20 @@
// After deployment, there should be one job in the database that starts a new process instance
Job startProcessTimer = managementService.createJobQuery().uniqueResult();
assertNotNull(startProcessTimer);
- assertEquals(DateUtils.getDate(10, Calendar.OCTOBER, 2099, 10, 0, 0).getTime(), startProcessTimer.getDuedate().getTime());
+ assertEquals(DateUtils.getDate(10, Calendar.OCTOBER, 2099, 10, 0, 0).getTime(), startProcessTimer.getDueDate().getTime());
// Triggering the job should start a new process instance of the deployed process definition
ProcessInstanceQuery procInstQuery = executionService.createProcessInstanceQuery();
assertEquals(0, procInstQuery.count());
- // need to change current date to calculate the next duedate internally correctl
+ // need to change current date to calculate the next due date internally correctly
Clock.setExplicitTime(DateUtils.getDate(10, Calendar.OCTOBER, 2099, 10, 0, 0));
managementService.executeJob(startProcessTimer.getId());
assertEquals(1, procInstQuery.count());
- // Since a timeCycle was used, the job should have been recreated with a new duedate
+ // Since a timeCycle was used, the job should have been recreated with a new due date
startProcessTimer = managementService.createJobQuery().uniqueResult();
- assertEquals(DateUtils.getDate(10, Calendar.OCTOBER, 2099, 20, 0, 0).getTime(), startProcessTimer.getDuedate().getTime());
+ assertEquals(DateUtils.getDate(10, Calendar.OCTOBER, 2099, 20, 0, 0).getTime(), startProcessTimer.getDueDate().getTime());
// So we need to manually delete it
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java 2010-08-20 03:14:27 UTC (rev 6615)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java 2010-08-20 03:21:28 UTC (rev 6616)
@@ -58,7 +58,7 @@
.processInstanceId(processInstance.getId())
.uniqueResult();
- long difference = job.getDuedate().getTime() - now;
+ long difference = job.getDueDate().getTime() - now;
// we do not know when this test will be run. So the exact actual duedate of the timer
// can not be calculated easily. But we do know for sure that each working day only
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2010-08-20 03:14:27 UTC (rev 6615)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2010-08-20 03:21:28 UTC (rev 6616)
@@ -27,7 +27,6 @@
import java.util.Timer;
import java.util.TimerTask;
-import javax.jms.Message;
import javax.jms.Session;
import org.hibernate.criterion.Projections;
@@ -111,16 +110,16 @@
}
}
- public static Message jmsConsumeMessage(String connectionFactoryName, String destinationName) {
+ public static Object jmsConsumeMessage(String connectionFactoryName, String destinationName) {
return jmsConsumeMessage(connectionFactoryName, destinationName, Session.AUTO_ACKNOWLEDGE);
}
- public static Message jmsConsumeMessage(String connectionFactoryName, String destinationName,
+ public static Object jmsConsumeMessage(String connectionFactoryName, String destinationName,
int acknowledgeMode) {
return jmsConsumeMessage(connectionFactoryName, destinationName, acknowledgeMode, 5000);
}
- public static Message jmsConsumeMessage(String connectionFactoryName, String destinationName,
+ public static Object jmsConsumeMessage(String connectionFactoryName, String destinationName,
int acknowledgeMode, long timeout) {
return JmsExtensions.consumeMessage(connectionFactoryName,
destinationName,
Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/cal/cfg/CustomBusinessCalendarCfgTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/cal/cfg/CustomBusinessCalendarCfgTest.java 2010-08-20 03:14:27 UTC (rev 6615)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/cal/cfg/CustomBusinessCalendarCfgTest.java 2010-08-20 03:21:28 UTC (rev 6616)
@@ -71,7 +71,7 @@
.processInstanceId(processInstance.getId())
.uniqueResult();
- Date duedate = job.getDuedate();
+ Date duedate = job.getDueDate();
gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTime(duedate);
Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/cal/impl/CustomBusinessCalendarImplTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/cal/impl/CustomBusinessCalendarImplTest.java 2010-08-20 03:14:27 UTC (rev 6615)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custom/cal/impl/CustomBusinessCalendarImplTest.java 2010-08-20 03:21:28 UTC (rev 6616)
@@ -65,10 +65,10 @@
.processInstanceId(processInstance.getId())
.uniqueResult();
- Date duedate = job.getDuedate();
+ Date dueDate = job.getDueDate();
GregorianCalendar gregorianCalendar = new GregorianCalendar();
- gregorianCalendar.setTime(duedate);
+ gregorianCalendar.setTime(dueDate);
assertEquals(Calendar.JULY, gregorianCalendar.get(Calendar.MONTH));
assertEquals(21, gregorianCalendar.get(Calendar.DAY_OF_MONTH));
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java 2010-08-20 03:14:27 UTC (rev 6615)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java 2010-08-20 03:21:28 UTC (rev 6616)
@@ -121,7 +121,7 @@
.uniqueResult();
Calendar jobDate = Calendar.getInstance();
- jobDate.setTime(job.getDuedate());
+ jobDate.setTime(job.getDueDate());
assertEquals(currentYear + 10, jobDate.get(Calendar.YEAR));
}
@@ -154,7 +154,7 @@
.uniqueResult();
Calendar jobDate = Calendar.getInstance();
- jobDate.setTime(job.getDuedate());
+ jobDate.setTime(job.getDueDate());
assertEquals(cal.get(Calendar.DAY_OF_MONTH), jobDate.get(Calendar.DAY_OF_MONTH));
@@ -190,7 +190,7 @@
.uniqueResult();
Calendar jobDate = Calendar.getInstance();
- jobDate.setTime(job.getDuedate());
+ jobDate.setTime(job.getDueDate());
assertEquals(cal.get(Calendar.DAY_OF_MONTH), jobDate.get(Calendar.DAY_OF_MONTH));
@@ -224,7 +224,7 @@
.processInstanceId(processInstance.getId())
.uniqueResult();
- Date jobDate = job.getDuedate();
+ Date jobDate = job.getDueDate();
assertTrue("should less than 2 minutes", jobDate.getTime() - new Date().getTime() <= 2 * 60 * 1000);
managementService.executeJob(job.getId());
@@ -259,7 +259,7 @@
.uniqueResult();
Calendar jobDate = Calendar.getInstance();
- jobDate.setTime(job.getDuedate());
+ jobDate.setTime(job.getDueDate());
cal.add(Calendar.DAY_OF_MONTH, 5);
assertEquals(cal.get(Calendar.DAY_OF_MONTH), jobDate.get(Calendar.DAY_OF_MONTH));
@@ -297,7 +297,7 @@
.uniqueResult();
Calendar jobDate = Calendar.getInstance();
- jobDate.setTime(job.getDuedate());
+ jobDate.setTime(job.getDueDate());
// 6 days from now minus 5 days is tomorrow so subtract 5 from the original added 6.
cal.add(Calendar.DAY_OF_MONTH, -5);
@@ -335,7 +335,7 @@
.uniqueResult();
Calendar jobDate = Calendar.getInstance();
- jobDate.setTime(job.getDuedate());
+ jobDate.setTime(job.getDueDate());
// 12 feb is friday, 5 businessdays further is friday 19th
assertEquals(19 , jobDate.get(Calendar.DAY_OF_MONTH));
@@ -397,7 +397,7 @@
.uniqueResult();
Calendar jobDate = Calendar.getInstance();
- jobDate.setTime(job.getDuedate());
+ jobDate.setTime(job.getDueDate());
// 17 feb is friday, 5 businessdays before is friday 10th
assertEquals(10 , jobDate.get(Calendar.DAY_OF_MONTH));
@@ -432,7 +432,7 @@
Job job = managementService.createJobQuery().processInstanceId(processInstance.getId()).uniqueResult();
Calendar jobDate = Calendar.getInstance();
- jobDate.setTime(job.getDuedate());
+ jobDate.setTime(job.getDueDate());
// 5 mar is monday, 5 businessdays before is monday feb 27th (29-02-12 is leap day)
assertEquals(27, jobDate.get(Calendar.DAY_OF_MONTH));
@@ -467,7 +467,7 @@
Job job = managementService.createJobQuery().processInstanceId(processInstance.getId()).uniqueResult();
Calendar jobDate = Calendar.getInstance();
- jobDate.setTime(job.getDuedate());
+ jobDate.setTime(job.getDueDate());
// 13 mar is tuesday, 10 businessdays before is tuesday feb 28th (29-02-12 is leap day)
assertEquals(28, jobDate.get(Calendar.DAY_OF_MONTH));
13 years, 10 months