JBoss JBPM SVN: r4349 - jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-03-29 12:51:56 -0400 (Sun, 29 Mar 2009)
New Revision: 4349
Modified:
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-mysql-ds.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-postgresql-ds.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-sybase-ds.xml
Log:
minor datasource updates
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-mysql-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-mysql-ds.xml 2009-03-29 16:29:30 UTC (rev 4348)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-mysql-ds.xml 2009-03-29 16:51:56 UTC (rev 4349)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<datasources>
+<datasources>
<xa-datasource>
<jndi-name>JbpmDS</jndi-name>
@@ -13,7 +13,7 @@
<!-- reduce isolation from the default level (repeatable read) -->
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- <!-- separate connections used with and without JTA transaction -->
+ <!-- separate connections used inside and outside a JTA transaction -->
<no-tx-separate-pools />
<!-- disable transaction interleaving -->
<track-connection-by-tx />
@@ -31,5 +31,4 @@
<type-mapping>mySQL</type-mapping>
</metadata>
</xa-datasource>
-
</datasources>
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-postgresql-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-postgresql-ds.xml 2009-03-29 16:29:30 UTC (rev 4348)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-postgresql-ds.xml 2009-03-29 16:51:56 UTC (rev 4349)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<datasources>
+<datasources>
<xa-datasource>
<jndi-name>JbpmDS</jndi-name>
@@ -19,5 +19,4 @@
<type-mapping>PostgreSQL 8.0</type-mapping>
</metadata>
</xa-datasource>
-
</datasources>
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-sybase-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-sybase-ds.xml 2009-03-29 16:29:30 UTC (rev 4348)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-sybase-ds.xml 2009-03-29 16:51:56 UTC (rev 4349)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
-
<xa-datasource>
<jndi-name>JbpmDS</jndi-name>
@@ -12,6 +11,8 @@
<user-name>${jdbc.sybase.username}</user-name>
<password>${jdbc.sybase.password}</password>
+ <!-- separate connections used inside and outside a JTA transaction -->
+ <no-tx-separate-pools />
<!-- disable transaction interleaving -->
<track-connection-by-tx />
@@ -24,5 +25,4 @@
<type-mapping>Sybase</type-mapping>
</metadata>
</xa-datasource>
-
</datasources>
15 years, 1 month
JBoss JBPM SVN: r4348 - in jbpm3/branches/jbpm-3.2.5.SP: hudson/hudson-home and 9 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-03-29 12:29:30 -0400 (Sun, 29 Mar 2009)
New Revision: 4348
Added:
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-oracle-ds.xml
Modified:
jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/command.sh
jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml
jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Database-Matrix/config.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/core/pom.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/hibernate.properties.oracle.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/db/pom.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/pom.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/scripts/antrun-installer.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/src/main/resources/installer/install-definition.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/src/main/resources/installer/user-input-spec.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/enterprise/pom.xml
jbpm3/branches/jbpm-3.2.5.SP/pom.xml
Log:
JBPM-1367: add qa for oracle
Modified: jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/command.sh
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/command.sh 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/command.sh 2009-03-29 16:29:30 UTC (rev 4348)
@@ -12,15 +12,15 @@
case "$CONTAINER" in
jboss422*)
JBOSS_BUILD=jboss-4.2.2.GA
- ;;
+ ;;
jboss423*)
JBOSS_BUILD=jboss-4.2.3.GA
- ;;
+ ;;
jboss500*)
JBOSS_BUILD=jboss-5.0.0.GA
- ;;
+ ;;
esac
#
@@ -44,7 +44,7 @@
fi
#
-# build the tests
+# Build the tests
#
MVN_CMD="mvn -o $ENVIRONMENT process-test-classes"
echo $MVN_CMD; $MVN_CMD 2>&1; MVN_STATUS=$?
@@ -67,16 +67,22 @@
cp $JBOSS_HOME/docs/examples/jbpm/jbpm-$DATABASE-ds.xml $JBOSS_HOME/server/$JBOSS_SERVER/deploy/jbpm/jbpm-$DATABASE-ds.xml
cp $JBOSS_HOME/docs/examples/jbpm/hibernate.cfg.$DATABASE.xml $JBOSS_HOME/server/$JBOSS_SERVER/deploy/jbpm/jbpm-service.sar/hibernate.cfg.xml
-# FIXME: find out whether jTDS can be made to work with XA data source
-# https://jira.jboss.org/jira/browse/JBPM-1818
+# Install Sybase JDBC driver manually, as the distribution cannot contain it
SYBASE_JDBC_DRIVER=~/.m2/repository/com/sybase/jconnect/6.0.5/jconnect-6.0.5.jar
if [ -f $SYBASE_JDBC_DRIVER ]; then
echo "cp $SYBASE_JDBC_DRIVER $JBOSS_HOME/server/$JBOSS_SERVER/deploy/jbpm/jbpm-service.sar"
cp $SYBASE_JDBC_DRIVER $JBOSS_HOME/server/$JBOSS_SERVER/deploy/jbpm/jbpm-service.sar
fi
+# Install Oracle JDBC driver manually, as the distribution cannot contain it
+ORACLE_JDBC_DRIVER=~/.m2/repository/com/oracle/ojdbc14/10.2.0.4/ojdbc14-10.2.0.4.jar
+if [ -f $ORACLE_JDBC_DRIVER ]; then
+ echo "cp $ORACLE_JDBC_DRIVER $JBOSS_HOME/server/$JBOSS_SERVER/deploy/jbpm/jbpm-service.sar"
+ cp $ORACLE_JDBC_DRIVER $JBOSS_HOME/server/$JBOSS_SERVER/deploy/jbpm/jbpm-service.sar
+fi
+
#
-# start jbossas
+# Start JBoss AS
#
$JBPMDIR/hudson/jboss/bin/jboss.sh $JBOSS_HOME start $JBOSS_BINDADDR
@@ -89,13 +95,13 @@
fi
#
-# log dependency tree
+# Log dependency tree
#
MVN_CMD="mvn -o $ENVIRONMENT dependency:tree"
echo $MVN_CMD; $MVN_CMD | tee $WORKSPACE/dependency-tree.txt
#
-# execute tests
+# Execute tests
#
MVN_CMD="mvn -o -fae $ENVIRONMENT test"
echo $MVN_CMD; $MVN_CMD 2>&1 | tee $WORKSPACE/tests.log
@@ -103,7 +109,7 @@
cat $WORKSPACE/fixme.txt | egrep "\[\S*]" > $WORKSPACE/errata-$CONTAINER.txt
#
-# stop jbossas
+# Stop JBoss AS
#
$JBPMDIR/hudson/jboss/bin/jboss.sh $JBOSS_HOME stop
cp $JBOSS_HOME/server/$JBOSS_SERVER/log/boot.log $WORKSPACE/jboss-boot.log
Modified: jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -41,8 +41,8 @@
<axis>
<name>database</name>
<values>
- <string>postgresql</string>
<string>sybase</string>
+ <string>oracle</string>
</values>
</axis>
<axis>
Modified: jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Database-Matrix/config.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Database-Matrix/config.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Database-Matrix/config.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -44,6 +44,7 @@
<string>mysql</string>
<string>postgresql</string>
<string>sybase</string>
+ <string>oracle</string>
</values>
</axis>
<axis>
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/pom.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/pom.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -198,28 +198,28 @@
<id>soa</id>
<build>
<plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>process-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="database" value="${database}" />
- <ant antfile="scripts/antrun-jbpm-config.xml" target="concat" />
- <ant antfile="scripts/antrun-jbpm-config.xml" target="jbpm-cfg-xml-soa" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="database" value="${database}" />
+ <ant antfile="scripts/antrun-jbpm-config.xml" target="concat" />
+ <ant antfile="scripts/antrun-jbpm-config.xml" target="jbpm-cfg-xml-soa" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</profile>
-
+
<!--
Name: no-database
Descr: Setup the default database
@@ -323,5 +323,27 @@
</plugins>
</build>
</profile>
+
+ <!--
+ Name: oracle
+ Descr: Oracle Database Setup
+ -->
+ <profile>
+ <id>oracle</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>oracle</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
</project>
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/hibernate.properties.oracle.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/hibernate.properties.oracle.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/hibernate.properties.oracle.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -1,12 +1,10 @@
<!-- hibernate dialect -->
- <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<!-- JDBC connection properties (begin) -->
- <!-- fetch driver from http://www.oracle.com -->
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">${jdbc.oracle.url}</property>
<property name="hibernate.connection.username">${jdbc.oracle.username}</property>
<property name="hibernate.connection.password">${jdbc.oracle.password}</property>
<!-- JDBC connection properties (end) -->
-
Added: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-oracle-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-oracle-ds.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/jbpm-oracle-ds.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<datasources>
+ <xa-datasource>
+ <jndi-name>JbpmDS</jndi-name>
+
+ <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
+ <xa-datasource-property name="ServerName">${jdbc.oracle.server}</xa-datasource-property>
+ <xa-datasource-property name="PortNumber">${jdbc.oracle.port}</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">${jdbc.oracle.database}</xa-datasource-property>
+ <user-name>${jdbc.oracle.username}</user-name>
+ <password>${jdbc.oracle.password}</password>
+
+ <!-- separate connections used inside and outside a JTA transaction -->
+ <no-tx-separate-pools />
+ <!-- disable transaction interleaving -->
+ <track-connection-by-tx />
+
+ <isSameRM-override-value>false</isSameRM-override-value>
+
+ <!-- check oracle error codes and messages for fatal errors -->
+ <exception-sorter-class-name>
+ org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
+ </exception-sorter-class-name>
+ <!-- use pingDatabase method to check a connection is still valid -->
+ <valid-connection-checker-class-name>
+ org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker
+ </valid-connection-checker-class-name>
+
+ <!-- corresponding type-mapping in standardjbosscmp-jdbc.xml -->
+ <metadata>
+ <type-mapping>Oracle9i</type-mapping>
+ </metadata>
+ </xa-datasource>
+
+ <mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
+ name="jboss.jca:service=OracleXAExceptionFormatter">
+ <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
+ </mbean>
+</datasources>
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/db/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/db/pom.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/db/pom.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -69,11 +69,6 @@
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
- <scope>runtime</scope>
- </dependency>
</dependencies>
<!-- Plugins -->
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/pom.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/pom.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -176,10 +176,6 @@
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
- <dependency>
- <groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
- </dependency>
</dependencies>
<!-- Plugins -->
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/scripts/antrun-installer.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/scripts/antrun-installer.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/scripts/antrun-installer.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -88,6 +88,12 @@
<macro-enable file="${sybase.cfg.xml}" section="DataSource properties"/>
<macro-enable file="${sybase.cfg.xml}" section="JTA transaction properties"/>
+ <property name="oracle.cfg.xml" value="${deploy.artifacts.resources}/jbpm-jpdl-config/hibernate.cfg.oracle.xml"/>
+ <macro-disable file="${oracle.cfg.xml}" section="JDBC connection properties"/>
+ <macro-disable file="${oracle.cfg.xml}" section="Automatic schema creation"/>
+ <macro-enable file="${oracle.cfg.xml}" section="DataSource properties"/>
+ <macro-enable file="${oracle.cfg.xml}" section="JTA transaction properties"/>
+
<condition property="database.is.hsqldb" value="true" else="false">
<equals arg1="${database}" arg2="hsqldb"/>
</condition>
@@ -100,6 +106,9 @@
<condition property="database.is.sybase" value="true" else="false">
<equals arg1="${database}" arg2="sybase"/>
</condition>
+ <condition property="database.is.oracle" value="true" else="false">
+ <equals arg1="${database}" arg2="oracle"/>
+ </condition>
</target>
@@ -116,6 +125,7 @@
<filter token="database.is.mysql" value="${database.is.mysql}" />
<filter token="database.is.postgresql" value="${database.is.postgresql}" />
<filter token="database.is.sybase" value="${database.is.sybase}" />
+ <filter token="database.is.oracle" value="${database.is.oracle}" />
<filter token="jbpm.target.container" value="${jbpm.target.container}" />
<filter token="jboss.home" value="${jboss.home}" />
<filter token="product.version" value="${product.version}" />
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/src/main/resources/installer/install-definition.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/src/main/resources/installer/install-definition.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -83,6 +83,10 @@
<name>dbSelection</name>
<value>sybase</value>
</condition>
+ <condition type="variable" id="isOracle">
+ <name>dbSelection</name>
+ <value>oracle</value>
+ </condition>
</conditions>
<!-- Panels -->
@@ -230,13 +234,15 @@
<include name="hibernate.cfg.mysql.xml"/>
<include name="hibernate.cfg.postgresql.xml"/>
<include name="hibernate.cfg.sybase.xml"/>
+ <include name="hibernate.cfg.oracle.xml"/>
<include name="jbpm-hsqldb-ds.xml"/>
<include name="jbpm-mysql-ds.xml"/>
<include name="jbpm-postgresql-ds.xml"/>
<include name="jbpm-sybase-ds.xml"/>
+ <include name="jbpm-oracle-ds.xml"/>
</fileset>
- <!-- Database Hypsersonic -->
+ <!-- Database Hypersonic -->
<file src="@{deploy.artifacts.dir}/resources/jbpm-jpdl-config/jbpm-hsqldb-ds.xml" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm" condition="isHypersonic"/>
<singlefile src="@{deploy.artifacts.dir}/resources/jbpm-jpdl-config/hibernate.cfg.hsqldb.xml" condition="isHypersonic"
target="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar/hibernate.cfg.xml" />
@@ -264,9 +270,11 @@
<file src="@{deploy.artifacts.dir}/resources/jbpm-jpdl-config/jbpm-sybase-ds.xml" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm" condition="isSybase"/>
<singlefile src="@{deploy.artifacts.dir}/resources/jbpm-jpdl-config/hibernate.cfg.sybase.xml" condition="isSybase"
target="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar/hibernate.cfg.xml" />
- <fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" override="true" condition="isSybase">
- <include name="jtds.jar" />
- </fileset>
+
+ <!-- Database Oracle -->
+ <file src="@{deploy.artifacts.dir}/resources/jbpm-jpdl-config/jbpm-oracle-ds.xml" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm" condition="isOracle"/>
+ <singlefile src="@{deploy.artifacts.dir}/resources/jbpm-jpdl-config/hibernate.cfg.oracle.xml" condition="isOracle"
+ target="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar/hibernate.cfg.xml" />
</pack>
<!--
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/src/main/resources/installer/user-input-spec.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/src/main/resources/installer/user-input-spec.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/distribution/src/main/resources/installer/user-input-spec.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -18,10 +18,11 @@
<field type="radio" variable="dbSelection">
<description align="left" txt="Please choose your target database" />
<spec>
- <choice txt="Hypersonic" value="hsqldb"/>
- <choice txt="MySQL" value="mysql" set="true"/>
+ <choice txt="Hypersonic" value="hsqldb" set="true"/>
+ <choice txt="MySQL" value="mysql"/>
<choice txt="PostgreSQL" value="postgresql"/>
<choice txt="Sybase" value="sybase"/>
+ <choice txt="Oracle" value="oracle"/>
</spec>
</field>
</panel>
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/enterprise/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/enterprise/pom.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/enterprise/pom.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!-- ====================================================================== -->
- <!-- -->
- <!-- JBoss, the OpenSource J2EE webOS -->
- <!-- -->
- <!-- Distributable under LGPL license. -->
- <!-- See terms of license at http://www.gnu.org. -->
- <!-- -->
- <!-- ====================================================================== -->
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
- <!-- $Id$ -->
+<!-- $Id$ -->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -30,7 +31,7 @@
<properties>
<surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/resources/tst.policy</surefire.security.args>
</properties>
-
+
<!-- Dependencies -->
<dependencies>
<!-- jBPM Dependencies -->
@@ -210,7 +211,7 @@
</plugins>
</build>
</profile>
-
+
<!--
Name: no-database
Descr: Setup the default database
@@ -335,5 +336,29 @@
</plugins>
</build>
</profile>
+
+ <!--
+ Name: oracle
+ Descr: Oracle Database Setup
+ -->
+ <profile>
+ <id>oracle</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>oracle</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ </dependencies>
+ </profile>
+
</profiles>
</project>
Modified: jbpm3/branches/jbpm-3.2.5.SP/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/pom.xml 2009-03-29 11:04:09 UTC (rev 4347)
+++ jbpm3/branches/jbpm-3.2.5.SP/pom.xml 2009-03-29 16:29:30 UTC (rev 4348)
@@ -10,7 +10,9 @@
<!-- ====================================================================== -->
<!-- $Id: pom.xml 7412 2008-06-06 13:42:30Z thomas.diesler(a)jboss.com $ -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>JBoss jBPM3</name>
<groupId>org.jbpm.jbpm3</groupId>
@@ -33,7 +35,7 @@
<module>modules/examples</module>
<module>modules/simulation</module>
- <!-- Execute as part of -Pdistro
+ <!-- Execute as part of -Pdistro
<module>modules/db</module>
<module>modules/userguide</module>
-->
@@ -88,6 +90,8 @@
<mysql.connector.version>5.0.7</mysql.connector.version>
<postgresql.version>8.2-504.jdbc3</postgresql.version>
<jtds.version>1.2.2</jtds.version>
+ <jconnect.version>6.0.5</jconnect.version>
+ <ojdbc.version>10.2.0.4</ojdbc.version>
</properties>
<!-- DependencyManagement -->
@@ -123,7 +127,7 @@
<!-- BPM Spec Dependencies-->
<dependency>
<groupId>org.jboss.bpm</groupId>
- <artifactId>bpm-spec-api</artifactId>
+ <artifactId>bpm-spec-api</artifactId>
<version>${bpm.spec.version}</version>
</dependency>
@@ -382,11 +386,6 @@
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
- <dependency>
- <groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
- <version>${jtds.version}</version>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -556,7 +555,7 @@
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
- <version>10.0.2.0</version>
+ <version>${ojdbc.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -567,7 +566,7 @@
</repository>
</repositories>
</profile>
-
+
<!--
Name: postgresql
Descr: MySQL Database Setup
@@ -605,7 +604,7 @@
<dependency>
<groupId>com.sybase</groupId>
<artifactId>jconnect</artifactId>
- <version>6.0.5</version>
+ <version>${jconnect.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -616,6 +615,6 @@
</repository>
</repositories>
</profile>
-
+
</profiles>
</project>
15 years, 1 month
JBoss JBPM SVN: r4347 - in jbpm4/branches/tbaeyens/modules: api/src/main/java/org/jbpm/session and 24 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-29 07:04:09 -0400 (Sun, 29 Mar 2009)
New Revision: 4347
Added:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
Removed:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStream.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java
Modified:
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ExecutionQuery.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinition.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java
jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.task.hbm.xml
jbpm4/branches/tbaeyens/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java
Log:
revisiting deployment
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ExecutionQuery.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ExecutionQuery.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ExecutionQuery.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -31,8 +31,6 @@
String PROPERTY_KEY = "key";
- ExecutionQuery processDefinitionNameLike(String processDefinitionName);
- ExecutionQuery processDefinitionKeyLike(String processDefinitionKey);
ExecutionQuery processDefinitionId(String processDefinitionId);
ExecutionQuery processInstanceId(String processInstanceId);
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinition.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinition.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinition.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -47,5 +47,8 @@
* represents the sequence number for process definitions with
* the same {@link ObservableElement#getId() name}. */
int getVersion();
-
+
+ /** references the deployment in which this process definition is
+ * deployed. */
+ long getDeploymentDbid();
}
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -37,6 +37,8 @@
ProcessDefinitionQuery id(String id);
ProcessDefinitionQuery key(String key);
ProcessDefinitionQuery nameLike(String name);
+ ProcessDefinitionQuery name(String name);
+ ProcessDefinitionQuery deploymentDbid(long deploymentDbid);
ProcessDefinitionQuery orderAsc(String property);
ProcessDefinitionQuery orderDesc(String property);
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -32,9 +32,10 @@
Deployment createDeployment();
void deleteDeployment(long deploymentDbid);
+ void deleteDeploymentCascade(long deploymentDbid);
InputStream getResourceAsStream(long deploymentDbid, String resourceName);
ProcessDefinitionQuery createProcessDefinitionQuery();
-}
\ No newline at end of file
+}
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.jbpm.Execution;
import org.jbpm.client.ClientExecution;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.job.Job;
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -22,7 +22,6 @@
package org.jbpm.session;
import java.io.InputStream;
-import java.util.List;
import org.jbpm.Deployment;
import org.jbpm.ProcessDefinitionQuery;
@@ -42,9 +41,5 @@
ProcessDefinitionQuery createProcessDefinitionQuery();
-
- List<String> findObjectNames(String propertyKey, String propertyValue);
- List<String> findObjectPropertyValues(String objectName, String propertyKey);
- Object findObjectByPropertyValue(String propertyKey, String propertyValue);
- ClientProcessDefinition findLatestProcessDefinitionByKey(String processDefinitionKey);
+ ClientProcessDefinition loadProcessDefinitionById(String processDefinitionId);
}
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.execution.hbm.xml 2009-03-29 11:04:09 UTC (rev 4347)
@@ -348,22 +348,4 @@
]]>
</query>
- <!-- query name="findExecutionByKey">
- <![CDATA[
- select execution
- from org.jbpm.pvm.internal.model.ExecutionImpl as execution
- where execution.key = :executionKey
- and execution.processDefinition.name = :processDefinitionName
- ]]>
- </query -->
-
- <query name="findProcessInstanceIds">
- <![CDATA[
- select processInstance.id
- from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinitionId = :processDefinitionId
- and processInstance.parent is null
- ]]>
- </query>
-
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.task.hbm.xml 2009-03-29 11:04:09 UTC (rev 4347)
@@ -118,11 +118,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <!-- many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" / -->
+ <property name="taskDefinitionName" column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
Modified: jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -36,7 +36,7 @@
import org.jbpm.enterprise.internal.custom.WaitState;
import org.jbpm.env.Environment;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
+import org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd;
import org.jbpm.pvm.internal.job.TimerImpl;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.session.DbSession;
@@ -118,7 +118,7 @@
public void testSchedule() throws CreateException {
// start an execution
environment.get(CommandService.class).execute(
- new StartExecutionCmd(processDefinitionId, null, null));
+ new StartProcessInstanceCmd(processDefinitionId, null, null));
// wait for activity to execute
Date executionDate = HappyListener.waitFor();
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.task.hbm.xml 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.task.hbm.xml 2009-03-29 11:04:09 UTC (rev 4347)
@@ -118,11 +118,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <!-- many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" / -->
+ <property name="taskDefinitionName" column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -21,13 +21,8 @@
*/
package org.jbpm.jpdl.internal.activity;
-import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
-import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -46,68 +41,9 @@
public Object parse(Element element, Parse parse, Parser parser) {
TaskActivity taskActivity = new TaskActivity();
- TaskDefinitionImpl taskDefinition = parseTaskDefinition(element, parse, parser);
+ TaskDefinitionImpl taskDefinition = JpdlParser.parseTaskDefinition(element, parse, parser);
taskActivity.setTaskDefinition(taskDefinition);
-
+
return taskActivity;
}
-
- public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, Parser parser) {
- TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
-
- taskDefinition.setName(XmlUtil.attribute(element, "name"));
-
- String swimlaneName = XmlUtil.attribute(element, "swimlane");
- if (swimlaneName!=null) {
- JpdlProcessDefinition jpdlProcessDefinition = parse.findObject(JpdlProcessDefinition.class);
- SwimlaneDefinitionImpl swimlaneDefinition = jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
- if (swimlaneDefinition!=null) {
- taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
- } else {
- parse.addProblem("swimlane "+swimlaneName+" not declared");
- }
- }
-
- Element taskHandlerElement = XmlUtil.element(element, "task-handler");
- if (taskHandlerElement!=null) {
- ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(taskHandlerElement, parse);
- taskDefinition.setTaskHandlerDescriptor(objectDescriptor);
- }
-
- parseAssignmentAttributes(element, taskDefinition, parse);
-
- return taskDefinition;
- }
-
- public static void parseAssignmentAttributes(Element element, AssignableDefinitionImpl assignableDefinition, Parse parse) {
- Element descriptionElement = XmlUtil.element(element, "description");
- if (descriptionElement!=null) {
- String description = XmlUtil.getContentText(descriptionElement);
- assignableDefinition.setDescription(description);
- }
-
- Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
- if (assignmentHandlerElement!=null) {
- ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(assignmentHandlerElement, parse);
- assignableDefinition.setAssignmentHandlerDescriptor(objectDescriptor);
- }
-
- String assigneeExpression = XmlUtil.attribute(element, "assignee");
- assignableDefinition.setAssigneeExpression(assigneeExpression);
-
- String assigneeExpressionLanguage = XmlUtil.attribute(element, "assignee-lang");
- assignableDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
-
- String candidateUsersExpression = XmlUtil.attribute(element, "candidate-users");
- assignableDefinition.setCandidateUsersExpression(candidateUsersExpression);
-
- String candidateUsersExpressionLanguage = XmlUtil.attribute(element, "candidate-users-lang");
- assignableDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
-
- String candidateGroupsExpression = XmlUtil.attribute(element, "candidate-groups");
- assignableDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
-
- String candidateGroupsExpressionLanguage = XmlUtil.attribute(element, "candidate-groups-lang");
- assignableDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
- }
}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -44,6 +44,10 @@
private static Log log = Log.getLog(JpdlDeployer.class.getName());
+ public static final String KEY_ID = "id";
+ public static final String KEY_KEY = "key";
+ public static final String KEY_VERSION = "version";
+
static JpdlParser jpdlParser = new JpdlParser();
public void deploy(DeploymentImpl deployment) {
@@ -63,9 +67,9 @@
processDefinition.setDeploymentDbid(deployment.getDbid());
if (deployment.hasObjectProperties(processDefinitionName)) {
- String key = (String) deployment.getObjectProperty(processDefinitionName, "key");
- String id = (String) deployment.getObjectProperty(processDefinitionName, "id");
- String version = (String) deployment.getObjectProperty(processDefinitionName, "version");
+ String key = (String) deployment.getObjectProperty(processDefinitionName, KEY_KEY);
+ String id = (String) deployment.getObjectProperty(processDefinitionName, KEY_ID);
+ String version = (String) deployment.getObjectProperty(processDefinitionName, KEY_VERSION);
processDefinition.setId(id);
processDefinition.setKey(key);
processDefinition.setVersion(Integer.parseInt(version));
@@ -75,9 +79,9 @@
checkVersion(processDefinition, deployment);
checkId(processDefinition, deployment);
- deployment.addObjectProperty(processDefinitionName, "key", processDefinition.getKey());
- deployment.addObjectProperty(processDefinitionName, "version", new Long(processDefinition.getVersion()));
- deployment.addObjectProperty(processDefinitionName, "id", processDefinition.getId());
+ deployment.addObjectProperty(processDefinitionName, KEY_KEY, processDefinition.getKey());
+ deployment.addObjectProperty(processDefinitionName, KEY_VERSION, new Long(processDefinition.getVersion()));
+ deployment.addObjectProperty(processDefinitionName, KEY_ID, processDefinition.getId());
}
deployment.addObject(processDefinitionName, processDefinition);
@@ -99,18 +103,25 @@
}
RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
- List<String> existingKeys = repositorySession.findObjectPropertyValues(processDefinitionName, "jpdl.key");
- if ( (!existingKeys.isEmpty())
- && existingKeys.get(0).equals(processDefinitionKey)
- ) {
- deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+
+ List<ProcessDefinition> existingProcesses = repositorySession.createProcessDefinitionQuery()
+ .name(processDefinitionName)
+ .execute();
+
+ for (ProcessDefinition existingProcess: existingProcesses) {
+ if (!processDefinitionKey.equals(existingProcess.getKey())) {
+ deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+ }
}
- List<String> existingNames = repositorySession.findObjectNames("jpdl.key", processDefinitionKey);
- if ( (!existingNames.isEmpty())
- && existingNames.get(0).equals(processDefinitionName)
- ) {
- deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+ existingProcesses = repositorySession.createProcessDefinitionQuery()
+ .key(processDefinitionKey)
+ .execute();
+
+ for (ProcessDefinition existingProcess: existingProcesses) {
+ if (!processDefinitionName.equals(existingProcess.getName())) {
+ deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+ }
}
}
@@ -123,7 +134,10 @@
}
RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
- if (repositorySession.findObjectByPropertyValue("jpdl.id", id) != null) {
+ ProcessDefinition existingProcessDefinition = repositorySession.createProcessDefinitionQuery()
+ .id(id)
+ .uniqueResult();
+ if (existingProcessDefinition != null) {
deployment.addProblem("process '" + id + "' already exists");
}
}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -30,10 +30,12 @@
import org.jbpm.activity.ActivityBehaviour;
import org.jbpm.internal.log.Log;
import org.jbpm.jpdl.internal.activity.JpdlActivityBinding;
-import org.jbpm.jpdl.internal.activity.TaskBinding;
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -132,7 +134,7 @@
if (swimlaneName!=null) {
SwimlaneDefinitionImpl swimlaneDefinition =
processDefinition.createSwimlaneDefinition(swimlaneName);
- TaskBinding.parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
+ JpdlParser.parseAssignmentAttributes(swimlaneElement, swimlaneDefinition, parse);
}
}
@@ -173,6 +175,73 @@
return processDefinition;
}
+ public static void parseAssignmentAttributes(Element element, AssignableDefinitionImpl assignableDefinition, Parse parse) {
+ Element descriptionElement = XmlUtil.element(element, "description");
+ if (descriptionElement!=null) {
+ String description = XmlUtil.getContentText(descriptionElement);
+ assignableDefinition.setDescription(description);
+ }
+
+ Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
+ if (assignmentHandlerElement!=null) {
+ ObjectDescriptor objectDescriptor = parseObjectDescriptor(assignmentHandlerElement, parse);
+ assignableDefinition.setAssignmentHandlerDescriptor(objectDescriptor);
+ }
+
+ String assigneeExpression = XmlUtil.attribute(element, "assignee");
+ assignableDefinition.setAssigneeExpression(assigneeExpression);
+
+ String assigneeExpressionLanguage = XmlUtil.attribute(element, "assignee-lang");
+ assignableDefinition.setAssigneeExpressionLanguage(assigneeExpressionLanguage);
+
+ String candidateUsersExpression = XmlUtil.attribute(element, "candidate-users");
+ assignableDefinition.setCandidateUsersExpression(candidateUsersExpression);
+
+ String candidateUsersExpressionLanguage = XmlUtil.attribute(element, "candidate-users-lang");
+ assignableDefinition.setCandidateUsersExpressionLanguage(candidateUsersExpressionLanguage);
+
+ String candidateGroupsExpression = XmlUtil.attribute(element, "candidate-groups");
+ assignableDefinition.setCandidateGroupsExpression(candidateGroupsExpression);
+
+ String candidateGroupsExpressionLanguage = XmlUtil.attribute(element, "candidate-groups-lang");
+ assignableDefinition.setCandidateGroupsExpressionLanguage(candidateGroupsExpressionLanguage);
+ }
+
+ public static TaskDefinitionImpl parseTaskDefinition(Element element, Parse parse, Parser parser) {
+ TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+
+ String taskName = XmlUtil.attribute(element, "name");
+ taskDefinition.setName(taskName);
+
+ ProcessDefinitionImpl processDefinition = parse.findObject(ProcessDefinitionImpl.class);
+ if (processDefinition.getTaskDefinition(taskName)!=null) {
+ parse.addProblem("duplicate task name "+taskName);
+ } else {
+ processDefinition.addTaskDefinitionImpl(taskDefinition);
+ }
+
+ String swimlaneName = XmlUtil.attribute(element, "swimlane");
+ if (swimlaneName!=null) {
+ JpdlProcessDefinition jpdlProcessDefinition = parse.findObject(JpdlProcessDefinition.class);
+ SwimlaneDefinitionImpl swimlaneDefinition = jpdlProcessDefinition.getSwimlaneDefinition(swimlaneName);
+ if (swimlaneDefinition!=null) {
+ taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
+ } else {
+ parse.addProblem("swimlane "+swimlaneName+" not declared");
+ }
+ }
+
+ Element taskHandlerElement = XmlUtil.element(element, "task-handler");
+ if (taskHandlerElement!=null) {
+ ObjectDescriptor objectDescriptor = parseObjectDescriptor(taskHandlerElement, parse);
+ taskDefinition.setTaskHandlerDescriptor(objectDescriptor);
+ }
+
+ JpdlParser.parseAssignmentAttributes(element, taskDefinition, parse);
+
+ return taskDefinition;
+ }
+
public static ObjectDescriptor parseObjectDescriptor(Element element, Parse parse) {
ObjectDescriptor objectDescriptor = new ObjectDescriptor();
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-29 11:04:09 UTC (rev 4347)
@@ -118,11 +118,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <!-- many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" / -->
+ <property name="taskDefinitionName" column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.JbpmException;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.RepositoryCache;
+import org.jbpm.session.PvmDbSession;
+import org.jbpm.session.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeleteDeploymentCmd implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ long deploymentDbid;
+ boolean cascade;
+
+ public DeleteDeploymentCmd(long deploymentDbid) {
+ this.deploymentDbid = deploymentDbid;
+ }
+
+ public DeleteDeploymentCmd(long deploymentDbid, boolean cascade) {
+ this.deploymentDbid = deploymentDbid;
+ this.cascade = cascade;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ List<ProcessDefinition> processDefinitions = repositorySession.createProcessDefinitionQuery()
+ .deploymentDbid(deploymentDbid)
+ .execute();
+
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+
+ for (ProcessDefinition processDefinition: processDefinitions) {
+ String processDefinitionId = processDefinition.getId();
+ List<String> processInstanceIds = pvmDbSession.findProcessInstanceIds(processDefinitionId);
+ if (cascade) {
+ for (String processInstanceId: processInstanceIds) {
+ pvmDbSession.deleteProcessInstance(processInstanceId, false);
+ }
+ } else {
+ if (!processInstanceIds.isEmpty()) {
+ throw new JbpmException("cannot delete deployment "+deploymentDbid+": still executions for "+processDefinition+": "+processInstanceIds);
+ }
+ }
+ }
+
+ Session session = environment.get(Session.class);
+ DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class, deploymentDbid);
+ session.delete(deployment);
+
+ RepositoryCache repositoryCache = environment.get(RepositoryCache.class);
+ repositoryCache.set(deploymentDbid, null);
+
+ return null;
+ }
+
+}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStream.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStream.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStream.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.cmd;
-
-import java.io.InputStream;
-
-import org.jbpm.env.Environment;
-import org.jbpm.session.RepositorySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class GetResourceAsStream extends AbstractCommand<InputStream> {
-
- private static final long serialVersionUID = 1L;
-
- protected long deploymentDbid;
- protected String resourceName;
-
- public GetResourceAsStream(long deploymentDbid, String resourceName) {
- this.deploymentDbid = deploymentDbid;
- this.resourceName = resourceName;
- }
-
- public InputStream execute(Environment environment) {
- RepositorySession repositorySession = environment.get(RepositorySession.class);
- InputStream resourceStream = repositorySession.getResourceAsStream(deploymentDbid, resourceName);
- return resourceStream;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import java.io.InputStream;
+
+import org.jbpm.env.Environment;
+import org.jbpm.session.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GetResourceAsStreamCmd extends AbstractCommand<InputStream> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long deploymentDbid;
+ protected String resourceName;
+
+ public GetResourceAsStreamCmd(long deploymentDbid, String resourceName) {
+ this.deploymentDbid = deploymentDbid;
+ this.resourceName = resourceName;
+ }
+
+ public InputStream execute(Environment environment) {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ InputStream resourceStream = repositorySession.getResourceAsStream(deploymentDbid, resourceName);
+ return resourceStream;
+ }
+}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.cmd;
-
-import java.util.Map;
-
-import org.jbpm.Execution;
-import org.jbpm.JbpmException;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.client.ClientProcessInstance;
-import org.jbpm.env.Environment;
-import org.jbpm.session.PvmDbSession;
-
-/**
- * @author Tom Baeyens
- */
-public class StartExecutionCmd extends VariablesCmd<Execution> {
-
- private static final long serialVersionUID = 1L;
-
- protected String processDefinitionId;
- protected String executionKey;
-
- public StartExecutionCmd(String processDefinitionId, Map<String, Object> variables, String executionKey) {
- this.processDefinitionId = processDefinitionId;
- this.variables = variables;
- this.executionKey = executionKey;
- }
-
- public Execution execute(Environment environment) throws Exception {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
-
- ClientProcessDefinition processDefinition = null;
-
- processDefinition = pvmDbSession.findProcessDefinitionById(processDefinitionId);
- if (processDefinition==null) {
- throw new JbpmException("no process definition with id '"+processDefinitionId+"'");
- }
-
- ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
- processInstance.setVariables(variables);
- processInstance.start();
-
- pvmDbSession.save(processInstance);
- return processInstance;
- }
-
- public String getProcessDefinitionKey() {
- return processDefinitionId;
- }
- public void setProcessDefinitionKey(String processDefinitionKey) {
- this.processDefinitionId = processDefinitionKey;
- }
- public String getExecutionKey() {
- return executionKey;
- }
- public void setExecutionKey(String executionKey) {
- this.executionKey = executionKey;
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.cmd;
-
-import java.util.Map;
-
-import org.hibernate.Session;
-import org.jbpm.Execution;
-import org.jbpm.JbpmException;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.client.ClientProcessInstance;
-import org.jbpm.env.Environment;
-import org.jbpm.session.RepositorySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
-
- private static final long serialVersionUID = 1L;
-
- protected String processDefinitionKey;
- protected String executionKey;
-
- public StartExecutionInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
- if (processDefinitionKey==null) {
- throw new JbpmException("processDefinitionKey is null");
- }
- this.processDefinitionKey = processDefinitionKey;
- this.variables = variables;
- this.executionKey = executionKey;
- }
-
- public Execution execute(Environment environment) throws Exception {
- ClientProcessDefinition processDefinition = null;
-
- RepositorySession repositorySession = environment.get(RepositorySession.class);
- processDefinition = (ClientProcessDefinition) repositorySession
- .findObjectByPropertyValue("key", processDefinitionKey);
-
- if (processDefinition==null) {
- throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
- }
-
- ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
- processInstance.setVariables(variables);
- processInstance.start();
-
- Session session = Environment.getFromCurrent(Session.class);
- session.save(processInstance);
- return processInstance;
- }
-
- public String getExecutionKey() {
- return executionKey;
- }
- public void setExecutionKey(String executionKey) {
- this.executionKey = executionKey;
- }
-}
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import java.util.Map;
+
+import org.hibernate.Session;
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.client.ClientProcessInstance;
+import org.jbpm.env.Environment;
+import org.jbpm.session.PvmDbSession;
+import org.jbpm.session.RepositorySession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartProcessInstanceCmd extends VariablesCmd<Execution> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String processDefinitionId;
+ protected String executionKey;
+
+ public StartProcessInstanceCmd(String processDefinitionId, Map<String, Object> variables, String executionKey) {
+ this.processDefinitionId = processDefinitionId;
+ this.variables = variables;
+ this.executionKey = executionKey;
+ }
+
+ public Execution execute(Environment environment) throws Exception {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+
+ ClientProcessDefinition processDefinition = (ClientProcessDefinition)
+ repositorySession.loadProcessDefinitionById(processDefinitionId);
+ if (processDefinition==null) {
+ throw new JbpmException("no process definition with id '"+processDefinitionId+"'");
+ }
+
+ ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
+ processInstance.setVariables(variables);
+ processInstance.start();
+
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(processInstance);
+
+ return processInstance;
+ }
+
+ public String getProcessDefinitionKey() {
+ return processDefinitionId;
+ }
+ public void setProcessDefinitionKey(String processDefinitionKey) {
+ this.processDefinitionId = processDefinitionKey;
+ }
+ public String getExecutionKey() {
+ return executionKey;
+ }
+ public void setExecutionKey(String executionKey) {
+ this.executionKey = executionKey;
+ }
+}
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import java.util.Map;
+
+import org.hibernate.Session;
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.client.ClientProcessInstance;
+import org.jbpm.env.Environment;
+import org.jbpm.session.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartProcessInstanceInLatestCmd extends VariablesCmd<Execution> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String processDefinitionKey;
+ protected String executionKey;
+
+ public StartProcessInstanceInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
+ if (processDefinitionKey==null) {
+ throw new JbpmException("processDefinitionKey is null");
+ }
+ this.processDefinitionKey = processDefinitionKey;
+ this.variables = variables;
+ this.executionKey = executionKey;
+ }
+
+ public Execution execute(Environment environment) throws Exception {
+ ClientProcessDefinition processDefinition = null;
+
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ processDefinition = (ClientProcessDefinition) repositorySession.createProcessDefinitionQuery()
+ .key(processDefinitionKey)
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0, 1)
+ .uniqueResult();
+
+ if (processDefinition==null) {
+ throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
+ }
+
+ processDefinition = repositorySession.loadProcessDefinitionById(processDefinition.getId());
+
+ ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
+ processInstance.setVariables(variables);
+ processInstance.start();
+
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(processInstance);
+ return processInstance;
+ }
+
+ public String getExecutionKey() {
+ return executionKey;
+ }
+ public void setExecutionKey(String executionKey) {
+ this.executionKey = executionKey;
+ }
+}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -208,7 +208,12 @@
public List<String> findProcessInstanceIds(String processDefinitionId) {
// query definition can be found at the bottom of resource jbpm.pvm.job.hbm.xml
- Query query = session.getNamedQuery("findProcessInstanceIds");
+ Query query = session.createQuery(
+ "select processInstance.id " +
+ "from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance " +
+ "where processInstance.processDefinitionId = :processDefinitionId " +
+ " and processInstance.parent is null"
+ );
query.setString("processDefinitionId", processDefinitionId);
return query.list();
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1024,7 +1024,7 @@
&& (processDefinitionId!=null)
) {
RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
- processDefinition = (ProcessDefinitionImpl) repositorySession.findObjectByPropertyValue("id", processDefinitionId);
+ processDefinition = (ProcessDefinitionImpl) repositorySession.loadProcessDefinitionById(processDefinitionId);
if (processDefinition==null) {
throw new JbpmException("couldn't find process definition "+processDefinitionId+" in the repository");
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -35,6 +35,7 @@
import org.jbpm.model.IdGenerator;
import org.jbpm.model.OpenProcessDefinition;
import org.jbpm.pvm.internal.lob.Lob;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.jbpm.pvm.internal.util.IoUtil;
/**
@@ -72,6 +73,8 @@
/** the activity which is executed when the process starts */
protected ActivityImpl initial;
+ protected Map<String, TaskDefinitionImpl> taskDefinitions;
+
/** the attachments */
protected Map<String, Lob> attachments;
@@ -127,6 +130,22 @@
public IdGenerator getIdGenerator() {
return Environment.getFromCurrent(IdGenerator.class, false);
}
+
+ // task definitions /////////////////////////////////////////////////////////
+
+ public void addTaskDefinitionImpl(TaskDefinitionImpl taskDefinition) {
+ if (taskDefinitions==null) {
+ taskDefinitions = new HashMap<String, TaskDefinitionImpl>();
+ }
+ taskDefinitions.put(taskDefinition.getName(), taskDefinition);
+ }
+
+ public TaskDefinitionImpl getTaskDefinition(String name) {
+ if (taskDefinitions!=null) {
+ return taskDefinitions.get(name);
+ }
+ return null;
+ }
// attachments //////////////////////////////////////////////////////////////
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -39,8 +39,6 @@
private static final long serialVersionUID = 1L;
protected boolean onlyProcessInstances;
- protected String processDefinitionNameLike;
- protected String processDefinitionKeyLike;
protected String processDefinitionId;
protected String processInstanceId;
@@ -80,17 +78,9 @@
}
if (processDefinitionId!=null) {
- appendWhereClause("execution.processDefinition.id = '"+processDefinitionId+"' ", hql);
+ appendWhereClause("execution.processDefinitionId = '"+processDefinitionId+"' ", hql);
}
- if (processDefinitionNameLike!=null) {
- appendWhereClause("execution.processDefinition.name like '"+processDefinitionNameLike+"' ", hql);
- }
-
- if (processDefinitionKeyLike!=null) {
- appendWhereClause("execution.processDefinition.key like '"+processDefinitionKeyLike+"' ", hql);
- }
-
appendOrderByClause(hql);
return hql.toString();
@@ -114,16 +104,6 @@
return this;
}
- public ExecutionQuery processDefinitionKeyLike(String processDefinitionKey) {
- this.processDefinitionKeyLike = processDefinitionKey;
- return this;
- }
-
- public ExecutionQuery processDefinitionNameLike(String processDefinitionName) {
- this.processDefinitionNameLike = processDefinitionName;
- return this;
- }
-
public ExecutionQuery page(int firstResult, int maxResults) {
this.page = new Page(firstResult, maxResults);
return this;
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -24,8 +24,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
import org.hibernate.Query;
import org.hibernate.Session;
@@ -48,7 +46,8 @@
protected String id;
protected String key;
protected String nameLike;
- protected String versionSortDirection;
+ protected String name;
+ protected Long deploymentDbid;
public ProcessDefinitionQueryImpl(CommandService commandService) {
super(commandService);
@@ -59,14 +58,14 @@
}
public ProcessDefinition uniqueResult() {
- List list = execute();
+ List<ProcessDefinition> list = execute();
if (list.isEmpty()) {
return null;
}
if (list.size()>1) {
throw new JbpmException("result not unique: "+list.size());
}
- return (ProcessDefinition) list.get(0);
+ return list.get(0);
}
public Object execute(Session session) {
@@ -78,6 +77,7 @@
processDefinition.setName((String)properties.get("name"));
processDefinition.setKey((String)properties.get("key"));
processDefinition.setId((String)properties.get("id"));
+ processDefinition.setDeploymentDbid((Long)properties.get("deploymentDbid"));
Long versionLong = (Long)properties.get("version");
processDefinition.setVersion(versionLong.intValue());
@@ -90,8 +90,9 @@
public String hql() {
StringBuffer hql = new StringBuffer();
hql.append("select new map( idProperty.objectName as name, " +
- "idProperty.stringValue as id, " +
- "keyProperty.stringValue as key," +
+ "idProperty.stringValue as id," +
+ "idProperty.deployment.dbid as deploymentDbid, " +
+ "keyProperty.stringValue as key, " +
"versionProperty.longValue as version ) ");
hql.append("from ");
hql.append(DeploymentImpl.class.getName());
@@ -115,17 +116,25 @@
appendWhereClause("versionProperty.deployment = deployment ", hql);
if (id!=null) {
- appendWhereClause("idProperty = '"+id+"'", hql);
+ appendWhereClause("idProperty.stringValue = '"+id+"'", hql);
}
if (nameLike!=null) {
appendWhereClause("idProperty.objectName like '"+nameLike+"' ", hql);
}
+ if (name!=null) {
+ appendWhereClause("idProperty.objectName = '"+nameLike+"' ", hql);
+ }
+
if (key!=null) {
appendWhereClause("keyProperty.stringValue = '"+key+"' ", hql);
}
+ if (deploymentDbid!=null) {
+ appendWhereClause("idProperty.deployment.dbid = "+deploymentDbid+" ", hql);
+ }
+
appendOrderByClause(hql);
return hql.toString();
@@ -149,6 +158,16 @@
return this;
}
+ public ProcessDefinitionQuery name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public ProcessDefinitionQuery deploymentDbid(long deploymentDbid) {
+ this.deploymentDbid = deploymentDbid;
+ return this;
+ }
+
public ProcessDefinitionQuery orderAsc(String property) {
addOrderByClause(property+" asc");
return this;
@@ -162,5 +181,5 @@
public ProcessDefinitionQuery page(int firstResult, int maxResults) {
this.page = new Page(firstResult, maxResults);
return this;
- }
+ }
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -41,15 +41,19 @@
}
public void set(long deploymentDbid, Map<String, Object> objects) {
- Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
- if (deploymentObjects==null) {
- deploymentObjects = new HashMap<String, Object>();
- deployments.put(deploymentDbid, deploymentObjects);
+ if (objects==null) {
+ deployments.put(deploymentDbid, null);
+ } else {
+ Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
+ if (deploymentObjects==null) {
+ deploymentObjects = new HashMap<String, Object>();
+ deployments.put(deploymentDbid, deploymentObjects);
+ }
+ for (String objectName: objects.keySet()) {
+ Object object = objects.get(objectName);
+ deploymentObjects.put(objectName, object);
+ }
}
- for (String objectName: objects.keySet()) {
- Object object = objects.get(objectName);
- deploymentObjects.put(objectName, object);
- }
}
public void clear() {
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -27,7 +27,8 @@
import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.RepositoryService;
import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.cmd.GetResourceAsStream;
+import org.jbpm.pvm.internal.cmd.DeleteDeploymentCmd;
+import org.jbpm.pvm.internal.cmd.GetResourceAsStreamCmd;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
/**
@@ -42,13 +43,19 @@
}
public void deleteDeployment(long deploymentDbid) {
+ commandService.execute(new DeleteDeploymentCmd(deploymentDbid));
}
-
+
+ public void deleteDeploymentCascade(long deploymentDbid) {
+ commandService.execute(new DeleteDeploymentCmd(deploymentDbid, true));
+ }
+
public InputStream getResourceAsStream(long deploymentDbid, String resource) {
- return commandService.execute(new GetResourceAsStream(deploymentDbid, resource));
+ return commandService.execute(new GetResourceAsStreamCmd(deploymentDbid, resource));
}
public ProcessDefinitionQuery createProcessDefinitionQuery() {
return new ProcessDefinitionQueryImpl(commandService);
}
+
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -23,7 +23,6 @@
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.List;
import org.hibernate.Session;
import org.jbpm.Deployment;
@@ -107,45 +106,21 @@
return new ProcessDefinitionQueryImpl(session);
}
-
- public Object findObjectByPropertyValue(String key, String value) {
+ public ClientProcessDefinition loadProcessDefinitionById(String processDefinitionId) {
DeploymentProperty deploymentProperty = (DeploymentProperty) session.createQuery(
"select deploymentProperty " +
"from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
- "where deploymentProperty.key = '"+key+"' " +
- " and deploymentProperty.stringValue = '"+value+"' " +
- "order by deploymentProperty.deployment.timestamp desc "
+ "where deploymentProperty.key = 'id' " +
+ " and deploymentProperty.stringValue = '"+processDefinitionId+"' "
).setMaxResults(1).uniqueResult();
if (deploymentProperty!=null) {
long deploymentDbid = deploymentProperty.getDeployment().getDbid();
String objectName = deploymentProperty.getObjectName();
- return getObject(deploymentDbid, objectName);
+ return (ClientProcessDefinition) getObject(deploymentDbid, objectName);
}
return null;
}
-
- public List<String> findObjectNames(String key, String value) {
- return session.createQuery(
- "select distinct deploymentProperty.objectName " +
- "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
- "where deploymentProperty.key = '"+key+"' " +
- " and deploymentProperty.stringValue = '"+value+"' "
- ).list();
- }
-
- public List<String> findObjectPropertyValues(String objectName, String key) {
- return session.createQuery(
- "select distinct deploymentProperty.stringValue " +
- "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
- "where deploymentProperty.objectName = '"+objectName+"' " +
- " and deploymentProperty.key = '"+key+"' "
- ).list();
- }
-
- public ClientProcessDefinition findLatestProcessDefinitionByKey(String processDefinitionKey) {
- return (ClientProcessDefinition) findObjectByPropertyValue("key", processDefinitionKey);
- }
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -37,8 +37,8 @@
import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
import org.jbpm.pvm.internal.cmd.SetVariablesCmd;
import org.jbpm.pvm.internal.cmd.SignalCmd;
-import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
-import org.jbpm.pvm.internal.cmd.StartExecutionInLatestCmd;
+import org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd;
+import org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd;
import org.jbpm.pvm.internal.query.ExecutionQueryImpl;
@@ -48,35 +48,35 @@
public class ExecutionServiceImpl extends AbstractServiceImpl implements ExecutionService {
public Execution startProcessInstanceById(String processDefinitionId){
- return commandService.execute(new StartExecutionCmd(processDefinitionId, null, null));
+ return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, null, null));
}
public Execution startProcessInstanceById(String processDefinitionId, String executionKey) {
- return commandService.execute(new StartExecutionCmd(processDefinitionId, null, executionKey));
+ return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, null, executionKey));
}
public Execution startProcessInstanceById(String processDefinitionId, Map<String, Object> variables){
- return commandService.execute(new StartExecutionCmd(processDefinitionId, variables, null));
+ return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, variables, null));
}
public Execution startProcessInstanceById(String processDefinitionId, Map<String, Object> variables, String executionKey){
- return commandService.execute(new StartExecutionCmd(processDefinitionId, variables, executionKey));
+ return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, variables, executionKey));
}
public Execution startProcessInstanceByKey(String processDefinitionKey) {
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, null, null));
+ return commandService.execute(new StartProcessInstanceInLatestCmd(processDefinitionKey, null, null));
}
public Execution startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables){
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, variables, null));
+ return commandService.execute(new StartProcessInstanceInLatestCmd(processDefinitionKey, variables, null));
}
public Execution startProcessInstanceByKey(String processDefinitionKey, String executionKey) {
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, null, executionKey));
+ return commandService.execute(new StartProcessInstanceInLatestCmd(processDefinitionKey, null, executionKey));
}
public Execution startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables, String executionKey){
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, variables, executionKey));
+ return commandService.execute(new StartProcessInstanceInLatestCmd(processDefinitionKey, variables, executionKey));
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ProcessServiceImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -34,7 +34,7 @@
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionByIdCmd;
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionKeysCmd;
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionsByKeyCmd;
-import org.jbpm.pvm.internal.cmd.GetResourceAsStream;
+import org.jbpm.pvm.internal.cmd.GetResourceAsStreamCmd;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -39,6 +39,7 @@
import org.jbpm.pvm.internal.history.events.TaskStart;
import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
@@ -86,7 +87,9 @@
protected String state;
+ protected String taskDefinitionName;
protected TaskDefinitionImpl taskDefinition;
+
protected ExecutionImpl execution;
protected ExecutionImpl processInstance;
protected SwimlaneImpl swimlane;
@@ -348,7 +351,7 @@
}
public TaskHandler getTaskHandler() {
- if ( (taskDefinition==null)
+ if ( (getTaskDefinition()==null)
|| (taskDefinition.getTaskHandlerDescriptor()==null)
) {
return DEFAULT_TASK_HANDLER;
@@ -358,6 +361,26 @@
return taskHandler;
}
+ // special getters and setters //////////////////////////////////////////////
+
+ public TaskDefinitionImpl getTaskDefinition() {
+ if ( (taskDefinition==null)
+ && (taskDefinitionName!=null)
+ && (execution!=null)
+ ) {
+ ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
+ taskDefinition = processDefinition.getTaskDefinition(taskDefinitionName);
+ }
+
+ return taskDefinition;
+ }
+
+ public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
+ this.taskDefinition = taskDefinition;
+ this.taskDefinitionName = taskDefinition.getName();
+ }
+
+
// getters and setters //////////////////////////////////////////////////////
public long getDbid() {
@@ -465,10 +488,5 @@
public void setSignalling(boolean isSignalling) {
this.isSignalling = isSignalling;
}
- public TaskDefinitionImpl getTaskDefinition() {
- return taskDefinition;
- }
- public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
- this.taskDefinition = taskDefinition;
- }
+
}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,614 +0,0 @@
-/**
- * Copyright (C) 2007 Bull S. A. S.
- * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
- * This library 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
- * version 2.1 of the License.
- * This library 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
- * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301, USA.
- **/
-package org.jbpm.pvm.internal.db.model;
-
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.model.Activity;
-import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.model.Transition;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-import org.jbpm.session.DbSession;
-import org.jbpm.session.PvmDbSession;
-
-/**
- * @author Guillaume Porcher
- *
- */
-public class ProcessCacheDbTest extends EnvironmentDbTestCase {
-
- /**
- * Defines a simple process: only activities. persists it.
- */
- public void testCacheProcessDefinitionActivities() {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- pvmDbSession.save(processDefinition);
-
- environment.get(Session.class).flush();
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- // only the processDefinition.getDbid() is carried over from the previous
- // transaction
-
- pvmDbSession = environment.get(PvmDbSession.class);
- processDefinition = pvmDbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(processDefinition);
- List<Activity> activities = processDefinition.getActivities();
- assertNotNull(activities);
-
- Activity a = activities.get(0);
- assertEquals("a", a.getName());
- assertTrue(a.getActivities().isEmpty());
-
- Activity b = activities.get(1);
- assertEquals("b", b.getName());
- assertTrue(b.getActivities().isEmpty());
-
- Activity c = activities.get(2);
- assertEquals("c", c.getName());
- assertTrue(c.getActivities().isEmpty());
-
- assertEquals(3, activities.size());
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- beginCacheTest(); // /////////////
- // only the processDefinition.getDbid() is carried over from the previous
- // transaction
-
- pvmDbSession = environment.get(PvmDbSession.class);
- processDefinition = pvmDbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(processDefinition);
- activities = processDefinition.getActivities();
- assertNotNull(activities);
-
- a = activities.get(0);
- assertEquals("a", a.getName());
- assertTrue(a.getActivities().isEmpty());
-
- b = activities.get(1);
- assertEquals("b", b.getName());
- assertTrue(b.getActivities().isEmpty());
-
- c = activities.get(2);
- assertEquals("c", c.getName());
- assertTrue(c.getActivities().isEmpty());
-
- assertEquals(3, activities.size());
-
- endCacheTest(); // ///////////
- }
-
- /**
- * Defines a simple process: only activities. persists it.
- */
- public void testCacheProcessDefinitionActivityOrder() {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- DbSession dbSession = environment.get(DbSession.class);
- dbSession.save(processDefinition);
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- // only the processDefinition.getDbid() is carried over from the previous
- // transaction
-
- dbSession = environment.get(DbSession.class);
- processDefinition = dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(processDefinition);
- List<Activity> activities = processDefinition.getActivities();
- assertNotNull(activities);
- assertEquals(3, activities.size());
-
- Activity a = activities.get(0);
- assertEquals("a", a.getName());
- assertEquals(0, a.getActivities().size());
-
- Activity b = activities.get(1);
- assertEquals("b", b.getName());
- assertEquals(0, b.getActivities().size());
-
- Activity c = activities.get(2);
- assertEquals("c", c.getName());
- assertEquals(0, c.getActivities().size());
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- dbSession = environment.get(DbSession.class);
- processDefinition = dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(processDefinition);
-
- activities = processDefinition.getActivities();
- assertNotNull(activities);
-
- // Pass a to the end -> activity order is "b,c,a"
- activities.add(activities.remove(0));
-
- activities = processDefinition.getActivities();
- b = activities.get(0);
- assertEquals("b", b.getName());
- assertEquals(0, b.getActivities().size());
-
- c = activities.get(1);
- assertEquals("c", c.getName());
- assertEquals(0, c.getActivities().size());
-
- a = activities.get(2);
- assertEquals("a", a.getName());
- assertEquals(0, a.getActivities().size());
-
- newTransaction(); // ///////////////////////////////////////////////////////
-
- dbSession = environment.get(DbSession.class);
- processDefinition = dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(processDefinition);
- activities = processDefinition.getActivities();
- assertNotNull(activities);
- assertEquals(3, activities.size());
-
- b = activities.get(0);
- assertEquals("b", b.getName());
- assertEquals(0, b.getActivities().size());
-
- c = activities.get(1);
- assertEquals("c", c.getName());
- assertEquals(0, c.getActivities().size());
-
- a = activities.get(2);
- assertEquals("a", a.getName());
- assertEquals(0, a.getActivities().size());
-
- newTransaction(); // ///////////////////////////////////////////////////////
- beginCacheTest(); // /////////
-
- dbSession = environment.get(DbSession.class);
- processDefinition = dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(processDefinition);
- activities = processDefinition.getActivities();
- assertNotNull(activities);
- assertEquals(3, activities.size());
-
- b = activities.get(0);
- assertEquals("b", b.getName());
- assertEquals(0, b.getActivities().size());
-
- c = activities.get(1);
- assertEquals("c", c.getName());
- assertEquals(0, c.getActivities().size());
-
- a = activities.get(2);
- assertEquals("a", a.getName());
- assertEquals(0, a.getActivities().size());
-
- endCacheTest(); // //////////////
- }
-
- /**
- * Test processDefinition initial activity
- */
- public void testCacheProcessDefinitionInitialActivity() {
- ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
- ActivityImpl activity = (ActivityImpl) processDefinition.createActivity();
- activity.setName("initial activity");
- activity.setDescription("very important activity");
-
- processDefinition.setInitial(activity);
-
- environment.get(DbSession.class).save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- ProcessDefinitionImpl p = environment.get(DbSession.class).get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(p);
-
- ActivityImpl n = p.getInitial();
-
- assertNotNull(n);
- assertEquals(activity.getName(), n.getName());
- assertEquals(activity.getDescription(), n.getDescription());
-
- newTransaction(); // /////////////////////////////////////////////////////
- beginCacheTest(); // //////////
-
- p = environment.get(DbSession.class).get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(p);
-
- n = p.getInitial();
-
- assertNotNull(n);
- assertEquals(activity.getName(), n.getName());
- assertEquals(activity.getDescription(), n.getDescription());
-
- endCacheTest(); // ///////////
- }
-
- /**
- * Defines a simple process: only nested activities. persists it, reloads it and
- * tries to access the nested activities
- */
- public void testCacheProcessDefinitionNestedActivities() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .startActivity("a")
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endActivity()
- .endProcess();
-
- persistenceSession.save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- persistenceSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition) persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(p);
-
- assertNotSame(processDefinition, p);
- p.getActivities();
- assertNotNull(p.getInitial());
- assertNotNull(p.getInitial().getActivity("a"));
- assertNotNull(p.getInitial().getActivity("b"));
- assertNotNull(p.getInitial().getActivity("c"));
-
- newTransaction(); // /////////////////////////////////////////////////////
- beginCacheTest(); // /////////
-
- persistenceSession = (DbSession) environment.get(DbSession.class);
-
- p = (OpenProcessDefinition) persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(p);
-
- assertNotSame(processDefinition, p);
- p.getActivities();
- assertNotNull(p.getInitial());
- assertNotNull(p.getInitial().getActivity("a"));
- assertNotNull(p.getInitial().getActivity("b"));
- assertNotNull(p.getInitial().getActivity("c"));
-
- endCacheTest(); // ////////
- }
-
- /**
- * Defines a process with nested activities with nested activities. persists it, reloads
- * it and tries to access the nested activities
- */
- public void testCacheProcessDefinitionNestedNestedActivities() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .startActivity("a")
- .startActivity("aa")
- .endActivity()
- .startActivity("ab")
- .endActivity()
- .startActivity("ac")
- .endActivity()
- .endActivity()
- .startActivity("b")
- .startActivity("ba")
- .endActivity()
- .startActivity("bb")
- .endActivity()
- .startActivity("bc")
- .endActivity()
- .endActivity()
- .startActivity("c")
- .startActivity("ca")
- .endActivity()
- .startActivity("cb")
- .endActivity()
- .startActivity("cc")
- .endActivity()
- .endActivity()
- .endActivity()
- .endProcess();
-
- persistenceSession.save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- persistenceSession = (DbSession) environment.get(DbSession.class);
-
- ClientProcessDefinition p = persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(p);
-
- assertNotSame(processDefinition, p);
- p.getActivities();
- assertNotNull(p.getInitial());
- Activity n = p.getInitial().getActivity("a");
- assertNotNull(n);
- List<Activity> l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("aa", l.get(0).getName());
- assertEquals("ab", l.get(1).getName());
- assertEquals("ac", l.get(2).getName());
-
- n = p.getInitial().getActivity("b");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("ba", l.get(0).getName());
- assertEquals("bb", l.get(1).getName());
- assertEquals("bc", l.get(2).getName());
-
- n = p.getInitial().getActivity("c");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("ca", l.get(0).getName());
- assertEquals("cb", l.get(1).getName());
- assertEquals("cc", l.get(2).getName());
-
- newTransaction(); // /////////////////////////////////////////////////////
- beginCacheTest(); // //////////
-
- persistenceSession = (DbSession) environment.get(DbSession.class);
-
- p = persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
- assertNotNull(p);
-
- assertNotSame(processDefinition, p);
- p.getActivities();
- assertNotNull(p.getInitial());
- n = p.getInitial().getActivity("a");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("aa", l.get(0).getName());
- assertEquals("ab", l.get(1).getName());
- assertEquals("ac", l.get(2).getName());
-
- n = p.getInitial().getActivity("b");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("ba", l.get(0).getName());
- assertEquals("bb", l.get(1).getName());
- assertEquals("bc", l.get(2).getName());
-
- n = p.getInitial().getActivity("c");
- assertNotNull(n);
- l = n.getActivities();
- assertEquals(3, l.size());
- assertEquals("ca", l.get(0).getName());
- assertEquals("cb", l.get(1).getName());
- assertEquals("cc", l.get(2).getName());
-
- endCacheTest(); // ///////////
- }
-
- /**
- * Defines a simple process: only activities and default transitions. persists it,
- * reloads and navigates through the transitions.
- */
- public void testCacheDefaultTransition() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .transition("a")
- .endActivity()
- .startActivity("a")
- .transition("b")
- .endActivity()
- .startActivity("b")
- .transition("c")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- persistenceSession.save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- DbSession testSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- Activity activity = p.getInitial();
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
-
- assertEquals(p.getActivity("a"), activity);
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
-
- assertEquals(p.getActivity("b"), activity);
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
- assertEquals(p.getActivity("c"), activity);
- assertNull(activity.getDefaultTransition());
-
- newTransaction(); // /////////////////////////////////////////////////////
- beginCacheTest(); // //////////
-
- testSession = (DbSession) environment.get(DbSession.class);
-
- p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- activity = p.getInitial();
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
-
- assertEquals(p.getActivity("a"), activity);
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
-
- assertEquals(p.getActivity("b"), activity);
- assertNotNull(activity.getDefaultTransition());
- assertEquals(activity, activity.getDefaultTransition().getSource());
-
- activity = activity.getDefaultTransition().getDestination();
- assertEquals(p.getActivity("c"), activity);
- assertNull(activity.getDefaultTransition());
-
- endCacheTest(); // //////////
- }
-
- /**
- * Defines a simple process: only activities and transitions. persists it, reloads
- * and navigates through the transitions.
- */
- public void testCacheTwoTransitions() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .transition("a")
- .transition("b")
- .endActivity()
- .startActivity("a")
- .endActivity()
- .startActivity("b")
- .endActivity()
- .endProcess();
-
- persistenceSession.save(processDefinition);
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- DbSession testSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- Activity activity = p.getInitial();
- List<Transition> l = activity.getOutgoingTransitions();
- assertNotNull(l);
- assertEquals(2, l.size());
-
- Activity a = p.getActivity("a");
- assertNotNull(a);
-
- Activity b = p.getActivity("b");
- assertNotNull(b);
-
- assertEquals(activity, l.get(0).getSource());
- assertEquals(activity, l.get(1).getSource());
-
- assertEquals(a, l.get(0).getDestination());
- assertEquals(b, l.get(1).getDestination());
-
- List<Transition> la = a.getIncomingTransitions();
- assertNotNull(la);
- assertEquals(1, la.size());
- assertSame(la.get(0), l.get(0));
-
- List<Transition> lb = b.getIncomingTransitions();
- assertNotNull(lb);
- assertEquals(1, lb.size());
- assertSame(lb.get(0), l.get(1));
-
- newTransaction(); // /////////////////////////////////////////////////////
-
- testSession = (DbSession) environment.get(DbSession.class);
- beginCacheTest(); // ///////
-
- p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- activity = p.getInitial();
- l = activity.getOutgoingTransitions();
- assertNotNull(l);
- assertEquals(2, l.size());
-
- a = p.getActivity("a");
- assertNotNull(a);
-
- b = p.getActivity("b");
- assertNotNull(b);
-
- assertEquals(activity, l.get(0).getSource());
- assertEquals(activity, l.get(1).getSource());
-
- assertEquals(a, l.get(0).getDestination());
- assertEquals(b, l.get(1).getDestination());
-
- la = a.getIncomingTransitions();
- assertNotNull(la);
- assertEquals(1, la.size());
- assertSame(la.get(0), l.get(0));
-
- lb = b.getIncomingTransitions();
- assertNotNull(lb);
- assertEquals(1, lb.size());
- assertSame(lb.get(0), l.get(1));
-
- endCacheTest(); // ////////
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,486 +0,0 @@
-/**
- * Copyright (C) 2007 Bull S. A. S.
- * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
- * This library 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
- * version 2.1 of the License.
- * This library 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
- * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301, USA.
- **/
-package org.jbpm.pvm.internal.db.model;
-
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import org.jbpm.model.Event;
-import org.jbpm.model.Activity;
-import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.model.Transition;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.EventImpl;
-import org.jbpm.pvm.internal.model.EventListenerReference;
-import org.jbpm.pvm.internal.model.ExceptionHandlerImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-import org.jbpm.session.DbSession;
-
-/**
- * @author Charles Souillard
- * @author Guillaume Porcher
- */
-public class ProcessDefinitionDbTest extends EnvironmentDbTestCase {
-
- public void testProcessDefinitionBasicProperties() {
- Date deploymentTime = new Date();
-
- ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
- processDefinition.setName("name");
- processDefinition.setDescription("description");
- processDefinition.setVersion(3);
- processDefinition.setDeploymentTime(deploymentTime);
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertEquals("name", processDefinition.getName());
- assertEquals("description", processDefinition.getDescription());
- assertEquals(3, processDefinition.getVersion());
- assertEquals(deploymentTime, processDefinition.getDeploymentTime());
- }
-
- public void testProcessDefinitionActivities() {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertNotNull(processDefinition);
- List<Activity> activities = processDefinition.getActivities();
- assertNotNull(activities);
-
- Activity a = activities.get(0);
- assertEquals("a", a.getName());
- assertTrue(a.getActivities().isEmpty());
-
- Activity b = activities.get(1);
- assertEquals("b", b.getName());
- assertTrue(b.getActivities().isEmpty());
-
- Activity c = activities.get(2);
- assertEquals("c", c.getName());
- assertTrue(c.getActivities().isEmpty());
-
- assertEquals(3, activities.size());
- }
-
- public void testInitialActivity() {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- Activity initial = processDefinition.getInitial();
- assertNotNull(initial);
-
- // check that the initial activity is still in the list of activities
- assertSame(processDefinition.getActivity("a"), initial);
- // check that the initial activity is not two times in the list of activities
- assertEquals(3, processDefinition.getActivities().size());
- }
-
- public void testProcessDefinitionNestedActivities() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("top")
- .initial()
- .startActivity("a")
- .endActivity()
- .startActivity("b")
- .startActivity("b1")
- .endActivity()
- .startActivity("b2")
- .endActivity()
- .startActivity("b3")
- .endActivity()
- .endActivity()
- .startActivity("c")
- .endActivity()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertNotNull(processDefinition);
- Activity initial = processDefinition.getInitial();
- assertNotNull(initial);
- assertEquals(initial, processDefinition.getActivity("top"));
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- List<Activity> activities = processDefinition.getActivities();
- assertNotNull(activities);
- assertEquals("expected size 1. activity list was: " + activities.toString(), 1, activities.size());
- Activity top = activities.get(0);
- assertNotNull(top);
-
- activities = top.getActivities();
- assertNotNull(activities);
- assertEquals("expected size 3. activity list was: " + activities.toString(), 3, activities.size());
- assertEquals("a", activities.get(0).getName());
- assertEquals("b", activities.get(1).getName());
- assertEquals("c", activities.get(2).getName());
-
- activities = processDefinition.getActivity("top").getActivity("b").getActivities();
- assertNotNull(activities);
- assertEquals("expected size 3. activity list was: " + activities.toString(), 3, activities.size());
- assertEquals("b1", activities.get(0).getName());
- assertEquals("b2", activities.get(1).getName());
- assertEquals("b3", activities.get(2).getName());
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- Activity activity = processDefinition.findActivity("b2");
- assertNotNull(activity);
- assertEquals("b", activity.getParent().getName());
- assertEquals("top", activity.getParent().getParent().getName());
- }
-
- public void testDefaultTransition() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .transition("a")
- .transition("b", "tob")
- .transition("c", "toc")
- .endActivity()
- .startActivity("b")
- .transition("a", "toa")
- .transition("b")
- .transition("c", "toc")
- .endActivity()
- .startActivity("c")
- .transition("c")
- .endActivity()
- .startActivity("d")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertEquals("a", processDefinition.getActivity("a").getDefaultTransition().getDestination().getName());
- assertEquals("a", processDefinition.getActivity("b").getDefaultTransition().getDestination().getName());
- assertEquals("c", processDefinition.getActivity("c").getDefaultTransition().getDestination().getName());
- assertNull(processDefinition.getActivity("d").getDefaultTransition());
- }
-
- public void testTwoTransitionsWithoutAName() {
- DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(persistenceSession);
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .transition("a")
- .transition("b")
- .endActivity()
- .startActivity("a")
- .endActivity()
- .startActivity("b")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertNotNull(processDefinition);
- Activity activity = processDefinition.getInitial();
- List<Transition> l = activity.getOutgoingTransitions();
- assertNotNull(l);
- assertEquals(2, l.size());
-
- Activity a = processDefinition.getActivity("a");
- assertNotNull(a);
-
- Activity b = processDefinition.getActivity("b");
- assertNotNull(b);
-
- assertEquals(activity, l.get(0).getSource());
- assertEquals(activity, l.get(1).getSource());
-
- assertEquals(a, l.get(0).getDestination());
- assertEquals(b, l.get(1).getDestination());
-
- List<Transition> la = a.getIncomingTransitions();
- assertNotNull(la);
- assertEquals(1, la.size());
- assertSame(la.get(0), l.get(0));
-
- List<Transition> lb = b.getIncomingTransitions();
- assertNotNull(lb);
- assertEquals(1, lb.size());
- assertSame(lb.get(0), l.get(1));
- }
-
- public void testEventsOnProcessDefinition() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .startEvent(Event.START)
- .listener("one")
- .listener("two")
- .endEvent()
- .startEvent(Event.END)
- .listener("three")
- .listener("four")
- .endEvent()
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- EventImpl event = processDefinition.getEvent(Event.START);
- List<EventListenerReference> listenerReferences = event.getListenerReferences();
- assertEquals("one", listenerReferences.get(0).getExpression());
- assertEquals("two", listenerReferences.get(1).getExpression());
-
- event = processDefinition.getEvent(Event.END);
- listenerReferences = event.getListenerReferences();
- assertEquals("three", listenerReferences.get(0).getExpression());
- assertEquals("four", listenerReferences.get(1).getExpression());
- }
-
- public void testEventsOnActivity() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .startEvent(Event.START)
- .listener("one")
- .listener("two")
- .endEvent()
- .startEvent(Event.END)
- .listener("three")
- .listener("four")
- .endEvent()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- EventImpl event = processDefinition.getActivity("a").getEvent(Event.START);
- List<EventListenerReference> listenerReferences = event.getListenerReferences();
- assertEquals("one", listenerReferences.get(0).getExpression());
- assertEquals("two", listenerReferences.get(1).getExpression());
-
- event = processDefinition.getActivity("a").getEvent(Event.END);
- listenerReferences = event.getListenerReferences();
- assertEquals("three", listenerReferences.get(0).getExpression());
- assertEquals("four", listenerReferences.get(1).getExpression());
- }
-
- public void testListenersOnTransition() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .startFlow("b")
- .listener("one")
- .listener("two")
- .endFlow()
- .endActivity()
- .startActivity("b")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- EventImpl event = processDefinition.getActivity("a").getDefaultTransition().getEvent();
- List<EventListenerReference> listenerReferences = event.getListenerReferences();
- assertEquals("one", listenerReferences.get(0).getExpression());
- assertEquals("two", listenerReferences.get(1).getExpression());
- }
-
- public void testExceptionHandlersOnProcessDefinition() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .startExceptionHandler(IllegalArgumentException.class)
- .listener("one")
- .listener("two")
- .endExceptionHandler()
- .startExceptionHandler(RuntimeException.class)
- .listener("three")
- .listener("four")
- .endExceptionHandler()
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- List<ExceptionHandlerImpl> exceptionHandlers = processDefinition.getExceptionHandlers();
-
- ExceptionHandlerImpl exceptionHandler = exceptionHandlers.get(0);
- assertEquals(IllegalArgumentException.class.getName(), exceptionHandler.getExceptionClassName());
- assertEquals("one", exceptionHandler.getEventListenerReferences().get(0).getExpression());
- assertEquals("two", exceptionHandler.getEventListenerReferences().get(1).getExpression());
-
- exceptionHandler = exceptionHandlers.get(1);
- assertEquals(RuntimeException.class.getName(), exceptionHandler.getExceptionClassName());
- assertEquals("three", exceptionHandler.getEventListenerReferences().get(0).getExpression());
- assertEquals("four", exceptionHandler.getEventListenerReferences().get(1).getExpression());
- }
-
- public void testExceptionHandlersOnActivity() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .startExceptionHandler(IllegalArgumentException.class)
- .listener("one")
- .listener("two")
- .endExceptionHandler()
- .startExceptionHandler(RuntimeException.class)
- .listener("three")
- .listener("four")
- .endExceptionHandler()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- List<ExceptionHandlerImpl> exceptionHandlers = processDefinition.getActivity("a").getExceptionHandlers();
-
- ExceptionHandlerImpl exceptionHandler = exceptionHandlers.get(0);
- assertEquals(IllegalArgumentException.class.getName(), exceptionHandler.getExceptionClassName());
- assertEquals("one", exceptionHandler.getEventListenerReferences().get(0).getExpression());
- assertEquals("two", exceptionHandler.getEventListenerReferences().get(1).getExpression());
-
- exceptionHandler = exceptionHandlers.get(1);
- assertEquals(RuntimeException.class.getName(), exceptionHandler.getExceptionClassName());
- assertEquals("three", exceptionHandler.getEventListenerReferences().get(0).getExpression());
- assertEquals("four", exceptionHandler.getEventListenerReferences().get(1).getExpression());
- }
-
- public void testProcessDynamicProperties() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .property("key1", "val1")
- .property("key2", "val2")
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- assertEquals("val1", processDefinition.getProperty("key1"));
- assertEquals("val2", processDefinition.getProperty("key2"));
- }
-
- public void testActivityDynamicProperties() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .startActivity()
- .initial()
- .property("key1", "val1")
- .property("key2", "val2")
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- Activity activity = processDefinition.getInitial();
- assertEquals("val1", activity.getProperty("key1"));
- assertEquals("val2", activity.getProperty("key2"));
- }
-
- public void testTransitionDynamicProperties() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .startActivity("a")
- .initial()
- .startFlow("a")
- .property("key1", "val1")
- .property("key2", "val2")
- .endFlow()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- Transition transition = processDefinition.getInitial().getDefaultTransition();
- assertEquals("val1", transition.getProperty("key1"));
- assertEquals("val2", transition.getProperty("key2"));
- }
-
- public void testEventDynamicProperties() {
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .startEvent(Event.START)
- .property("key1", "val1")
- .property("key2", "val2")
- .endEvent()
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- EventImpl event = processDefinition.getEvent(Event.START);
- assertEquals("val1", event.getProperty("key1"));
- assertEquals("val2", event.getProperty("key2"));
- }
-
- public void testProcessDefinitionAttachments() {
-
- if (true) {
- System.err.print("FIXME: JBPM-1972 finish process attachments");
- return;
- }
-
- StringBuffer text = new StringBuffer();
- for (int i=0; i<500; i++) {
- text.append("This is a lot of bytes! ");
- }
- byte[] bytes = text.toString().getBytes();
-
- ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) ProcessDefinitionBuilder
- .startProcess()
- .attachment("msgbytes", bytes)
- .endProcess();
-
- processDefinition = reload(processDefinition, ProcessDefinitionImpl.class);
-
- byte[] retrievedBytes = processDefinition.getAttachment("msgbytes");
- // assertTrue(Arrays.equals(bytes, retrievedBytes));
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/SessionFactoryDbTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.db.model;
-
-import org.hibernate.SessionFactory;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-
-/**
- * @author Tom Baeyens
- */
-public class SessionFactoryDbTest extends EnvironmentDbTestCase
-{
-
- public void testSessionFactory()
- {
- environment.get(SessionFactory.class);
- }
-
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,600 +0,0 @@
-/**
- * Copyright (C) 2007 Bull S. A. S.
- * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
- * This library 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
- * version 2.1 of the License.
- * This library 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
- * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301, USA.
- **/
-package org.jbpm.pvm.internal.db.model;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.EventImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
-import org.jbpm.pvm.internal.model.WireProperties;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ByteDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.CharacterDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ClassDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.DoubleDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.FalseDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.FloatDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.LongDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.MapDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.NullDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.SetDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ShortDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.TrueDescriptor;
-import org.jbpm.pvm.internal.wire.operation.FieldOperation;
-import org.jbpm.pvm.internal.wire.operation.PropertyOperation;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-import org.jbpm.session.DbSession;
-
-/**
- * @author Guillaume Porcher
- *
- * This class uses process annotations to test wire descriptors
- * persistence
- */
-public class WireDbTest extends EnvironmentDbTestCase {
-
- public void testCharacterDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- CharacterDescriptor descriptor = new CharacterDescriptor();
- descriptor.setName("n");
- descriptor.setValue('c');
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (CharacterDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals('c', descriptor.construct(null));
- }
-
- public void testByteDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- ByteDescriptor descriptor = new ByteDescriptor();
- descriptor.setName("n");
- descriptor.setValue((byte) 6);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (ByteDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals((byte) 6, descriptor.construct(null));
- }
-
- public void testClassDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- ClassDescriptor descriptor = new ClassDescriptor();
- descriptor.setName("n");
- descriptor.setClassName(EventImpl.class.getName());
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (ClassDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(EventImpl.class, WireContext.create(descriptor));
- }
-
- public void testDoubleDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- DoubleDescriptor descriptor = new DoubleDescriptor();
- descriptor.setName("n");
- descriptor.setValue(6.666);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (DoubleDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(6.666, descriptor.construct(null));
- }
-
- public void testFalseDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- FalseDescriptor descriptor = new FalseDescriptor();
- descriptor.setName("n");
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (FalseDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(Boolean.FALSE, descriptor.construct(null));
- }
-
- public void testFloatDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- FloatDescriptor descriptor = new FloatDescriptor();
- descriptor.setName("n");
- descriptor.setValue((float) 6.666);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (FloatDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals((float) 6.666, descriptor.construct(null));
- }
-
- public void testIntegerDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- IntegerDescriptor descriptor = new IntegerDescriptor();
- descriptor.setName("n");
- descriptor.setValue(6);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (IntegerDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(6, descriptor.construct(null));
- }
-
- public void testLongDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- LongDescriptor descriptor = new LongDescriptor();
- descriptor.setName("n");
- descriptor.setValue(6L);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (LongDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(6L, descriptor.construct(null));
- }
-
- public void testNullDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- NullDescriptor descriptor = new NullDescriptor();
- descriptor.setName("n");
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (NullDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertNull(descriptor.construct(null));
- }
-
- public void testShortDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- ShortDescriptor descriptor = new ShortDescriptor();
- descriptor.setName("n");
- descriptor.setValue((short) 6);
-
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (ShortDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals((short) 6, descriptor.construct(null));
- }
-
- public void testStringDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- StringDescriptor descriptor = new StringDescriptor();
- descriptor.setName("n");
- descriptor.setValue("s");
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (StringDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals("s", descriptor.construct(null));
- }
-
- public void testTrueDescriptor() {
- DbSession dbSession = environment.get(DbSession.class);
-
- TrueDescriptor descriptor = new TrueDescriptor();
- descriptor.setName("n");
- dbSession.save(descriptor);
-
- newTransaction();
- dbSession = environment.get(DbSession.class);
-
- descriptor = (TrueDescriptor) dbSession.get(AbstractDescriptor.class, descriptor.getDbid());
- assertEquals("n", descriptor.getName());
- assertEquals(Boolean.TRUE, descriptor.construct(null));
- }
-
- public void testRefDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- WireProperties configurations = new WireProperties();
-
- StringDescriptor referencedDescriptor = new StringDescriptor();
- referencedDescriptor.setName("referenced");
- referencedDescriptor.setValue("text");
- configurations.add(referencedDescriptor);
-
- ReferenceDescriptor descriptor = new ReferenceDescriptor();
- descriptor.setName("reference");
- descriptor.setValue("referenced");
- configurations.add(descriptor);
-
- dbSession.save(configurations);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- configurations = dbSession.get(WireProperties.class, configurations.getDbid());
-
- assertNotNull(configurations);
- assertEquals("text", configurations.get("reference"));
- }
-
- /**
- * Check that list descriptors are persisted
- */
- public void testListDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- StringDescriptor stringD = new StringDescriptor();
- stringD.setValue("value");
-
- StringDescriptor string2D = new StringDescriptor();
- string2D.setValue("value2");
-
- List<Descriptor> listValues = new ArrayList<Descriptor>();
- listValues.add(stringD);
- listValues.add(string2D);
-
- ListDescriptor listD = new ListDescriptor();
- listD.setName("list");
- listD.setValueDescriptors(listValues);
- listD.setClassName(LinkedList.class.getName());
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(listD)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- List<String> result = (List<String>) p.getProperty("list");
- assertNotNull(result);
- assertEquals(2, result.size());
- assertEquals("value", result.get(0));
- assertEquals("value2", result.get(1));
-
- assertTrue(result instanceof LinkedList);
- }
-
- /**
- * Check that set descriptors are persisted
- */
- public void testSetDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- StringDescriptor stringD = new StringDescriptor();
- stringD.setValue("value");
-
- StringDescriptor string2D = new StringDescriptor();
- string2D.setValue("value2");
-
- List<Descriptor> listValues = new ArrayList<Descriptor>();
- listValues.add(stringD);
- listValues.add(string2D);
-
- SetDescriptor setD = new SetDescriptor();
- setD.setName("set");
- setD.setValueDescriptors(listValues);
- setD.setClassName(TreeSet.class.getName());
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(setD)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- Set<String> result = (Set<String>) p.getProperty("set");
- assertNotNull(result);
- assertTrue(result.contains("value"));
- assertTrue(result.contains("value2"));
- assertEquals(2, result.size());
-
- assertTrue(result instanceof TreeSet);
- }
-
- /**
- * Check that map descriptors are persisted
- */
- public void testMapDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- StringDescriptor keyD = new StringDescriptor();
- keyD.setValue("key");
-
- StringDescriptor key2D = new StringDescriptor();
- key2D.setValue("key2");
-
- StringDescriptor stringD = new StringDescriptor();
- stringD.setValue("value");
-
- StringDescriptor string2D = new StringDescriptor();
- string2D.setValue("value2");
-
- List<Descriptor> mapKeys = new ArrayList<Descriptor>();
- mapKeys.add(keyD);
- mapKeys.add(key2D);
-
- List<Descriptor> mapValues = new ArrayList<Descriptor>();
- mapValues.add(stringD);
- mapValues.add(string2D);
-
- MapDescriptor mapD = new MapDescriptor();
- mapD.setName("map");
- mapD.setValueDescriptors(mapValues);
- mapD.setKeyDescriptors(mapKeys);
- mapD.setClassName(TreeMap.class.getName());
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(mapD)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- Map<String, String> result = (Map<String, String>) p.getProperty("map");
- assertNotNull(result);
- assertEquals(2, result.size());
- assertEquals("value", result.get("key"));
- assertEquals("value2", result.get("key2"));
-
- assertTrue(result instanceof TreeMap);
- }
-
- /**
- * Check that map descriptors are persisted
- */
- public void testObjectDescriptor() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- ObjectDescriptor objDefault = new ObjectDescriptor();
- objDefault.setName("objectByEmptyConstr");
- objDefault.setClassName(Object.class.getName());
-
- ObjectDescriptor objConstr = new ObjectDescriptor();
- objConstr.setName("objectByConstr");
- objConstr.setClassName(Integer.class.getName());
-
- ArgDescriptor argObjConstr = new ArgDescriptor();
- argObjConstr.setTypeName(int.class.getName());
- IntegerDescriptor argObjConstrVal = new IntegerDescriptor();
- argObjConstrVal.setValue(42);
- argObjConstr.setDescriptor(argObjConstrVal);
-
- objConstr.addArgDescriptor(argObjConstr);
-
- ObjectDescriptor objStaticMethod = new ObjectDescriptor();
- objStaticMethod.setName("objectByStaticMethod");
- objStaticMethod.setClassName(Integer.class.getName());
- objStaticMethod.setMethodName("signum");
- ArgDescriptor argStaticMethod = new ArgDescriptor();
- argStaticMethod.setTypeName(int.class.getName());
- IntegerDescriptor argStaticMethodValue = new IntegerDescriptor();
- argStaticMethodValue.setValue(42);
- argStaticMethod.setDescriptor(argStaticMethodValue);
-
- objStaticMethod.addArgDescriptor(argStaticMethod);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(objDefault)
- .property(objConstr)
- .property(objStaticMethod)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- assertNotNull(p.getProperty("objectByEmptyConstr"));
- assertEquals(42, p.getProperty("objectByConstr"));
- assertTrue(p.getProperty("objectByConstr") instanceof Integer);
-
- assertEquals(1, p.getProperty("objectByStaticMethod"));
- }
-
- /**
- * Check that map descriptors are persisted
- */
- public void testFieldOperation() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- ObjectDescriptor objDescr = new ObjectDescriptor(VariableDefinitionImpl.class.getName());
- objDescr.setName("object");
-
- FieldOperation fieldOp = new FieldOperation();
- fieldOp.setFieldName("name");
-
- StringDescriptor varNameDescriptor = new StringDescriptor();
- varNameDescriptor.setValue("varName");
-
- fieldOp.setDescriptor(varNameDescriptor);
-
- objDescr.addOperation(fieldOp);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(objDescr)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- assertNotNull(p.getProperty("object"));
- assertTrue(p.getProperty("object") instanceof VariableDefinitionImpl);
- assertEquals("varName", ((VariableDefinitionImpl) p.getProperty("object")).getName());
- }
-
- /**
- * Check that map descriptors are persisted
- */
- public void testPropertyOperation() {
- DbSession dbSession = (DbSession) environment.get(DbSession.class);
- assertNotNull(dbSession);
-
- ObjectDescriptor objDescr = new ObjectDescriptor();
- objDescr.setName("object");
- objDescr.setClassName(VariableDefinitionImpl.class.getName());
-
- PropertyOperation propertyOp = new PropertyOperation();
- propertyOp.setPropertyName("name");
-
- StringDescriptor varNameDescriptor = new StringDescriptor();
- varNameDescriptor.setValue("varName");
-
- propertyOp.setDescriptor(varNameDescriptor);
-
- objDescr.addOperation(propertyOp);
-
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .property(objDescr)
- .startActivity()
- .initial()
- .endActivity()
- .endProcess();
-
- dbSession.save(processDefinition);
-
- newTransaction();
-
- dbSession = (DbSession) environment.get(DbSession.class);
-
- OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
-
- assertNotNull(p);
- assertNotSame(processDefinition, p);
-
- assertNotNull(p.getProperty("object"));
- assertTrue(p.getProperty("object") instanceof VariableDefinitionImpl);
- assertEquals("varName", ((VariableDefinitionImpl) p.getProperty("object")).getName());
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/model/WireTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,108 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.db.model;
-
-import org.hibernate.Session;
-import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-import org.jbpm.session.DbSession;
-
-/**
- * @author Tom Baeyens
- */
-public class WireTest extends EnvironmentDbTestCase
-{
-
- public void testObjectDescriptor()
- {
- DbSession persistenceSession = (DbSession)environment.get(DbSession.class);
-
- ObjectDescriptor objStaticMethod = new ObjectDescriptor();
- objStaticMethod.setName("objectByStaticMethod");
- objStaticMethod.setClassName(Integer.class.getName());
- objStaticMethod.setMethodName("signum");
- ArgDescriptor argStaticMethod = new ArgDescriptor();
- argStaticMethod.setTypeName(int.class.getName());
- IntegerDescriptor argStaticMethodValue = new IntegerDescriptor();
- argStaticMethodValue.setValue(42);
- argStaticMethod.setDescriptor(argStaticMethodValue);
-
- objStaticMethod.addArgDescriptor(argStaticMethod);
-
- persistenceSession.save(argStaticMethodValue);
- environment.get(Session.class).flush();
-
- persistenceSession.save(objStaticMethod);
- environment.get(Session.class).flush();
-
- persistenceSession.save(objStaticMethod);
- environment.get(Session.class).flush();
-
- }
-
- /*
- * public void testObjectDescriptor() { DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
- * assertNotNull(persistenceSession);
- *
- * ObjectDescriptor objDefault = new ObjectDescriptor(); objDefault.setName("objectByEmptyConstr");
- * objDefault.setClassName(Object.class.getName());
- *
- * ObjectDescriptor objConstr = new ObjectDescriptor(); objConstr.setName("objectByConstr");
- * objConstr.setClassName(Integer.class.getName());
- *
- * ArgDescriptor argObjConstr = new ArgDescriptor(); argObjConstr.setTypeName(int.class.getName()); IntegerDescriptor
- * argObjConstrVal = new IntegerDescriptor(); argObjConstrVal.setValue(42);
- * argObjConstr.setDescriptor(argObjConstrVal);
- *
- * objConstr.addArgDescriptor(argObjConstr);
- *
- * ObjectDescriptor objStaticMethod = new ObjectDescriptor(); objStaticMethod.setName("objectByStaticMethod");
- * objStaticMethod.setClassName(Integer.class.getName()); objStaticMethod.setMethodName("signum"); ArgDescriptor
- * argStaticMethod = new ArgDescriptor(); argStaticMethod.setTypeName(int.class.getName()); IntegerDescriptor
- * argStaticMethodValue = new IntegerDescriptor(); argStaticMethodValue.setValue(42);
- * argStaticMethod.setDescriptor(argStaticMethodValue);
- *
- * objStaticMethod.addArgDescriptor(argStaticMethod);
- *
- * ProcessDefinition processDefinition = ProcessFactory.build() .configuration(objDefault) .configuration(objConstr)
- * .configuration(objStaticMethod) .done();
- *
- * persistenceSession.save(processDefinition);
- *
- * newTransaction();
- *
- * DbSession testSession = (DbSession) environment.get(DbSession.class);
- *
- * ProcessDefinition p = (ProcessDefinition) testSession.get(ProcessDefinitionImpl.class,
- * processDefinition.getDbid());
- *
- * assertNotNull(p); assertNotSame(processDefinition, p);
- *
- * assertNotNull(p.getConfigurations()); assertNotNull(p.getConfigurations().get("objectByEmptyConstr"));
- * assertEquals(42 , p.getConfigurations().get("objectByConstr"));
- * assertTrue(p.getConfigurations().get("objectByConstr") instanceof Integer);
- *
- * assertEquals(1, p.getConfigurations().get("objectByStaticMethod")); }
- */
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/PvmProcessExecutionTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.execution;
-
-import org.jbpm.Execution;
-import org.jbpm.ExecutionService;
-import org.jbpm.ProcessService;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.pvm.activities.AutomaticActivity;
-import org.jbpm.pvm.activities.WaitState;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
-import org.jbpm.pvm.test.EnvironmentFactoryTestCase;
-
-/**
- * @author Tom Baeyens
- */
-public class PvmProcessExecutionTest extends EnvironmentFactoryTestCase {
-
- public void testDeploy() {
- JbpmConfiguration environmentFactory = (JbpmConfiguration) getEnvironmentFactory();
- ProcessService processService = environmentFactory.get(ProcessService.class);
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder.startProcess("test")
- .startActivity("start", WaitState.class)
- .initial()
- .transition("end", "end")
- .endActivity()
- .startActivity("end", AutomaticActivity.class)
- .endActivity()
- .endProcess();
-
- processService
- .createDeployment()
- .addProcessDefinition(processDefinition)
- .deploy();
- }
-
- public void testStartProcessInstance() {
- JbpmConfiguration environmentFactory = (JbpmConfiguration) getEnvironmentFactory();
- ExecutionService executionService = environmentFactory.get(ExecutionService.class);
- Execution execution = executionService.startProcessInstanceById("test-1", "request17");
- }
-
- public void testResumeProcessInstance() {
- JbpmConfiguration environmentFactory = (JbpmConfiguration) getEnvironmentFactory();
- ExecutionService executionService = environmentFactory.get(ExecutionService.class);
- Execution execution = executionService.signalExecutionById("test.request17", "end");
- }
-
-}
\ No newline at end of file
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/AsyncContinuationsTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.jobexecutor;
-
-import org.hibernate.Session;
-import org.jbpm.Execution;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.model.OpenProcessDefinition;
-import org.jbpm.pvm.activities.AutomaticActivity;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class AsyncContinuationsTest extends JbpmTestCase {
-
- public void testContinuations() {
- deployProcess();
-
- Execution execution = executionService.startProcessInstanceByKey("continuations");
-
- assertEquals("start", execution.getActivityName());
- assertEquals(Execution.STATE_ASYNC, execution.getState());
-
- executeAsyncMessage(execution);
- execution = executionService.findExecution(execution.getId());
-
- assertEquals("a", execution.getActivityName());
- assertEquals(Execution.STATE_ASYNC, execution.getState());
-
- executeAsyncMessage(execution);
- execution = executionService.findExecution(execution.getId());
-
- assertEquals("b", execution.getActivityName());
- assertEquals(Execution.STATE_ASYNC, execution.getState());
-
- executeAsyncMessage(execution);
- execution = executionService.findExecution(execution.getId());
-
- assertEquals("c", execution.getActivityName());
- assertEquals(Execution.STATE_ASYNC, execution.getState());
-
- executeAsyncMessage(execution);
-
- assertNull(executionService.findExecution(execution.getId()));
- }
-
- public void deployProcess() {
- commandService.execute(new Command<Object>() {
- public Object execute(Environment environment) throws Exception {
- OpenProcessDefinition processDefinition = ProcessDefinitionBuilder.startProcess("continuations")
- .key("continuations")
- .startActivity("start", AutomaticActivity.class)
- .initial()
- .asyncExecute()
- .transition("a")
- .endActivity()
- .startActivity("a", AutomaticActivity.class)
- .asyncExecute()
- .transition("b")
- .endActivity()
- .startActivity("b", AutomaticActivity.class)
- .asyncExecute()
- .transition("c")
- .endActivity()
- .startActivity("c", AutomaticActivity.class)
- .asyncExecute()
- .transition("end")
- .endActivity()
- .startActivity("end", AutomaticActivity.class)
- .endActivity()
- .endProcess();
-
- Session session = environment.get(Session.class);
- session.save(processDefinition);
- return null;
- }
- });
- }
-}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/variables/CustomTypeVariableTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.variables;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.pvm.activities.WaitState;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.type.Variable;
-import org.jbpm.pvm.internal.type.variable.DateVariable;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.test.EnvironmentDbTestCase;
-
-/**
- * @author Guillaume Porcher
- */
-public class CustomTypeVariableTest extends EnvironmentDbTestCase {
-
- private static final String ENVIRONMENT_CFG_XML = "org/jbpm/pvm/variables/custom.types.jbpm.cfg.xml";
-
- public CustomTypeVariableTest() {
- super(ENVIRONMENT_CFG_XML);
- }
-
- public void testDateVariable() {
- ClientProcessDefinition clientProcessDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity(
- new ObjectDescriptor(WaitState.class)
- )
- .initial()
- .endActivity()
- .endProcess();
-
- getDbSession().save(clientProcessDefinition);
-
- ExecutionImpl execution = (ExecutionImpl) clientProcessDefinition.startProcessInstance();
-
- execution = reload(execution, ExecutionImpl.class);
-
- Calendar calendar = new GregorianCalendar();
- calendar.set(Calendar.YEAR, 2007);
- calendar.set(Calendar.MONTH, 10); // (10 == november)
- calendar.set(Calendar.DAY_OF_MONTH, 22);
- calendar.set(Calendar.HOUR_OF_DAY, 15);
- calendar.set(Calendar.MINUTE, 28);
- calendar.set(Calendar.SECOND, 57);
- calendar.set(Calendar.MILLISECOND, 374);
-
- execution.setVariable("v", calendar.getTime());
-
- execution = reload(execution, ExecutionImpl.class);
-
- Variable variable = execution.getVariableObject("v");
- assertEquals(DateVariable.class, variable.getClass());
-
- assertEquals(calendar.getTime(), execution.getVariable("v"));
- }
-
-}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.task.hbm.xml 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.task.hbm.xml 2009-03-29 11:04:09 UTC (rev 4347)
@@ -118,11 +118,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <!-- many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" / -->
+ <property name="taskDefinitionName" column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
Modified: jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -58,14 +58,14 @@
static protected Log log = Log.getLog(BaseJbpmTestCase.class.getName());
protected void setUp() throws Exception {
- assertNull(Environment.getCurrent());
+ assertNull("there is already an environment open", Environment.getCurrent());
LogFormatter.resetIndentation();
log.debug("=== starting "+getName()+" =============================");
}
protected void tearDown() throws Exception {
log.debug("=== ending "+getName()+" =============================\n");
- assertNull(Environment.getCurrent());
+ assertNull("there is still an environment open", Environment.getCurrent());
}
public void assertTextPresent(String expected, String value) {
Modified: jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -117,7 +117,7 @@
protected void tearDown() throws Exception {
if (registeredDeployments!=null) {
for (Long deploymentDbid : registeredDeployments) {
- repositoryService.deleteDeployment(deploymentDbid);
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
}
}
@@ -132,13 +132,15 @@
super.tearDown();
}
- public void deployJpdlXmlString(String jpdlXmlString) {
+ public long deployJpdlXmlString(String jpdlXmlString) {
long deploymentDbid =
repositoryService.createDeployment()
.addResourceFromString("xmlstring.jpdl.xml", jpdlXmlString)
.deploy();
registerDeployment(deploymentDbid);
+
+ return deploymentDbid;
}
public void deployJpdlResource(String resource) {
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/execution/StartExecutionTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -175,8 +175,6 @@
"</process>"
);
- ProcessDefinition processDefinition = processService.findProcessDefinitionsByKey("ICL").get(0);
-
// start an execution for the process with the given id
Execution execution = executionService.startProcessInstanceById("ICL-1");
assertNotNull(execution);
Deleted: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessServiceTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -1,358 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test.process;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.Execution;
-import org.jbpm.JbpmException;
-import org.jbpm.ProcessDefinition;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ProcessServiceTest extends JbpmTestCase {
-
- public void testProcessWithNameOnly() {
- deployJpdlXmlString(
- "<process name='Insurance claim'>" +
- " <start />" +
- "</process>"
- );
-
- ProcessDefinition processDefinition = processService.findLatestProcessDefinitionByKey("Insurance_claim");
-
- assertNotNull(processDefinition);
- assertEquals("Insurance claim", processDefinition.getName());
- assertEquals("Insurance_claim", processDefinition.getKey());
- assertEquals(1, processDefinition.getVersion());
- assertEquals("Insurance_claim-1", processDefinition.getId());
- }
-
- public void testProcessWithNameAndKey() {
- deployJpdlXmlString(
- "<process name='Insurance claim' key='ICL'>" +
- " <start />" +
- "</process>"
- );
-
- ProcessDefinition processDefinition = processService.findLatestProcessDefinitionByKey("ICL");
-
- assertNotNull(processDefinition);
- assertEquals("Insurance claim", processDefinition.getName());
- assertEquals("ICL", processDefinition.getKey());
- assertEquals(1, processDefinition.getVersion());
- assertEquals("ICL-1", processDefinition.getId());
- }
-
- // interface methods ////////////////////////////////////////////////////////
-
- public void testFindProcessDefinitionKeys() {
- deployMultipleVersionsOfProcesses();
-
- List<String> processKeys = processService.findProcessDefinitionKeys();
-
- List<String> expected = new ArrayList<String>();
- expected.add("nuclear_fusion");
- expected.add("publish_book");
- expected.add("ultimate_seduction");
-
- assertEquals(expected, processKeys);
- }
-
-
- public void testFindProcessByKey() {
- deployJpdlXmlString(
- "<process name='Name with spaces'>" +
- " <start />" +
- "</process>"
- );
-
- ProcessDefinition processDefinition = processService.findLatestProcessDefinitionByKey("Name_with_spaces");
- assertNotNull(processDefinition);
- assertEquals("Name with spaces", processDefinition.getName());
- assertEquals("Name_with_spaces", processDefinition.getKey());
- assertEquals(1, processDefinition.getVersion());
- assertEquals("Name_with_spaces-1", processDefinition.getId());
- }
-
- public void testFindProcessDefinitions() {
- deployMultipleVersionsOfProcesses();
-
- List<ProcessDefinition> processDefinitions = processService.findProcessDefinitionsByKey("nuclear_fusion");
- assertNotNull(processDefinitions);
-
- assertEquals("expected 3 but was " + processDefinitions.size() + ": " + processDefinitions, 3, processDefinitions.size());
- assertEquals("nuclear fusion", processDefinitions.get(0).getName());
- assertEquals(3, processDefinitions.get(0).getVersion());
-
- assertEquals("nuclear fusion", processDefinitions.get(1).getName());
- assertEquals(2, processDefinitions.get(1).getVersion());
-
- assertEquals("nuclear fusion", processDefinitions.get(2).getName());
- assertEquals(1, processDefinitions.get(2).getVersion());
- }
-
- public void testFindLatestProcessDefinition() {
- deployMultipleVersionsOfProcesses();
-
- ProcessDefinition retrieved = processService.findLatestProcessDefinitionByKey("nuclear_fusion");
- assertNotNull(retrieved);
-
- assertEquals(3, retrieved.getVersion());
- assertEquals("nuclear fusion", retrieved.getName());
- assertEquals("nuclear_fusion", retrieved.getKey());
- }
-
- public void testFindProcessDefinitionById() {
- deployJpdlXmlString(
- "<process name='given' version='33'>" +
- " <start />" +
- "</process>"
- );
-
- // load it
- ProcessDefinition processDefinition = processService.findProcessDefinitionById("given-33");
- assertNotNull(processDefinition);
- assertEquals("given", processDefinition.getName());
- assertEquals(33, processDefinition.getVersion());
- }
-
- public void testDeleteProcessDefinition() {
- processService.createDeployment()
- .addResourceFromString("xmlstring.jpdl.xml",
- "<process name='deleteme' version='33'>" +
- " <start />" +
- "</process>")
- .deploy();
-
- // delete it
- processService.deleteProcessDefinition("deleteme-33");
-
- // check if the db is empty
- assertEquals(0, processService.createProcessDefinitionQuery().execute().size());
- }
-
- public void testDeleteProcessDefinitionAndInstances() {
- processService.createDeployment()
- .addResourceFromString("xmlstring.jpdl.xml",
- "<process name='deleteme' version='33'>" +
- " <start>" +
- " <transition to='w' />" +
- " </start>" +
- " <state name='w' />" +
- "</process>")
- .deploy();
-
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
-
- // delete it all
- processService.deleteProcessDefinitionCascade("deleteme-33");
-
- // check if the db is empty
- assertEquals(0, processService.createProcessDefinitionQuery().execute().size());
- assertEquals(0, executionService.createExecutionQuery().execute().size());
- }
-
- public void testDeleteProcessDefinitionButNotInstances() {
- deployJpdlXmlString(
- "<process name='deleteme' version='33'>" +
- " <start>" +
- " <transition to='w' />" +
- " </start>" +
- " <state name='w' />" +
- "</process>"
- );
-
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
- executionService.startProcessInstanceByKey("deleteme");
-
- // delete it all
- try {
- processService.deleteProcessDefinition("deleteme-33");
- fail("expected exception");
- } catch (JbpmException e) {
- assertTextPresent("still 4 process instances for process definition deleteme-33", e.getMessage());
- }
- }
-
- // various other aspects ////////////////////////////////////////////////////
-
- public void testAutomaticVersioning() {
- deployJpdlXmlString(
- "<process name='versionme'>" +
- " <start />" +
- "</process>"
- );
-
- // look it up again
- List<ProcessDefinition> processDefinitions = processService.findProcessDefinitionsByKey("versionme");
- assertNotNull(processDefinitions);
- // verify that there is only one
- assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
- ProcessDefinition processDefinition = processDefinitions.get(0);
- // and check that automatically assigned version starts with 1
- assertEquals(1, processDefinition.getVersion());
-
- deployJpdlXmlString(
- "<process name='versionme'>" +
- " <start />" +
- "</process>"
- );
-
- // look them up again
- processDefinitions = processService.findProcessDefinitionsByKey("versionme");
- // verify that there is only one
- assertEquals(processDefinitions.toString(), 2, processDefinitions.size());
- // and check that automatically assigned version starts with 1
- assertEquals(2, processDefinitions.get(0).getVersion());
- assertEquals(1, processDefinitions.get(1).getVersion());
- }
-
- public void testUserProvidedVersion() {
- deployJpdlXmlString(
- "<process name='takethis' version='234'>" +
- " <start />" +
- "</process>"
- );
-
- // load it
- List<ProcessDefinition> processDefinitions = processService.findProcessDefinitionsByKey("takethis");
- assertNotNull(processDefinitions);
- assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
- ProcessDefinition processDefinition = processDefinitions.get(0);
- // verify that the user specified version was used
- // (and not overwritten by an automatically assigned versioning)
- assertEquals(234, processDefinition.getVersion());
- }
-
- public void testDuplicateUserProvidedVersion() {
- deployJpdlXmlString(
- "<process name='takethis' version='234'>" +
- " <start />" +
- "</process>"
- );
-
- try {
- deployJpdlXmlString(
- "<process name='takethis' version='234'>" +
- " <start />" +
- "</process>"
- );
- fail("expected exception");
- } catch (JbpmException e) {
- assertTextPresent("process 'takethis-234' already exists", e.getMessage());
- }
- }
-
- /**
- * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the processes 'ultimate seduction' and
- * 'publish book'
- */
- void deployMultipleVersionsOfProcesses() {
- deployJpdlXmlString(
- "<process name='nuclear fusion'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='ultimate seduction'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='ultimate seduction'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='ultimate seduction'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='ultimate seduction'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='publish book'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='nuclear fusion'>" +
- " <start />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='nuclear fusion'>" +
- " <start />" +
- "</process>"
- );
- }
-
- public void testMinimalProcess() {
- deployJpdlXmlString(
- "<process name='minimal'>" +
- " <start>" +
- " <transition to='end' />" +
- " </start>" +
- " <end name='end' />" +
- "</process>"
- );
-
- Execution execution = executionService.startProcessInstanceByKey("minimal");
-
- assertEquals("end", execution.getActivityName());
- assertTrue(execution.isEnded());
- assertFalse(execution.isActive());
- }
-
- public void testMostMinimalProcess() {
- deployJpdlXmlString(
- "<process name='minimal'>" +
- " <start />" +
- "</process>"
- );
-
- Execution execution = executionService.startProcessInstanceByKey("minimal");
-
- assertTrue(execution.isEnded());
- assertFalse(execution.isActive());
- }
-}
Added: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -0,0 +1,378 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.process;
+
+import java.util.List;
+
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryServiceTest extends JbpmTestCase {
+
+ public void testProcessWithNameOnly() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .key("Insurance_claim")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0,1)
+ .uniqueResult();
+
+ assertNotNull(processDefinition);
+ assertEquals("Insurance claim", processDefinition.getName());
+ assertEquals("Insurance_claim", processDefinition.getKey());
+ assertEquals(1, processDefinition.getVersion());
+ assertEquals("Insurance_claim-1", processDefinition.getId());
+ }
+
+ public void testProcessWithNameAndKey() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .key("ICL")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0,1)
+ .uniqueResult();
+
+ assertNotNull(processDefinition);
+ assertEquals("Insurance claim", processDefinition.getName());
+ assertEquals("ICL", processDefinition.getKey());
+ assertEquals(1, processDefinition.getVersion());
+ assertEquals("ICL-1", processDefinition.getId());
+ }
+
+ // interface methods ////////////////////////////////////////////////////////
+
+ public void testFindProcessByKey() {
+ deployJpdlXmlString(
+ "<process name='Name with spaces'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .key("Name_with_spaces")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0,1)
+ .uniqueResult();
+
+ assertNotNull(processDefinition);
+ assertEquals("Name with spaces", processDefinition.getName());
+ assertEquals("Name_with_spaces", processDefinition.getKey());
+ assertEquals(1, processDefinition.getVersion());
+ assertEquals("Name_with_spaces-1", processDefinition.getId());
+ }
+
+ public void testFindProcessDefinitions() {
+ deployMultipleVersionsOfProcesses();
+
+ List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+ .key("nuclear_fusion")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .execute();
+ assertNotNull(processDefinitions);
+
+ assertEquals("expected 3 but was " + processDefinitions.size() + ": " + processDefinitions, 3, processDefinitions.size());
+ assertEquals("nuclear fusion", processDefinitions.get(0).getName());
+ assertEquals(3, processDefinitions.get(0).getVersion());
+
+ assertEquals("nuclear fusion", processDefinitions.get(1).getName());
+ assertEquals(2, processDefinitions.get(1).getVersion());
+
+ assertEquals("nuclear fusion", processDefinitions.get(2).getName());
+ assertEquals(1, processDefinitions.get(2).getVersion());
+ }
+
+ public void testFindLatestProcessDefinition() {
+ deployMultipleVersionsOfProcesses();
+
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .key("nuclear_fusion")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0,1)
+ .uniqueResult();
+ assertNotNull(processDefinition);
+
+ assertEquals(3, processDefinition.getVersion());
+ assertEquals("nuclear fusion", processDefinition.getName());
+ assertEquals("nuclear_fusion", processDefinition.getKey());
+ }
+
+ public void testFindProcessDefinitionById() {
+ deployJpdlXmlString(
+ "<process name='given' version='33'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ // load it
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .id("given-33")
+ .uniqueResult();
+
+ assertNotNull(processDefinition);
+ assertEquals("given", processDefinition.getName());
+ assertEquals(33, processDefinition.getVersion());
+ }
+
+ public void testDeleteDeployment() {
+ long deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromString("xmlstring.jpdl.xml",
+ "<process name='deleteme' version='33'>" +
+ " <start />" +
+ "</process>")
+ .deploy();
+
+ // delete it
+ repositoryService.deleteDeployment(deploymentDbid);
+
+ // check if the db is empty
+ assertEquals(0, repositoryService.createProcessDefinitionQuery().execute().size());
+ }
+
+ public void testDeleteProcessDefinitionAndInstances() {
+ long deploymentDbid = repositoryService.createDeployment()
+ .addResourceFromString("xmlstring.jpdl.xml",
+ "<process name='deleteme' version='33'>" +
+ " <start>" +
+ " <transition to='w' />" +
+ " </start>" +
+ " <state name='w' />" +
+ "</process>")
+ .deploy();
+
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+
+ // delete it all
+ repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+ // check if the db is empty
+ assertEquals(0, repositoryService.createProcessDefinitionQuery().execute().size());
+ assertEquals(0, executionService.createExecutionQuery().execute().size());
+ }
+
+ public void testDeleteProcessDefinitionButNotInstances() {
+ long deploymentDbid = deployJpdlXmlString(
+ "<process name='deleteme' version='33'>" +
+ " <start>" +
+ " <transition to='w' />" +
+ " </start>" +
+ " <state name='w' />" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+ executionService.startProcessInstanceByKey("deleteme");
+
+ // delete it all
+ try {
+ repositoryService.deleteDeployment(deploymentDbid);
+ fail("expected exception");
+ } catch (JbpmException e) {
+ assertTextPresent("cannot delete deployment 23: still executions for process(deleteme): ", e.getMessage());
+ }
+ }
+
+ // various other aspects ////////////////////////////////////////////////////
+
+ public void testAutomaticVersioning() {
+ deployJpdlXmlString(
+ "<process name='versionme'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ // look it up again
+ List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+ .key("versionme")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .execute();
+
+ assertNotNull(processDefinitions);
+ // verify that there is only one
+ assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
+ ProcessDefinition processDefinition = processDefinitions.get(0);
+ // and check that automatically assigned version starts with 1
+ assertEquals(1, processDefinition.getVersion());
+
+ deployJpdlXmlString(
+ "<process name='versionme'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ // look them up again
+ processDefinitions = repositoryService.createProcessDefinitionQuery()
+ .key("versionme")
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .execute();
+
+ // verify that there is only one
+ assertEquals(processDefinitions.toString(), 2, processDefinitions.size());
+ // and check that automatically assigned version starts with 1
+ assertEquals(2, processDefinitions.get(0).getVersion());
+ assertEquals(1, processDefinitions.get(1).getVersion());
+ }
+
+ public void testUserProvidedVersion() {
+ deployJpdlXmlString(
+ "<process name='takethis' version='234'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ // load it
+ List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+ .key("takethis")
+ .execute();
+
+ assertNotNull(processDefinitions);
+ assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
+ ProcessDefinition processDefinition = processDefinitions.get(0);
+ // verify that the user specified version was used
+ // (and not overwritten by an automatically assigned versioning)
+ assertEquals(234, processDefinition.getVersion());
+ }
+
+ public void testDuplicateUserProvidedVersion() {
+ deployJpdlXmlString(
+ "<process name='takethis' version='234'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ try {
+ deployJpdlXmlString(
+ "<process name='takethis' version='234'>" +
+ " <start />" +
+ "</process>"
+ );
+ fail("expected exception");
+ } catch (JbpmException e) {
+ assertTextPresent("process 'takethis-234' already exists", e.getMessage());
+ }
+ }
+
+ /**
+ * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the processes 'ultimate seduction' and
+ * 'publish book'
+ */
+ void deployMultipleVersionsOfProcesses() {
+ deployJpdlXmlString(
+ "<process name='nuclear fusion'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='ultimate seduction'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='ultimate seduction'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='ultimate seduction'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='ultimate seduction'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='publish book'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='nuclear fusion'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='nuclear fusion'>" +
+ " <start />" +
+ "</process>"
+ );
+ }
+
+ public void testMinimalProcess() {
+ deployJpdlXmlString(
+ "<process name='minimal'>" +
+ " <start>" +
+ " <transition to='end' />" +
+ " </start>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("minimal");
+
+ assertEquals("end", execution.getActivityName());
+ assertTrue(execution.isEnded());
+ assertFalse(execution.isActive());
+ }
+
+ public void testMostMinimalProcess() {
+ deployJpdlXmlString(
+ "<process name='minimal'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("minimal");
+
+ assertTrue(execution.isEnded());
+ assertFalse(execution.isActive());
+ }
+}
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.task.hbm.xml 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.task.hbm.xml 2009-03-29 11:04:09 UTC (rev 4347)
@@ -118,11 +118,7 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <!-- many-to-one name="taskDefinition"
- column="TASKDEF_"
- class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
- foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" / -->
+ <property name="taskDefinitionName" column="TASKDEFNAME_"/>
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
Modified: jbpm4/branches/tbaeyens/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java 2009-03-28 17:58:26 UTC (rev 4346)
+++ jbpm4/branches/tbaeyens/modules/test-load/src/test/java/org/jbpm/test/load/async/ExclusiveMessagesTest.java 2009-03-29 11:04:09 UTC (rev 4347)
@@ -32,7 +32,7 @@
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
+import org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
@@ -119,7 +119,7 @@
public Object execute(Environment environment) throws Exception {
MessageSession messageSession = environment.get(MessageSession.class);
for (int i = 0; i < nbrOfTestExecutions; i++) {
- Execution execution = new StartExecutionCmd("excl:1", null, "execution-" + i).execute(environment);
+ Execution execution = new StartProcessInstanceCmd("excl:1", null, "execution-" + i).execute(environment);
for (int j = 0; j < nbrOfTestMessagesPerExecution; j++) {
CommandMessage exclusiveTestMessage = ExclusiveTestCommand.createMessage(execution);
15 years, 1 month
JBoss JBPM SVN: r4346 - in jbpm3/branches/jbpm-3.2.5.SP: modules/core/src/main/java/org/jbpm/graph/node and 3 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-03-28 13:58:26 -0400 (Sat, 28 Mar 2009)
New Revision: 4346
Added:
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/graph/node/Join.lock.hbm.xml
Removed:
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.3.xsd
Modified:
jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/graph/node/Join.java
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/graph/node/Join.hbm.xml
jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/graph/node/JoinDbTest.java
Log:
JBPM-2121: revert addition of PARENTLOCKMODE_ column
merge r4320:4345 from branch jbpm-3.2.5.SP4_JBPM-2121
Modified: jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml 2009-03-28 13:46:48 UTC (rev 4345)
+++ jbpm3/branches/jbpm-3.2.5.SP/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml 2009-03-28 17:58:26 UTC (rev 4346)
@@ -34,7 +34,6 @@
<axis>
<name>container</name>
<values>
- <string>jboss422</string>
<string>jboss423</string>
<string>jboss500</string>
</values>
@@ -42,8 +41,8 @@
<axis>
<name>database</name>
<values>
- <string>hsqldb</string>
- <string>mysql</string>
+ <string>postgresql</string>
+ <string>sybase</string>
</values>
</axis>
<axis>
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/graph/node/Join.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/graph/node/Join.java 2009-03-28 13:46:48 UTC (rev 4345)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/java/org/jbpm/graph/node/Join.java 2009-03-28 17:58:26 UTC (rev 4346)
@@ -42,13 +42,13 @@
private static final long serialVersionUID = 1L;
/**
- * specifies wether what type of hibernate lock should be acquired.
+ * specifies what type of hibernate lock should be acquired.
* null value defaults to LockMode.UPGRADE
*/
String parentLockMode;
/**
- * specifies if this joinhandler is a discriminator.
+ * specifies if this join is a discriminator.
* a descriminator reactivates the parent when the first
* concurrent token enters the join.
*/
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/graph/node/Join.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/graph/node/Join.hbm.xml 2009-03-28 13:46:48 UTC (rev 4345)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/graph/node/Join.hbm.xml 2009-03-28 17:58:26 UTC (rev 4346)
@@ -6,8 +6,6 @@
<hibernate-mapping auto-import="false" default-access="field" >
<subclass name="org.jbpm.graph.node.Join" discriminator-value="J"
- extends="org.jbpm.graph.def.Node">
- <property name="parentLockMode" column="PARENTLOCKMODE_"/>
- </subclass>
+ extends="org.jbpm.graph.def.Node" />
</hibernate-mapping>
Copied: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/graph/node/Join.lock.hbm.xml (from rev 4345, jbpm3/branches/jbpm-3.2.5.SP4_JBPM-2121/modules/core/src/main/resources/org/jbpm/graph/node/Join.lock.hbm.xml)
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/graph/node/Join.lock.hbm.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/graph/node/Join.lock.hbm.xml 2009-03-28 17:58:26 UTC (rev 4346)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping auto-import="false" default-access="field" >
+
+ <subclass name="org.jbpm.graph.node.Join" discriminator-value="J"
+ extends="org.jbpm.graph.def.Node">
+ <property name="parentLockMode" column="PARENTLOCKMODE_"/>
+ </subclass>
+
+</hibernate-mapping>
Deleted: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.3.xsd
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.3.xsd 2009-03-28 13:46:48 UTC (rev 4345)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.3.xsd 2009-03-28 17:58:26 UTC (rev 4346)
@@ -1,511 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<xs:schema targetNamespace="urn:jbpm.org:jpdl-3.3"
- elementFormDefault="qualified"
- xmlns="urn:jbpm.org:jpdl-3.3"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <!-- PROCESS-DEFINITION -->
- <!-- ################## -->
- <xs:element name="process-definition">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element ref="swimlane" />
- <xs:element ref="start-state" />
- <xs:group ref="node-elements"/>
- <xs:group ref="action-elements" />
- <xs:element ref="event" />
- <xs:element ref="exception-handler" />
- <xs:element ref="task" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required" />
- </xs:complexType>
- </xs:element>
-
- <!-- SWIMLANE -->
- <!-- ######## -->
- <xs:element name="swimlane">
- <xs:complexType>
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:element ref="assignment"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required" />
- </xs:complexType>
- </xs:element>
-
- <!-- NODES -->
- <!-- ##### -->
- <xs:element name="start-state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element ref="task"/>
- <xs:element ref="transition"/>
- <xs:element ref="event"/>
- <xs:element ref="exception-handler"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="end-state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element ref="event"/>
- <xs:element ref="exception-handler"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="end-complete-process" type="booleanType" use="optional" default="false"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="decision">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element name="handler" type="delegation" />
- <xs:element ref="event"/>
- <xs:element ref="exception-handler"/>
- <xs:element ref="transition"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="expression" type="xs:string" />
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="fork">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="script" />
- <xs:group ref="node-content-elements" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="join">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="node-content-elements" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- <xs:attribute name="lock" type="lockMode"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="node">
- <xs:complexType>
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="1">
- <xs:group ref="action-elements" />
- </xs:choice>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="node-content-elements" />
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="process-state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="sub-process">
- <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:complexType>
- </xs:element>
- <xs:element ref="variable" />
- <xs:group ref="node-content-elements" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required" />
- <xs:attribute name="async" type="xs:string" default="false" />
- <xs:attribute name="binding" type="bindingType"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="node-content-elements"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="super-state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="node-elements"/>
- <xs:group ref="node-content-elements"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="task-node">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="task" />
- <xs:group ref="node-content-elements" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="create-tasks" type="booleanType" default="true" />
- <xs:attribute name="end-tasks" type="booleanType" default="false" />
- <xs:attribute name="signal" default="last">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="unsynchronized"/>
- <xs:enumeration value="never"/>
- <xs:enumeration value="first"/>
- <xs:enumeration value="first-wait"/>
- <xs:enumeration value="last"/>
- <xs:enumeration value="last-wait"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="mail-node">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="subject" />
- <xs:element ref="text" />
- <xs:group ref="node-content-elements"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- <xs:attribute name="template" type="xs:string"/>
- <xs:attribute name="actors" type="xs:string"/>
- <xs:attribute name="to" type="xs:string"/>
- <xs:attribute name="subject" type="xs:string"/>
- <xs:attribute name="text" type="xs:string"/>
- </xs:complexType>
- </xs:element>
-
-
- <!-- TRANSITION -->
- <!-- ########## -->
- <xs:element name="transition">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element name="condition">
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="expression" type="xs:string" />
- </xs:complexType>
- </xs:element>
- <xs:group ref="action-elements"/>
- <xs:element ref="exception-handler" />
- </xs:choice>
- <xs:attribute name="to" type="xs:string" use="required" />
- <xs:attribute name="name" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <!-- ACTIONS -->
- <!-- ####### -->
- <xs:element name="action">
- <xs:complexType mixed="true">
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="class" type="xs:string" />
- <xs:attribute name="config-type" default="field" type="xs:string" />
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="ref-name" type="xs:string" />
- <xs:attribute name="accept-propagated-events" type="booleanType" default="true" />
- <xs:attribute name="expression" type="xs:string" />
- <xs:attribute name="async" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="cancel-timer">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="create-timer">
- <xs:complexType>
- <xs:choice minOccurs="0">
- <xs:element ref="action"/>
- <xs:element ref="script"/>
- </xs:choice>
- <xs:attribute name="duedate" type="xs:string" use="required" />
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="repeat" type="xs:string" />
- <xs:attribute name="transition" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="script">
- <xs:complexType mixed="true">
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="accept-propagated-events" type="booleanType" default="true" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="mail">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="subject" />
- <xs:element ref="text" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- <xs:attribute name="template" type="xs:string"/>
- <xs:attribute name="actors" type="xs:string"/>
- <xs:attribute name="to" type="xs:string"/>
- <xs:attribute name="subject" type="xs:string"/>
- <xs:attribute name="text" type="xs:string"/>
- </xs:complexType>
- </xs:element>
-
- <!-- EVENT -->
- <!-- ##### -->
- <xs:element name="event">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="action-elements"/>
- </xs:choice>
- <xs:attribute name="type" use="required">
- <xs:simpleType>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:string"/>
- </xs:simpleType>
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="node-enter"/>
- <xs:enumeration value="node-leave"/>
- <xs:enumeration value="process-start"/>
- <xs:enumeration value="process-end"/>
- <xs:enumeration value="task-create"/>
- <xs:enumeration value="task-assign"/>
- <xs:enumeration value="task-start"/>
- <xs:enumeration value="task-end"/>
- <xs:enumeration value="before-signal"/>
- <xs:enumeration value="after-signal"/>
- <xs:enumeration value="superstate-enter"/>
- <xs:enumeration value="superstate-leave"/>
- <xs:enumeration value="timer-create"/>
- <xs:enumeration value="subprocess-created"/>
- <xs:enumeration value="subprocess-end"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
-
- <!-- EXCEPTION-HANDLER -->
- <!-- ################# -->
- <xs:element name="exception-handler">
- <xs:complexType>
- <xs:choice minOccurs="1" maxOccurs="unbounded">
- <xs:element ref="action"/>
- <xs:element ref="script"/>
- </xs:choice>
- <xs:attribute name="exception-class" type="xs:string"/>
- </xs:complexType>
- </xs:element>
-
- <!-- TASK -->
- <!-- #### -->
- <xs:element name="task">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element ref="assignment"/>
- <xs:element ref="controller"/>
- <xs:element ref="event"/>
- <xs:element ref="timer"/>
- <xs:element name="reminder">
- <xs:complexType>
- <xs:attribute name="duedate" type="xs:string" use="required" />
- <xs:attribute name="repeat" type="xs:string" />
- </xs:complexType>
- </xs:element>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="blocking" type="booleanType" default="false"/>
- <xs:attribute name="signalling" type="booleanType" default="true"/>
- <xs:attribute name="description" type="xs:string" />
- <xs:attribute name="duedate" type="xs:string" />
- <xs:attribute name="swimlane" type="xs:string" />
- <xs:attribute name="priority" type="priorityType" default="normal" />
- <xs:attribute name="notify" type="booleanType" default="false"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="controller" type="delegation" />
-
- <xs:element name="assignment">
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="delegation">
- <xs:attribute name="expression" type="xs:string" />
- <xs:attribute name="actor-id" type="xs:string" />
- <xs:attribute name="pooled-actors" type="xs:string" />
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <!-- TIMER -->
- <!-- ##### -->
- <xs:element name="timer">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="1">
- <xs:group ref="action-elements" />
- </xs:choice>
- <xs:attribute name="duedate" type="xs:string" use="required" />
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="repeat" type="xs:string" />
- <xs:attribute name="transition" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="variable">
- <xs:complexType>
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="access" type="xs:string" default="read,write"/>
- <xs:attribute name="mapped-name" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <!-- MAIL -->
- <!-- #### -->
- <xs:element name="to" type="xs:string"/>
- <xs:element name="recipients" type="xs:string"/>
- <xs:element name="subject" type="xs:string"/>
- <xs:element name="text" type="xs:string"/>
- <xs:element name="template" type="xs:string"/>
-
- <!-- TYPES AND GROUPS -->
- <!-- ################ -->
-
- <xs:element name="description" type="xs:string" />
-
- <xs:complexType name="delegation" mixed="true">
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="class" type="xs:string" />
- <xs:attribute name="config-type" default="field" type="xs:string" />
- </xs:complexType>
-
- <xs:simpleType name="configType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="field"/>
- <xs:enumeration value="bean"/>
- <xs:enumeration value="constructor"/>
- <xs:enumeration value="configuration-property"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="booleanType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="yes"/>
- <xs:enumeration value="no"/>
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- <xs:enumeration value="on"/>
- <xs:enumeration value="off"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="priorityType">
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="highest"/>
- <xs:enumeration value="high"/>
- <xs:enumeration value="normal"/>
- <xs:enumeration value="low"/>
- <xs:enumeration value="lowest"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:restriction base="xs:int"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:group name="node-elements">
- <xs:choice>
- <xs:element ref="node"/>
- <xs:element ref="state"/>
- <xs:element ref="task-node"/>
- <xs:element ref="super-state"/>
- <xs:element ref="process-state"/>
- <xs:element ref="fork"/>
- <xs:element ref="join"/>
- <xs:element ref="decision"/>
- <xs:element ref="end-state"/>
- <xs:element ref="mail-node"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="action-elements">
- <xs:choice>
- <xs:element ref="action"/>
- <xs:element ref="script"/>
- <xs:element ref="create-timer"/>
- <xs:element ref="cancel-timer"/>
- <xs:element ref="mail"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="node-content-elements">
- <xs:choice>
- <xs:element ref="description" />
- <xs:element ref="event"/>
- <xs:element ref="exception-handler"/>
- <xs:element ref="timer"/>
- <xs:element ref="transition"/>
- </xs:choice>
- </xs:group>
-
- <xs:simpleType name="bindingType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="late"/>
- <xs:enumeration value="early"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="lockMode">
- <xs:restriction base="xs:string">
- <xs:enumeration value="NONE"/>
- <xs:enumeration value="READ"/>
- <xs:enumeration value="UPGRADE"/>
- <xs:enumeration value="UPGRADE_NOWAIT"/>
- <xs:enumeration value="FORCE"/>
- <xs:enumeration value="pessimistic"/>
- </xs:restriction>
- </xs:simpleType>
-</xs:schema>
Modified: jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/graph/node/JoinDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/graph/node/JoinDbTest.java 2009-03-28 13:46:48 UTC (rev 4345)
+++ jbpm3/branches/jbpm-3.2.5.SP/modules/core/src/test/java/org/jbpm/graph/node/JoinDbTest.java 2009-03-28 17:58:26 UTC (rev 4346)
@@ -21,27 +21,87 @@
*/
package org.jbpm.graph.node;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.regex.Pattern;
+
import org.hibernate.LockMode;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmException;
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.graph.def.ProcessDefinition;
/**
* Verifies the join node can be persisted correctly.
+ *
* @author Alejandro Guizar
*/
public class JoinDbTest extends AbstractDbTestCase {
+ @Override
+ protected JbpmConfiguration getJbpmConfiguration() {
+ if (jbpmConfiguration == null) {
+ URL cfgResource = getClass().getClassLoader().getResource("hibernate.cfg.xml");
+ try {
+ OutputStream outStream = new FileOutputStream(new File(cfgResource.toURI().resolve(
+ "hibernate.join.cfg.xml")));
+ sed("Join.hbm.xml", "Join.lock.hbm.xml", cfgResource.openStream(), outStream);
+ outStream.close();
+ }
+ catch (URISyntaxException e) {
+ throw new AssertionError(e);
+ }
+ catch (IOException e) {
+ throw new JbpmException("could not edit hibernate configuration", e);
+ }
+ jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
+ + " <string name='resource.hibernate.cfg.xml' value='hibernate.join.cfg.xml' />"
+ + "</jbpm-configuration>");
+ }
+ return jbpmConfiguration;
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ jbpmConfiguration.close();
+ }
+
+ private static void sed(String target, String replacement, InputStream inStream,
+ OutputStream outStream) throws IOException {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));
+ Writer writer = new OutputStreamWriter(outStream);
+ Pattern pattern = Pattern.compile(target, Pattern.LITERAL);
+ for (String inLine; (inLine = reader.readLine()) != null;) {
+ String outLine = pattern.matcher(inLine).replaceAll(replacement);
+ writer.write(outLine);
+ writer.write('\n');
+ }
+ reader.close();
+ writer.flush();
+ }
+
public void testParentLockMode() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition name='" + getName() + "'>" +
- " <join name='read' lock='READ' />" +
- " <join name='nowait' lock='UPGRADE_NOWAIT' />" +
- " <join name='upgrade' lock='pessimistic' />" +
- "</process-definition>");
+ ProcessDefinition processDefinition = ProcessDefinition
+ .parseXmlString("<process-definition name='"
+ + getName()
+ + "'>"
+ + " <join name='read' lock='READ' />"
+ + " <join name='nowait' lock='UPGRADE_NOWAIT' />"
+ + " <join name='upgrade' lock='pessimistic' />"
+ + "</process-definition>");
jbpmContext.deployProcessDefinition(processDefinition);
- long processDefinitionId = processDefinition.getId();
+
newTransaction();
-
try {
processDefinition = graphSession.findLatestProcessDefinition(getName());
Join join = (Join) processDefinition.getNode("read");
@@ -50,11 +110,9 @@
assertEquals(LockMode.UPGRADE_NOWAIT.toString(), join.getParentLockMode());
join = (Join) processDefinition.getNode("upgrade");
assertEquals(LockMode.UPGRADE.toString(), join.getParentLockMode());
-
- } finally {
- newTransaction();
- graphSession.deleteProcessDefinition(processDefinitionId);
}
-
+ finally {
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
}
}
15 years, 1 month
JBoss JBPM SVN: r4345 - jbpm3/branches/jbpm-3.2.5.SP4_JBPM-2121/modules/core/src/main/resources/org/jbpm/jpdl/xml.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-03-28 09:46:48 -0400 (Sat, 28 Mar 2009)
New Revision: 4345
Removed:
jbpm3/branches/jbpm-3.2.5.SP4_JBPM-2121/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.3.xsd
Log:
JBPM-2121: remove unsupported 3.3 schema - lock attribute addition to join element
Deleted: jbpm3/branches/jbpm-3.2.5.SP4_JBPM-2121/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.3.xsd
===================================================================
--- jbpm3/branches/jbpm-3.2.5.SP4_JBPM-2121/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.3.xsd 2009-03-27 16:12:52 UTC (rev 4344)
+++ jbpm3/branches/jbpm-3.2.5.SP4_JBPM-2121/modules/core/src/main/resources/org/jbpm/jpdl/xml/jpdl-3.3.xsd 2009-03-28 13:46:48 UTC (rev 4345)
@@ -1,511 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<xs:schema targetNamespace="urn:jbpm.org:jpdl-3.3"
- elementFormDefault="qualified"
- xmlns="urn:jbpm.org:jpdl-3.3"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <!-- PROCESS-DEFINITION -->
- <!-- ################## -->
- <xs:element name="process-definition">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element ref="swimlane" />
- <xs:element ref="start-state" />
- <xs:group ref="node-elements"/>
- <xs:group ref="action-elements" />
- <xs:element ref="event" />
- <xs:element ref="exception-handler" />
- <xs:element ref="task" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required" />
- </xs:complexType>
- </xs:element>
-
- <!-- SWIMLANE -->
- <!-- ######## -->
- <xs:element name="swimlane">
- <xs:complexType>
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:element ref="assignment"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required" />
- </xs:complexType>
- </xs:element>
-
- <!-- NODES -->
- <!-- ##### -->
- <xs:element name="start-state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element ref="task"/>
- <xs:element ref="transition"/>
- <xs:element ref="event"/>
- <xs:element ref="exception-handler"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="end-state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element ref="event"/>
- <xs:element ref="exception-handler"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="end-complete-process" type="booleanType" use="optional" default="false"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="decision">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element name="handler" type="delegation" />
- <xs:element ref="event"/>
- <xs:element ref="exception-handler"/>
- <xs:element ref="transition"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="expression" type="xs:string" />
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="fork">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="script" />
- <xs:group ref="node-content-elements" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="join">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="node-content-elements" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- <xs:attribute name="lock" type="lockMode"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="node">
- <xs:complexType>
- <xs:sequence>
- <xs:choice minOccurs="0" maxOccurs="1">
- <xs:group ref="action-elements" />
- </xs:choice>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="node-content-elements" />
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="process-state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="sub-process">
- <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:complexType>
- </xs:element>
- <xs:element ref="variable" />
- <xs:group ref="node-content-elements" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required" />
- <xs:attribute name="async" type="xs:string" default="false" />
- <xs:attribute name="binding" type="bindingType"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="node-content-elements"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="super-state">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="node-elements"/>
- <xs:group ref="node-content-elements"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="task-node">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="task" />
- <xs:group ref="node-content-elements" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="create-tasks" type="booleanType" default="true" />
- <xs:attribute name="end-tasks" type="booleanType" default="false" />
- <xs:attribute name="signal" default="last">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="unsynchronized"/>
- <xs:enumeration value="never"/>
- <xs:enumeration value="first"/>
- <xs:enumeration value="first-wait"/>
- <xs:enumeration value="last"/>
- <xs:enumeration value="last-wait"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="async" type="xs:string" default="false" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="mail-node">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="subject" />
- <xs:element ref="text" />
- <xs:group ref="node-content-elements"/>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- <xs:attribute name="template" type="xs:string"/>
- <xs:attribute name="actors" type="xs:string"/>
- <xs:attribute name="to" type="xs:string"/>
- <xs:attribute name="subject" type="xs:string"/>
- <xs:attribute name="text" type="xs:string"/>
- </xs:complexType>
- </xs:element>
-
-
- <!-- TRANSITION -->
- <!-- ########## -->
- <xs:element name="transition">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element name="condition">
- <xs:complexType mixed="true">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="expression" type="xs:string" />
- </xs:complexType>
- </xs:element>
- <xs:group ref="action-elements"/>
- <xs:element ref="exception-handler" />
- </xs:choice>
- <xs:attribute name="to" type="xs:string" use="required" />
- <xs:attribute name="name" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <!-- ACTIONS -->
- <!-- ####### -->
- <xs:element name="action">
- <xs:complexType mixed="true">
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="class" type="xs:string" />
- <xs:attribute name="config-type" default="field" type="xs:string" />
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="ref-name" type="xs:string" />
- <xs:attribute name="accept-propagated-events" type="booleanType" default="true" />
- <xs:attribute name="expression" type="xs:string" />
- <xs:attribute name="async" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="cancel-timer">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="create-timer">
- <xs:complexType>
- <xs:choice minOccurs="0">
- <xs:element ref="action"/>
- <xs:element ref="script"/>
- </xs:choice>
- <xs:attribute name="duedate" type="xs:string" use="required" />
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="repeat" type="xs:string" />
- <xs:attribute name="transition" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="script">
- <xs:complexType mixed="true">
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="accept-propagated-events" type="booleanType" default="true" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="mail">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="subject" />
- <xs:element ref="text" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="async" type="xs:string" default="false" />
- <xs:attribute name="template" type="xs:string"/>
- <xs:attribute name="actors" type="xs:string"/>
- <xs:attribute name="to" type="xs:string"/>
- <xs:attribute name="subject" type="xs:string"/>
- <xs:attribute name="text" type="xs:string"/>
- </xs:complexType>
- </xs:element>
-
- <!-- EVENT -->
- <!-- ##### -->
- <xs:element name="event">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:group ref="action-elements"/>
- </xs:choice>
- <xs:attribute name="type" use="required">
- <xs:simpleType>
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:string"/>
- </xs:simpleType>
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="node-enter"/>
- <xs:enumeration value="node-leave"/>
- <xs:enumeration value="process-start"/>
- <xs:enumeration value="process-end"/>
- <xs:enumeration value="task-create"/>
- <xs:enumeration value="task-assign"/>
- <xs:enumeration value="task-start"/>
- <xs:enumeration value="task-end"/>
- <xs:enumeration value="before-signal"/>
- <xs:enumeration value="after-signal"/>
- <xs:enumeration value="superstate-enter"/>
- <xs:enumeration value="superstate-leave"/>
- <xs:enumeration value="timer-create"/>
- <xs:enumeration value="subprocess-created"/>
- <xs:enumeration value="subprocess-end"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
-
- <!-- EXCEPTION-HANDLER -->
- <!-- ################# -->
- <xs:element name="exception-handler">
- <xs:complexType>
- <xs:choice minOccurs="1" maxOccurs="unbounded">
- <xs:element ref="action"/>
- <xs:element ref="script"/>
- </xs:choice>
- <xs:attribute name="exception-class" type="xs:string"/>
- </xs:complexType>
- </xs:element>
-
- <!-- TASK -->
- <!-- #### -->
- <xs:element name="task">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="description" />
- <xs:element ref="assignment"/>
- <xs:element ref="controller"/>
- <xs:element ref="event"/>
- <xs:element ref="timer"/>
- <xs:element name="reminder">
- <xs:complexType>
- <xs:attribute name="duedate" type="xs:string" use="required" />
- <xs:attribute name="repeat" type="xs:string" />
- </xs:complexType>
- </xs:element>
- </xs:choice>
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="blocking" type="booleanType" default="false"/>
- <xs:attribute name="signalling" type="booleanType" default="true"/>
- <xs:attribute name="description" type="xs:string" />
- <xs:attribute name="duedate" type="xs:string" />
- <xs:attribute name="swimlane" type="xs:string" />
- <xs:attribute name="priority" type="priorityType" default="normal" />
- <xs:attribute name="notify" type="booleanType" default="false"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="controller" type="delegation" />
-
- <xs:element name="assignment">
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="delegation">
- <xs:attribute name="expression" type="xs:string" />
- <xs:attribute name="actor-id" type="xs:string" />
- <xs:attribute name="pooled-actors" type="xs:string" />
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <!-- TIMER -->
- <!-- ##### -->
- <xs:element name="timer">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="1">
- <xs:group ref="action-elements" />
- </xs:choice>
- <xs:attribute name="duedate" type="xs:string" use="required" />
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="repeat" type="xs:string" />
- <xs:attribute name="transition" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="variable">
- <xs:complexType>
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="access" type="xs:string" default="read,write"/>
- <xs:attribute name="mapped-name" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <!-- MAIL -->
- <!-- #### -->
- <xs:element name="to" type="xs:string"/>
- <xs:element name="recipients" type="xs:string"/>
- <xs:element name="subject" type="xs:string"/>
- <xs:element name="text" type="xs:string"/>
- <xs:element name="template" type="xs:string"/>
-
- <!-- TYPES AND GROUPS -->
- <!-- ################ -->
-
- <xs:element name="description" type="xs:string" />
-
- <xs:complexType name="delegation" mixed="true">
- <xs:sequence>
- <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="class" type="xs:string" />
- <xs:attribute name="config-type" default="field" type="xs:string" />
- </xs:complexType>
-
- <xs:simpleType name="configType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="field"/>
- <xs:enumeration value="bean"/>
- <xs:enumeration value="constructor"/>
- <xs:enumeration value="configuration-property"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="booleanType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="yes"/>
- <xs:enumeration value="no"/>
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- <xs:enumeration value="on"/>
- <xs:enumeration value="off"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="priorityType">
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="highest"/>
- <xs:enumeration value="high"/>
- <xs:enumeration value="normal"/>
- <xs:enumeration value="low"/>
- <xs:enumeration value="lowest"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType>
- <xs:restriction base="xs:int"/>
- </xs:simpleType>
- </xs:union>
- </xs:simpleType>
-
- <xs:group name="node-elements">
- <xs:choice>
- <xs:element ref="node"/>
- <xs:element ref="state"/>
- <xs:element ref="task-node"/>
- <xs:element ref="super-state"/>
- <xs:element ref="process-state"/>
- <xs:element ref="fork"/>
- <xs:element ref="join"/>
- <xs:element ref="decision"/>
- <xs:element ref="end-state"/>
- <xs:element ref="mail-node"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="action-elements">
- <xs:choice>
- <xs:element ref="action"/>
- <xs:element ref="script"/>
- <xs:element ref="create-timer"/>
- <xs:element ref="cancel-timer"/>
- <xs:element ref="mail"/>
- </xs:choice>
- </xs:group>
-
- <xs:group name="node-content-elements">
- <xs:choice>
- <xs:element ref="description" />
- <xs:element ref="event"/>
- <xs:element ref="exception-handler"/>
- <xs:element ref="timer"/>
- <xs:element ref="transition"/>
- </xs:choice>
- </xs:group>
-
- <xs:simpleType name="bindingType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="late"/>
- <xs:enumeration value="early"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:simpleType name="lockMode">
- <xs:restriction base="xs:string">
- <xs:enumeration value="NONE"/>
- <xs:enumeration value="READ"/>
- <xs:enumeration value="UPGRADE"/>
- <xs:enumeration value="UPGRADE_NOWAIT"/>
- <xs:enumeration value="FORCE"/>
- <xs:enumeration value="pessimistic"/>
- </xs:restriction>
- </xs:simpleType>
-</xs:schema>
15 years, 1 month
JBoss JBPM SVN: r4344 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/task and 10 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-03-27 12:12:52 -0400 (Fri, 27 Mar 2009)
New Revision: 4344
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Participant.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignmenthandler/TaskAssignmentHandlerTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/cancel/TaskCancelTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java
Log:
Console integration: Reflect task participation model
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -47,7 +47,9 @@
/** only find tasks for which the given user is a candidate */
TaskQuery candidate(String userId);
-
+
+ TaskQuery candidateGroups(List<String> groups);
+
TaskQuery page(int firstResult, int maxResults);
TaskQuery orderAsc(String property);
TaskQuery orderDesc(String property);
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -47,11 +47,11 @@
Task newTask();
/** Creates a new subtask for the given task.
- * Make sure that the super task is saved before the
+ * Make sure that the parent task is saved before the
* {@link Task#getDbid() dbid} is taken.
* The returned task will be transient.
* Use {@link #saveTask(Task)} to persist the task. */
- Task newTask(long superTaskDbid);
+ Task newTask(long parentTaskDbid);
/** Saves the given task to persistent storage.
* @return the taskDbid */
@@ -65,7 +65,7 @@
/** assigns this task to the given asignee. */
void assignTask(long taskDbid, String assigneeUserId);
- /** Deletes this task, marks the related history task as completed.
+ /** Deletes this task, marks the related history task as completed.
* If the task was created in the context
* of a process execution, this operation may result in a process instance
* being triggered. */
@@ -132,16 +132,22 @@
/** create a new query for tasks */
TaskQuery createTaskQuery();
- /** retrieves the personal task of the given user, which might be different
- * then the current authenticated user. E.g. when a manager wants to
- * look at a subordinate's task list. */
- List<Task> getPersonalTaskList(String userId, int firstResult, int maxResults);
+ /**
+ * retrieves a list of tasks assigned to a particular user
+ */
+ List<Task> getAssigneeTaskList(String userId, int firstResult, int maxResults);
- /** retrieves the group task of the given user.
- * The user id will be resolved to a set of candidate identities
- * by the identity spi. */
- List<Task> getGroupTaskList(String userId, int firstResult, int maxResults);
+ /**
+ * retrieves a list of unassigned tasks for a candidate user.
+ * */
+ List<Task> getUserTaskList(String userId, int firstResult, int maxResults);
+ /**
+ * retrieves a list of unassigned tasks for
+ * a candidate group or a list of candidate groups.
+ */
+ List<Task> getGroupTaskList(List<String> groupIds, int firstResult, int maxResults);
+
/** get the subtasks for this task. Only goes one level deep at a time. */
List<Task> getSubTasks(long taskDbid);
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Participant.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Participant.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Participant.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -53,6 +53,6 @@
IdentityRef getIdentityRef();
- /** see contants for default participations */
+ /** see constants for default participations */
String getParticipation();
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -43,7 +43,7 @@
Execution execution = executionService.startProcessInstanceByKey("TaskAssignee", variables);
String executionId = execution.getId();
- List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ List<Task> taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(1, taskList.size());
Task task = taskList.get(0);
assertEquals("review", task.getName());
@@ -53,7 +53,7 @@
taskService.completeTask(task.getDbid());
// verify that the task list is now empty
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(0, taskList.size());
// verify that process moved to the next state
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignmenthandler/TaskAssignmentHandlerTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignmenthandler/TaskAssignmentHandlerTest.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignmenthandler/TaskAssignmentHandlerTest.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -36,7 +36,7 @@
executionService.startProcessInstanceByKey("TaskAssignmentHandler");
- List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ List<Task> taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(1, taskList.size());
Task task = taskList.get(0);
assertEquals("review", task.getName());
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/cancel/TaskCancelTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/cancel/TaskCancelTest.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/cancel/TaskCancelTest.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -21,14 +21,6 @@
*/
package org.jbpm.examples.task.cancel;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.Execution;
-import org.jbpm.examples.task.assignee.Order;
-import org.jbpm.history.HistoryActivityInstance;
-import org.jbpm.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -44,7 +36,7 @@
Execution execution = executionService.startProcessInstanceByKey("TaskCancel");
String executionId = execution.getId();
- Task task = taskService.getPersonalTaskList("johndoe",0,1).get(0);
+ Task task = taskService.getAssigneeTaskList("johndoe",0,1).get(0);
executionService.signalExecutionById(executionId);
@@ -67,7 +59,7 @@
taskService.submitTask(task.getDbid());
// verify that the task list is now empty
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(0, taskList.size());
// verify that process moved to the next state
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -22,6 +22,7 @@
package org.jbpm.examples.task.candidates;
import java.util.List;
+import java.util.ArrayList;
import org.jbpm.Execution;
import org.jbpm.task.Task;
@@ -48,13 +49,16 @@
Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
String executionId = execution.getId();
-
- List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+
+ List<String> groupIds = new ArrayList<String>();
+ groupIds.add(salesGroupId);
+
+ List<Task> taskList = taskService.getGroupTaskList(groupIds, 0, 10);
assertEquals("Expected a single task being created", 1, taskList.size());
Task task = taskList.get(0);
assertEquals("review", task.getName());
- taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ taskList = taskService.getGroupTaskList(groupIds, 0, 10);
assertEquals("Expected a single task being created", 1, taskList.size());
task = taskList.get(0);
assertEquals("review", task.getName());
@@ -63,13 +67,13 @@
taskService.assignTask(task.getDbid(), "johndoe");
// verify that the group task lists are now empty
- taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ taskList = taskService.getGroupTaskList(groupIds, 0, 10);
assertEquals("Expected a no task to remain", 0, taskList.size());
- taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ taskList = taskService.getGroupTaskList(groupIds, 0, 10);
assertEquals("Expected a no task to remain",0, taskList.size());
// verify that the task now shows up in the personal task list for johndoe
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(1, taskList.size());
task = taskList.get(0);
assertEquals("review", task.getName());
@@ -79,11 +83,12 @@
taskService.completeTask(task.getDbid());
// verify that the task list is now empty
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(0, taskList.size());
// verify that process moved to the next state
execution = executionService.findExecution(executionId);
assertEquals("wait", execution.getActivityName());
}
+
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -22,6 +22,7 @@
package org.jbpm.examples.task.swimlane;
import java.util.List;
+import java.util.ArrayList;
import org.jbpm.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -42,15 +43,18 @@
deployJpdlResource("org/jbpm/examples/task/swimlane/process.jpdl.xml");
executionService.startProcessInstanceByKey("TaskSwimlane");
-
- List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+
+ List<String> groupIds = new ArrayList<String>();
+ groupIds.add(salesGroupId);
+
+ List<Task> taskList = taskService.getGroupTaskList(groupIds, 0, 10);
assertEquals(1, taskList.size());
Task task = taskList.get(0);
long taskDbid = task.getDbid();
assertEquals("enter order data", task.getName());
assertNull(task.getAssignee());
- assertEquals(0, taskService.getPersonalTaskList("johndoe", 0, 10).size());
+ assertEquals(0, taskService.getAssigneeTaskList("johndoe", 0, 10).size());
// lets assume that johndoe takes the task
taskService.assignTask(taskDbid, "johndoe");
@@ -61,10 +65,10 @@
// to know the context of this case
// we'll check that the group task lists for johndoe and joesmoe are empty
- assertEquals(0, taskService.getGroupTaskList("johndoe", 0, 10).size());
+ assertEquals(0, taskService.getGroupTaskList(groupIds, 0, 10).size());
// and that the task is directly assigned to johndoe
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(1, taskList.size());
task = taskList.get(0);
assertEquals("enter order data", task.getName());
@@ -73,7 +77,7 @@
// submit the task
taskService.completeTask(taskDbid);
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(1, taskList.size());
task = taskList.get(0);
assertEquals("calculate quote", task.getName());
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/variables/TaskVariablesTest.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -45,7 +45,8 @@
variables.put("dollars", 100000);
Execution execution = executionService.startProcessInstanceByKey("TaskVariables", variables);
- List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ List<Task> taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
+ assertFalse("Task list for assignee was empty", taskList.isEmpty());
Task task = taskList.get(0);
long taskDbid = task.getDbid();
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -24,12 +24,13 @@
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.TaskRef;
+import org.jboss.bpm.console.client.model.ParticipantRef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
import org.jbpm.model.OpenExecution;
import org.jbpm.model.OpenProcessDefinition;
import org.jbpm.model.Transition;
-import org.jbpm.task.Task;
+import org.jbpm.task.*;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -91,6 +92,7 @@
tok.setId(topLevelExecution.getId());
tok.setCurrentNodeName( topLevelExecution.getActivityName() );
+ // transitions
List<String> availableSignals = new ArrayList<String>();
for(Transition t : topLevelExecution.getActivity().getOutgoingTransitions())
{
@@ -106,10 +108,8 @@
TaskRef task = new TaskRef();
task.setId( t0.getDbid() );
task.setName( t0.getName());
- task.setActor( t0.getAssignee() );
+ task.setAssignee( t0.getAssignee() );
-
- // TODO: verify usage
TaskImpl cast = ((TaskImpl) t0);
task.setSignalling( cast.isSignalling());
@@ -118,7 +118,37 @@
// TODO: weird API
task.setProcessId( execution.getProcessInstance().getProcessInstance().getId() );
-
+
+
+ // participants
+ for(Participant p0 : cast.getParticipants())
+ {
+ if(p0.getParticipation().equals(Participant.CANDIDATE))
+ {
+ IdentityRef idRef = p0.getIdentityRef();
+ ParticipantRef participant = new ParticipantRef("candidate", idRef.getId());
+
+ if(idRef instanceof GroupRef)
+ {
+ task.getParticipantGroups().add(participant);
+ }
+ else if(idRef instanceof UserRef)
+ {
+ participant.setGroup(true);
+ task.getParticipantUsers().add(participant);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown IdentityRef: " + idRef);
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown participation type: " +p0.getParticipation());
+ }
+
+ }
+
return task;
}
}
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -24,8 +24,9 @@
import org.jboss.bpm.console.server.integration.TaskManagement;
import org.jboss.bpm.console.client.model.TaskRef;
import org.jbpm.TaskService;
-import org.jbpm.pvm.internal.env.Authentication;
-import org.jbpm.task.Task;
+import org.jbpm.IdentityService;
+import org.jbpm.identity.Group;
+import org.jbpm.task.*;
import java.util.List;
import java.util.ArrayList;
@@ -35,20 +36,61 @@
*/
public class TaskManagementImpl extends JBPMIntegration implements TaskManagement
{
- public List<TaskRef> getTasksByActor(String actorName)
+ public List<TaskRef> getTasksForIdentity(String idRef)
{
+ return internalGetTaskForIdentity(idRef, null);
+ }
+
+ public List<TaskRef> getTasksForIdentity(String idRef, String participationType)
+ {
+ return internalGetTaskForIdentity(idRef, participationType);
+ }
+
+ private List<TaskRef> internalGetTaskForIdentity(String idRef, String participationType)
+ {
TaskService taskService = this.processEngine.get(TaskService.class);
+ List<TaskRef> results = new ArrayList<TaskRef>();
- // TODO: Paging
- List<Task> tasks = taskService.getPersonalTaskList(actorName, 0 , 100);
- List<TaskRef> actualTasks = new ArrayList<TaskRef>();
+ if(null==participationType || participationType.equals(Participant.CANDIDATE))
+ {
+ // TODO: Paging
+ List<Task> assignedTasks = taskService.getAssigneeTaskList(idRef, 0 , 100);
+ List<Task> userTasks = taskService.getUserTaskList(idRef, 0 , 100);
+ List<Task> groupTasks = taskService.getGroupTaskList(getGroupIdsForIdentityRef(idRef), 0 , 100);
+
+ adoptTasks(assignedTasks, results);
+ adoptTasks(userTasks, results);
+ adoptTasks(groupTasks, results);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown participation type: " +participationType);
+ }
+
+ return results;
+ }
+
+ private void adoptTasks(List<Task> tasks, List<TaskRef> results)
+ {
for(Task t0 : tasks)
{
- actualTasks.add( ModelAdaptor.adoptTask(t0) );
+ results.add( ModelAdaptor.adoptTask(t0) );
}
- return actualTasks;
}
+ private List<String> getGroupIdsForIdentityRef(String idRef)
+ {
+ IdentityService idService = this.processEngine.get(IdentityService.class);
+ List<Group> groups = idService.findGroupsByUser(idRef);
+ List<String> groupIds = new ArrayList<String>();
+ for(Group g : groups)
+ {
+ groupIds.add(g.getId());
+ }
+
+ return groupIds;
+ }
+
public TaskRef getTaskById(long taskId)
{
TaskService taskService = this.processEngine.get(TaskService.class);
@@ -56,17 +98,29 @@
return ModelAdaptor.adoptTask(t0);
}
- public void reassignTask(long taskId, String actorId)
+ public void assignTask(long taskId, String idRef)
{
TaskService taskService = this.processEngine.get(TaskService.class);
+ taskService.assignTask(taskId, idRef);
+ }
- taskService.assignTask(taskId, actorId);
+ public void releaseTask(long taskId)
+ {
+ TaskService taskService = this.processEngine.get(TaskService.class);
+ taskService.assignTask(taskId, null);
}
- public void closeTask(long taskId, String signalName)
+ public void completeTask(long taskId, String outcome)
{
TaskService taskService = this.processEngine.get(TaskService.class);
- // TODO. Signaling?
+ taskService.completeTask(taskId, outcome);
+ }
+
+
+ public void completeTask(long taskId)
+ {
+ TaskService taskService = this.processEngine.get(TaskService.class);
taskService.completeTask(taskId);
}
+
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -29,23 +29,7 @@
import org.jbpm.TaskQuery;
import org.jbpm.TaskService;
import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.cmd.AddParticipantCmd;
-import org.jbpm.pvm.internal.cmd.AddReplyCommentCmd;
-import org.jbpm.pvm.internal.cmd.AddTaskCommentCmd;
-import org.jbpm.pvm.internal.cmd.CancelTaskCmd;
-import org.jbpm.pvm.internal.cmd.CompleteTaskCmd;
-import org.jbpm.pvm.internal.cmd.DeleteCommentCmd;
-import org.jbpm.pvm.internal.cmd.GetParticipantsCmd;
-import org.jbpm.pvm.internal.cmd.GetSubTasksCmd;
-import org.jbpm.pvm.internal.cmd.GetTaskCmd;
-import org.jbpm.pvm.internal.cmd.GetTaskCommentsCmd;
-import org.jbpm.pvm.internal.cmd.GetVariableNamesCmd;
-import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
-import org.jbpm.pvm.internal.cmd.NewTaskCmd;
-import org.jbpm.pvm.internal.cmd.RemoveParticipantCmd;
-import org.jbpm.pvm.internal.cmd.SaveTaskCmd;
-import org.jbpm.pvm.internal.cmd.SetVariablesCmd;
-import org.jbpm.pvm.internal.cmd.AssignTaskCmd;
+import org.jbpm.pvm.internal.cmd.*;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.task.TaskQueryImpl;
import org.jbpm.task.IdentityRef;
@@ -107,31 +91,32 @@
commandService.execute(cmd);
}
- public void addSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
- AddParticipantCmd cmd = new AddParticipantCmd(null, szimlaneDbid, identityRef, participation);
+ public void addSwimlaneParticipant(long swimlaneDbid, IdentityRef identityRef, String participation) {
+ AddParticipantCmd cmd = new AddParticipantCmd(null, swimlaneDbid, identityRef, participation);
commandService.execute(cmd);
}
- public List<Participant> getSwimlaneParticipants(long szimlaneDbid) {
- GetParticipantsCmd cmd = new GetParticipantsCmd(null, szimlaneDbid);
+ public List<Participant> getSwimlaneParticipants(long swimlaneDbid) {
+ GetParticipantsCmd cmd = new GetParticipantsCmd(null, swimlaneDbid);
return commandService.execute(cmd);
}
- public void removeSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
- RemoveParticipantCmd cmd = new RemoveParticipantCmd(null, szimlaneDbid, identityRef, participation);
+ public void removeSwimlaneParticipant(long swimlaneDbid, IdentityRef identityRef, String participation) {
+ RemoveParticipantCmd cmd = new RemoveParticipantCmd(null, swimlaneDbid, identityRef, participation);
commandService.execute(cmd);
}
- public List<Task> getPersonalTaskList(String userId, int firstResult, int maxResults) {
+ public List<Task> getAssigneeTaskList(String identityRefId, int firstResult, int maxResults) {
return createTaskQuery()
- .assignee(userId)
+ .assignee(identityRefId)
.orderDesc(TaskQuery.PROPERTY_PRIORITY)
.page(firstResult, maxResults)
.execute();
}
- public List<Task> getGroupTaskList(String userId, int firstResult, int maxResults) {
- return createTaskQuery()
+ public List<Task> getUserTaskList(String userId, int firstResult, int maxResults)
+ {
+ return createTaskQuery()
.unassigned()
.candidate(userId)
.orderDesc(TaskQuery.PROPERTY_PRIORITY)
@@ -139,6 +124,15 @@
.execute();
}
+ public List<Task> getGroupTaskList(List<String> groupIds, int firstResult, int maxResults) {
+ return createTaskQuery()
+ .unassigned()
+ .candidateGroups(groupIds)
+ .orderDesc(TaskQuery.PROPERTY_PRIORITY)
+ .page(firstResult, maxResults)
+ .execute();
+ }
+
public TaskQuery createTaskQuery() {
return new TaskQueryImpl(commandService);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -72,6 +72,7 @@
protected String description;
protected String assignee;
+ protected String nomination;
protected Set<ParticipantImpl> participants;
protected Date create;
@@ -126,7 +127,8 @@
}
// participants /////////////////////////////////////////////////////////////
-
+
+ // TODO: Why does it return the impl. not the interface?
public Set<ParticipantImpl> getParticipants() {
if (participants==null) {
return Collections.emptySet();
@@ -471,4 +473,5 @@
public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
this.taskDefinition = taskDefinition;
}
+
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -21,48 +21,53 @@
*/
package org.jbpm.pvm.internal.task;
-import java.util.ArrayList;
-import java.util.List;
-
import org.hibernate.Query;
import org.jbpm.TaskQuery;
import org.jbpm.cmd.CommandService;
-import org.jbpm.env.Environment;
-import org.jbpm.identity.Group;
-import org.jbpm.pvm.internal.identity.spi.IdentitySession;
import org.jbpm.pvm.internal.query.AbstractQuery;
import org.jbpm.pvm.internal.query.Page;
import org.jbpm.task.Task;
+import java.util.List;
+
/**
* @author Tom Baeyens
*/
public class TaskQueryImpl extends AbstractQuery implements TaskQuery {
-
+
private static final long serialVersionUID = 1L;
private static final String UNASSIGNED = "unassigned";
protected String assignee = null;
protected String candidate = null;
-
+
protected List<String> groupIds = null;
public TaskQueryImpl(CommandService commandService) {
super(commandService);
}
-
+
public TaskQuery assignee(String assignee) {
this.assignee = assignee;
return this;
}
-
+
public TaskQuery candidate(String userId) {
this.candidate = userId;
return this;
}
+ public TaskQuery candidateGroups(List<String> groups)
+ {
+ if(candidate!=null)
+ throw new IllegalArgumentException("Illegal query: Can either select by candiate or candidateGroup, not both");
+
+ this.groupIds = groups;
+ return this;
+ }
+
public TaskQuery unassigned() {
this.assignee = UNASSIGNED;
return this;
@@ -92,6 +97,11 @@
query.setString("assignee", assignee);
}
+ if(candidate!=null)
+ {
+ query.setString("candidate", candidate);
+ }
+
if (groupIds!=null) {
query.setParameterList("groupIds", groupIds);
}
@@ -103,32 +113,32 @@
hql.append("from ");
hql.append(TaskImpl.class.getName());
hql.append(" as task ");
-
- if (candidate!=null) {
+
+ // participants
+ if(candidate!=null || groupIds!=null)
+ {
hql.append(", ");
hql.append(ParticipantImpl.class.getName());
hql.append(" as participant ");
-
+
appendWhereClause("participant.task = task ", hql);
appendWhereClause("participant.participation = 'candidate' ", hql);
-
- IdentitySession identitySession = Environment.getFromCurrent(IdentitySession.class);
- List<Group> groups = identitySession.findGroupsByUser(candidate);
- if (!groups.isEmpty()) {
- groupIds = new ArrayList<String>();
- for (Group g: groups) {
- groupIds.add(g.getId());
- }
- appendWhereClause("(participant.userId = '"+candidate+"' or participant.groupId in (:groupIds) ) ", hql);
+
+ if(candidate!=null)
+ {
+ appendWhereClause("(participant.userId = :candidate)", hql);
}
+ else if (groupIds!=null && !groupIds.isEmpty()) {
+ appendWhereClause("(participant.groupId in (:groupIds) ) ", hql);
+ }
}
-
+
if (assignee==UNASSIGNED) {
appendWhereClause("task.assignee is null ", hql);
} else if (assignee!=null) {
appendWhereClause("task.assignee = :assignee ", hql);
}
-
+
appendOrderByClause(hql);
return hql.toString();
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -52,12 +52,12 @@
Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
String executionId = execution.getId();
- List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ List<Task> taskList = taskService.getUserTaskList("johndoe", 0, 10);
assertEquals(1, taskList.size());
Task task = taskList.get(0);
assertEquals("review", task.getName());
- taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ taskList = taskService.getUserTaskList("joesmoe", 0, 10);
assertEquals(1, taskList.size());
task = taskList.get(0);
assertEquals("review", task.getName());
@@ -66,13 +66,13 @@
taskService.assignTask(task.getDbid(), "johndoe");
// verify that the group task lists are now empty
- taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ taskList = taskService.getUserTaskList("johndoe", 0, 10);
assertEquals(0, taskList.size());
- taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ taskList = taskService.getUserTaskList("joesmoe", 0, 10);
assertEquals(0, taskList.size());
// verify that the task now shows up in the personal task list for johndoe
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(1, taskList.size());
task = taskList.get(0);
assertEquals("review", task.getName());
@@ -82,7 +82,7 @@
taskService.completeTask(task.getDbid());
// verify that the task list is now empty
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(0, taskList.size());
// verify that process moved to the next state
@@ -110,12 +110,12 @@
Execution execution = executionService.startProcessInstanceByKey("TaskCandidates", variables);
String executionId = execution.getId();
- List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ List<Task> taskList = taskService.getUserTaskList("johndoe", 0, 10);
assertEquals(1, taskList.size());
Task task = taskList.get(0);
assertEquals("review", task.getName());
- taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ taskList = taskService.getUserTaskList("joesmoe", 0, 10);
assertEquals(1, taskList.size());
task = taskList.get(0);
assertEquals("review", task.getName());
@@ -124,13 +124,13 @@
taskService.assignTask(task.getDbid(), "johndoe");
// verify that the group task lists are now empty
- taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ taskList = taskService.getUserTaskList("johndoe", 0, 10);
assertEquals(0, taskList.size());
- taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ taskList = taskService.getUserTaskList("joesmoe", 0, 10);
assertEquals(0, taskList.size());
// verify that the task now shows up in the personal task list for johndoe
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(1, taskList.size());
task = taskList.get(0);
assertEquals("review", task.getName());
@@ -140,7 +140,7 @@
taskService.completeTask(task.getDbid());
// verify that the task list is now empty
- taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertEquals(0, taskList.size());
// verify that process moved to the next state
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java 2009-03-27 16:11:26 UTC (rev 4343)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java 2009-03-27 16:12:52 UTC (rev 4344)
@@ -53,13 +53,13 @@
task.setAssignee("joesmoe");
saveAndRegisterTask(task);
- List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ List<Task> taskList = taskService.getAssigneeTaskList("johndoe", 0, 10);
assertNotNull(taskList);
assertEquals("do laundry", taskList.get(0).getName());
assertEquals(1, taskList.size());
- taskList = taskService.getPersonalTaskList("joesmoe", 0, 10);
+ taskList = taskService.getAssigneeTaskList("joesmoe", 0, 10);
assertNotNull(taskList);
assertContainsTask(taskList, "get good idea");
@@ -100,7 +100,7 @@
task.setPriority(10);
saveAndRegisterTask(task);
- List<Task> taskList = taskService.getPersonalTaskList("joesmoe", 0, 10);
+ List<Task> taskList = taskService.getAssigneeTaskList("joesmoe", 0, 10);
assertNotNull(taskList);
// default sort order is based on the priority
15 years, 1 month
JBoss JBPM SVN: r4343 - in projects/gwt-console/trunk: plugin-api/src/main/java/org/jboss/bpm/console/client/model and 7 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-03-27 12:11:26 -0400 (Fri, 27 Mar 2009)
New Revision: 4343
Added:
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ParticipantRef.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskListFacade.java
Removed:
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/forms/
projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestDTOParser.java
Modified:
projects/gwt-console/trunk/plugin-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/trunk/plugin-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRef.java
projects/gwt-console/trunk/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/TaskManagementTest.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentCallback.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
projects/gwt-console/trunk/war/src/main/resources/jmaki/xhp/xhp.json
Log:
JBPM-2126: Migrate console integration API to participation model
Modified: projects/gwt-console/trunk/plugin-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/plugin-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/plugin-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -100,32 +100,36 @@
return getConsoleServerUrl() + "/rs/process/definitions/new";
}
- public String getTaskListByActorURL(String actor)
+ public String getTaskListURL(String idRef)
{
- return getConsoleServerUrl() + "/rs/tasks/actor/" + URL.encode(actor);
+ return getConsoleServerUrl() + "/rs/tasks/" + URL.encode(idRef);
}
- public String getTaskFormDefURL(long processId, long taskId)
+ public String getParticipationTaskListURL(String idRef, String participation)
{
- return getConsoleServerUrl() + "/rs/tasks/forms/" + processId + "/" + taskId;
+ return getConsoleServerUrl() + "/rs/tasks/" + URL.encode(idRef) +"/participation/"+URL.encode(participation);
}
- public String getTaskEndURL(long id)
+ public String getTaskReleaseURL(long id)
{
- return getConsoleServerUrl() + "/rs/tasks/" + id + "/close/transition/default";
+ return getConsoleServerUrl() + "/rs/task/" + id + "/release";
}
- public String getTaskEndURL(long id, String signalName)
+ public String getTaskCompleteURL(long id)
{
- return getConsoleServerUrl() + "/rs/tasks/" + id + "/close/transition?signal=" + URL.encode(signalName);
+ return getConsoleServerUrl() + "/rs/task/" + id + "/close";
}
- public String getTaskAssignmentURL(long id, String actor)
+ public String getTaskCompleteURL(long id, String outcome)
{
- String actualActor = actor == null ? "" : "/" + actor;
- return getConsoleServerUrl() + "/rs/tasks/" + id + "/assignment" + URL.encode(actualActor);
+ return getConsoleServerUrl() + "/rs/task/" + id + "/close/" + URL.encode(outcome);
}
+ public String getTaskAssignURL(long id, String idRef)
+ {
+ return getConsoleServerUrl() + "/rs/task/" + id + "/assign/" + URL.encode(idRef);
+ }
+
public String getExecutionSignalUrl(TokenReference tok)
{
return getConsoleServerUrl() + "/rs/process/tokens/" + adoptExecutionId(tok.getId()) + "/transition/default";
Modified: projects/gwt-console/trunk/plugin-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
===================================================================
--- projects/gwt-console/trunk/plugin-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/plugin-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -23,8 +23,6 @@
import com.google.gwt.json.client.*;
import org.jboss.bpm.console.client.util.ConsoleLog;
-import org.jboss.bpm.console.client.model.forms.FieldDef;
-import org.jboss.bpm.console.client.model.forms.FormDef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
import org.jboss.bpm.console.client.util.JSONWalk;
@@ -99,44 +97,51 @@
public static TaskRef parseTaskReference(JSONObject item)
{
- long id = JSONWalk.on(item).next("id").asLong();
- long tokenId = JSONWalk.on(item).next("tokenId").asLong();
- String instanceId = JSONWalk.on(item).next("processInstanceId").asString();
+ long id = JSONWalk.on(item).next("id").asLong();
+ String executionId = JSONWalk.on(item).next("processInstanceId").asString();
String processId = JSONWalk.on(item).next("processId").asString();
String name = JSONWalk.on(item).next("name").asString();
- String actor = JSONWalk.on(item).next("actor").asString();
+ String assignee = JSONWalk.on(item).next("assignee").asString();
boolean isBlocking = JSONWalk.on(item).next("isBlocking").asBool();
boolean isSignalling = JSONWalk.on(item).next("isSignalling").asBool();
TaskRef ref = new TaskRef(
- id, tokenId, instanceId,
+ id, executionId,
processId,
- name, actor,
+ name, assignee,
isSignalling, isBlocking
);
- // pooled actors
- JSONArray pooledActors = JSONWalk.on(item).next("pooledActors").asArray();
- for (int k = 0; k < pooledActors.size(); ++k)
+ // participant users
+ JSONArray arrUsers = JSONWalk.on(item).next("participantUsers").asArray();
+ for (int k = 0; k < arrUsers.size(); ++k)
{
- JSONValue jsonValue = pooledActors.get(k);
- JSONString t = jsonValue.isString();
- ref.addPooledActor(t.stringValue());
+ JSONValue jsonValue = arrUsers.get(k);
+ ParticipantRef p = parseParticipant(jsonValue, k);
+ ref.getParticipantUsers().add(p);
}
+ JSONArray arrGroups = JSONWalk.on(item).next("participantGroups").asArray();
+ for (int k = 0; k < arrGroups.size(); ++k)
+ {
+ JSONValue jsonValue = arrGroups.get(k);
+ ParticipantRef p = parseParticipant(jsonValue, k);
+ ref.getParticipantGroups().add(p);
+ }
+
if (isSignalling)
{
- JSONArray arr = JSONWalk.on(item).next("transitionNames").asArray();
+ JSONArray arr = JSONWalk.on(item).next("outcomes").asArray();
for (int k = 0; k < arr.size(); ++k)
{
JSONValue jsonValue = arr.get(k);
if (jsonValue.toString().equals("null"))
{
- ConsoleLog.debug("FIXME JBPM-1828: Null value on transitionNames:" + arr.toString());
+ ConsoleLog.debug("FIXME JBPM-1828: Null value on outcomes:" + arr.toString());
continue; // TODO: JBPM-1828
}
JSONString t = jsonValue.isString();
- ref.getTransitionNames().add(t.stringValue());
+ ref.getOutcomes().add(t.stringValue());
}
}
@@ -144,55 +149,18 @@
return ref;
}
- public static Map<String, String> parseFormMapping(String json)
+ private static ParticipantRef parseParticipant(JSONValue jsonValue, int k)
{
- //[{"name":"update erp","value":"form.raise.erp-update.xhtml"}]
+ String type = JSONWalk.on(jsonValue).next("type").asString();
+ String idRef = JSONWalk.on(jsonValue).next("idRef").asString();
+ ParticipantRef p = new ParticipantRef(type, idRef);
- throw new RuntimeException("Not implemented");
-
+ boolean isGroup = JSONWalk.on(jsonValue).next("isGroup").asBool();
+ p.setGroup(isGroup);
+
+ return p;
}
- public static FormDef parseFormDef(String json)
- {
- return parseFormDef(JSONParser.parse(json));
- }
-
- public static FormDef parseFormDef(JSONValue root)
- {
- // {"formName":"taskform-15",
- // "fields":[
- // {"varname":"amount","label":"FirstName","required":true,"inputType":"TEXT",
- // "dataTypeClass":"java.lang.String","defaults":[]}
- // ]}
-
- String formName = JSONWalk.on(root).next("formName").asString();
- FormDef formDef = new FormDef(formName);
-
- JSONArray array = JSONWalk.on(root).next("fields").asArray();
- for (int i = 0; i < array.size(); i++)
- {
- JSONObject item = array.get(i).isObject();
-
- // fieldDefs
- String label = JSONWalk.on(item).next("label").asString();
- String varName = JSONWalk.on(item).next("varname").asString();
- boolean required = JSONWalk.on(item).next("required").asBool();
- FieldDef.InputType inputType = FieldDef.InputType.valueOf(
- JSONWalk.on(item).next("inputType").asString()
- );
-
- String dataType = JSONWalk.on(item).next("dataTypeClass").asString();
-
- // TODO: Parse defaults
-
- formDef.getFields().add(
- new FieldDef(label, varName, inputType, dataType, required)
- );
- }
-
- return formDef;
- }
-
public static ProcessInstanceRef parseProcessInstance(JSONObject root)
{
ConsoleLog.debug("parse " + root);
Added: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ParticipantRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ParticipantRef.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ParticipantRef.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.model;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ParticipantRef
+{
+ private String type;
+ private String idRef;
+ private boolean isGroup;
+
+ public ParticipantRef()
+ {
+ }
+
+ public ParticipantRef(String type, String idRef)
+ {
+ this.type = type;
+ this.idRef = idRef;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getIdRef()
+ {
+ return idRef;
+ }
+
+ public void setIdRef(String idRef)
+ {
+ this.idRef = idRef;
+ }
+
+ public boolean isGroup()
+ {
+ return isGroup;
+ }
+
+ public void setGroup(boolean group)
+ {
+ isGroup = group;
+ }
+}
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRef.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskRef.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -31,185 +31,163 @@
@XmlRootElement(name = "taskReference")
public class TaskRef
{
- private long id;
- private long tokenId;
- private String processInstanceId;
- private String processId;
+ private long id;
+ private String processInstanceId;
+ private String processId;
- private String name;
- private String actor = "";
+ private String name;
+ private String assignee = "";
- private boolean isBlocking;
- private boolean isSignalling = true;
+ private boolean isBlocking;
+ private boolean isSignalling = true;
- private List<String> transitionNames = new ArrayList<String>();
- private List<String> pooledActors = new ArrayList<String>();
+ private List<String> outcomes = new ArrayList<String>();
- public enum STATE {OPEN, ASSIGNED, CLOSED};
- private STATE currentState;
+ public enum STATE {OPEN, ASSIGNED, CLOSED};
+ private STATE currentState;
- public TaskRef()
- {
- initOrUpdateState();
- }
+ private List<ParticipantRef> participantUsers = new ArrayList<ParticipantRef>();
+ private List<ParticipantRef> participantGroups = new ArrayList<ParticipantRef>();
+
+ public TaskRef()
+ {
+ initOrUpdateState();
+ }
- public TaskRef(
- long taskId, long tokenId, String processInstanceId,
- String processId,
- String taskName, String actorName,
- boolean blocking, boolean signalling
- )
- {
- this.id = taskId;
- this.tokenId = tokenId;
- this.processInstanceId = processInstanceId;
- this.processId = processId;
- this.name = taskName;
- setActor(actorName);
- isBlocking = blocking;
- isSignalling = signalling;
+ public TaskRef(
+ long taskId,
+ String processInstanceId, String processId,
+ String taskName, String assignee,
+ boolean blocking, boolean signalling
+ )
+ {
+ this.id = taskId;
+ this.processInstanceId = processInstanceId;
+ this.processId = processId;
+ this.name = taskName;
+ setAssignee(assignee);
+ isBlocking = blocking;
+ isSignalling = signalling;
- initOrUpdateState();
- }
+ initOrUpdateState();
+ }
- public long getId()
- {
- return id;
- }
+ public long getId()
+ {
+ return id;
+ }
- public void setId(long id)
- {
- this.id = id;
- }
+ public void setId(long id)
+ {
+ this.id = id;
+ }
- public long getTokenId()
- {
- return tokenId;
- }
+ public String getProcessInstanceId()
+ {
+ return processInstanceId;
+ }
- public void setTokenId(long tokenId)
- {
- this.tokenId = tokenId;
- }
+ public void setProcessInstanceId(String processInstanceId)
+ {
+ this.processInstanceId = processInstanceId;
+ }
- public String getProcessInstanceId()
- {
- return processInstanceId;
- }
+ public String getName()
+ {
+ return name;
+ }
- public void setProcessInstanceId(String processInstanceId)
- {
- this.processInstanceId = processInstanceId;
- }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
- public String getName()
- {
- return name;
- }
+ public String getAssignee()
+ {
+ return assignee;
+ }
- public void setName(String name)
- {
- this.name = name;
- }
+ public void setAssignee(String assignee)
+ {
+ if(null== assignee)
+ assignee = "";
- public String getActor()
- {
- return actor;
- }
+ this.assignee = assignee;
+ initOrUpdateState();
+ }
- public void setActor(String actor)
- {
- if(null==actor)
- actor = "";
-
- this.actor = actor;
- initOrUpdateState();
- }
+ public boolean isBlocking()
+ {
+ return isBlocking;
+ }
- public boolean isBlocking()
- {
- return isBlocking;
- }
+ public void setBlocking(boolean blocking)
+ {
+ isBlocking = blocking;
+ }
- public void setBlocking(boolean blocking)
- {
- isBlocking = blocking;
- }
+ public boolean isSignalling()
+ {
+ return isSignalling;
+ }
- public boolean isSignalling()
- {
- return isSignalling;
- }
+ public void setSignalling(boolean signalling)
+ {
+ isSignalling = signalling;
+ }
- public void setSignalling(boolean signalling)
- {
- isSignalling = signalling;
- }
+ public List<String> getOutcomes()
+ {
+ return outcomes;
+ }
- public List<String> getTransitionNames()
- {
- return transitionNames;
- }
+ public void setProcessId(String processId)
+ {
+ this.processId = processId;
+ }
- public void setProcessId(String processId)
- {
- this.processId = processId;
- }
+ public List<ParticipantRef> getParticipantUsers()
+ {
+ return participantUsers;
+ }
- public void setTransitionNames(List<String> transitionNames)
- {
- this.transitionNames = transitionNames;
- }
+ public List<ParticipantRef> getParticipantGroups()
+ {
+ return participantGroups;
+ }
- public void setPooledActors(List<String> pooledActors)
- {
- this.pooledActors = pooledActors;
- }
+ private void initOrUpdateState()
+ {
+ if(assignee ==null || assignee.equals(""))
+ {
+ currentState = STATE.OPEN;
+ }
+ else
+ {
+ currentState = STATE.ASSIGNED;
+ }
+ }
- public void addPooledActor(String actorId)
- {
- pooledActors.add(actorId);
+ public void close()
+ {
+ if(STATE.ASSIGNED != currentState)
+ throw new IllegalArgumentException("Cannot close task in state " + currentState);
- initOrUpdateState();
- }
+ currentState = STATE.CLOSED;
+ }
- private void initOrUpdateState()
- {
- if(actor==null || actor.equals(""))
- {
- currentState = STATE.OPEN;
- }
- else
- {
- currentState = STATE.ASSIGNED;
- }
- }
+ public String getProcessId()
+ {
+ return processId;
+ }
- public void close()
- {
- if(STATE.ASSIGNED != currentState)
- throw new IllegalArgumentException("Cannot close task in state " + currentState);
+ public STATE getCurrentState()
+ {
+ return currentState;
+ }
- currentState = STATE.CLOSED;
- }
-
- public String getProcessId()
- {
- return processId;
- }
-
- public STATE getCurrentState()
- {
- return currentState;
- }
-
- public String toString()
- {
- return "TaskRef{id:"+id+",state:"+currentState+"}";
- }
-
- public List<String> getPooledActors()
- {
- return pooledActors;
- }
+ public String toString()
+ {
+ return "TaskRef{id:"+id+",state:"+currentState+"}";
+ }
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -27,31 +27,32 @@
/**
* JAX-RS core component.
- *
+ *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public class ConsoleServerApplication extends Application
{
- HashSet<Object> singletons = new HashSet<Object>();
+ HashSet<Object> singletons = new HashSet<Object>();
- public ConsoleServerApplication()
- {
- singletons.add(new ProcessMgmtFacade());
- singletons.add(new TaskMgmtFacade());
- singletons.add(new UserMgmtFacade());
- singletons.add(new TestFacade());
- }
+ public ConsoleServerApplication()
+ {
+ singletons.add(new ProcessMgmtFacade());
+ singletons.add(new TaskListFacade());
+ singletons.add(new TaskMgmtFacade());
+ singletons.add(new UserMgmtFacade());
+ singletons.add(new TestFacade());
+ }
- @Override
- public Set<Class<?>> getClasses()
- {
- HashSet<Class<?>> set = new HashSet<Class<?>>();
- return set;
- }
+ @Override
+ public Set<Class<?>> getClasses()
+ {
+ HashSet<Class<?>> set = new HashSet<Class<?>>();
+ return set;
+ }
- @Override
- public Set<Object> getSingletons()
- {
- return singletons;
- }
+ @Override
+ public Set<Object> getSingletons()
+ {
+ return singletons;
+ }
}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskListFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskListFacade.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskListFacade.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.server;
+
+import com.google.gson.Gson;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.client.model.TaskRefWrapper;
+import org.jboss.bpm.console.server.gson.GsonFactory;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
+import org.jboss.bpm.console.server.integration.TaskManagement;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+
+/**
+ * REST server module for accessing task related data.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@Path("tasks")
+public class TaskListFacade
+{
+ private static final Log log = LogFactory.getLog(TaskMgmtFacade.class);
+
+ private TaskManagement taskManagement;
+
+ /**
+ * Lazy load the {@link org.jboss.bpm.console.server.integration.TaskManagement}
+ */
+ private TaskManagement getTaskManagement()
+ {
+ if(null==this.taskManagement)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.taskManagement = factory.createTaskManagement();
+ log.debug("Using ManagementFactory impl:" + factory.getClass().getName());
+ }
+
+ return this.taskManagement;
+ }
+
+ @GET
+ @Path("{idRef}")
+ @Produces("application/json")
+ public Response getTasksForIdRef(
+ @PathParam("idRef")
+ String idRef
+ )
+ {
+ TaskRefWrapper wrapper =
+ new TaskRefWrapper(getTaskManagement().getTasksForIdentity(idRef));
+ return createJsonResponse(wrapper);
+ }
+
+ @GET
+ @Path("{idRef}/participation/{type}")
+ @Produces("application/json")
+ public Response getTasksForIdRefAndParticipation(
+ @PathParam("idRef")
+ String idRef,
+ @PathParam("type")
+ String participationType
+ )
+ {
+ TaskRefWrapper wrapper =
+ new TaskRefWrapper(getTaskManagement().getTasksForIdentity(idRef, participationType));
+ return createJsonResponse(wrapper);
+ }
+
+ private Response createJsonResponse(Object wrapper)
+ {
+ Gson gson = GsonFactory.createInstance();
+ String json = gson.toJson(wrapper);
+ return Response.ok(json).type("application/json").build();
+ }
+}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -37,99 +37,88 @@
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-@Path("tasks")
+@Path("task")
public class TaskMgmtFacade
{
- private static final Log log = LogFactory.getLog(TaskMgmtFacade.class);
+ private static final Log log = LogFactory.getLog(TaskMgmtFacade.class);
- private TaskManagement taskManagement;
+ private TaskManagement taskManagement;
- /**
- * Lazy load the {@link org.jboss.bpm.console.server.integration.ProcessManagement}
- */
- private TaskManagement getTaskManagement()
- {
- if(null==this.taskManagement)
- {
- ManagementFactory factory = ManagementFactory.newInstance();
- this.taskManagement = factory.createTaskManagement();
- log.debug("Using ManagementFactory impl:" + factory.getClass().getName());
- }
+ /**
+ * Lazy load the {@link org.jboss.bpm.console.server.integration.TaskManagement}
+ */
+ private TaskManagement getTaskManagement()
+ {
+ if(null==this.taskManagement)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.taskManagement = factory.createTaskManagement();
+ log.debug("Using ManagementFactory impl:" + factory.getClass().getName());
+ }
- return this.taskManagement;
- }
+ return this.taskManagement;
+ }
- @GET
- @Path("actor/{actorName}")
- @Produces("application/json")
- public Response getTasksForActor(
- @PathParam("actorName")
- String actorName
- )
- {
- TaskRefWrapper wrapper =
- new TaskRefWrapper(getTaskManagement().getTasksByActor(actorName));
- return createJsonResponse(wrapper);
- }
+ @POST
+ @Path("{taskId}/assign/{ifRef}")
+ @Produces("application/json")
+ public Response assignTask(
+ @PathParam("taskId")
+ long taskId,
+ @PathParam("ifRef")
+ String idRef
+ )
+ {
+ log.debug("Assign task " + taskId + " to '" + idRef +"'");
+ getTaskManagement().assignTask(taskId, idRef);
+ return Response.ok().build();
+ }
- @POST
- @Path("{taskId}/assignment/{actorId}")
- @Produces("application/json")
- public Response assignTask(
- @PathParam("taskId")
- long taskId,
- @PathParam("actorId")
- String actorId
- )
- {
- log.debug("Reassign task " + taskId + " to '" + actorId +"'");
- getTaskManagement().reassignTask(taskId, actorId);
- return Response.ok().build();
- }
+ @POST
+ @Path("{taskId}/release")
+ @Produces("application/json")
+ public Response releaseTask(
+ @PathParam("taskId")
+ long taskId
+ )
+ {
+ log.debug("Release task " + taskId);
+ getTaskManagement().assignTask(taskId, null);
+ return Response.ok().build();
+ }
- @POST
- @Path("{taskId}/assignment")
- @Produces("application/json")
- public Response releaseTask(
- @PathParam("taskId")
- long taskId
- )
- {
- log.debug("Release task " + taskId);
- getTaskManagement().reassignTask(taskId, null);
- return Response.ok().build();
- }
+ @POST
+ @Path("{taskId}/close")
+ @Produces("application/json")
+ public Response closeTask(
+ @PathParam("taskId")
+ long taskId
+ )
+ {
+ log.debug("Close task " + taskId );
+ getTaskManagement().completeTask(taskId);
+ return Response.ok().build();
+ }
- @POST
- @Path("{taskId}/close/transition/default")
- @Produces("application/json")
- public Response closeTask(
- @PathParam("taskId")
- long taskId
- )
- {
- return closeTaskWithSignal(taskId, null);
- }
+ @POST
+ @Path("{taskId}/close/{outcome}")
+ @Produces("application/json")
+ public Response closeTaskWithSignal(
+ @PathParam("taskId")
+ long taskId,
+ @QueryParam("outcome")
+ String outcome
+ )
+ {
+ log.debug("Close task " + taskId + " outcome " + outcome);
+ getTaskManagement().completeTask(taskId, outcome);
+ return Response.ok().build();
+ }
- @POST
- @Path("{taskId}/close/transition")
- @Produces("application/json")
- public Response closeTaskWithSignal(
- @PathParam("taskId")
- long taskId,
- @QueryParam("signal")
- String signalName
- )
- {
- log.debug("Close task " + taskId);
- getTaskManagement().closeTask(taskId, signalName);
- return Response.ok().build();
- }
-
- private Response createJsonResponse(Object wrapper)
- {
- Gson gson = GsonFactory.createInstance();
- String json = gson.toJson(wrapper);
- return Response.ok(json).type("application/json").build();
- }
+ private Response createJsonResponse(Object wrapper)
+ {
+ Gson gson = GsonFactory.createInstance();
+ String json = gson.toJson(wrapper);
+ return Response.ok(json).type("application/json").build();
+ }
}
Modified: projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/TaskManagementTest.java
===================================================================
--- projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/TaskManagementTest.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/server/src/test/java/org/jboss/bpm/console/server/TaskManagementTest.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -70,7 +70,7 @@
}
assertNotNull(match);
- List<String> transitions = match.getTransitionNames();
+ List<String> transitions = match.getOutcomes();
assertFalse(transitions.isEmpty());
assertTrue(transitions.size()==1);
assertEquals("to_end", transitions.get(0));
Modified: projects/gwt-console/trunk/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java
===================================================================
--- projects/gwt-console/trunk/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/server-integration/src/main/java/org/jboss/bpm/console/server/integration/TaskManagement.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -29,12 +29,18 @@
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public interface TaskManagement
-{
- List<TaskRef> getTasksByActor(String actorName);
+{
+ TaskRef getTaskById(long taskId);
- TaskRef getTaskById(long taskId);
+ void assignTask(long taskId, String idRef);
- void reassignTask(long taskId, String actorId);
-
- void closeTask(long taskId, String signalName);
+ void releaseTask(long taskId);
+
+ void completeTask(long taskId);
+
+ void completeTask(long taskId, String outcome);
+
+ List<TaskRef> getTasksForIdentity(String idRef);
+
+ List<TaskRef> getTasksForIdentity(String idRef, String participationType);
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentCallback.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentCallback.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentCallback.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -29,4 +29,6 @@
void onAssignmentDone();
void onTaskEnd();
+
+ void onReleaseDone();
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/AssignmentFormPanel.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -21,25 +21,27 @@
*/
package org.jboss.bpm.console.client.task;
-import org.jboss.bpm.console.client.util.ConsoleLog;
-import org.jboss.bpm.console.client.util.ModelListenerRegistry;
import com.google.gwt.http.client.*;
-import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.json.client.JSONValue;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.data.Record;
-import com.gwtext.client.widgets.*;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.Container;
+import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.event.PanelListenerAdapter;
import com.gwtext.client.widgets.form.Form;
import com.gwtext.client.widgets.form.FormPanel;
import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.ParticipantRef;
import org.jboss.bpm.console.client.model.TaskRef;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.util.ModelChangeListener;
+import org.jboss.bpm.console.client.util.ModelListenerRegistry;
import org.jboss.bpm.console.client.widgets.FormWidgets;
-import org.jboss.bpm.console.client.util.ModelChangeListener;
import org.jboss.bpm.console.client.widgets.RefreshableComboBox;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -54,7 +56,7 @@
private ApplicationContext mainView;
private AssignmentCallback callback;
- private List<String> availableActors;
+ private List<ParticipantRef> availableAssignees;
private TaskRef selectedInstance;
public AssignmentFormPanel(ApplicationContext mainView, AssignmentCallback callback)
@@ -63,15 +65,15 @@
this.mainView = mainView;
this.callback = callback;
- setTitle("Reassign Task");
+ setTitle("Assign User");
setBorder(false);
setFrame(false);
- setIconCls("bpm-tools-icon");
+ setIconCls("bpm-tools-icon");
// ---------------
formPanel = FormWidgets.createBaseFormPanel();
- RefreshableComboBox cb = new RefreshableComboBox("actorId", "Actor");
+ RefreshableComboBox cb = new RefreshableComboBox("assignee", "Assignee");
formPanel.add(cb);
final Button assignBtn = new Button("Delegate",
@@ -81,12 +83,12 @@
public void onClick(Button button, EventObject eventObject)
{
Form form = formPanel.getForm();
- RefreshableComboBox cb = (RefreshableComboBox) form.findField("actorId");
+ RefreshableComboBox cb = (RefreshableComboBox) form.findField("assignee");
String rawValue = cb.getRawValue();
if (null == rawValue || rawValue.equals(""))
{
- MessageBox.alert("Please select an actor.");
+ MessageBox.alert("Please select an assignee.");
return;
}
@@ -118,20 +120,14 @@
public void onModelChange(ModelListenerRegistry parent, Object changeEvent)
{
selectedInstance = (TaskRef) changeEvent;
- availableActors = null;
+ availableAssignees = null;
- boolean hasPooledActors = selectedInstance.getPooledActors().size() > 0;
- if (hasPooledActors)
+ boolean hasParticipants = selectedInstance.getParticipantGroups().size() > 0;
+ if (hasParticipants)
{
- // has pooled actors -> can be asigned to pooled actors only
- availableActors = selectedInstance.getPooledActors();
- }
- else if (!hasPooledActors &&
- TaskRef.STATE.ASSIGNED == selectedInstance.getCurrentState())
- {
- // no pooled actors but an assigned actor
- loadActors();
- }
+ // has pooled actors -> can be assigned to pooled actors only
+ availableAssignees = selectedInstance.getParticipantGroups();
+ }
else
{
// no pooled actors and no assignee
@@ -149,6 +145,8 @@
// ignore
}
+ /*
+ TODO: What's this?
private void loadActors()
{
String url = mainView.getUrlBuilder().getAvailableActorsUrl(mainView.getAuthentication().getUsername());
@@ -181,25 +179,35 @@
{
ConsoleLog.error("Request failed", e1);
}
- }
+ } */
private void refreshComboBox()
{
- if (null == availableActors)
+ if (null == availableAssignees)
throw new IllegalArgumentException("available actors cannot be null");
if (isRendered())
{
Form form = formPanel.getForm();
RefreshableComboBox cb = (RefreshableComboBox) form.findField("actorId");
- cb.display(availableActors);
+
+ List<String> items = new ArrayList<String>(availableAssignees.size());
+ for(int i=0; i< availableAssignees.size(); i++)
+ {
+ ParticipantRef participantRef = availableAssignees.get(i);
+ // TODO: only users are assignable, otherwise we need to fetch all user for each group
+ if(participantRef.isGroup() == false)
+ items.add(participantRef.getIdRef());
+ }
+
+ cb.display(items);
}
}
private void reassignTask(long taskId, String actor)
{
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,
- mainView.getUrlBuilder().getTaskAssignmentURL(taskId, actor)
+ mainView.getUrlBuilder().getTaskAssignURL(taskId, actor)
);
try
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailsFormPanel.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -80,7 +80,7 @@
nameField.setReadOnly(true);
formPanel.add(nameField);
- TextField actorField = new TextField("Actor", "actor", 230);
+ TextField actorField = new TextField("Assignee", "assignee", 230);
actorField.setReadOnly(true);
formPanel.add(actorField);
@@ -89,7 +89,7 @@
formPanel.add(stateField);
// ----------
- RefreshableComboBox cb = new RefreshableComboBox("signal", "Signal");
+ RefreshableComboBox cb = new RefreshableComboBox("outcome", "Outcome");
formPanel.add(cb);
startBtn = new Button("Claim",
@@ -103,8 +103,8 @@
MessageBox.alert("Please select a task.");
return;
}
- selectedInstance.setActor(mainView.getAuthentication().getUsername());
- reassignTask();
+ selectedInstance.setAssignee(mainView.getAuthentication().getUsername());
+ assignTask();
}
}
);
@@ -120,8 +120,8 @@
MessageBox.alert("Please select a task.");
return;
}
- selectedInstance.setActor(null);
- reassignTask();
+ selectedInstance.setAssignee(null);
+ releaseTask();
}
}
);
@@ -140,10 +140,10 @@
selectedInstance.close();
- ComboBox cb = (ComboBox) formPanel.getForm().findField("signal");
+ ComboBox cb = (ComboBox) formPanel.getForm().findField("outcome");
String signalName = cb.getRawValue();
if (signalName.equals(""))
- MessageBox.alert("Please select a signal to end this task");
+ MessageBox.alert("Please select an outcome to end this task");
else
endTask(signalName);
}
@@ -157,11 +157,11 @@
this.add(formPanel);
}
- private void reassignTask()
+ private void assignTask()
{
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,
- mainView.getUrlBuilder().getTaskAssignmentURL(
- selectedInstance.getId(), selectedInstance.getActor()
+ mainView.getUrlBuilder().getTaskAssignURL(
+ selectedInstance.getId(), selectedInstance.getAssignee()
)
);
@@ -174,7 +174,7 @@
public void onResponseReceived(Request request, Response response)
{
if (200 != response.getStatusCode())
- ConsoleLog.error("Failed to reassign task: " + response.getStatusText());
+ ConsoleLog.error("Failed to assign task: " + response.getStatusText());
selectedInstance = null;
callback.onAssignmentDone();
@@ -193,11 +193,46 @@
}
}
- private void endTask(String signalName)
+ private void releaseTask()
+ {
+ RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,
+ mainView.getUrlBuilder().getTaskReleaseURL(selectedInstance.getId())
+ );
+
+ try
+ {
+ rb.sendRequest("",
+ new RequestCallback()
+ {
+
+ public void onResponseReceived(Request request, Response response)
+ {
+ if (200 != response.getStatusCode())
+ ConsoleLog.error("Failed to release task: " + response.getStatusText());
+
+ selectedInstance = null;
+ callback.onReleaseDone();
+ }
+
+ public void onError(Request request, Throwable t)
+ {
+ // Unknown error
+ ConsoleLog.error("Unknown error", t);
+ }
+ });
+ }
+ catch (RequestException e1)
+ {
+ ConsoleLog.error("Request failed", e1);
+ }
+ }
+
+
+ private void endTask(String outcome)
{
- String taskCloseURL = signalName.equals(UIConstants.DEFAULT_TRANSITION) ?
- mainView.getUrlBuilder().getTaskEndURL(selectedInstance.getId()) :
- mainView.getUrlBuilder().getTaskEndURL(selectedInstance.getId(), signalName);
+ String taskCloseURL = outcome.equals(UIConstants.DEFAULT_TRANSITION) ?
+ mainView.getUrlBuilder().getTaskCompleteURL(selectedInstance.getId()) :
+ mainView.getUrlBuilder().getTaskCompleteURL(selectedInstance.getId(), outcome);
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, taskCloseURL);
@@ -235,9 +270,9 @@
selectedInstance = TaskList.transform(changeEvent);
Form form = formPanel.getForm();
- RefreshableComboBox cb = (RefreshableComboBox) form.findField("signal");
+ RefreshableComboBox cb = (RefreshableComboBox) form.findField("outcome");
- if (selectedInstance.getPooledActors().isEmpty())
+ if (selectedInstance.getParticipantGroups().isEmpty())
{
// no group assignment available
startBtn.disable();
@@ -258,7 +293,7 @@
endBtn.disable();
}
- cb.display(selectedInstance.getTransitionNames());
+ cb.display(selectedInstance.getOutcomes());
formPanel.getForm().loadRecord(changeEvent);
formPanel.doLayout();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -182,6 +182,11 @@
resetEditor();
}
+ public void onReleaseDone()
+ {
+ resetEditor();
+ }
+
class TaskTree extends TreePanel
{
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -70,7 +70,7 @@
this.setFrame(false);
this.setIconCls("bpm-task-icon");
- String resourceUrl = appContext.getUrlBuilder().getTaskListByActorURL(appContext.getAuthentication().getUsername());
+ String resourceUrl = appContext.getUrlBuilder().getTaskListURL(appContext.getAuthentication().getUsername());
DataProxy dataProxy = new ScriptTagProxy(resourceUrl, 1000*10);
final Reader reader = createReader();
@@ -132,7 +132,7 @@
{
new ColumnConfig("ID", "id", 35, true),
new ColumnConfig("Task Name", "name", 290, true, null, "expand"),
- new ColumnConfig("Assigned to", "actor", 75, true),
+ new ColumnConfig("Assigned to", "assignee", 75, true),
new ColumnConfig("State", "currentState", 50, true)
}
);
@@ -145,7 +145,7 @@
new FieldDef[]{
new IntegerFieldDef("id"),
new StringFieldDef("name"),
- new StringFieldDef("actor"),
+ new StringFieldDef("assignee"),
new StringFieldDef("currentState")
}
);
Modified: projects/gwt-console/trunk/war/src/main/resources/jmaki/xhp/xhp.json
===================================================================
--- projects/gwt-console/trunk/war/src/main/resources/jmaki/xhp/xhp.json 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/war/src/main/resources/jmaki/xhp/xhp.json 2009-03-27 16:11:26 UTC (rev 4343)
@@ -4,8 +4,8 @@
{"id": "default",
"url":"http://localhost:8080/gwt-console-server",
"passthrough":true,
- "username":"admin",
- "password":"admin"
+ "username":"peter",
+ "password":"password"
},
{"id": "birt",
"url":"http://localhost:8080/report",
Deleted: projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestDTOParser.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestDTOParser.java 2009-03-27 13:19:48 UTC (rev 4342)
+++ projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestDTOParser.java 2009-03-27 16:11:26 UTC (rev 4343)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.client;
-
-import com.google.gwt.junit.client.GWTTestCase;
-import org.jboss.bpm.console.client.model.DTOParser;
-import org.jboss.bpm.console.client.model.TaskRef;
-import org.jboss.bpm.console.client.model.forms.FormDef;
-
-import java.util.List;
-
-
-public class GwtTestDTOParser extends GWTTestCase {
-
- public String getModuleName() {
- return "org.jboss.bpm.console.Application";
- }
-
- public void testRolesAssgnedParsing()
- {
- // {"roles":[{"isAssigned":true,"role":"admin"},{"isAssigned":true,"role":"user"}]}
-
- String json = "{\"roles\":[{\"isAssigned\":true,\"role\":\"admin\"},{\"isAssigned\":true,\"role\":\"user\"}]}";
- List<String> roles = DTOParser.parseRolesAssigned(json);
- assertTrue(roles.size() == 2);
- }
-
- public void testTaskRefParsing()
- {
- String json = "{\"tasks\":[{\"id\":14,\"tokenId\":6,\"processInstanceId\":4,\"id\":2,\"name\":\"manager evaluation\",\"actor\":\"manager\",\"isBlocking\":false,\"isSignalling\":true,\"transitionNames\":[\"reject\",\"approve\"],\"pooledActors\":[\"hr\",\"sales\"]}]}";
- List<TaskRef> result = DTOParser.parseTaskReferenceList(json);
- assertTrue("Failed to parse TaskReferenceList", result.size()==1);
- assertTrue("Failed to parse transitionNames", result.get(0).getTransitionNames().size()==2);
- assertFalse("Failed to parse pooledActors", result.get(0).getPooledActors().isEmpty());
-
- }
-
- public void testForDefParsing()
- {
- // {"formName":"taskform-15","fields":[{"varname":"amount","required":true,"inputType":"TEXT","dataTypeClass":"java.lang.String","defaults":[]},{"varname":"reason","required":true,"inputType":"TEXTAREA","dataTypeClass":"java.lang.String","defaults":[]}]}
-
- String json = "{\"formName\":\"taskform-14\",\"fields\":[{\"label\":\"Amount:\",\"varname\":\"amount\",\"required\":true,\"inputType\":\"TEXT\",\"dataTypeClass\":\"java.lang.String\",\"defaults\":[]}]}";
-
- /*
- TODO: clean source code imports into GWT
-
- FormDef form = new FormDef("myform-14");
- form.getFields().add( new FieldDef(
- "FirstName", "firstname",
- FieldDef.InputType.TEXT, String.class.getName(),
- true
- ) );
-
- String json = getGSONParser().toJson(form);
- System.out.println("!!! " + json);
- */
-
- FormDef formDef = DTOParser.parseFormDef(json);
- System.out.println(formDef.getFields());
- }
-}
15 years, 1 month
JBoss JBPM SVN: r4342 - in jbpm4/branches/tbaeyens/modules: api/src/main/java/org/jbpm/session and 14 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-03-27 09:19:48 -0400 (Fri, 27 Mar 2009)
New Revision: 4342
Removed:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
Modified:
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinition.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java
jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml
jbpm4/branches/tbaeyens/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java
jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
Log:
revisiting deployment
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinition.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinition.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinition.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -30,12 +30,6 @@
*/
public interface ProcessDefinition extends Serializable {
- /** the optional package name of this process. This can be used to create
- * hierarchy of process categories for easy lookup. This is a
- * similar way of grouping and creating a structure as in Java.
- * We recommend the same conventions as with Java package names. */
- String getPackageName();
-
/** the short display name given to this process definition.
* Multiple process definitions can have the same as long
* as they are given a different {@link #version}. */
@@ -54,8 +48,4 @@
* the same {@link ObservableElement#getId() name}. */
int getVersion();
- /** the description name given to this process definition.
- * Multiple process definitions can have the same */
- String getDescription();
-
}
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessDefinitionQuery.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -28,17 +28,21 @@
*/
public interface ProcessDefinitionQuery {
- String PROPERTY_NAME = "name";
- String PROPERTY_KEY = "key";
- String PROPERTY_PACKAGENAME = "packageName";
- String PROPERTY_VERSION = "version";
- String PROPERTY_DEPLOYMENTTIME = "deploymentTime";
+ String PROPERTY_ID = "idProperty.stringValue";
+ String PROPERTY_KEY = "keyProperty.stringValue";
+ String PROPERTY_NAME = "idProperty.objectName";
+ String PROPERTY_VERSION = "versionProperty.longValue";
+ String PROPERTY_DEPLOYMENT_TIMESTAMP = "deployment.timestamp";
+ ProcessDefinitionQuery id(String id);
+ ProcessDefinitionQuery key(String key);
ProcessDefinitionQuery nameLike(String name);
- ProcessDefinitionQuery keyLike(String key);
ProcessDefinitionQuery orderAsc(String property);
ProcessDefinitionQuery orderDesc(String property);
+
+ ProcessDefinitionQuery page(int firstResult, int maxResults);
List<ProcessDefinition> execute();
+ ProcessDefinition uniqueResult();
}
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/RepositoryService.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -35,4 +35,6 @@
InputStream getResourceAsStream(long deploymentDbid, String resourceName);
+ ProcessDefinitionQuery createProcessDefinitionQuery();
+
}
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/session/RepositorySession.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -25,6 +25,8 @@
import java.util.List;
import org.jbpm.Deployment;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.client.ClientProcessDefinition;
/**
@@ -36,9 +38,13 @@
Object getObject(long deploymentDbid, String objectName);
+ InputStream getResourceAsStream(long deploymentDbid, String resourceName);
+
+ ProcessDefinitionQuery createProcessDefinitionQuery();
+
+
List<String> findObjectNames(String propertyKey, String propertyValue);
List<String> findObjectPropertyValues(String objectName, String propertyKey);
Object findObjectByPropertyValue(String propertyKey, String propertyValue);
-
- InputStream getResourceAsStream(long deploymentDbid, String resourceName);
+ ClientProcessDefinition findLatestProcessDefinitionByKey(String processDefinitionKey);
}
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml 2009-03-27 13:19:48 UTC (rev 4342)
@@ -43,7 +43,8 @@
index="IDX_DEPLPROP_DEPL" />
<property name="objectName" column="OBJNAME_" />
<property name="key" column="KEY_" />
- <property name="value" column="VALUE_" />
+ <property name="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
</class>
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.repository.hbm.xml 2009-03-27 13:19:48 UTC (rev 4342)
@@ -43,7 +43,8 @@
index="IDX_DEPLPROP_DEPL" />
<property name="objectName" column="OBJNAME_" />
<property name="key" column="KEY_" />
- <property name="value" column="VALUE_" />
+ <property name="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
</class>
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -49,10 +49,9 @@
def.setId( p0.getId() );
def.setName(p0.getName());
def.setVersion(p0.getVersion());
-
def.setKey( p0.getKey() );
- def.setDescription(p0.getDescription());
- def.setPackageName(p0.getPackageName());
+ // def.setDescription(p0.getDescription());
+ // def.setPackageName(p0.getPackageName());
return def;
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -24,6 +24,8 @@
import java.io.InputStream;
import java.util.List;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.env.Environment;
import org.jbpm.internal.log.Log;
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
@@ -60,21 +62,25 @@
processDefinition.setDeploymentDbid(deployment.getDbid());
- String key = deployment.getObjectProperty(processDefinitionName, "jpdl.key");
- if (key != null) {
- String id = deployment.getObjectProperty(processDefinitionName, "jpdl.id");
+ if (deployment.hasObjectProperties(processDefinitionName)) {
+ String key = (String) deployment.getObjectProperty(processDefinitionName, "key");
+ String id = (String) deployment.getObjectProperty(processDefinitionName, "id");
+ String version = (String) deployment.getObjectProperty(processDefinitionName, "version");
processDefinition.setId(id);
processDefinition.setKey(key);
- deployment.addObject(processDefinitionName, processDefinition);
+ processDefinition.setVersion(Integer.parseInt(version));
} else {
checkKey(processDefinition, deployment);
+ checkVersion(processDefinition, deployment);
checkId(processDefinition, deployment);
- deployment.addObject(processDefinitionName, processDefinition);
- deployment.addObjectProperty(processDefinitionName, "jpdl.key", processDefinition.getKey());
- deployment.addObjectProperty(processDefinitionName, "jpdl.id", processDefinition.getId());
+ deployment.addObjectProperty(processDefinitionName, "key", processDefinition.getKey());
+ deployment.addObjectProperty(processDefinitionName, "version", new Long(processDefinition.getVersion()));
+ deployment.addObjectProperty(processDefinitionName, "id", processDefinition.getId());
}
+
+ deployment.addObject(processDefinitionName, processDefinition);
}
}
}
@@ -111,8 +117,8 @@
protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
String id = processDefinition.getId();
if (id==null) {
- id = processDefinition.getKey()+"-"+deployment.getDbid();
- log.trace("created id '"+id+"' for "+processDefinition);
+ id = processDefinition.getKey()+"-"+processDefinition.getVersion();
+ if (log.isTraceEnabled()) log.trace("created id '"+id+"' for "+processDefinition);
processDefinition.setId(id);
}
@@ -121,4 +127,27 @@
deployment.addProblem("process '" + id + "' already exists");
}
}
+
+ protected void checkVersion(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+ int version = processDefinition.getVersion();
+ String key = processDefinition.getKey();
+ if (version==ProcessDefinitionImpl.UNASSIGNED_VERSION) {
+ RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+
+ ProcessDefinition latestDeployedVersion = repositorySession
+ .createProcessDefinitionQuery()
+ .key(key)
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .page(0, 1)
+ .uniqueResult();
+
+ if (latestDeployedVersion!=null) {
+ version = latestDeployedVersion.getVersion() + 1;
+ } else {
+ version = 1;
+ }
+ if (log.isTraceEnabled()) log.trace("assigning version "+version+" to process definition "+key);
+ processDefinition.setVersion(version);
+ }
+ }
}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml 2009-03-27 13:19:48 UTC (rev 4342)
@@ -43,7 +43,8 @@
index="IDX_DEPLPROP_DEPL" />
<property name="objectName" column="OBJNAME_" />
<property name="key" column="KEY_" />
- <property name="value" column="VALUE_" />
+ <property name="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
</class>
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -56,7 +56,7 @@
RepositorySession repositorySession = environment.get(RepositorySession.class);
processDefinition = (ClientProcessDefinition) repositorySession
- .findObjectByPropertyValue("jpdl.key", processDefinitionKey);
+ .findObjectByPropertyValue("key", processDefinitionKey);
if (processDefinition==null) {
throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -1024,7 +1024,7 @@
&& (processDefinitionId!=null)
) {
RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
- processDefinition = (ProcessDefinitionImpl) repositorySession.findObjectByPropertyValue("jpdl.id", processDefinitionId);
+ processDefinition = (ProcessDefinitionImpl) repositorySession.findObjectByPropertyValue("id", processDefinitionId);
if (processDefinition==null) {
throw new JbpmException("couldn't find process definition "+processDefinitionId+" in the repository");
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -22,9 +22,11 @@
package org.jbpm.pvm.internal.query;
import java.io.ObjectStreamException;
+import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
+import org.jbpm.ProcessDefinition;
import org.jbpm.cmd.Command;
import org.jbpm.cmd.CommandService;
import org.jbpm.env.Environment;
@@ -37,6 +39,7 @@
private static final long serialVersionUID = 1L;
+ protected Session session;
protected CommandService commandService;
protected String orderByClause = null;
protected Page page = null;
@@ -46,6 +49,10 @@
this.commandService = commandService;
}
+ public AbstractQuery(Session session) {
+ this.session = session;
+ }
+
protected abstract void applyParameters(Query query);
public abstract String hql();
@@ -53,20 +60,31 @@
/* reuse by copy and paste:
* (return type can't be changed)
public ConcreteQuery page(int firstResult, int maxResults) {
- this.page = new Page{firstResult, maxResults};
+ this.page = new Page(firstResult, maxResults);
return this;
}
*/
+ public List execute() {
+ if (commandService!=null) {
+ return (List) commandService.execute(this);
+ }
+ return (List) execute(session);
+ }
+
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
+ return execute(session);
+ }
+
+ public Object execute(Session session) {
String hql = hql();
Query query = session.createQuery(hql);
applyParameters(query);
applyPage(query);
return query.list();
}
-
+
protected void appendWhereClause(String whereClause, StringBuffer hql) {
if (isWhereAdded) {
hql.append(" and ");
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -21,13 +21,21 @@
*/
package org.jbpm.pvm.internal.query;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
import org.hibernate.Query;
+import org.hibernate.Session;
+import org.jbpm.JbpmException;
import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.DeploymentProperty;
/**
@@ -37,32 +45,85 @@
private static final long serialVersionUID = 1L;
- private static final String NEWLINE = System.getProperty("line.separator");
-
+ protected String id;
+ protected String key;
protected String nameLike;
- protected String keyLike;
+ protected String versionSortDirection;
public ProcessDefinitionQueryImpl(CommandService commandService) {
super(commandService);
}
- public List<ProcessDefinition> execute() {
- return (List) commandService.execute(this);
+ public ProcessDefinitionQueryImpl(Session session) {
+ super(session);
}
+ public ProcessDefinition uniqueResult() {
+ List list = execute();
+ if (list.isEmpty()) {
+ return null;
+ }
+ if (list.size()>1) {
+ throw new JbpmException("result not unique: "+list.size());
+ }
+ return (ProcessDefinition) list.get(0);
+ }
+
+ public Object execute(Session session) {
+ List<Map<String, Object>> propertyMaps = (List<Map<String, Object>>) super.execute(session);
+
+ List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
+ for (Map<String, Object> properties: propertyMaps) {
+ ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
+ processDefinition.setName((String)properties.get("name"));
+ processDefinition.setKey((String)properties.get("key"));
+ processDefinition.setId((String)properties.get("id"));
+ Long versionLong = (Long)properties.get("version");
+ processDefinition.setVersion(versionLong.intValue());
+
+ processDefinitions.add(processDefinition);
+ }
+
+ return processDefinitions;
+ }
+
public String hql() {
StringBuffer hql = new StringBuffer();
- hql.append("select pd ");
+ hql.append("select new map( idProperty.objectName as name, " +
+ "idProperty.stringValue as id, " +
+ "keyProperty.stringValue as key," +
+ "versionProperty.longValue as version ) ");
hql.append("from ");
- hql.append(ProcessDefinitionImpl.class.getName());
- hql.append(" as pd ");
+ hql.append(DeploymentImpl.class.getName());
+ hql.append(" as deployment, ");
+ hql.append(DeploymentProperty.class.getName());
+ hql.append(" as idProperty, ");
+ hql.append(DeploymentProperty.class.getName());
+ hql.append(" as keyProperty, ");
+ hql.append(DeploymentProperty.class.getName());
+ hql.append(" as versionProperty ");
+
+ appendWhereClause("idProperty.key = 'id'", hql);
+ appendWhereClause("idProperty.deployment = deployment ", hql);
+ appendWhereClause("keyProperty.key = 'key' ", hql);
+ appendWhereClause("keyProperty.objectName = idProperty.objectName ", hql);
+ appendWhereClause("keyProperty.deployment = deployment ", hql);
+
+ appendWhereClause("versionProperty.key = 'version' ", hql);
+ appendWhereClause("versionProperty.objectName = idProperty.objectName ", hql);
+ appendWhereClause("versionProperty.deployment = deployment ", hql);
+
+ if (id!=null) {
+ appendWhereClause("idProperty = '"+id+"'", hql);
+ }
+
if (nameLike!=null) {
- appendWhereClause("pd.name like '"+nameLike+"'", hql);
+ appendWhereClause("idProperty.objectName like '"+nameLike+"' ", hql);
}
- if (keyLike!=null) {
- appendWhereClause("pd.key like '"+keyLike+"'", hql);
+ if (key!=null) {
+ appendWhereClause("keyProperty.stringValue = '"+key+"' ", hql);
}
appendOrderByClause(hql);
@@ -73,23 +134,33 @@
protected void applyParameters(Query query) {
}
- public ProcessDefinitionQuery nameLike(String name) {
- this.nameLike = name;
+ public ProcessDefinitionQuery id(String id) {
+ this.id = id;
return this;
}
- public ProcessDefinitionQuery keyLike(String key) {
- this.keyLike = key;
+ public ProcessDefinitionQuery key(String key) {
+ this.key = key;
return this;
}
+ public ProcessDefinitionQuery nameLike(String name) {
+ this.nameLike = name;
+ return this;
+ }
+
public ProcessDefinitionQuery orderAsc(String property) {
- addOrderByClause("pd."+property+" asc");
+ addOrderByClause(property+" asc");
return this;
}
public ProcessDefinitionQuery orderDesc(String property) {
- addOrderByClause("pd."+property+" desc");
+ addOrderByClause(property+" desc");
return this;
}
+
+ public ProcessDefinitionQuery page(int firstResult, int maxResults) {
+ this.page = new Page(firstResult, maxResults);
+ return this;
+ }
}
Deleted: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.repository;
-
-import org.jbpm.JbpmException;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.repository.DeploymentImpl;
-import org.jbpm.session.RepositorySession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployCmd implements Command<Long> {
-
- private static final long serialVersionUID = 1L;
-
- private static Log log = Log.getLog(DeployCmd.class.getName());
-
- DeploymentImpl deployment;
-
- public DeployCmd(DeploymentImpl deployment) {
- this.deployment = deployment;
- }
-
- public Long execute(Environment environment) throws Exception {
- RepositorySession repositorySession = environment.get(RepositorySession.class);
- long deploymentDbid = repositorySession.deploy(deployment);
-
- if (deployment.hasProblems()) {
- String problemsText = deployment.getProblemsText();
- if (problemsText!=null) {
- String errorMsg = "problems during deployment of "+deployment+": "+problemsText;
- log.info(errorMsg);
- throw new JbpmException(errorMsg);
- }
- }
-
- return deploymentDbid;
- }
-}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -31,10 +31,9 @@
List<Deployer> deployers;
- public Object deploy(DeploymentImpl deployment) {
+ public void deploy(DeploymentImpl deployment) {
for (Deployer deployer: deployers) {
deployer.deploy(deployment);
}
- return null;
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -146,14 +146,16 @@
objects.put(objectName, object);
}
- public void addObjectProperty(String objectName, String key, String value) {
+ public void addObjectProperty(String objectName, String key, Object value) {
if (objectProperties==null) {
objectProperties = new HashSet<DeploymentProperty>();
}
- objectProperties.add(new DeploymentProperty(this, objectName, key, value));
+ DeploymentProperty deploymentProperty = new DeploymentProperty(this, objectName, key);
+ deploymentProperty.setValue(value);
+ objectProperties.add(deploymentProperty);
}
- public String getObjectProperty(String objectName, String key) {
+ public Object getObjectProperty(String objectName, String key) {
if (objectProperties!=null) {
for (DeploymentProperty deploymentProperty: objectProperties) {
if ( (deploymentProperty.getObjectName().equals(objectName))
@@ -166,6 +168,17 @@
return null;
}
+ public boolean hasObjectProperties(String objectName) {
+ if (objectProperties!=null) {
+ for (DeploymentProperty deploymentProperty: objectProperties) {
+ if (deploymentProperty.getObjectName().equals(objectName)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
protected Object writeReplace() throws ObjectStreamException {
commandService = null;
return this;
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -23,7 +23,9 @@
import java.io.Serializable;
+import org.jbpm.JbpmException;
+
/**
* @author Tom Baeyens
*/
@@ -35,20 +37,20 @@
protected DeploymentImpl deployment;
protected String objectName;
protected String key;
- protected String value;
+ protected String stringValue;
+ protected Long longValue;
public DeploymentProperty() {
}
- public DeploymentProperty(DeploymentImpl deployment, String objectName, String key, String value) {
+ public DeploymentProperty(DeploymentImpl deployment, String objectName, String key) {
this.deployment = deployment;
this.objectName = objectName;
this.key = key;
- this.value = value;
}
public String toString() {
- return "{"+objectName+","+key+","+value+"}";
+ return "{"+objectName+","+key+","+(stringValue!=null?stringValue:longValue)+"}";
}
public String getObjectName() {
@@ -57,10 +59,39 @@
public String getKey() {
return key;
}
- public String getValue() {
- return value;
- }
public DeploymentImpl getDeployment() {
return deployment;
}
+ public String getStringValue() {
+ return stringValue;
+ }
+ public Long getLongValue() {
+ return longValue;
+ }
+ public void setStringValue(String stringValue) {
+ this.stringValue = stringValue;
+ }
+ public void setLongValue(Long longValue) {
+ this.longValue = longValue;
+ }
+
+ public void setValue(Object value) {
+ if (value==null) {
+ stringValue = null;
+ longValue = null;
+ } else if (value instanceof String) {
+ stringValue = (String)value;
+ } else if (value instanceof Long) {
+ longValue = (Long)value;
+ } else {
+ throw new JbpmException("value type "+value.getClass().getName()+" not supported (only string and long)");
+ }
+ }
+
+ public Object getValue() {
+ if (stringValue!=null) {
+ return stringValue;
+ }
+ return longValue;
+ }
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -24,9 +24,11 @@
import java.io.InputStream;
import org.jbpm.Deployment;
+import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.RepositoryService;
import org.jbpm.cmd.CommandService;
import org.jbpm.pvm.internal.cmd.GetResourceAsStream;
+import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
/**
* @author Tom Baeyens
@@ -45,4 +47,8 @@
public InputStream getResourceAsStream(long deploymentDbid, String resource) {
return commandService.execute(new GetResourceAsStream(deploymentDbid, resource));
}
+
+ public ProcessDefinitionQuery createProcessDefinitionQuery() {
+ return new ProcessDefinitionQueryImpl(commandService);
+ }
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -29,7 +29,10 @@
import org.jbpm.Deployment;
import org.jbpm.JbpmException;
import org.jbpm.Problem;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
import org.jbpm.session.RepositorySession;
/**
@@ -39,9 +42,9 @@
private static Log log = Log.getLog(RepositorySessionImpl.class.getName());
- Session session;
- RepositoryCache repositoryCache;
- DeployerManager deployerManager;
+ protected Session session;
+ protected RepositoryCache repositoryCache;
+ protected DeployerManager deployerManager;
public long deploy(Deployment deployment) {
DeploymentImpl deploymentImpl = (DeploymentImpl) deployment;
@@ -89,15 +92,30 @@
}
return object;
}
+
+ public InputStream getResourceAsStream(long deploymentDbid, String resourceName) {
+ DeploymentImpl deployment = getDeployment(deploymentDbid);
+ if (deployment==null) {
+ throw new JbpmException("deployment "+deploymentDbid+" doesn't exist");
+ }
+ return deployment.getResourceAsStream(resourceName);
+ }
+ // queries //////////////////////////////////////////////////////////////////
+
+ public ProcessDefinitionQuery createProcessDefinitionQuery() {
+ return new ProcessDefinitionQueryImpl(session);
+ }
+
+
public Object findObjectByPropertyValue(String key, String value) {
DeploymentProperty deploymentProperty = (DeploymentProperty) session.createQuery(
"select deploymentProperty " +
"from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
"where deploymentProperty.key = '"+key+"' " +
- " and deploymentProperty.value = '"+value+"' " +
+ " and deploymentProperty.stringValue = '"+value+"' " +
"order by deploymentProperty.deployment.timestamp desc "
- ).uniqueResult();
+ ).setMaxResults(1).uniqueResult();
if (deploymentProperty!=null) {
long deploymentDbid = deploymentProperty.getDeployment().getDbid();
@@ -114,24 +132,20 @@
"select distinct deploymentProperty.objectName " +
"from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
"where deploymentProperty.key = '"+key+"' " +
- " and deploymentProperty.value = '"+value+"' "
+ " and deploymentProperty.stringValue = '"+value+"' "
).list();
}
public List<String> findObjectPropertyValues(String objectName, String key) {
return session.createQuery(
- "select distinct deploymentProperty.value " +
+ "select distinct deploymentProperty.stringValue " +
"from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
"where deploymentProperty.objectName = '"+objectName+"' " +
" and deploymentProperty.key = '"+key+"' "
).list();
}
- public InputStream getResourceAsStream(long deploymentDbid, String resourceName) {
- DeploymentImpl deployment = getDeployment(deploymentDbid);
- if (deployment==null) {
- throw new JbpmException("deployment "+deploymentDbid+" doesn't exist");
- }
- return deployment.getResourceAsStream(resourceName);
+ public ClientProcessDefinition findLatestProcessDefinitionByKey(String processDefinitionKey) {
+ return (ClientProcessDefinition) findObjectByPropertyValue("key", processDefinitionKey);
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -297,7 +297,7 @@
if (autoWireValue!=null) {
try {
- log.debug("auto wiring field "+fieldName+" in "+name);
+ if (log.isTraceEnabled()) log.trace("auto wiring field "+fieldName+" in "+name);
ReflectUtil.set(field, object, autoWireValue);
} catch (JbpmException e) {
if(e.getCause() instanceof IllegalArgumentException) {
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/java/org/jbpm/pvm/builder/BuilderTest.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -36,20 +36,6 @@
*/
public class BuilderTest extends BaseJbpmTestCase {
- public void testBuilderProcessDefinitionProperties() {
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("p")
- .key("k")
- .version(5)
- .description("the description")
- .endProcess();
-
- assertEquals("p", processDefinition.getName());
- assertEquals("k", processDefinition.getKey());
- assertEquals(5, processDefinition.getVersion());
- assertEquals("the description", processDefinition.getDescription());
- }
-
public void testBuilderInitialActivity() {
ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
.startProcess("p")
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/test/resources/jbpm.repository.hbm.xml 2009-03-27 13:19:48 UTC (rev 4342)
@@ -43,7 +43,8 @@
index="IDX_DEPLPROP_DEPL" />
<property name="objectName" column="OBJNAME_" />
<property name="key" column="KEY_" />
- <property name="value" column="VALUE_" />
+ <property name="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
</class>
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/process/ProcessDefinitionQueryTest.java 2009-03-27 13:19:48 UTC (rev 4342)
@@ -72,7 +72,7 @@
"</process>"
);
- List<ProcessDefinition> processDefinitions = processService.createProcessDefinitionQuery()
+ List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
.nameLike("%make%")
.orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
.execute();
@@ -125,15 +125,14 @@
"</process>"
);
- List<ProcessDefinition> processDefinitions = processService.createProcessDefinitionQuery()
- .keyLike("make%")
- .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
- .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+ .nameLike("make%")
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_ID)
.execute();
- assertEquals("make_friends-3", processDefinitions.get(0).getId());
+ assertEquals("make_friends-1", processDefinitions.get(0).getId());
assertEquals("make_friends-2", processDefinitions.get(1).getId());
- assertEquals("make_friends-1", processDefinitions.get(2).getId());
+ assertEquals("make_friends-3", processDefinitions.get(2).getId());
assertEquals("make_print-1", processDefinitions.get(3).getId());
}
}
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 21:46:59 UTC (rev 4341)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/resources/jbpm.repository.hbm.xml 2009-03-27 13:19:48 UTC (rev 4342)
@@ -43,7 +43,8 @@
index="IDX_DEPLPROP_DEPL" />
<property name="objectName" column="OBJNAME_" />
<property name="key" column="KEY_" />
- <property name="value" column="VALUE_" />
+ <property name="stringValue" column="STRINGVAL_" />
+ <property name="longValue" column="LONGVAL_" />
</class>
</hibernate-mapping>
\ No newline at end of file
15 years, 1 month
JBoss JBPM SVN: r4341 - jbpm4/branches/ainze/modules/spring.
by do-not-reply@jboss.org
Author: ainze
Date: 2009-03-26 17:46:59 -0400 (Thu, 26 Mar 2009)
New Revision: 4341
Modified:
jbpm4/branches/ainze/modules/spring/
Log:
added svn:ignore for eclipse files
Property changes on: jbpm4/branches/ainze/modules/spring
___________________________________________________________________
Name: svn:ignore
+ target
.settings
.project
.classpath
15 years, 1 month
JBoss JBPM SVN: r4340 - in jbpm4/branches/ainze/modules: spring and 26 other directories.
by do-not-reply@jboss.org
Author: ainze
Date: 2009-03-26 17:45:23 -0400 (Thu, 26 Mar 2009)
New Revision: 4340
Added:
jbpm4/branches/ainze/modules/spring/
jbpm4/branches/ainze/modules/spring/pom.xml
jbpm4/branches/ainze/modules/spring/src/
jbpm4/branches/ainze/modules/spring/src/main/
jbpm4/branches/ainze/modules/spring/src/main/java/
jbpm4/branches/ainze/modules/spring/src/main/java/org/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java
jbpm4/branches/ainze/modules/spring/src/test/
jbpm4/branches/ainze/modules/spring/src/test/java/
jbpm4/branches/ainze/modules/spring/src/test/java/org/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java
jbpm4/branches/ainze/modules/spring/src/test/resources/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml
Log:
spring release
Added: jbpm4/branches/ainze/modules/spring/pom.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/pom.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/pom.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id: pom.xml 3558 2008-12-27 12:58:42Z tom.baeyens(a)jboss.com $ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>jBPM 4 - Spring</name>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-spring</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-api</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-test-base</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-pvm</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-mock</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <!-- Plugins -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <testSourceDirectory>
+ src/main/java
+ </testSourceDirectory>
+ <classesDirectory>target/classes</classesDirectory>
+ <testClassesDirectory>
+ target/classes
+ </testClassesDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Property changes on: jbpm4/branches/ainze/modules/spring/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,80 @@
+/**
+ *
+ */
+package org.jbpm.spring.cfg;
+
+import org.hibernate.SessionFactory;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.cfg.SpringConfiguration;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * Factory that creates a singleton SpringConfiguration.
+ *
+ * @author Andries Inze
+ *
+ */
+public class SpringConfigurationFactoryBean implements FactoryBean, ApplicationContextAware {
+
+ private String jbpmConfigurationLocation;
+ private SessionFactory sessionFactory;
+ private CommandService commandService;
+
+ private ApplicationContext applicationContext;
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getObject() throws Exception {
+ SpringConfiguration result = new SpringConfiguration(jbpmConfigurationLocation);
+ result.setApplicationContext(applicationContext);
+ result.setSessionFactory(sessionFactory);
+ if (commandService != null) {
+ result.set("commandService", commandService);
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc)
+ */
+ @SuppressWarnings("unchecked")
+ public Class getObjectType() {
+ return SpringConfiguration.class;
+ }
+
+ /**
+ * {@inheritDoc)
+ */
+ public boolean isSingleton() {
+ return true;
+ }
+
+ /**
+ * @param jbpmConfigurationLocation the jbpmConfigurationLocation to set
+ */
+ public void setJbpmConfigurationLocation(String jbpmConfigurationLocation) {
+ this.jbpmConfigurationLocation = jbpmConfigurationLocation;
+ }
+
+ /**
+ * @param sessionFactory the sessionFactory to set
+ */
+ public void setSessionFactory(SessionFactory sessionFactory) {
+ this.sessionFactory = sessionFactory;
+ }
+
+ public void setApplicationContext(ApplicationContext applicationContext)
+ throws BeansException {
+ this.applicationContext = applicationContext;
+ }
+
+ public void setCommandService(CommandService commandService) {
+ this.commandService = commandService;
+ }
+
+
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,67 @@
+/**
+ *
+ */
+package org.jbpm.spring.test;
+
+import java.util.List;
+
+import org.jbpm.Configuration;
+import org.jbpm.ExecutionService;
+import org.jbpm.ManagementService;
+import org.jbpm.ProcessEngine;
+import org.jbpm.ProcessService;
+import org.jbpm.TaskService;
+import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
+
+/**
+ * Abstract test class that - builds the application context - runs in 1
+ * transaction - adds convenience methods: e.g. deploying a process.
+ *
+ * @author Andries Inze
+ *
+ */
+public abstract class AbstractTransactionalSpringJbpmTestCase extends
+ AbstractTransactionalDataSourceSpringContextTests {
+
+ private Configuration configuration;
+ private ProcessEngine processEngine;
+
+ protected ExecutionService executionService;
+ protected ProcessService processService;
+ protected TaskService taskService;
+ protected ManagementService managementService;
+ protected List<String> taskIds;
+
+ public AbstractTransactionalSpringJbpmTestCase() {
+ super();
+
+ //AUTOWIRE_BY_NAME is default behavior for Spring version 2.5.x
+ //AUTOWIRE_BY_TYPE is default behavior for Spring version 2.0.8, but
+ // fails because of Hibernate specific instances.
+ setAutowireMode(AUTOWIRE_BY_NAME);
+ }
+
+ /**
+ * {@inheritDoc)
+ */
+ protected void injectDependencies() throws Exception {
+ super.injectDependencies();
+ configuration = (Configuration) applicationContext
+ .getBean("configuration");
+ processEngine = configuration.buildProcessEngine();
+ executionService = processEngine.getExecutionService();
+ processService = processEngine.getProcessService();
+ taskService = processEngine.getTaskService();
+ managementService = processEngine.getManagementService();
+ }
+
+ public void deployJpdlXmlString(String jpdlXmlString) {
+ processService.createDeployment().addString("xmlstring.jpdl.xml",
+ jpdlXmlString).deploy().getProcessDefinitions();
+ }
+
+ public void deployJpdlResource(String resource) {
+ processService.createDeployment().addResource(resource).deploy()
+ .getProcessDefinitions();
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.activities;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testExclusiveExpression() {
+ deployJpdlXmlString(
+ "<process name='Poolcar'>" +
+ " <start>" +
+ " <transition to='How far?' />" +
+ " </start>" +
+ " <exclusive name='How far?' expr='#{distance}'>" +
+ " <transition name='far' to='Big car' />" +
+ " <transition name='nearby' to='Small car' />" +
+ " </exclusive>" +
+ " <state name='Big car' />" +
+ " <state name='Small car' />" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("distance", "far");
+ Execution execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertEquals("Big car", execution.getActivityName());
+
+ variables.put("distance", "nearby");
+ execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertEquals("Small car", execution.getActivityName());
+ }
+
+ public void testExclusiveWithConditions() {
+ deployJpdlXmlString(
+ "<process name='Poolcar'>" +
+ " <start>" +
+ " <transition to='How far?' />" +
+ " </start>" +
+ " <exclusive name='How far?'>" +
+ " <transition to='Big car'>" +
+ " <condition expr='#{distance > 10}' />" +
+ " </transition>" +
+ " <transition to='Small car'>" +
+ " <condition expr='#{distance >= 3}' />" +
+ " </transition>" +
+ " <transition to='No car' />" +
+ " </exclusive>" +
+ " <state name='Big car' />" +
+ " <state name='Small car' />" +
+ " <state name='No car' />" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("distance", new Integer(69));
+ Execution execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertEquals("Big car", execution.getActivityName());
+
+ variables.put("distance", new Integer(6));
+ execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertEquals("Small car", execution.getActivityName());
+
+ variables.put("distance", new Integer(2));
+ execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+ assertEquals("No car", execution.getActivityName());
+ }
+
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package org.jbpm.spring.test.activities;
+
+import org.jbpm.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+/**
+ * @author AIEXM45
+ *
+ */
+public class StateTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ /**
+ * {@inheritDoc)
+ */
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testWaitStatesSequence() {
+ deployJpdlXmlString("<process name='ThreeStates'>"
+ + " <start name='a'>" + " <transition to='b' />" + " </start>"
+ + " <state name='b'>" + " <transition to='c' />" + " </state>"
+ + " <state name='c'>" + " <transition to='d' />" + " </state>"
+ + " <end name='d' />" + "</process>");
+
+ Execution execution = executionService
+ .startProcessInstanceById("ThreeStates:1");
+ assertEquals("b", execution.getActivityName());
+
+ String executionId = execution.getId();
+ execution = executionService.signalExecutionById(executionId);
+ assertEquals("c", execution.getActivityName());
+
+ execution = executionService.signalExecutionById(executionId);
+ assertEquals("d", execution.getActivityName());
+ assertTrue(execution.isEnded());
+ }
+
+
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,54 @@
+/**
+ *
+ */
+package org.jbpm.spring.test.beans;
+
+import org.jbpm.jpdl.ExclusiveHandler;
+import org.jbpm.model.OpenExecution;
+
+/**
+ * @author Andries Inze
+ *
+ */
+public class InvokeTestBean implements ExclusiveHandler {
+
+ private boolean testMethodHasRun;
+ private boolean testMethodWithParametersHasRun;
+ private boolean testSelectHasRun;
+
+ public void testMethod() {
+ testMethodHasRun = true;
+ }
+
+ public void testMethodWithParameters(String name) {
+ if ("a good test".equals(name)) {
+ testMethodWithParametersHasRun = true;
+ }
+ }
+
+ public String select(OpenExecution execution) {
+ testSelectHasRun = true;
+ return "yes";
+ }
+
+ /**
+ * @return the testMethodHasRun
+ */
+ public boolean isTestMethodHasRun() {
+ return testMethodHasRun;
+ }
+
+ /**
+ * @return the testMethodWithParametersHasRun
+ */
+ public boolean isTestMethodWithParametersHasRun() {
+ return testMethodWithParametersHasRun;
+ }
+
+ /**
+ * @return the testSelectHasRun
+ */
+ public boolean isTestSelectHasRun() {
+ return testSelectHasRun;
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,35 @@
+/**
+ *
+ */
+package org.jbpm.spring.test.beans;
+
+import org.jbpm.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+/**
+ * @author AIEXM45
+ *
+ */
+public class SpringBeanTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ /**
+ * {@inheritDoc)
+ */
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testInvokeSpringBean() {
+ deployJpdlResource("org/jbpm/spring/test/beans/process.jpdl.xml");
+
+ InvokeTestBean invokeTestBean = (InvokeTestBean) applicationContext.getBean("testBean");
+
+ Execution execution = executionService
+ .startProcessInstanceByKey("Spring");
+ assertEquals("wait", execution.getActivityName());
+ assertTrue(invokeTestBean.isTestMethodHasRun());
+ assertTrue(invokeTestBean.isTestMethodWithParametersHasRun());
+ assertTrue(invokeTestBean.isTestSelectHasRun());
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,56 @@
+/*
+ * 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.spring.test.execution;
+
+import org.jbpm.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ */
+public class FindExecutionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testFindExecutionById() {
+ deployJpdlXmlString(
+ "<process name='p'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("p");
+
+ // take the id and see if the execution service can still find it back
+ execution = executionService.findExecution(execution.getId());
+ assertNotNull(execution);
+ assertEquals("a", execution.getActivityName());
+ }
+
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,260 @@
+/*
+ * 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.spring.test.execution;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SignalExecutionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testSignalExecutionByKey() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to='b' />" +
+ " </state>" +
+ " <state name='b'>" +
+ " <transition to='c' />" +
+ " </state>" +
+ " <state name='c' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("ICL", "82436");
+
+ assertEquals("a", execution.getActivityName());
+
+ execution = executionService.signalExecutionByKey("ICL", "82436");
+
+ assertEquals("b", execution.getActivityName());
+
+ execution = executionService.signalExecutionByKey("ICL", "82436");
+
+ assertEquals("c", execution.getActivityName());
+ }
+
+ public void testSignalExecutionById() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to='b' />" +
+ " </state>" +
+ " <state name='b'>" +
+ " <transition to='c' />" +
+ " </state>" +
+ " <state name='c' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("ICL", "82436");
+
+ assertEquals("a", execution.getActivityName());
+
+ execution = executionService.signalExecutionById("ICL/82436");
+
+ assertEquals("b", execution.getActivityName());
+
+ execution = executionService.signalExecutionById("ICL/82436");
+
+ assertEquals("c", execution.getActivityName());
+ }
+
+ public void testSignalExecutionWithVariables() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to='b' />" +
+ " </state>" +
+ " <state name='b' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("ICL", "82436");
+
+ Map<String,Object> variables = new HashMap<String,Object>();
+ variables.put("customer", "John Doe");
+ variables.put("type", "Accident");
+ variables.put("amount", new Float(763.74));
+
+ execution = executionService.signalExecutionById("ICL/82436", variables);
+
+ assertNotNull(execution);
+ String executionId = execution.getId();
+ assertEquals("b", execution.getActivityName());
+
+ Map<String,Object> expectedVariables = new HashMap<String, Object>(variables);
+ Set<String> expectedVariableNames = new HashSet<String>(expectedVariables.keySet());
+ Set<String> variableNames = new HashSet<String>(executionService.getVariableNames(executionId));
+ assertEquals(expectedVariableNames, variableNames);
+
+ variables = executionService.getVariables(executionId, variableNames);
+ assertEquals(expectedVariables, variables);
+ }
+
+
+ public void testDefaultSignalWithoutTransitions() {
+ deployJpdlXmlString(
+ "<process name='p'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("p");
+ execution = executionService.signalExecutionById(execution.getId());
+ assertEquals("a", execution.getActivityName());
+ }
+
+ /*
+
+ public void testSetVariable()
+ {
+ Execution execution = startExecution();
+
+ String executionId = execution.getId();
+ // set variable a to value text
+ executionService.setVariable(executionId, "a", "text");
+ // check if we can read that value back
+ assertEquals("text", executionService.getVariable(executionId, "a"));
+
+ // overwrite the value of variable a with another text
+ executionService.setVariable(executionId, "a", "another text");
+ // see if we can read another text back from the variable
+ assertEquals("another text", executionService.getVariable(executionId, "a"));
+ }
+
+ public void testSetVariables()
+ {
+ Execution execution = startExecution();
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("a", new Integer(1));
+ variables.put("b", "text");
+
+ // set variables in bulk by providing a map
+ executionService.setVariables(execution.getId(), variables);
+
+ Map<String, Object> expected = new HashMap<String, Object>(variables);
+
+ Set<String> variableNames = new HashSet<String>();
+ variableNames.add("a");
+ variableNames.add("b");
+
+ // read the variables back and compare
+ assertEquals(expected, executionService.getVariables(execution.getId(), variableNames));
+
+ // now set variables b and c with a map
+ variables = new HashMap<String, Object>();
+ variables.put("b", new Integer(99));
+ variables.put("c", "another text");
+
+ // this should leave a untouched, overwrite b and create c
+ executionService.setVariables(execution.getId(), variables);
+
+ // update the expected map
+ expected.put("b", new Integer(99));
+ expected.put("c", "another text");
+
+ // add c to the variable names that should be collected
+ variableNames.add("c");
+
+ // read the variables back and compare
+ assertEquals(expected, executionService.getVariables(execution.getId(), variableNames));
+ }
+
+ // helper methods ///////////////////////////////////////////////////////////
+
+ /**
+ * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the processes 'ultimate seduction' and
+ * 'publish book'
+ void deployMultipleVersionsOfProcesses()
+ {
+ ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
+
+ ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").activity("initial").initial().behaviour(
+ WaitState.class).done();
+ DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("ultimate seduction").key("USD").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("ultimate seduction").key("USD").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("publish book").key("PBO").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+ }
+
+ Execution startExecution()
+ {
+ ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
+
+ ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").activity("initial").initial().behaviour(WaitState.class)
+ .done();
+ DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
+
+ return executionService.startExecutionByName("nuclear fusion");
+ }
+
+ */
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,224 @@
+/*
+ * 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.spring.test.execution;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.Execution;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartExecutionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testStartNewExecutionByKey() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("ICL");
+
+ assertNotNull(execution);
+ assertEquals("a", execution.getActivityName());
+ }
+
+ public void testStartNewExecutionInLatestProcessDefinition() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("ICL");
+
+ assertNotNull(execution);
+ assertEquals("a", execution.getActivityName());
+
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='b' />" +
+ " </start>" +
+ " <state name='b' />" +
+ "</process>"
+ );
+
+ execution = executionService.startProcessInstanceByKey("ICL");
+
+ assertNotNull(execution);
+ assertEquals("b", execution.getActivityName());
+ }
+
+ public void testStartExecutionInLatestByNameWithVariables() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='b' />" +
+ " </start>" +
+ " <state name='b' />" +
+ "</process>"
+ );
+
+ // create variables that are fed into the process before it starts executing
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("a", new Integer(1));
+ variables.put("b", "text");
+
+ // feed the variables in
+ Execution execution = executionService.startProcessInstanceByKey("ICL", variables);
+ String executionId = execution.getId();
+ assertEquals("b", execution.getActivityName());
+
+ // verify that the variables are actually set
+ assertEquals(new Integer(1), executionService.getVariable(executionId, "a"));
+ assertEquals("text", executionService.getVariable(executionId, "b"));
+
+ // in the generated id, we can see if the right process definition version was taken
+ assertTrue(execution.getId().startsWith("ICL/"));
+ }
+
+ public void testStartNewProcessInstanceWithAKey() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("ICL", "one");
+
+ assertNotNull(execution);
+ assertEquals("ICL/one", execution.getId());
+ }
+
+ public void testStartNewProcessInstanceWithVariables() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ Map<String,Object> variables = new HashMap<String,Object>();
+ variables.put("customer", "John Doe");
+ variables.put("type", "Accident");
+ variables.put("amount", new Float(763.74));
+
+ Execution execution = executionService.startProcessInstanceByKey("ICL", variables);
+
+ String executionId = execution.getId();
+
+ assertNotNull(execution);
+
+ Map<String,Object> expectedVariables = new HashMap<String, Object>(variables);
+ Set<String> expectedVariableNames = new HashSet<String>(expectedVariables.keySet());
+ Set<String> variableNames = new HashSet<String>(executionService.getVariableNames(executionId));
+ assertEquals(expectedVariableNames, variableNames);
+
+ variables = executionService.getVariables(executionId, variableNames);
+ assertEquals(expectedVariables, variables);
+ }
+
+ public void testStartExecutionById() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ ProcessDefinition processDefinition = processService.findProcessDefinitionsByKey("ICL").get(0);
+
+ // start an execution for the process with the given id
+ Execution execution = executionService.startProcessInstanceById("ICL:1");
+ assertNotNull(execution);
+
+ // checking the state
+ assertEquals("a", execution.getActivityName());
+
+ // checking the generated id
+ assertNull(execution.getName());
+ assertNull(execution.getKey());
+ // if there is no user defined name or key specified in the execution,
+ // the default id generator will create a unique id like this: processDefinitionId/execution.dbid
+ assertTrue(execution.getId().startsWith("ICL/"));
+ // the last part of the execution key should be the dbid.
+ Long.parseLong(execution.getId().substring(4));
+ }
+
+ public void testStartExecutionByIdWithVariables() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ "</process>"
+ );
+
+ // create the map with variables
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("a", new Integer(1));
+ variables.put("b", "text");
+
+ // provide the variables in the start execution method
+ Execution execution = executionService.startProcessInstanceById("ICL:1", variables);
+ String executionId = execution.getId();
+
+ assertEquals(new Integer(1), executionService.getVariable(executionId, "a"));
+ assertEquals("text", executionService.getVariable(executionId, "b"));
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,145 @@
+/*
+ * 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.spring.test.process;
+
+import java.util.List;
+
+import org.jbpm.ProcessDefinition;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessDefinitionQueryTest extends AbstractTransactionalSpringJbpmTestCase {
+
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testQueryProcessDefinitionsEmpty() {
+ List<ProcessDefinition> processDefinitions = processService
+ .createProcessDefinitionQuery()
+ .execute();
+
+ assertEquals(0, processDefinitions.size());
+ }
+
+ public void testQueryProcessDefinitionsNameLike() {
+ deployJpdlXmlString(
+ "<process name='make print'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='use phone'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='make friends'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='clean whiteboard'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='fix coffeemaker'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ List<ProcessDefinition> processDefinitions = processService.createProcessDefinitionQuery()
+ .nameLike("%make%")
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .execute();
+
+ assertEquals("fix coffeemaker", processDefinitions.get(0).getName());
+ assertEquals("make friends", processDefinitions.get(1).getName());
+ assertEquals("make print", processDefinitions.get(2).getName());
+ }
+
+ public void testQueryProcessDefinitionsKeyLike() {
+ deployJpdlXmlString(
+ "<process name='make print'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='use phone'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='make friends'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='make friends'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='make friends'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='clean whiteboard'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='fix coffeemaker'>" +
+ " <start />" +
+ "</process>"
+ );
+
+ List<ProcessDefinition> processDefinitions = processService.createProcessDefinitionQuery()
+ .keyLike("make%")
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .execute();
+
+ assertEquals("make_friends:3", processDefinitions.get(0).getId());
+ assertEquals("make_friends:2", processDefinitions.get(1).getId());
+ assertEquals("make_friends:1", processDefinitions.get(2).getId());
+ assertEquals("make_print:1", processDefinitions.get(3).getId());
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.task;
+
+import java.util.Date;
+
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.task.Task;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class TaskCreateUpdateDeleteTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testNewTask() {
+ // creation of a new non-persisted task
+ Task task = taskService.newTask();
+ task = taskService.getTask(task.getDbid());
+ assertNull(task);
+ }
+
+ public void testSaveTask() {
+ Task task = taskService.newTask();
+ taskService.saveTask(task);
+ Long taskId = task.getDbid();
+ // task was made persistent
+ task = taskService.getTask(taskId);
+ assertNotNull("expected non-null task", task);
+ // make some change
+ Date dueDate = new Date();
+ task.setDueDate(dueDate);
+ taskService.saveTask(task);
+ // verify change is applied
+ task = taskService.getTask(taskId);
+ assertEquals(dueDate, task.getDueDate());
+ }
+
+ public void testDeleteTask() {
+ Task task = taskService.newTask();
+ taskService.saveTask(task);
+ Long taskId = task.getDbid();
+
+ // task was made persistent
+ assertNotNull("expected non-null task", taskService.getTask(taskId));
+ // delete task and verify it does not exist
+ taskService.deleteTask(taskId);
+ task = taskService.getTask(taskId);
+ assertNull("expected null, but was " + task, task);
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,120 @@
+/*
+ * 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.spring.test.task;
+
+import java.util.List;
+
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.task.Task;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskListTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testPersonalTaskList() {
+ Task task = taskService.newTask();
+ task.setName("do laundry");
+ task.setAssignee("johndoe");
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("get good idea");
+ task.setAssignee("joesmoe");
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("find venture capital");
+ task.setAssignee("joesmoe");
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("start new business");
+ task.setAssignee("joesmoe");
+ taskService.saveTask(task);
+
+ List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertNotNull(taskList);
+
+ assertEquals("do laundry", taskList.get(0).getName());
+ assertEquals(1, taskList.size());
+
+ taskList = taskService.getPersonalTaskList("joesmoe", 0, 10);
+ assertNotNull(taskList);
+
+// assertContainsTask(taskList, "get good idea");
+// assertContainsTask(taskList, "start new business");
+// assertContainsTask(taskList, "find venture capital");
+
+ assertEquals(3, taskList.size());
+ }
+
+ public void testPersonalTaskListDefaultSortOrder() {
+ Task task = taskService.newTask();
+ task.setName("get good idea");
+ task.setAssignee("joesmoe");
+ task.setPriority(3);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("find venture capital");
+ task.setAssignee("joesmoe");
+ task.setPriority(2);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("start new business");
+ task.setAssignee("joesmoe");
+ task.setPriority(1);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("take a day off");
+ task.setAssignee("joesmoe");
+ task.setPriority(-5);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("make profit");
+ task.setAssignee("joesmoe");
+ task.setPriority(10);
+ taskService.saveTask(task);
+
+ List<Task> taskList = taskService.getPersonalTaskList("joesmoe", 0, 10);
+ assertNotNull(taskList);
+
+ // default sort order is based on the priority
+ assertEquals("make profit", taskList.get(0).getName());
+ assertEquals("get good idea", taskList.get(1).getName());
+ assertEquals("find venture capital", taskList.get(2).getName());
+ assertEquals("start new business", taskList.get(3).getName());
+ assertEquals("take a day off", taskList.get(4).getName());
+
+ assertEquals(5, taskList.size());
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,116 @@
+/*
+ * 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.spring.test.task;
+
+import java.util.List;
+
+import org.jbpm.TaskQuery;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.task.Task;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskQueryTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testSimplestTaskQuery() {
+ Task task = taskService.newTask();
+ task.setName("do laundry");
+ task.setAssignee("johndoe");
+ task.setPriority(3);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("change dyper");
+ task.setAssignee("johndoe");
+ task.setPriority(1);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("start new business");
+ task.setAssignee("joesmoe");
+ task.setPriority(4);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("find venture capital");
+ task.setPriority(4);
+ taskService.saveTask(task);
+
+ List<Task> taskList = taskService
+ .createTaskQuery()
+ .execute();
+ assertNotNull(taskList);
+
+// assertContainsTask(taskList, "do laundry");
+// assertContainsTask(taskList, "change dyper");
+// assertContainsTask(taskList, "start new business");
+// assertContainsTask(taskList, "find venture capital");
+
+ assertEquals(4, taskList.size());
+ }
+
+ public void testSimplestTaskQuerySortBy() {
+ Task task = taskService.newTask();
+ task.setName("do laundry");
+ task.setAssignee("johndoe");
+ task.setPriority(3);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("change dyper");
+ task.setAssignee("johndoe");
+ task.setPriority(1);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("start new business");
+ task.setAssignee("joesmoe");
+ task.setPriority(4);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("find venture capital");
+ task.setPriority(7);
+ taskService.saveTask(task);
+
+ List<Task> taskList = taskService
+ .createTaskQuery()
+ .orderAsc(TaskQuery.PROPERTY_NAME)
+ .execute();
+ assertNotNull(taskList);
+
+ assertEquals("change dyper", taskList.get(0).getName());
+ assertEquals("do laundry", taskList.get(1).getName());
+ assertEquals("find venture capital", taskList.get(2).getName());
+ assertEquals("start new business", taskList.get(3).getName());
+
+ assertEquals(4, taskList.size());
+ }
+
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,121 @@
+/*
+ * 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.spring.test.variables;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class BasicVariablesTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testStartProcessInstanceWithoutVariables() {
+ deployJpdlXmlString(
+ "<process name='var'>" +
+ " <start name='a'>" +
+ " <transition to='b' />" +
+ " </start>" +
+ " <state name='b'/>" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("var", "one");
+ Set<String> variableNames = executionService.getVariableNames("var/one");
+ assertNotNull(variableNames);
+ assertEquals(0, variableNames.size());
+ }
+
+ public void testStartProcessInstanceWithThreeVariables() {
+ deployJpdlXmlString(
+ "<process name='var'>" +
+ " <start name='a'>" +
+ " <transition to='b' />" +
+ " </start>" +
+ " <state name='b'/>" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("customer", "John Doe");
+ variables.put("type", "Accident");
+ variables.put("amount", new Float(763.74));
+
+ Set<String> expectedVariableNames = new HashSet<String>(variables.keySet());
+ Map<String, Object> expectedVariables = new HashMap<String, Object>(variables);
+
+ executionService.startProcessInstanceByKey("var", variables, "one");
+
+ Set<String> variableNames = executionService.getVariableNames("var/one");
+ assertNotNull(variableNames);
+
+ assertEquals(expectedVariableNames, variableNames);
+
+ variables = executionService.getVariables("var/one", variableNames);
+
+ assertEquals(expectedVariables, variables);
+ }
+
+ public void testSetAndUpdateVariable() {
+ deployJpdlXmlString(
+ "<process name='var'>" +
+ " <start name='a'>" +
+ " <transition to='b' />" +
+ " </start>" +
+ " <state name='b'/>" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("var", "one");
+ executionService.setVariable("var/one", "msg", "hello");
+ assertEquals("hello", executionService.getVariable("var/one", "msg"));
+ executionService.setVariable("var/one", "msg", "world");
+ assertEquals("world", executionService.getVariable("var/one", "msg"));
+ }
+
+ public void testUpdateVariableToDifferentType() {
+ deployJpdlXmlString(
+ "<process name='var'>" +
+ " <start name='a'>" +
+ " <transition to='b' />" +
+ " </start>" +
+ " <state name='b'/>" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("var", "one");
+ executionService.setVariable("var/one", "msg", "hello");
+ assertEquals("hello", executionService.getVariable("var/one", "msg"));
+ executionService.setVariable("var/one", "msg", new Integer(5));
+ assertEquals(new Integer(5), executionService.getVariable("var/one", "msg"));
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,127 @@
+/*
+ * 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.spring.test.variables;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class VariableBasicTypesTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void checkVariableValue(Object variableValue) {
+ deployJpdlXmlString(
+ "<process name='var'>" +
+ " <start name='a'>" +
+ " <transition to='b' />" +
+ " </start>" +
+ " <state name='b'/>" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("var", "one");
+ executionService.setVariable("var/one", "msg", variableValue);
+ assertEquals(variableValue, executionService.getVariable("var/one", "msg"));
+ }
+
+ public void testVariableTypeString() {
+ checkVariableValue("hello");
+ }
+
+ public void testVariableTypeCharacter() {
+ checkVariableValue(new Character('x'));
+ }
+
+ public void testVariableTypeBoolean() {
+ checkVariableValue(Boolean.TRUE);
+ }
+
+ public void testVariableTypeByte() {
+ checkVariableValue(new Byte((byte)5));
+ }
+
+ public void testVariableTypeShort() {
+ checkVariableValue(new Short((short)5));
+ }
+
+ public void testVariableTypeInteger() {
+ checkVariableValue(new Integer(5));
+ }
+
+ public void testVariableTypeLong() {
+ checkVariableValue(new Long(5));
+ }
+
+ public void testVariableTypeFloat() {
+ checkVariableValue(new Float(5.7));
+ }
+
+ public void testVariableTypeDouble() {
+ checkVariableValue(new Double(5.7));
+ }
+
+ public void testVariableTypeDate() {
+ checkVariableValue(new Date());
+ }
+
+ public static class SerializeMe implements Serializable {
+ private static final long serialVersionUID = 1L;
+ String text;
+ public SerializeMe(String text) {
+ this.text = text;
+ }
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((text == null) ? 0 : text.hashCode());
+ return result;
+ }
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SerializeMe other = (SerializeMe) obj;
+ if (text == null) {
+ if (other.text != null)
+ return false;
+ } else if (!text.equals(other.text))
+ return false;
+ return true;
+ }
+ }
+
+ public void testVariableTypeSerializable() {
+ checkVariableValue(new SerializeMe("hello world"));
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
+
+ <bean id="configuration" class="org.jbpm.spring.cfg.SpringConfigurationFactoryBean">
+ <property name="jbpmConfigurationLocation" value="org/jbpm/spring/test/jbpm.cfg.xml" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ <property name="commandService" ref="commandService" />
+ </bean>
+
+ <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+ <property name="configLocation" value="classpath:org/jbpm/spring/test/hibernate.jbpm.cfg.xml" />
+ <!-- A best practice should be to keep split the config into multiple files
+ <property name="configLocations" value="hibernate.cfg.xml, hibernate.jbpm.cfg.xml" />
+ -->
+ </bean>
+
+ <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+
+ <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
+ <property name="url" value="jdbc:hsqldb:mem:." />
+ <property name="username" value="sa" />
+ <property name="password" value="" />
+ </bean>
+
+ <!-- We need to get the commandService, since we want a transaction around it. -->
+ <bean id="commandService"
+ class="org.jbpm.pvm.internal.spring.SpringCommandService">
+ <property name="transactionManager" ref="transactionManager" />
+ </bean>
+
+ <!-- Start the jobExecutor -->
+ <bean id="jobExecutor" class="org.jbpm.pvm.internal.jobexecutor.JobExecutor" init-method="start" destroy-method="stop">
+ <property name="commandExecutor" ref="commandService" />
+ </bean>
+
+ <bean id="testBean" class="org.jbpm.spring.test.beans.InvokeTestBean" />
+
+
+</beans>
\ No newline at end of file
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Spring">
+
+ <start>
+ <transition to="test" />
+ </start>
+
+ <spring name="test">
+ <bean>testBean</bean>
+ <method>testMethod</method>
+ <transition to="testWithParameters" />
+ </spring>
+
+ <spring name="testWithParameters">
+ <bean>testBean</bean>
+ <method>testMethodWithParameters</method>
+ <parameters>
+ <string value="a good test" />
+ </parameters>
+ <transition to="exclusive spring test" />
+ </spring>
+
+ <exclusive name="exclusive spring test" handler-ref="testBean">
+ <transition name="no" to="wait" />
+ <transition name="yes" to="wait" />
+ </exclusive>
+
+ <state name="wait" />
+
+</process>
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,50 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+ <mapping resource="jbpm.pvm.typedefs.hbm.xml" />
+ <mapping resource="jbpm.pvm.wire.hbm.xml" />
+ <mapping resource="jbpm.pvm.definition.hbm.xml" />
+ <mapping resource="jbpm.pvm.execution.hbm.xml" />
+ <mapping resource="jbpm.pvm.variable.hbm.xml" />
+ <mapping resource="jbpm.pvm.history.hbm.xml" />
+ <mapping resource="jbpm.pvm.job.hbm.xml" />
+ <mapping resource="jbpm.jpdl.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
+
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.ActivityImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.TransitionImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.EventImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.ExceptionHandlerImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.ObjectReference" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.VariableDefinitionImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.TimerDefinitionImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" />
+
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.exceptionHandlers" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.events" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.activities" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.variableDefinitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.timerDefinitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.exceptionHandlers" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.events" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.activities" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.variableDefinitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.timerDefinitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.incomingTransitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.outgoingTransitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.TransitionImpl.exceptionHandlers" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.TransitionImpl.events" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.EventImpl.exceptionHandlers" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.EventImpl.listenerReferences" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ExceptionHandlerImpl.eventListenerReferences" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor.argDescriptors" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor.operations" />
+
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration xmlns="http://jbpm.org/xsd/cfg">
+
+ <process-engine-context>
+
+ <deployer-manager>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <parse-jpdl />
+ <check-process />
+ <check-problems />
+ <save />
+ </deployer-manager>
+
+ <process-service />
+ <execution-service />
+ <history-service />
+ <management-service />
+ <task-service />
+
+ <command-service>
+ <retry-interceptor />
+ <environment-interceptor />
+
+ <!-- Spring is doing all the transaction stuff. -->
+ <!-- <standard-transaction-interceptor /> -->
+
+ </command-service>
+
+ <script-manager default-expression-language="juel"
+ default-script-language="juel"
+ read-contexts="execution, environment, process-engine"
+ write-context="">
+ <script-language name="juel" factory="com.sun.script.juel.JuelScriptEngineFactory" />
+ </script-manager>
+
+ <job-executor auto-start="true" />
+ <job-test-helper />
+
+ <id-generator />
+ <types resource="jbpm.pvm.types.xml" />
+
+ <business-calendar>
+ <monday hours="9:00-12:00 and 12:30-17:00"/>
+ <tuesday hours="9:00-12:00 and 12:30-17:00"/>
+ <wednesday hours="9:00-12:00 and 12:30-17:00"/>
+ <thursday hours="9:00-12:00 and 12:30-17:00"/>
+ <friday hours="9:00-12:00 and 12:30-17:00"/>
+ <holiday period="01/07/2008 - 31/08/2008"/>
+ </business-calendar>
+
+ </process-engine-context>
+
+ <transaction-context>
+ <!-- All operations inside a single request will be handled by the spring session -->
+ <hibernate-session current="true" />
+
+ <transaction />
+ <pvm-db-session />
+ <job-db-session />
+ <task-db-session />
+ <message-session />
+ <timer-session />
+ <history-session />
+ </transaction-context>
+
+
+</jbpm-configuration>
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 1 month