JBoss JBPM SVN: r5264 - in jbpm4/branches/jbpm-4.0/modules: devguide/src/main/docbook/en/modules and 6 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-07-09 04:22:13 -0400 (Thu, 09 Jul 2009)
New Revision: 5264
Modified:
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/TaskService.java
jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch03-MigrationFromJbpm3.xml
jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/SubProcessOutcomeValueTest.java
jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskVariablesTest.java
jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch04-DeployingBusinessArchives.xml
jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2396 removed TaskService.setVariable and ProcessEngine.setSessionFactory plus other docs updates
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java 2009-07-09 08:22:13 UTC (rev 5264)
@@ -62,7 +62,4 @@
/** retrieve and object defined in the process engine by name */
Object get(String name);
-
- /** programmatically provide a hibernate session factory */
- void setSessionFactory(Object sessionFactory);
}
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/TaskService.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-07-09 08:22:13 UTC (rev 5264)
@@ -159,9 +159,6 @@
* this will recursively delete all replies to this comment. */
void deleteComment(String commentId);
- /** creates or overwrites a variable value on the given task */
- void setVariable(String taskId, String name, Object value);
-
/** creates or overwrites the variable values on the given task */
void setVariables(String taskId, Map<String, Object> variables);
Modified: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch02-Incubation.xml 2009-07-09 08:22:13 UTC (rev 5264)
@@ -85,6 +85,9 @@
<section id="businesscalendar">
<title>Business calendar</title>
+ <para>Known limitation. The business calendar is not yet configurable.
+ See also <ulink url="https://jira.jboss.org/jira/browse/JBPM-2334">JBPM-2334</ulink>
+ </para>
<para>The default configuration will contain a reference to the file
<literal>jbpm.business.calendar.xml</literal>. That contains a
configuration of business hours in the following format:
Modified: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch03-MigrationFromJbpm3.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch03-MigrationFromJbpm3.xml 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch03-MigrationFromJbpm3.xml 2009-07-09 08:22:13 UTC (rev 5264)
@@ -26,11 +26,15 @@
<title>Known limitations</title>
<para>As part of creating a clear separation between basic and advanced usage, the API
has been completely revisited. Basic usage is covered with the public API. The same API
- is available in all the supported environments.
+ is available in all the supported environments. Package names in jBPM 4 are strictly
+ separated from package names in jBPM 3.
</para>
<para>Instead of providing a full DB migration, we opted for a strategy to
allow for jBPM 3 and jBPM 4 instances to run concurrently next to each
- other. One of the main reasons is that any QA for a data migration of the
+ other. The table prefix is changed from <literal>JBPM_</literal> to <literal>JBPM4_</literal>.
+ There is no migration tool to convert jBPM 3 runtime database contents
+ to jBPM 4. We're not sure if we'll be able to build such a tool in one of the
+ next version. One of the main reasons is that any QA for a data migration of the
DB contents would be impossible for the project team to achieve.
</para>
<para>Furthermore, there are some features that are not yet available
@@ -45,8 +49,8 @@
<listitem>Identity expression to calculate the assignee of a task</listitem>
<listitem>Task form variable-to-parameter conversions</listitem>
</itemizedlist>
- </section>
-
+ </section>
+
<section id="processconversiontool">
<title>Process conversion tool</title>
<para>In many cases, a lot of work has been put in the design of JPDL3 process
@@ -158,7 +162,10 @@
<entry>Execution</entry>
<entry>The root execution is now the same object as the
process instance. (In jBPM 3, the ProcessInstance had
- a pointer to the root token)
+ a pointer to the root token). Also, unlike in jBPM 3, executions in jBPM 4 might
+ get inactivated, create a child execution and let the child execution continue, even
+ when logically this represents only one single path of execution. This happens in
+ scope activities (or composite activities) that have timers or variables declared.
</entry>
</row>
<row>
Modified: jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/SubProcessOutcomeValueTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/SubProcessOutcomeValueTest.java 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/SubProcessOutcomeValueTest.java 2009-07-09 08:22:13 UTC (rev 5264)
@@ -21,8 +21,11 @@
*/
package org.jbpm.examples.subprocess.outcomevalue;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections.map.HashedMap;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -65,7 +68,9 @@
Task task = taskList.get(0);
// the result variable is set in the task
- taskService.setVariable(task.getId(), "result", "ok");
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("result", "ok");
+ taskService.setVariables(task.getId(), variables);
// the task in the sub process instance is completed
taskService.completeTask(task.getId());
@@ -85,7 +90,9 @@
Task task = taskList.get(0);
// the result variable is set in the task
- taskService.setVariable(task.getId(), "result", "nok");
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("result", "nok");
+ taskService.setVariables(task.getId(), variables);
// the task in the sub process instance is completed
taskService.completeTask(task.getId());
@@ -105,7 +112,9 @@
Task task = taskList.get(0);
// the result variable is set in the task
- taskService.setVariable(task.getId(), "result", "reject");
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("result", "reject");
+ taskService.setVariables(task.getId(), variables);
// the task in the sub process instance is completed
taskService.completeTask(task.getId());
Modified: jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java 2009-07-09 08:22:13 UTC (rev 5264)
@@ -75,7 +75,9 @@
assertEquals("This document describes how we can make more money...", document);
// the result variable is set in the task
- taskService.setVariable(task.getId(), "result", "accept");
+ variables = new HashMap<String, Object>();
+ variables.put("result", "accept");
+ taskService.setVariables(task.getId(), variables);
// the task in the sub process instance is completed
taskService.completeTask(task.getId());
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-07-09 08:22:13 UTC (rev 5264)
@@ -125,7 +125,7 @@
public void setSessionFactory(Object sessionFactory) {
processEngineWireContext
.getWireDefinition()
- .addDescriptor(new ProvidedObjectDescriptor(sessionFactory));
+ .addDescriptor(new ProvidedObjectDescriptor(sessionFactory, true));
}
public Configuration setInputStream(InputStream inputStream) {
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-07-09 08:22:13 UTC (rev 5264)
@@ -180,12 +180,6 @@
return commandService.execute(new GetTaskVariablesCmd(taskDbid, variableNames));
}
- public void setVariable(String taskDbid, String name, Object value) {
- SetTaskVariablesCmd cmd = new SetTaskVariablesCmd(taskDbid);
- cmd.addVariable(name, value);
- commandService.execute(cmd);
- }
-
public void setVariables(String taskDbid, Map<String, Object> variables) {
SetTaskVariablesCmd cmd = new SetTaskVariablesCmd(taskDbid);
cmd.setVariables(variables);
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskVariablesTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskVariablesTest.java 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskVariablesTest.java 2009-07-09 08:22:13 UTC (rev 5264)
@@ -21,6 +21,9 @@
*/
package org.jbpm.test.task;
+import java.util.HashMap;
+import java.util.Map;
+
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -35,8 +38,11 @@
task.setName("clean da house");
String taskId = taskService.saveTask(task);
- taskService.setVariable(taskId, "text", "hello");
- taskService.setVariable(taskId, "number", new Integer(5));
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("text", "hello");
+ variables.put("number", new Integer(5));
+
+ taskService.setVariables(taskId, variables);
assertEquals("hello", taskService.getVariable(taskId, "text"));
assertEquals(new Integer(5), taskService.getVariable(taskId, "number"));
Modified: jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml 2009-07-09 08:22:13 UTC (rev 5264)
@@ -51,27 +51,9 @@
<section>
<title>Migration from jBPM 3</title>
- <para>Migration from jBPM 3 to jBPM 4 is not supported.
+ <para>Migration from jBPM 3 to jBPM 4 is not supported. Check out the developers
+ guide for more information about migration.
</para>
- <para>jBPM 3 and jBPM 4 can be deployed on the same JVM and
- on the same database. Packages are stricktly separated and database
- table prefix is changed from <literal>JBPM_</literal> to <literal>JBPM4_</literal>
- </para>
- <itemizedlist>
- <listitem><emphasis role="bold">jPDL process files</emphasis>: A process file
- conversion tool is in the works. It will be shipped with the distribution
- in one of the following releases.
- </listitem>
- <listitem><emphasis role="bold">API</emphasis>: The jBPM API has completely
- changed. Where jBPM 3 exposed the internal object model and didn't have
- a session facade API, the supported API of jBPM 4 are the services, which are
- in fact session facades that can be used in any environment that we support.
- </listitem>
- <listitem><emphasis role="bold">Database</emphasis>: The jBPM database also
- has drastically changed between version 3 and 4. There is no migration tool
- to convert jBPM 3 runtime database contents to jBPM 4.
- </listitem>
- </itemizedlist>
</section>
</chapter>
Modified: jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml 2009-07-09 08:22:13 UTC (rev 5264)
@@ -165,8 +165,7 @@
<section id="tomcat">
<title>Tomcat</title>
- <para>TODO: this will contain a description of how to use the
- installer to install jbpm on tomcat</para>
+ <para>ETA for Tomcat is 4.1: <ulink url="https://jira.jboss.org/jira/browse/JBPM-2397">See JBPM-2397</ulink></para>
</section>
<section id="configurationfiles">
Modified: jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch04-DeployingBusinessArchives.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch04-DeployingBusinessArchives.xml 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch04-DeployingBusinessArchives.xml 2009-07-09 08:22:13 UTC (rev 5264)
@@ -144,6 +144,12 @@
<para>In case of the examples, an examples.jar file is created with
all the classes and it is put in the <literal>lib</literal> directory of the JBoss
server configuration.</para>
+ <para>If you want process classloading so that user defined classes can be deployed
+ in and loaded from the business archive, vote for it in
+ <ulink url="https://jira.jboss.org/jira/browse/JBPM-2200">JIRA issue JBPM-2200</ulink>.
+ We'll prioritize this depending on the number of votes and on the use cases that
+ you can add as a comment in which you explain why you need it.
+ </para>
</section>
</chapter>
Modified: jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-07-09 04:31:00 UTC (rev 5263)
+++ jbpm4/branches/jbpm-4.0/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-07-09 08:22:13 UTC (rev 5264)
@@ -1579,7 +1579,9 @@
<para>Then we set a variable on the task. This is typically done through a form. But
here we'll show how it is done programmatically.
</para>
- <programlisting>taskService.setVariable(task.getDbid(), "result", "accept");</programlisting>
+ <programlisting>Map<String, Object> variables = new HashMap<String, Object>();
+variables.put("result", "accept");
+taskService.setVariables(task.getDbid(), variables);</programlisting>
<para>Completing this task, will cause the sub process instance to end.
</para>
<programlisting>taskService.completeTask(task.getDbid());</programlisting>
@@ -1654,9 +1656,10 @@
<para>Then the <literal>result</literal> variable is set and
the task is completed.
</para>
- <programlisting>taskService.setVariable(task.getDbid(), "result", "ok");
-taskService.completeTask(task.getDbid());
- </programlisting>
+ <programlisting>Map<String, Object> variables = new HashMap<String, Object>();
+variables.put(quot;resultquot;, quot;okquot;);
+taskService.setVariables(task.getId(), variables);
+taskService.completeTask(task.getDbid());</programlisting>
<para>In this scenario, the <literal>ok</literal> transition is taken in
the parent process out of the sub-process review activity. The example
test case also shows other scenarios.
15 years, 3 months
JBoss JBPM SVN: r5263 - jbpm4/branches/jbpm-4.0.
by do-not-reply@jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-07-09 00:31:00 -0400 (Thu, 09 Jul 2009)
New Revision: 5263
Modified:
jbpm4/branches/jbpm-4.0/pom.xml
Log:
change jbpm.gpd.version to 4.0.0
Modified: jbpm4/branches/jbpm-4.0/pom.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/pom.xml 2009-07-09 02:40:27 UTC (rev 5262)
+++ jbpm4/branches/jbpm-4.0/pom.xml 2009-07-09 04:31:00 UTC (rev 5263)
@@ -49,7 +49,7 @@
<cactus.version>13-1.7.1</cactus.version>
<freemarker.version>2.3.15</freemarker.version>
<gwt.console.version>1.0.0-SNAPSHOT</gwt.console.version>
- <jbpm.gpd.version>4.0.0-SNAPSHOT</jbpm.gpd.version>
+ <jbpm.gpd.version>4.0.0</jbpm.gpd.version>
<hibernate.version>3.3.1.GA</hibernate.version>
<slf4j.version>1.5.2</slf4j.version>
<hsqldb.version>1.8.0.7</hsqldb.version>
15 years, 3 months
JBoss JBPM SVN: r5262 - in jbpm3/branches/jbpm-3.2-soa/modules: enterprise and 2 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-08 22:40:27 -0400 (Wed, 08 Jul 2009)
New Revision: 5262
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
jbpm3/branches/jbpm-3.2-soa/modules/enterprise/pom.xml
jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java
jbpm3/branches/jbpm-3.2-soa/modules/identity/pom.xml
Log:
JBPM-1292: Integrate simulation tests in automated testrun (RESOLVED)
Supply missing xerces dependencies under jdk 1.4
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-07-08 19:37:50 UTC (rev 5261)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-07-09 02:40:27 UTC (rev 5262)
@@ -174,7 +174,7 @@
<systemProperties>
<property>
<name>log4j.output.dir</name>
- <value>${basedir}/target</value>
+ <value>${project.build.directory}</value>
</property>
</systemProperties>
</configuration>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/enterprise/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/enterprise/pom.xml 2009-07-08 19:37:50 UTC (rev 5261)
+++ jbpm3/branches/jbpm-3.2-soa/modules/enterprise/pom.xml 2009-07-09 02:40:27 UTC (rev 5262)
@@ -163,7 +163,7 @@
<systemProperties>
<property>
<name>log4j.output.dir</name>
- <value>${basedir}/target</value>
+ <value>${project.build.directory}</value>
</property>
</systemProperties>
</configuration>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java 2009-07-08 19:37:50 UTC (rev 5261)
+++ jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java 2009-07-09 02:40:27 UTC (rev 5262)
@@ -33,12 +33,16 @@
public class AppServerConfigurationsTest extends ServletTestCase {
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
+ private JbpmConfiguration jbpmConfiguration;
public static Test suite() throws Exception {
return new IntegrationTestSetup(AppServerConfigurationsTest.class, "enterprise-test.war");
}
+ protected void setUp() throws Exception {
+ jbpmConfiguration = JbpmConfiguration.getInstance();
+ }
+
public void testUnavailabilityOfTheJobExecutor() {
assertNull(jbpmConfiguration.getJobExecutor());
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/identity/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/identity/pom.xml 2009-07-08 19:37:50 UTC (rev 5261)
+++ jbpm3/branches/jbpm-3.2-soa/modules/identity/pom.xml 2009-07-09 02:40:27 UTC (rev 5262)
@@ -52,31 +52,10 @@
</dependency>
</dependencies>
- <!-- Plugins -->
+ <!-- Plugins -->
<build>
<plugins>
- <!--
<plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>schema</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="test.classpath" refid="maven.test.classpath" />
- <property name="log4j.output.dir" location="${basedir}/target" />
- <ant antfile="scripts/antrun-jbpm-schema.xml" target="create" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- -->
- <plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
@@ -93,6 +72,7 @@
</descriptors>
</configuration>
</execution>
+
<execution>
<id>assembly-service</id>
<phase>package</phase>
@@ -109,6 +89,7 @@
</execution>
</executions>
</plugin>
+
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
@@ -117,4 +98,30 @@
</plugin>
</plugins>
</build>
+
+ <!-- Profiles -->
+ <profiles>
+ <!--
+ Name: jdk14
+ Desc: dependencies specific to jdk 1.4
+ -->
+ <profile>
+ <id>jdk14</id>
+ <activation>
+ <jdk>1.4</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
15 years, 3 months
JBoss JBPM SVN: r5261 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/api/model and 24 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-07-08 15:37:50 -0400 (Wed, 08 Jul 2009)
New Revision: 5261
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/erd.history.png
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/erd.identity.png
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/erd.repo.and.runtime.png
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/comments/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/comments/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java
Removed:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/Discussable.java
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/jbpm.erd.png
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/taskform/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceStart.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-Persistence.xml
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch14-History.xml
jbpm4/trunk/modules/distro/src/main/files/readme.html
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.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/type/Variable.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DateVariable.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DoubleVariable.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/LongVariable.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/StringVariable.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.history.hbm.xml
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java
jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java
Log:
JBPM-2393 fixed history logs for audit purposes
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -21,36 +21,24 @@
*/
package org.jbpm.api.history;
-import java.util.Date;
import java.util.List;
import org.jbpm.api.Execution;
-import org.jbpm.api.model.Discussable;
/** a free text comment that can be made to an {@link Execution}
* or a task.
*
* This class also supports threaded discussions with the
- * {@link #getComments() parent-child relation}.
+ * {@link #getReplies()}.
*
* @author Tom Baeyens
*/
-public interface HistoryComment extends Discussable {
+public interface HistoryComment extends HistoryDetail {
- /** the unique id for this comment that is used as a reference in the service methods */
- String getId();
-
- /** the id of the user that made this comment. The term actorId is an abstract
- * reference to an entity in an external identity component. */
- String getUserId();
-
/** the actual message. Both plain text as well as HTML can be stored
* as the message. */
String getMessage();
- /** time that specifies when the comment was made */
- Date getTime();
-
/** threaded replies to this comment */
- List<HistoryComment> getComments();
+ List<HistoryComment> getReplies();
}
\ No newline at end of file
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -0,0 +1,44 @@
+/*
+ * 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.api.history;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/** base type for all history details.
+ *
+ * @author Tom Baeyens
+ */
+public interface HistoryDetail extends Serializable {
+
+ /** the unique id for this comment that is used as a reference in the service methods */
+ String getId();
+
+ /** the id of the user that made this comment. The term actorId is an abstract
+ * reference to an entity in an external identity component. */
+ String getUserId();
+
+ /** time that specifies when the comment was made */
+ Date getTime();
+
+}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -41,8 +41,6 @@
/** the unique id for this task that is used as a reference in the service methods */
String getId();
- List<? extends HistoryComment> getComments();
-
/** the execution that was related to this activity occurrence */
String getExecutionId();
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/Discussable.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/Discussable.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/Discussable.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -1,48 +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.api.model;
-
-import java.util.List;
-
-import org.jbpm.api.TaskService;
-import org.jbpm.api.history.HistoryComment;
-
-
-/** something that people can discuss like a task
- * or a process instance.
- *
- * for now, only task discussions are supported in
- * the {@link TaskService}
- *
- * @author Tom Baeyens
- */
-public interface Discussable {
-
- /** all comments. */
- List<HistoryComment> getComments();
-
- /** create a comment */
- HistoryComment createComment(String message);
-
- /** remove a comment */
- void removeComment(HistoryComment comment);
-}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -104,10 +104,6 @@
* the type automagically. */
void createVariable(String key, Object value);
- /** create a new variable in this execution scope with
- * the given type name. */
- void createVariable(String key, Object value, String typeName);
-
// priority /////////////////////////////////////////////////////////////////
/** setter for the priority. The default priority is 0, which means
Copied: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/erd.history.png (from rev 5260, jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.history.png)
===================================================================
(Binary files differ)
Copied: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/erd.identity.png (from rev 5260, jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.identity.png)
===================================================================
(Binary files differ)
Copied: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/erd.repo.and.runtime.png (from rev 5260, jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.repo.and.runtime.png)
===================================================================
(Binary files differ)
Deleted: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/jbpm.erd.png
===================================================================
(Binary files differ)
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-Persistence.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-Persistence.xml 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-Persistence.xml 2009-07-08 19:37:50 UTC (rev 5261)
@@ -10,16 +10,19 @@
<ulink url="http://dev.mysql.com/workbench/">MySQL Workbench></ulink>.
</para>
- <figure id="schema ">
- <title>The jBPM Schema ER Diagram</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/jbpm.erd.png"/></imageobject></mediaobject>
+ <figure id="erd.repo.and.runtime">
+ <title>The jBPM repository and runtime schema ER diagram</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/erd.repo.and.runtime.png"/></imageobject></mediaobject>
</figure>
+ <figure id="erd.history">
+ <title>The jBPM history schema ER diagram</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/erd.history.png"/></imageobject></mediaobject>
+ </figure>
- <para>TODO: hibernate-session and the standard transaction
- </para>
+ <figure id="erd.identity">
+ <title>The jBPM identity schema ER diagram</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/erd.identity.png"/></imageobject></mediaobject>
+ </figure>
- <para>TODO: process definition caching
- </para>
-
</chapter>
\ No newline at end of file
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch14-History.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch14-History.xml 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch14-History.xml 2009-07-08 19:37:50 UTC (rev 5261)
@@ -1,24 +1,20 @@
<chapter id="history">
<title>History</title>
- <section id="overview">
- <title>Overview</title>
+ <para>History information is the information that will be maintained in the database
+ for querying purposes. This information is kept in the database after the
+ process or task has ended. But it is always up to date with the runtime
+ information. History information is updated inside of the runtime
+ transaction.
+ </para>
- <para>HistoryEvents are fired during process execution.
+ <para>We maintain history information on 4 entities: process instance, activity instance
+ task and variable. Each entity has a list of details associated to it.
+ Preferably use the history queries to access this information through the API.
</para>
- <para>We maintain history information on 2 levels: process instance and activity instance.
- </para>
-
- <para>Process instance start and process instance end generate history events are fired directly
- from within the implementation.
- </para>
-
- <para>ActivityBehaviour implementations are responsible for calling the historyXxx methods that
- are exposed on the ActivityExecution
- </para>
-
- <para>All the HistoryEvents are delegated to a HistorySession. The default HistorySessionImpl
+ <para>HistoryEvents are fired during process execution and dispatched to the configured
+ HistorySession. (see HistoryEvent.fire) All the HistoryEvents are delegated to a HistorySession. The default HistorySessionImpl
will invoke the process() method on the history events themselves.
</para>
@@ -27,7 +23,7 @@
</para>
<para>In the HistoryEvent.process methods, the history events create model entities or merge
- information into the model entities. For instance, a ProcessInstanceStart history event will
+ information into the history entities. For instance, a ProcessInstanceCreate history event will
create a HistoryProcessInstance entity/record. And the ProcessInstanceEnd will set the endTime
property in the existing HistoryProcessInstance entity/record.
</para>
@@ -37,6 +33,4 @@
this happens inside 1 transaction).
</para>
- </section>
-
</chapter>
\ No newline at end of file
Modified: jbpm4/trunk/modules/distro/src/main/files/readme.html
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/readme.html 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/distro/src/main/files/readme.html 2009-07-08 19:37:50 UTC (rev 5261)
@@ -78,6 +78,8 @@
</li>
<li>[<a href='https://jira.jboss.org/jira/browse/JBPM-2390'>JBPM-2390</a>] - add tasks and task comments the history
</li>
+<li>[<a href='https://jira.jboss.org/jira/browse/JBPM-2393'>JBPM-2393</a>] - expand task history to full audit logs
+</li>
</ul>
<h2> Feature Request
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -21,12 +21,8 @@
*/
package org.jbpm.enterprise.internal.custom;
-import java.sql.SQLException;
-
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
-import org.jbpm.pvm.internal.session.DbSession;
/**
* @author Alejandro Guizar
@@ -48,11 +44,11 @@
}
public Void execute(Environment environment) throws Exception {
- HistoryCommentImpl comment = new HistoryCommentImpl();
- comment.setMessage(message);
- environment.get(DbSession.class).save(comment);
- if (fail)
- throw new SQLException("simulated failure");
+// HistoryDetailImpl comment = new HistoryDetailImpl();
+// comment.setMessage(message);
+// environment.get(DbSession.class).save(comment);
+// if (fail)
+// throw new SQLException("simulated failure");
return null;
}
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -28,7 +28,7 @@
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
/**
* @author Alejandro Guizar
@@ -45,13 +45,13 @@
public Boolean execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- List<?> comments = session.createCriteria(HistoryCommentImpl.class)
+ List<?> comments = session.createCriteria(HistoryDetailImpl.class)
.add(Restrictions.eq("message", message))
.setMaxResults(1)
.list();
if (comments.isEmpty())
return false;
- HistoryCommentImpl phrase = (HistoryCommentImpl) comments.get(0);
+ HistoryDetailImpl phrase = (HistoryDetailImpl) comments.get(0);
session.delete(phrase);
return true;
}
Copied: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/comments (from rev 5260, jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/task/comments)
Deleted: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -1,69 +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.examples.task.comments;
-
-import java.util.List;
-
-import org.jbpm.api.history.HistoryComment;
-import org.jbpm.api.task.Task;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class TaskCommentsTest extends JbpmTestCase {
-
- String deploymentId;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- deploymentId = repositoryService.createDeployment()
- .addResourceFromClasspath("org/jbpm/examples/task/comments/process.jpdl.xml")
- .deploy();
- }
-
- protected void tearDown() throws Exception {
- repositoryService.deleteDeploymentCascade(deploymentId);
-
- super.tearDown();
- }
-
- public void testTaskComments() {
- executionService.startProcessInstanceByKey("TaskComments");
-
- List<Task> taskList = taskService.findPersonalTasks("johndoe");
- assertEquals(1, taskList.size());
- String taskId = taskList.get(0).getId();
-
- taskService.addTaskComment(taskId, "hi");
- taskService.addTaskComment(taskId, "yo");
-
- List<HistoryComment> comments = taskService.getTaskComments(taskId);
-
- assertEquals("expected 2 comments: "+comments, 2, comments.size());
-
- assertEquals("hi", comments.get(0).getMessage());
- assertEquals("yo", comments.get(1).getMessage());
- }
-}
Copied: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java)
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.task.comments;
+
+import java.util.List;
+
+import org.jbpm.api.history.HistoryComment;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskCommentsTest extends JbpmTestCase {
+
+ String deploymentId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentId = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/task/comments/process.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+
+ super.tearDown();
+ }
+
+ public void testTaskComments() {
+ executionService.startProcessInstanceByKey("TaskComments");
+
+ List<Task> taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals(1, taskList.size());
+ String taskId = taskList.get(0).getId();
+
+ taskService.addTaskComment(taskId, "hi");
+ taskService.addTaskComment(taskId, "yo");
+
+ List<HistoryComment> comments = taskService.getTaskComments(taskId);
+
+ assertEquals("expected 2 comments: "+comments, 2, comments.size());
+
+ assertEquals("hi", comments.get(0).getMessage());
+ assertEquals("yo", comments.get(1).getMessage());
+ }
+}
Copied: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/comments (from rev 5260, jbpm4/branches/jbpm-4.0/modules/examples/src/test/resources/org/jbpm/examples/task/comments)
Deleted: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml 2009-07-08 19:37:50 UTC (rev 5261)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process name="TaskComments" xmlns="http://jbpm.org/4.0/jpdl">
-
- <start g="20,20,48,48">
- <transition to="review" />
- </start>
-
- <task name="review"
- assignee="johndoe"
- g="96,16,127,52">
-
- <transition to="wait" />
- </task>
-
- <state name="wait" g="255,16,88,52"/>
-
-</process>
Copied: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml (from rev 5260, jbpm4/branches/jbpm-4.0/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml)
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml 2009-07-08 19:37:50 UTC (rev 5261)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="TaskComments" xmlns="http://jbpm.org/4.0/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="review" />
+ </start>
+
+ <task name="review"
+ assignee="johndoe"
+ g="96,16,127,52">
+
+ <transition to="wait" />
+ </task>
+
+ <state name="wait" g="255,16,88,52"/>
+
+</process>
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -52,7 +52,7 @@
if (parentComment==null) {
throw new JbpmException("parent comment doesn't exist: "+commentId);
}
- HistoryComment replyComment = parentComment.createComment(message);
+ HistoryComment replyComment = parentComment.createReply(message);
return replyComment;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -50,7 +50,9 @@
if (historyTask==null) {
throw new JbpmException("task "+taskDbid+" doesn't exist");
}
- HistoryCommentImpl comment = historyTask.createComment(message);
+ HistoryCommentImpl comment = new HistoryCommentImpl(message);
+ historyTask.addDetail(comment);
+ dbSession.save(comment);
return comment;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -23,7 +23,7 @@
import org.jbpm.api.JbpmException;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.session.DbSession;
@@ -45,7 +45,7 @@
public Object execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- HistoryCommentImpl comment = (HistoryCommentImpl) dbSession.get(HistoryCommentImpl.class, Long.parseLong(commentId));
+ HistoryDetailImpl comment = (HistoryDetailImpl) dbSession.get(HistoryDetailImpl.class, Long.parseLong(commentId));
if (comment!=null) {
dbSession.delete(comment);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -27,7 +27,7 @@
import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.session.DbSession;
@@ -47,15 +47,10 @@
public List<HistoryComment> execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- HistoryTaskImpl historyTask = dbSession.get(HistoryTaskImpl.class, Long.parseLong(taskId));
-
- if (historyTask != null) {
- List<HistoryComment> comments = historyTask.getComments();
- forceInitializationAndClean(comments);
- return comments;
- } else {
- return Collections.emptyList();
- }
+
+ List<HistoryComment> comments = dbSession.findCommentsByTaskId(taskId);
+ forceInitializationAndClean(comments);
+ return comments;
}
protected void forceInitializationAndClean(List<HistoryComment> comments) {
@@ -74,7 +69,7 @@
if (comment==null) {
comments.remove(i);
} else {
- forceInitializationAndClean(comment.getComments());
+ forceInitializationAndClean(comment.getReplies());
}
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -31,15 +31,15 @@
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.client.ClientExecution;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.HistorySession;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
-import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
@@ -425,4 +425,21 @@
public DeploymentQueryImpl createDeploymentQuery() {
return new DeploymentQueryImpl();
}
+
+ public List<HistoryComment> findCommentsByTaskId(String taskId) {
+ Long taskDbid = null;
+ try {
+ taskDbid = Long.parseLong(taskId);
+ } catch (Exception e) {
+ throw new JbpmException("invalid taskId: "+taskId);
+ }
+ return session.createQuery(
+ "select hc " +
+ "from "+HistoryCommentImpl.class.getName()+" as hc " +
+ "where hc.historyTask.dbid = :taskDbid " +
+ "order by hc.historyTaskIndex asc "
+ ).setLong("taskDbid", taskDbid)
+ .list();
+ }
+
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.events;
+
+import java.io.Serializable;
+
+import org.hibernate.Session;
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessInstanceCreate extends HistoryEvent implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public void process() {
+ HistoryProcessInstance historyProcessInstanceImpl = new HistoryProcessInstanceImpl(execution);
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(historyProcessInstanceImpl);
+ }
+}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceStart.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceStart.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceStart.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -1,45 +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.history.events;
-
-import java.io.Serializable;
-
-import org.hibernate.Session;
-import org.jbpm.api.history.HistoryProcessInstance;
-import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ProcessInstanceStart extends HistoryEvent implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- public void process() {
- HistoryProcessInstance historyProcessInstanceImpl = new HistoryProcessInstanceImpl(execution);
- Session session = Environment.getFromCurrent(Session.class);
- session.save(historyProcessInstanceImpl);
- }
-}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -44,7 +44,6 @@
public void process() {
DbSession dbSession = Environment.getFromCurrent(DbSession.class);
HistoryTaskImpl historyTask = dbSession.get(HistoryTaskImpl.class, task.getDbid());
-
historyTask.updated(task);
}
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -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.pvm.internal.history.events;
+
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.api.history.HistoryTask;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
+import org.jbpm.pvm.internal.history.model.HistoryVariableImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.pvm.internal.type.Variable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class VariableCreate extends HistoryEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ Variable variable;
+
+ public VariableCreate(Variable variable) {
+ this.variable = variable;
+ }
+
+ public void process() {
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+
+ dbSession.save(variable);
+
+ HistoryProcessInstanceImpl historyProcessInstance = null;
+ ExecutionImpl processInstance = variable.getProcessInstance();
+ if (processInstance!=null) {
+ long processInstanceDbid = processInstance.getDbid();
+ historyProcessInstance = (HistoryProcessInstanceImpl)
+ dbSession.get(HistoryProcessInstanceImpl.class, processInstanceDbid);
+ }
+
+ HistoryTaskImpl historyTask = null;
+ TaskImpl task = variable.getTask();
+ if (task!=null) {
+ long taskDbid = task.getDbid();
+ historyTask = (HistoryTaskImpl)
+ dbSession.get(HistoryTaskImpl.class, taskDbid);
+ }
+
+ HistoryVariableImpl historyVariable = new HistoryVariableImpl(historyProcessInstance, historyTask, variable);
+ dbSession.save(historyVariable);
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -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.history.events;
+
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryVariableImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.type.Variable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class VariableUpdate extends HistoryEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ Variable variable;
+
+ public VariableUpdate(Variable variable) {
+ this.variable = variable;
+ }
+
+ @Override
+ public void process() {
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+ HistoryVariableImpl historyVariable = dbSession.get(HistoryVariableImpl.class, variable.getDbid());
+ historyVariable.updated(variable);
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -22,7 +22,11 @@
package org.jbpm.pvm.internal.history.model;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import org.jbpm.api.history.HistoryActivityInstance;
import org.jbpm.api.history.HistoryProcessInstance;
@@ -51,6 +55,12 @@
protected long duration;
protected String transitionName;
+
+ protected int nextDetailIndex = 1;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryDetailImpl> details = new HashSet<HistoryDetailImpl>();
+
public HistoryActivityInstanceImpl() {
}
@@ -62,6 +72,13 @@
this.activityName = activity.getName();
this.startTime = execution.getHistoryActivityStart();
}
+
+ // details //////////////////////////////////////////////////////////////////
+
+ public void addDetail(HistoryDetailImpl detail) {
+ detail.setHistoryActivityInstance(this, nextDetailIndex);
+ nextDetailIndex++;
+ }
public void setEndTime(Date endTime) {
this.endTime = endTime;
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -1,124 +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.history.model;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.history.HistoryComment;
-import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.util.Clock;
-import org.jbpm.pvm.internal.util.EqualsUtil;
-
-public class HistoryCommentImpl implements Serializable, HistoryComment {
-
- private static final long serialVersionUID = 1L;
-
- protected long dbid;
- protected int dbversion;
- protected String userId = null;
- protected Date time = null;
- protected String message = null;
- protected List<HistoryCommentImpl> comments = new ArrayList<HistoryCommentImpl>();
-
- public HistoryCommentImpl() {
- }
-
- public HistoryCommentImpl(String message) {
- this.message = message;
- this.time = Clock.getCurrentTime();
-
- Environment environment = Environment.getCurrent();
- if (environment!=null) {
- this.userId = environment.getUserId();
- }
- }
-
- // replies //////////////////////////////////////////////////////////////////
-
- public HistoryComment createComment(String message) {
- if (message==null) {
- throw new JbpmException("message is null");
- }
- HistoryCommentImpl reply = new HistoryCommentImpl(message);
- comments.add(reply);
- return reply;
- }
-
- public void removeComment(HistoryComment comment) {
- if (comment==null) {
- throw new JbpmException("reply is null");
- }
- if (comments.contains(comment)) {
- comments.remove(comment);
- }
- }
-
- public List<HistoryComment> getComments() {
- return (List)comments;
- }
-
-
- public void setComments(List<HistoryCommentImpl> replies) {
- this.comments = replies;
- }
-
- // equals ///////////////////////////////////////////////////////////////////
- // hack to support comparing hibernate proxies against the real objects
- // since this always falls back to ==, we don't need to overwrite the hashcode
- public boolean equals(Object o) {
- return EqualsUtil.equals(this, o);
- }
-
- // cusomtized getters and setters ////////////////////////////////////////////
-
- public String getId() {
- return Long.toString(dbid);
- }
-
- // getters and setters //////////////////////////////////////////////////////
-
- public long getDbid() {
- return dbid;
- }
- public String getUserId() {
- return userId;
- }
- public String getMessage() {
- return message;
- }
- public Date getTime() {
- return time;
- }
- public void setUserId(String userId) {
- this.userId = userId;
- }
- public void setTime(Date time) {
- this.time = time;
- }
- public void setMessage(String message) {
- this.message = message;
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -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.pvm.internal.history.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.history.HistoryComment;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryCommentImpl extends HistoryDetailImpl implements HistoryComment {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String message;
+ protected List<HistoryCommentImpl> replies = new ArrayList<HistoryCommentImpl>();
+
+ public HistoryCommentImpl() {
+ }
+
+ public HistoryCommentImpl(String message) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ if (message==null) {
+ throw new JbpmException("message is null");
+ }
+ this.message = message;
+ }
+
+ // replies //////////////////////////////////////////////////////////////////
+
+ public HistoryCommentImpl createReply(String message) {
+ HistoryCommentImpl reply = new HistoryCommentImpl(message);
+ replies.add(reply);
+ return reply;
+ }
+
+ public List<HistoryComment> getReplies() {
+ return (List) replies;
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -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.pvm.internal.history.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.util.Clock;
+import org.jbpm.pvm.internal.util.EqualsUtil;
+
+public class HistoryDetailImpl implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int dbversion;
+ protected String userId = null;
+ protected Date time = null;
+
+ protected HistoryProcessInstanceImpl historyProcessInstance;
+ protected Integer historyProcessInstanceIndex;
+
+ protected HistoryActivityInstanceImpl historyActivityInstance;
+ protected Integer historyActivityInstanceIndex;
+
+ protected HistoryTaskImpl historyTask;
+ protected Integer historyTaskIndex;
+
+ protected HistoryVariableImpl historyVariable;
+ protected Integer historyVariableIndex;
+
+ protected HistoryDetailImpl() {
+ }
+
+ // dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ protected HistoryDetailImpl(String dummy) {
+ this.time = Clock.getCurrentTime();
+
+ Environment environment = Environment.getCurrent();
+ if (environment!=null) {
+ this.userId = environment.getUserId();
+ }
+ }
+
+ // equals ///////////////////////////////////////////////////////////////////
+ // hack to support comparing hibernate proxies against the real objects
+ // since this always falls back to ==, we don't need to overwrite the hashcode
+ public boolean equals(Object o) {
+ return EqualsUtil.equals(this, o);
+ }
+
+ // cusomtized getters and setters ////////////////////////////////////////////
+
+ public String getId() {
+ return Long.toString(dbid);
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public long getDbid() {
+ return dbid;
+ }
+ public String getUserId() {
+ return userId;
+ }
+ public Date getTime() {
+ return time;
+ }
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+ public void setHistoryProcessInstance(HistoryProcessInstanceImpl historyProcessInstance, int historyProcessInstanceIndex) {
+ this.historyProcessInstance = historyProcessInstance;
+ this.historyProcessInstanceIndex = historyProcessInstanceIndex;
+ }
+
+ public void setHistoryActivityInstance(HistoryActivityInstanceImpl historyActivityInstance, int historyActivityInstanceIndex) {
+ this.historyActivityInstance = historyActivityInstance;
+ this.historyActivityInstanceIndex = historyActivityInstanceIndex;
+ }
+
+ public void setHistoryTask(HistoryTaskImpl historyTask, int historyTaskIndex) {
+ this.historyTask = historyTask;
+ this.historyTaskIndex = historyTaskIndex;
+ }
+
+ public void setHistoryVariable(HistoryVariableImpl historyVariable, int historyVariableIndex) {
+ this.historyVariable = historyVariable;
+ this.historyVariableIndex = historyVariableIndex;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.model;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryPriorityUpdateImpl extends HistoryDetailImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ public int oldPriority;
+ public int newPriority;
+
+ public HistoryPriorityUpdateImpl() {
+ }
+
+ public HistoryPriorityUpdateImpl(int oldPriority, int newPriority) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ this.oldPriority = oldPriority;
+ this.newPriority = newPriority;
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import java.util.Date;
+import java.util.HashSet;
import java.util.Set;
import org.jbpm.api.history.HistoryProcessInstance;
@@ -49,11 +50,24 @@
protected String endActivityName;
protected Date startTime;
protected Date endTime;
- protected Long duration = null;
-
- /** only here to get hibernate cascade deletes */
+ protected Long duration;
+ protected int nextDetailIndex = 1;
+
+ /** only here to get hibernate cascade */
protected Set<HistoryActivityInstanceImpl> historyActivityInstances;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryVariableImpl> historyVariables;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryDetailImpl> details = new HashSet<HistoryDetailImpl>();
+
+ public void addDetail(HistoryDetailImpl detail) {
+ detail.setHistoryProcessInstance(this, nextDetailIndex);
+ nextDetailIndex++;
+ }
+
public HistoryProcessInstanceImpl() {
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.model;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryTaskAssignmentImpl extends HistoryDetailImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String oldAssignee;
+ protected String newAssignee;
+
+ public HistoryTaskAssignmentImpl() {
+ }
+
+ public HistoryTaskAssignmentImpl(String oldAssignee, String newAssignee) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ this.oldAssignee = oldAssignee;
+ this.newAssignee = newAssignee;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.model;
+
+import java.util.Date;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryTaskDuedateUpdateImpl extends HistoryDetailImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Date oldDuedate;
+ protected Date newDuedate;
+
+ public HistoryTaskDuedateUpdateImpl() {
+ }
+
+ public HistoryTaskDuedateUpdateImpl(Date oldDuedate, Date newDuedate) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ this.oldDuedate = oldDuedate;
+ this.newDuedate = newDuedate;
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -28,8 +28,6 @@
import java.util.List;
import java.util.Set;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.history.HistoryTask;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.util.Clock;
@@ -45,18 +43,26 @@
protected long dbid;
protected int dbversion;
+
protected String executionId;
protected String assignee;
protected String state;
protected String outcome;
- protected Integer priority;
+ protected int priority;
protected Date duedate;
protected Date createTime;
protected Date endTime;
protected long duration;
+ protected int nextDetailIndex = 1;
+
protected Set<HistoryTaskImpl> subTasks = new HashSet<HistoryTaskImpl>();
- protected List<HistoryCommentImpl> comments = new ArrayList<HistoryCommentImpl>();
-
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryVariableImpl> historyVariables;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryDetailImpl> details = new HashSet<HistoryDetailImpl>();
+
public HistoryTaskImpl() {
}
@@ -69,37 +75,33 @@
}
public void updated(TaskImpl task) {
- this.assignee = task.getAssignee();
- this.priority = task.getPriority();
- this.duedate = task.getDuedate();
- }
-
- // comments /////////////////////////////////////////////////////////////////
- public List<HistoryComment> getComments() {
- return (List)comments;
- }
-
- public HistoryCommentImpl createComment(String commentText) {
- HistoryCommentImpl comment = new HistoryCommentImpl(commentText);
- comments.add(comment);
- return comment;
- }
-
- public void removeComment(HistoryCommentImpl comment) {
- if (comment == null) {
- throw new JbpmException("comment is null");
+ if ( (assignee==null && task.getAssignee()!=null)
+ || (assignee!=null) && (!assignee.equals(task.getAssignee()))
+ ) {
+ addDetail(new HistoryTaskAssignmentImpl(assignee, task.getAssignee()));
+ this.assignee = task.getAssignee();
}
- if (comments.contains(comment)) {
- comments.remove(comment);
+ if (priority!=task.getPriority()) {
+ addDetail(new HistoryPriorityUpdateImpl(priority, task.getPriority()));
+ this.priority = task.getPriority();
}
+ if ( (duedate==null && task.getDuedate()!=null)
+ || (duedate!=null) && (!duedate.equals(task.getDuedate()))
+ ) {
+ addDetail(new HistoryTaskDuedateUpdateImpl(duedate, task.getDuedate()));
+ this.duedate = task.getDuedate();
+ }
}
- // subtasks /////////////////////////////////////////////////////////////////
+ // details //////////////////////////////////////////////////////////////////
- public Set<HistoryTask> getSubTasks() {
- return (Set)subTasks;
+ public void addDetail(HistoryDetailImpl detail) {
+ detail.setHistoryTask(this, nextDetailIndex);
+ nextDetailIndex++;
}
+ // subtasks /////////////////////////////////////////////////////////////////
+
public void addSubTask(HistoryTaskImpl historyTask) {
subTasks.add(historyTask);
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -0,0 +1,87 @@
+/*
+ * 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.history.model;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.type.Variable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryVariableImpl implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int dbversion;
+
+ protected HistoryProcessInstanceImpl historyProcessInstance;
+ protected HistoryTaskImpl historyTask;
+
+ protected String processInstanceId;
+ protected String executionId;
+ protected String variableName;
+ protected String value;
+ protected int nextDetailIndex = 1;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryDetailImpl> details = new HashSet<HistoryDetailImpl>();
+
+ protected HistoryVariableImpl() {
+ }
+
+ public HistoryVariableImpl(HistoryProcessInstanceImpl historyProcessInstance, HistoryTaskImpl historyTask, Variable variable) {
+ this.dbid = variable.getDbid();
+
+ this.historyProcessInstance = historyProcessInstance;
+ this.historyTask = historyTask;
+
+ ExecutionImpl processInstance = variable.getProcessInstance();
+ if (processInstance!=null) {
+ this.processInstanceId = processInstance.getId();
+ }
+ // this.executionId = variable.getExecution().getId();
+
+ this.variableName = variable.getKey();
+ this.value = variable.getTextValue();
+ }
+
+ public void updated(Variable variable) {
+ String newValue = variable.getTextValue();
+ if ( (value==null && newValue!=null)
+ || (value!=null && (!value.equals(newValue)))
+ ) {
+ addDetail(new HistoryVariableUpdateImpl(value, newValue));
+ }
+ }
+
+ public void addDetail(HistoryDetailImpl detail) {
+ detail.setHistoryVariable(this, nextDetailIndex);
+ nextDetailIndex++;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java (from rev 5260, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.model;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryVariableUpdateImpl extends HistoryDetailImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String oldValue;
+ protected String newValue;
+
+ public HistoryVariableUpdateImpl() {
+ }
+
+ public HistoryVariableUpdateImpl(String oldValue, String newValue) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -51,14 +51,12 @@
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.env.ExecutionContext;
import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.HistorySession;
import org.jbpm.pvm.internal.history.events.ActivityEnd;
import org.jbpm.pvm.internal.history.events.ActivityStart;
import org.jbpm.pvm.internal.history.events.AutomaticEnd;
import org.jbpm.pvm.internal.history.events.DecisionEnd;
+import org.jbpm.pvm.internal.history.events.ProcessInstanceCreate;
import org.jbpm.pvm.internal.history.events.ProcessInstanceEnd;
-import org.jbpm.pvm.internal.history.events.ProcessInstanceStart;
-import org.jbpm.pvm.internal.history.events.TaskActivityStart;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.model.op.AtomicOperation;
@@ -70,11 +68,8 @@
import org.jbpm.pvm.internal.session.RepositorySession;
import org.jbpm.pvm.internal.session.TimerSession;
import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
-import org.jbpm.pvm.internal.task.ParticipationImpl;
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneImpl;
-import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.type.Variable;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
@@ -188,6 +183,8 @@
if (idGenerator!=null) {
this.id = idGenerator.createId(processDefinition, null, this);
}
+
+ HistoryEvent.fire(new ProcessInstanceCreate(), this);
}
// execution method : start /////////////////////////////////////////////////
@@ -199,7 +196,6 @@
this.state = STATE_ACTIVE_ROOT;
ExecutionImpl scopedExecution = initializeScopes();
- HistoryEvent.fire(new ProcessInstanceStart(), this);
fire(Event.START, getProcessDefinition());
if (getActivity()!=null) {
scopedExecution.performAtomicOperation(AtomicOperation.EXECUTE_ACTIVITY);
@@ -922,7 +918,7 @@
}
public void createSystemVariable(String key, Object value, String typeName) {
- Variable variable = createVariableObject(key, value, typeName);
+ Variable variable = createVariableObject(key, value, typeName, false);
systemVariables.put(variable.getKey(), variable);
}
@@ -1155,6 +1151,12 @@
return parent==null;
}
+ // getters and setters for scope instance //////////////////////////////////////
+
+ public ExecutionImpl getExecution() {
+ return this;
+ }
+
// getters and setters /////////////////////////////////////////////////////////
public TransitionImpl getTransition() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -33,7 +33,10 @@
import org.jbpm.api.JbpmException;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.events.VariableCreate;
import org.jbpm.pvm.internal.job.TimerImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.type.Converter;
import org.jbpm.pvm.internal.type.Type;
import org.jbpm.pvm.internal.type.TypeSet;
@@ -72,24 +75,23 @@
String key = variableDefinition.getName();
Object value = variableDefinition.getInitValue(outerExecution);
String typeName = variableDefinition.getTypeName();
- createVariable(key, value, typeName);
+ boolean isHistoryEnabled = variableDefinition.isHistoryEnabled();
+ createVariable(key, value, typeName, isHistoryEnabled);
}
}
}
public void createVariable(String key, Object value) {
- createVariable(key, value, null);
+ createVariable(key, value, null, false);
}
- public void createVariable(String key, Object value, String typeName) {
- Variable variable = createVariableObject(key, value, typeName);
+ public void createVariable(String key, Object value, String typeName, boolean isHistoryEnabled) {
+ Variable variable = createVariableObject(key, value, typeName, isHistoryEnabled);
variables.put(variable.getKey(), variable);
hasVariables = true;
-
- // TODO add createTime-variable-log
}
- protected Variable createVariableObject(String key, Object value, String typeName) {
+ protected Variable createVariableObject(String key, Object value, String typeName, boolean isHistoryEnabled) {
log.debug("create variable '"+key+"' in '"+this+"' with value '"+value+"'");
Type type = null;
@@ -130,8 +132,15 @@
}
variable.setKey(key);
+ variable.setExecution(getExecution());
+ variable.setTask(getTask());
+ variable.setHistoryEnabled(isHistoryEnabled);
+
+ if (isHistoryEnabled) {
+ HistoryEvent.fire(new VariableCreate(variable));
+ }
+
variable.setValue(value);
- variable.setProcessInstance(getProcessInstance());
return variable;
}
@@ -153,7 +162,7 @@
variable.setValue(value);
} else if (getParentVariableScope()==null) {
- createVariable(key, value, null);
+ createVariable(key, value, null, false);
} else {
getParentVariableScope().setVariable(key,value);
@@ -353,10 +362,14 @@
// customizable methods /////////////////////////////////////////////////////
- public ExecutionImpl getProcessInstance() {
+ public ExecutionImpl getExecution() {
return null;
}
+ public TaskImpl getTask() {
+ return null;
+ }
+
public ExecutionImpl getTimerExecution() {
return null;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -43,6 +43,7 @@
protected String name;
protected String typeName;
+ protected boolean isHistoryEnabled;
protected String initExpression;
protected String initLanguage;
@@ -89,4 +90,10 @@
public void setInitLanguage(String initLanguage) {
this.initLanguage = initLanguage;
}
+ public boolean isHistoryEnabled() {
+ return isHistoryEnabled;
+ }
+ public void setHistoryEnabled(boolean isHistoryEnabled) {
+ this.isHistoryEnabled = isHistoryEnabled;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -24,6 +24,7 @@
import java.util.List;
import org.jbpm.api.Execution;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.task.Task;
import org.jbpm.pvm.internal.client.ClientExecution;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
@@ -79,7 +80,9 @@
/** create a history activity instance query */
HistoryActivityInstanceQueryImpl createHistoryActivityInstanceQuery();
-
+
+ List<HistoryComment> findCommentsByTaskId(String taskId);
+
/** create a process instance query */
JobQueryImpl createJobQuery();
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -21,15 +21,18 @@
*/
package org.jbpm.pvm.internal.svc;
+import java.util.List;
import java.util.Map;
import org.jbpm.api.HistoryService;
import org.jbpm.api.history.HistoryActivityInstanceQuery;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.history.HistoryProcessInstanceQuery;
import org.jbpm.api.history.HistoryTaskQuery;
import org.jbpm.pvm.internal.cmd.CreateHistoryActivityInstanceQueryCmd;
import org.jbpm.pvm.internal.cmd.CreateHistoryProcessInstanceQueryCmd;
import org.jbpm.pvm.internal.cmd.CreateHistoryTaskQueryCmd;
+import org.jbpm.pvm.internal.cmd.GetTaskCommentsCmd;
import org.jbpm.pvm.internal.query.AvgDurationPerActivityQueryCmd;
import org.jbpm.pvm.internal.query.ChoiceDistributionQueryCmd;
import org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl;
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-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -101,6 +101,10 @@
public ScopeInstanceImpl getParentVariableScope() {
return execution;
}
+
+ public TaskImpl getTask() {
+ return this;
+ }
// assignment ///////////////////////////////////////////////////////////////
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -24,7 +24,12 @@
import java.io.Serializable;
import org.jbpm.api.JbpmException;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.HistorySession;
+import org.jbpm.pvm.internal.history.events.VariableUpdate;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
/**
* is a jbpm-internal class that serves as a base class for classes
@@ -39,9 +44,12 @@
protected String key = null;
protected Converter converter = null;
- protected String queryText = null;
- protected ExecutionImpl processInstance;
+ protected String textValue = null;
+ protected boolean isHistoryEnabled = false;
+ protected ExecutionImpl execution;
+ protected TaskImpl task;
+
// constructors /////////////////////////////////////////////////////////////
// abstract methods /////////////////////////////////////////////////////////
@@ -80,6 +88,13 @@
throw new JbpmException("variable instance '"+this.getClass().getName()+"' does not support values of type '"+value.getClass().getName()+"'. to change the type of a variable, you have to delete it first");
}
setObject(value);
+
+ HistorySession historySession = Environment.getFromCurrent(HistorySession.class, false);
+ if ( isHistoryEnabled
+ && (historySession!=null)
+ ) {
+ HistoryEvent.fire(new VariableUpdate(this));
+ }
}
public Object getValue() {
@@ -96,7 +111,7 @@
public String toString() {
return "${"+key+"}";
}
-
+
public Type getType() {
Type type = new Type();
type.setConverter(converter);
@@ -104,11 +119,18 @@
return type;
}
+ public ExecutionImpl getProcessInstance() {
+ return (execution!=null ? execution.getProcessInstance() : null);
+ }
+
// getters and setters //////////////////////////////////////////////////////
public String getKey() {
return key;
}
+ public long getDbid() {
+ return dbid;
+ }
public Converter getConverter() {
return converter;
}
@@ -118,10 +140,25 @@
public void setKey(String key) {
this.key = key;
}
- public ExecutionImpl getProcessInstance() {
- return processInstance;
+ public String getTextValue() {
+ return textValue;
}
- public void setProcessInstance(ExecutionImpl processInstance) {
- this.processInstance = processInstance;
+ public ExecutionImpl getExecution() {
+ return execution;
}
+ public void setExecution(ExecutionImpl execution) {
+ this.execution = execution;
+ }
+ public TaskImpl getTask() {
+ return task;
+ }
+ public void setTask(TaskImpl task) {
+ this.task = task;
+ }
+ public boolean isHistoryEnabled() {
+ return isHistoryEnabled;
+ }
+ public void setHistoryEnabled(boolean isHistoryEnabled) {
+ this.isHistoryEnabled = isHistoryEnabled;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DateVariable.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DateVariable.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DateVariable.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -47,9 +47,9 @@
public void setObject(Object value) {
this.date = (Date) value;
if (value!=null) {
- this.queryText = new SimpleDateFormat(dateFormat).format(value);
+ this.textValue = new SimpleDateFormat(dateFormat).format(value);
} else {
- this.queryText = null;
+ this.textValue = null;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DoubleVariable.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DoubleVariable.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DoubleVariable.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -42,9 +42,9 @@
public void setObject(Object value) {
this.d = (Double) value;
if (value!=null) {
- this.queryText = value.toString();
+ this.textValue = value.toString();
} else {
- this.queryText = null;
+ this.textValue = null;
}
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/LongVariable.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/LongVariable.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/LongVariable.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -42,9 +42,9 @@
public void setObject(Object value) {
this.l = (Long) value;
if (value!=null) {
- this.queryText = value.toString();
+ this.textValue = value.toString();
} else {
- this.queryText = null;
+ this.textValue = null;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/StringVariable.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/StringVariable.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/StringVariable.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -42,9 +42,9 @@
public void setObject(Object value) {
this.string = (String) value;
if (value!=null) {
- this.queryText = string;
+ this.textValue = string;
} else {
- this.queryText = null;
+ this.textValue = null;
}
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-08 19:37:50 UTC (rev 5261)
@@ -124,13 +124,17 @@
<version name="dbversion" column="DBVERSION_" />
<property name="key" column="KEY_"/>
- <property name="queryText" column="QUERYTEXT_" />
<property name="converter" type="converter" column="CONVERTER_" />
- <many-to-one name="processInstance"
- column="PROCINST_"
+ <property name="isHistoryEnabled" column="HIST_" />
+
+ <many-to-one name="execution"
+ column="EXECUTION_"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
- foreign-key="FK_VAR_PROCINST"
- index="IDX_VAR_PROCINST"/>
+ foreign-key="none"/>
+ <many-to-one name="task"
+ column="TASK_"
+ class="org.jbpm.pvm.internal.task.TaskImpl"
+ foreign-key="none"/>
</class>
<subclass name="org.jbpm.pvm.internal.type.variable.DateVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="date">
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.history.hbm.xml 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.history.hbm.xml 2009-07-08 19:37:50 UTC (rev 5261)
@@ -19,20 +19,32 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <!-- many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCDEF_"
- foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" / -->
-
+ <property name="nextDetailIndex" column="NEXTIDX_" />
+
<set name="historyActivityInstances"
cascade="all">
- <key>
- <column name="HPI_" />
+ <key foreign-key="FK_HACTI_HPROCI">
+ <column name="HPROCI_" index="IDX_HACTI_HPROCI" />
</key>
- <one-to-many class="HistoryActivityInstanceImpl" />
+ <one-to-many class="HistoryActivityInstanceImpl" />
</set>
+ <set name="historyVariables"
+ cascade="all">
+ <key foreign-key="FK_HVAR_HPROCI">
+ <column name="HPROCI_" index="IDX_HVAR_HPROCI" />
+ </key>
+ <one-to-many class="HistoryVariableImpl" />
+ </set>
+
+ <set name="details"
+ cascade="all">
+ <key foreign-key="FK_HDETAIL_HPROCI">
+ <column name="HPROCI_" index="IDX_HDETAIL_HPROCI" />
+ </key>
+ <one-to-many class="HistoryDetailImpl" />
+ </set>
+
</class>
<!-- ### HISTORY ACTIVITY INSTANCE ####################################### -->
@@ -43,18 +55,12 @@
<discriminator column="CLASS_" />
<version name="dbversion" column="DBVERSION_" />
+ <!-- the foreign-key is set on the other side of the relation: see historyActivityInstances above -->
<many-to-one name="historyProcessInstance"
class="HistoryProcessInstanceImpl"
- column="HPI_"
- foreign-key="FK_HAI_HPI"
- index="IDX_HAI_HPI" />
+ column="HPROCI_"
+ foreign-key="none" />
- <!-- many-to-one name="activity"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="ACTIVITY_"
- foreign-key="FK_HISTAI_ACT"
- index="IDX_HISTAI_ACT" / -->
-
<property name="type" column="TYPE_" />
<property name="executionId" column="EXECUTION_" />
<property name="activityName" column="ACTIVITY_NAME_" />
@@ -62,7 +68,16 @@
<property name="endTime" column="END_" type="timestamp" />
<property name="duration" column="DURATION_" />
<property name="transitionName" column="TRANSITION_" />
+ <property name="nextDetailIndex" column="NEXTIDX_" />
+ <set name="details"
+ cascade="all">
+ <key foreign-key="FK_HDETAIL_HACTI">
+ <column name="HACTI_" index="IDX_HDETAIL_HACTI" />
+ </key>
+ <one-to-many class="HistoryDetailImpl" />
+ </set>
+
<subclass name="HistoryAutomaticInstanceImpl" discriminator-value="aut">
<subclass name="HistoryDecisionInstanceImpl" discriminator-value="excl" />
</subclass>
@@ -84,35 +99,75 @@
</id>
<version name="dbversion" column="DBVERSION_" />
- <!-- many-to-one name="historyTaskInstance"
- class="HistoryTaskInstanceImpl"
- column="HTI_"
- foreign-key="none"
- index="IDX_HTASK_HTI" / -->
-
<property name="executionId" column="EXECUTION_" />
<property name="outcome" column="OUTCOME_" />
<property name="assignee" column="ASSIGNEE_" />
+ <property name="priority" column="PRIORITY_" />
<property name="state" column="STATE_" />
<property name="createTime" column="CREATE_" type="timestamp" />
<property name="endTime" column="END_" type="timestamp" />
<property name="duration" column="DURATION_" />
+ <property name="nextDetailIndex" column="NEXTIDX_" />
- <list name="comments" cascade="all-delete-orphan">
- <key column="HTASK_" />
- <list-index column="HTASK_IDX_" />
- <one-to-many class="HistoryCommentImpl" />
- </list>
-
+ <set name="details"
+ cascade="all">
+ <key foreign-key="FK_HDETAIL_HTASK">
+ <column name="HTASK_" index="IDX_HDETAIL_HTASK" />
+ </key>
+ <one-to-many class="HistoryDetailImpl" />
+ </set>
+
+ <set name="historyVariables"
+ cascade="all">
+ <key foreign-key="FK_HVAR_HTASK">
+ <column name="HTASK_" index="IDX_HVAR_HTASK" />
+ </key>
+ <one-to-many class="HistoryVariableImpl" />
+ </set>
+
<set name="subTasks" cascade="all-delete-orphan">
- <key column="SUPERTASK_" />
- <one-to-many class="HistoryTaskImpl" />
+ <key column="SUPERTASK_" foreign-key="FK_HSUPERT_SUB" />
+ <one-to-many class="HistoryTaskImpl" />
</set>
</class>
+ <!-- ### HISTORY VARIABLE ################################################# -->
+ <class name="HistoryVariableImpl" table="JBPM4_HIST_VAR">
+ <id name="dbid" column="DBID_">
+ <generator class="assigned" />
+ </id>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="processInstanceId" column="PROCINSTID_" />
+ <property name="executionId" column="EXECUTIONID_" />
+ <property name="variableName" column="VARNAME_" />
+ <property name="value" column="VALUE_" />
+
+ <!-- the foreign-key is set on the other side of the relation: see historyVariables above in HistoryProcessInstanceImpl -->
+ <many-to-one name="historyProcessInstance"
+ class="HistoryProcessInstanceImpl"
+ column="HPROCI_"
+ foreign-key="none" />
+
+ <!-- the foreign-key is set on the other side of the relation: see historyVariables above in HistoryTaskImpl -->
+ <many-to-one name="historyTask"
+ class="HistoryTaskImpl"
+ column="HTASK_"
+ foreign-key="none" />
+
+ <set name="details"
+ cascade="all">
+ <key foreign-key="FK_HDETAIL_HVAR">
+ <column name="HVAR_" index="IDX_HDETAIL_HVAR" />
+ </key>
+ <one-to-many class="HistoryDetailImpl" />
+ </set>
+
+ </class>
+
<!-- ### HISTORY COMMENTS ################################################# -->
- <class name="HistoryCommentImpl" table="JBPM4_HIST_COMMENT">
+ <class name="HistoryDetailImpl" table="JBPM4_HIST_DETAIL">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -121,15 +176,66 @@
<property name="userId" column="USERID_" />
<property name="time" column="TIME_" />
- <property name="message" column="MESSAGE_" type="text" />
+
+ <many-to-one name="historyProcessInstance"
+ class="HistoryProcessInstanceImpl"
+ column="HPROCI_"
+ foreign-key="FK_HDET_HPROCI"
+ index="IDX_HDET_HPROCI" />
+ <property name="historyProcessInstanceIndex" column="HPROCIIDX_" />
- <list name="comments"
- cascade="all-delete-orphan"
- inverse="false">
- <key column="PARENT_" foreign-key="none" />
- <list-index column="PARENT_IDX_" />
- <one-to-many class="HistoryCommentImpl" />
- </list>
+ <many-to-one name="historyActivityInstance"
+ class="HistoryActivityInstanceImpl"
+ column="HACTI_"
+ foreign-key="FK_HDET_HACTI"
+ index="IDX_HDET_HACTI" />
+ <property name="historyActivityInstanceIndex" column="HACTIIDX_" />
+
+ <many-to-one name="historyTask"
+ class="HistoryTaskImpl"
+ column="HTASK_"
+ foreign-key="FK_HDET_HTASK"
+ index="IDX_HDET_HTASK" />
+ <property name="historyTaskIndex" column="HTASKIDX_" />
+
+ <many-to-one name="historyVariable"
+ class="HistoryVariableImpl"
+ column="HVAR_"
+ foreign-key="FK_HDET_HVAR"
+ index="IDX_HDET_HVAR" />
+ <property name="historyVariableIndex" column="HVARIDX_" />
+
+ <subclass name="HistoryCommentImpl" discriminator-value="comment">
+ <property name="message" column="MESSAGE_" type="text" />
+ <list name="replies"
+ cascade="all-delete-orphan"
+ inverse="false">
+ <key column="PARENT_" foreign-key="none" />
+ <list-index column="PARENT_IDX_" />
+ <one-to-many class="HistoryCommentImpl" />
+ </list>
+ </subclass>
+
+ <subclass name="HistoryPriorityUpdateImpl" discriminator-value="priority-update">
+ <property name="oldPriority" column="OLD_INT_" />
+ <property name="newPriority" column="NEW_INT_" />
+ </subclass>
+
+ <subclass name="HistoryTaskAssignmentImpl" discriminator-value="assignment">
+ <property name="oldAssignee" column="OLD_STR_" />
+ <property name="newAssignee" column="NEW_STR_" />
+ </subclass>
+
+ <subclass name="HistoryTaskDuedateUpdateImpl" discriminator-value="duedate-update">
+ <property name="oldDuedate" column="OLD_TIME_" type="timestamp" />
+ <property name="newDuedate" column="NEW_TIME_" type="timestamp" />
+ </subclass>
+
+ <subclass name="HistoryVariableUpdateImpl" discriminator-value="variable-update">
+ <property name="oldValue" column="OLD_STR_" />
+ <property name="newValue" column="NEW_STR_" />
+ </subclass>
+
</class>
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -32,6 +32,7 @@
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.env.Transaction;
import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.type.variable.StringVariable;
import org.jbpm.test.JbpmTestCase;
@@ -89,7 +90,7 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
+ List<HistoryDetailImpl> comments = session.createQuery("from " + HistoryDetailImpl.class.getName()).list();
assertEquals(0, comments.size());
return null;
}
@@ -119,7 +120,7 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
+ List<HistoryDetailImpl> comments = session.createQuery("from " + HistoryDetailImpl.class.getName()).list();
assertEquals(0, comments.size());
return null;
}
@@ -129,11 +130,8 @@
public static class SuccessfulSynchronization implements Synchronization {
public void beforeCompletion() {
- Environment environment = Environment.getCurrent();
- Session session = environment.get(Session.class);
- StringVariable stringVariable = new StringVariable();
- stringVariable.setValue("hello");
- session.save(stringVariable);
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(new HistoryCommentImpl("b) hello from before completion"));
}
public void afterCompletion(int arg0) {
@@ -144,7 +142,7 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- session.save(new HistoryCommentImpl("if i only had the time to write code"));
+ session.save(new HistoryCommentImpl("a) if i only had the time to write code"));
Transaction transaction = environment.get(Transaction.class);
SuccessfulSynchronization successfulSynchronization = new SuccessfulSynchronization();
transaction.registerSynchronization(successfulSynchronization);
@@ -155,12 +153,13 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
- assertEquals("if i only had the time to write code", comments.get(0).getMessage());
+ List<HistoryCommentImpl> comments = session.createQuery(
+ "from " + HistoryCommentImpl.class.getName()+" as hc " +
+ "order by hc.message asc ").list();
+ assertEquals("a) if i only had the time to write code", comments.get(0).getMessage());
+ assertEquals("b) hello from before completion", comments.get(1).getMessage());
session.delete(comments.get(0));
- List<StringVariable> stringVariables = session.createQuery("from " + StringVariable.class.getName()).list();
- assertEquals("hello", stringVariables.get(0).getValue());
- session.delete(stringVariables.get(0));
+ session.delete(comments.get(1));
return null;
}
});
@@ -169,11 +168,8 @@
public static class UnsuccessfulSynchronization implements Synchronization {
public void beforeCompletion() {
- Environment environment = Environment.getCurrent();
- Session session = environment.get(Session.class);
- StringVariable stringVariable = new StringVariable();
- stringVariable.setValue("hello");
- session.save(stringVariable);
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(new HistoryCommentImpl("b) hello from before completion"));
throw new MyOwnRuntimeException();
}
@@ -187,7 +183,7 @@
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- session.save(new HistoryCommentImpl("if i only had the time to write code"));
+ session.save(new HistoryCommentImpl("a) if i only had the time to write code"));
Transaction transaction = environment.get(Transaction.class);
UnsuccessfulSynchronization unsuccessfulSynchronization = new UnsuccessfulSynchronization();
transaction.registerSynchronization(unsuccessfulSynchronization);
@@ -207,10 +203,8 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
+ List<HistoryDetailImpl> comments = session.createQuery("from " + HistoryDetailImpl.class.getName()).list();
assertEquals(0, comments.size());
- List<StringVariable> stringVariables = session.createQuery("from " + StringVariable.class.getName()).list();
- assertEquals(0, stringVariables.size());
return null;
}
});
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -54,10 +54,10 @@
assertEquals("what a party yesterday", taskComments.get(0).getMessage());
assertEquals("i'll clean up the mess", taskComments.get(1).getMessage());
- taskComments = taskComments.get(0).getComments();
+ taskComments = taskComments.get(0).getReplies();
assertEquals("what! you had a party while i was out ?!", taskComments.get(0).getMessage());
- taskComments = taskComments.get(0).getComments();
+ taskComments = taskComments.get(0).getReplies();
assertEquals("euh yes. it was a great party :-)", taskComments.get(0).getMessage());
taskService.deleteComment(whatAPartyId);
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -30,7 +30,7 @@
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.session.MessageSession;
@@ -70,7 +70,7 @@
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- List<HistoryComment> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
+ List<HistoryComment> comments = session.createQuery("from " + HistoryDetailImpl.class.getName()).list();
for (HistoryComment comment : comments) {
log.debug("retrieved message: "+comment.getMessage());
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -27,7 +27,6 @@
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -28,7 +28,7 @@
import org.jbpm.api.job.Job;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.session.MessageSession;
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -24,7 +24,7 @@
import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -41,8 +41,8 @@
DbSession dbSession = environment.get(DbSession.class);
// this message execution should be rolled back
- HistoryComment comment = new HistoryCommentImpl("failing update");
- dbSession.save(comment);
+// HistoryComment comment = new HistoryDetailImpl("failing update");
+// dbSession.save(comment);
throw new RuntimeException("ooops");
}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -27,6 +27,7 @@
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -57,7 +58,7 @@
}
public Void execute(Environment environment) throws Exception {
- HistoryCommentImpl comment = new HistoryCommentImpl(Integer.toString(messageId));
+ HistoryDetailImpl comment = new HistoryCommentImpl(Integer.toString(messageId));
Session session = environment.get(Session.class);
session.save(comment);
return null;
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -28,7 +28,7 @@
import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.session.MessageSession;
@@ -67,7 +67,7 @@
public List<Integer> execute(Environment environment) {
List<Integer> processedMessageNumbers = new ArrayList<Integer>();
Session session = environment.get(Session.class);
- List<HistoryComment> comments = session.createCriteria(HistoryCommentImpl.class).list();
+ List<HistoryComment> comments = session.createCriteria(HistoryDetailImpl.class).list();
for (HistoryComment comment: comments) {
int processedMessageNumber = Integer.parseInt(comment.getMessage());
processedMessageNumbers.add(processedMessageNumber);
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -24,7 +24,7 @@
import org.hibernate.Session;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
/**
* @author Tom Baeyens
@@ -36,10 +36,10 @@
protected String message;
public Void execute(Environment environment) throws Exception {
- HistoryCommentImpl comment = new HistoryCommentImpl(message);
- Session session = environment.get(Session.class);
- session.save(comment);
- MessageProcessingTest.commentAdded();
+// HistoryDetailImpl comment = new HistoryDetailImpl(message);
+// Session session = environment.get(Session.class);
+// session.save(comment);
+// MessageProcessingTest.commentAdded();
return null;
}
}
Modified: jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java 2009-07-08 18:48:00 UTC (rev 5260)
+++ jbpm4/trunk/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java 2009-07-08 19:37:50 UTC (rev 5261)
@@ -31,7 +31,7 @@
import org.jbpm.pvm.internal.cmd.CompositeCmd;
import org.jbpm.pvm.internal.cmd.SendMessageCmd;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -119,7 +119,7 @@
public List<Integer> execute(Environment environment) {
List<Integer> processedMessageNumbers = new ArrayList<Integer>();
Session session = environment.get(Session.class);
- List<HistoryComment> comments = session.createCriteria(HistoryCommentImpl.class).list();
+ List<HistoryComment> comments = session.createCriteria(HistoryDetailImpl.class).list();
for (HistoryComment comment: comments) {
int processedMessageNumber = Integer.parseInt(comment.getMessage());
processedMessageNumbers.add(processedMessageNumber);
15 years, 3 months
JBoss JBPM SVN: r5260 - in jbpm4/branches/jbpm-4.0/modules: pvm/src/main/java/org/jbpm/pvm/internal/model and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-07-08 14:48:00 -0400 (Wed, 08 Jul 2009)
New Revision: 5260
Modified:
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
Log:
JBPM-2393 fixed audit logs, make variable history optional, default is disabled
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java 2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/OpenExecution.java 2009-07-08 18:48:00 UTC (rev 5260)
@@ -104,10 +104,6 @@
* the type automagically. */
void createVariable(String key, Object value);
- /** create a new variable in this execution scope with
- * the given type name. */
- void createVariable(String key, Object value, String typeName);
-
// priority /////////////////////////////////////////////////////////////////
/** setter for the priority. The default priority is 0, which means
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
@@ -51,14 +51,12 @@
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.env.ExecutionContext;
import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.HistorySession;
import org.jbpm.pvm.internal.history.events.ActivityEnd;
import org.jbpm.pvm.internal.history.events.ActivityStart;
import org.jbpm.pvm.internal.history.events.AutomaticEnd;
import org.jbpm.pvm.internal.history.events.DecisionEnd;
-import org.jbpm.pvm.internal.history.events.ProcessInstanceEnd;
import org.jbpm.pvm.internal.history.events.ProcessInstanceCreate;
-import org.jbpm.pvm.internal.history.events.TaskActivityStart;
+import org.jbpm.pvm.internal.history.events.ProcessInstanceEnd;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.model.op.AtomicOperation;
@@ -70,11 +68,8 @@
import org.jbpm.pvm.internal.session.RepositorySession;
import org.jbpm.pvm.internal.session.TimerSession;
import org.jbpm.pvm.internal.task.AssignableDefinitionImpl;
-import org.jbpm.pvm.internal.task.ParticipationImpl;
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneImpl;
-import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.type.Variable;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
@@ -923,7 +918,7 @@
}
public void createSystemVariable(String key, Object value, String typeName) {
- Variable variable = createVariableObject(key, value, typeName);
+ Variable variable = createVariableObject(key, value, typeName, false);
systemVariables.put(variable.getKey(), variable);
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
@@ -75,22 +75,23 @@
String key = variableDefinition.getName();
Object value = variableDefinition.getInitValue(outerExecution);
String typeName = variableDefinition.getTypeName();
- createVariable(key, value, typeName);
+ boolean isHistoryEnabled = variableDefinition.isHistoryEnabled();
+ createVariable(key, value, typeName, isHistoryEnabled);
}
}
}
public void createVariable(String key, Object value) {
- createVariable(key, value, null);
+ createVariable(key, value, null, false);
}
- public void createVariable(String key, Object value, String typeName) {
- Variable variable = createVariableObject(key, value, typeName);
+ public void createVariable(String key, Object value, String typeName, boolean isHistoryEnabled) {
+ Variable variable = createVariableObject(key, value, typeName, isHistoryEnabled);
variables.put(variable.getKey(), variable);
hasVariables = true;
}
- protected Variable createVariableObject(String key, Object value, String typeName) {
+ protected Variable createVariableObject(String key, Object value, String typeName, boolean isHistoryEnabled) {
log.debug("create variable '"+key+"' in '"+this+"' with value '"+value+"'");
Type type = null;
@@ -133,8 +134,11 @@
variable.setKey(key);
variable.setExecution(getExecution());
variable.setTask(getTask());
+ variable.setHistoryEnabled(isHistoryEnabled);
- HistoryEvent.fire(new VariableCreate(variable));
+ if (isHistoryEnabled) {
+ HistoryEvent.fire(new VariableCreate(variable));
+ }
variable.setValue(value);
@@ -158,7 +162,7 @@
variable.setValue(value);
} else if (getParentVariableScope()==null) {
- createVariable(key, value, null);
+ createVariable(key, value, null, false);
} else {
getParentVariableScope().setVariable(key,value);
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/VariableDefinitionImpl.java 2009-07-08 18:48:00 UTC (rev 5260)
@@ -43,6 +43,7 @@
protected String name;
protected String typeName;
+ protected boolean isHistoryEnabled;
protected String initExpression;
protected String initLanguage;
@@ -89,4 +90,10 @@
public void setInitLanguage(String initLanguage) {
this.initLanguage = initLanguage;
}
+ public boolean isHistoryEnabled() {
+ return isHistoryEnabled;
+ }
+ public void setHistoryEnabled(boolean isHistoryEnabled) {
+ this.isHistoryEnabled = isHistoryEnabled;
+ }
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java 2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java 2009-07-08 18:48:00 UTC (rev 5260)
@@ -45,6 +45,7 @@
protected String key = null;
protected Converter converter = null;
protected String textValue = null;
+ protected boolean isHistoryEnabled = false;
protected ExecutionImpl execution;
protected TaskImpl task;
@@ -89,7 +90,9 @@
setObject(value);
HistorySession historySession = Environment.getFromCurrent(HistorySession.class, false);
- if (historySession!=null) {
+ if ( isHistoryEnabled
+ && (historySession!=null)
+ ) {
HistoryEvent.fire(new VariableUpdate(this));
}
}
@@ -108,7 +111,7 @@
public String toString() {
return "${"+key+"}";
}
-
+
public Type getType() {
Type type = new Type();
type.setConverter(converter);
@@ -152,4 +155,10 @@
public void setTask(TaskImpl task) {
this.task = task;
}
+ public boolean isHistoryEnabled() {
+ return isHistoryEnabled;
+ }
+ public void setHistoryEnabled(boolean isHistoryEnabled) {
+ this.isHistoryEnabled = isHistoryEnabled;
+ }
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-08 18:12:04 UTC (rev 5259)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-08 18:48:00 UTC (rev 5260)
@@ -125,6 +125,8 @@
<property name="key" column="KEY_"/>
<property name="converter" type="converter" column="CONVERTER_" />
+ <property name="isHistoryEnabled" column="HIST_" />
+
<many-to-one name="execution"
column="EXECUTION_"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
15 years, 3 months
JBoss JBPM SVN: r5259 - in jbpm4/branches/jbpm-4.0/modules: api/src/main/java/org/jbpm/api/model and 24 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-07-08 14:12:04 -0400 (Wed, 08 Jul 2009)
New Revision: 5259
Added:
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java
jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.history.png
jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.identity.png
jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.repo.and.runtime.png
jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/task/comments/
jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java
jbpm4/branches/jbpm-4.0/modules/examples/src/test/resources/org/jbpm/examples/task/comments/
jbpm4/branches/jbpm-4.0/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java
Removed:
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Discussable.java
jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/jbpm.erd.png
jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/taskform/
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceStart.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java
Modified:
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java
jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch10-Persistence.xml
jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch14-History.xml
jbpm4/branches/jbpm-4.0/modules/distro/src/main/files/readme.html
jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DateVariable.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DoubleVariable.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/LongVariable.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/StringVariable.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.history.hbm.xml
jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java
Log:
JBPM-2393 fixed audit logs
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -21,36 +21,24 @@
*/
package org.jbpm.api.history;
-import java.util.Date;
import java.util.List;
import org.jbpm.api.Execution;
-import org.jbpm.api.model.Discussable;
/** a free text comment that can be made to an {@link Execution}
* or a task.
*
* This class also supports threaded discussions with the
- * {@link #getComments() parent-child relation}.
+ * {@link #getReplies()}.
*
* @author Tom Baeyens
*/
-public interface HistoryComment extends Discussable {
+public interface HistoryComment extends HistoryDetail {
- /** the unique id for this comment that is used as a reference in the service methods */
- String getId();
-
- /** the id of the user that made this comment. The term actorId is an abstract
- * reference to an entity in an external identity component. */
- String getUserId();
-
/** the actual message. Both plain text as well as HTML can be stored
* as the message. */
String getMessage();
- /** time that specifies when the comment was made */
- Date getTime();
-
/** threaded replies to this comment */
- List<HistoryComment> getComments();
+ List<HistoryComment> getReplies();
}
\ No newline at end of file
Added: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -0,0 +1,44 @@
+/*
+ * 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.api.history;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/** base type for all history details.
+ *
+ * @author Tom Baeyens
+ */
+public interface HistoryDetail extends Serializable {
+
+ /** the unique id for this comment that is used as a reference in the service methods */
+ String getId();
+
+ /** the id of the user that made this comment. The term actorId is an abstract
+ * reference to an entity in an external identity component. */
+ String getUserId();
+
+ /** time that specifies when the comment was made */
+ Date getTime();
+
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryDetail.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -41,8 +41,6 @@
/** the unique id for this task that is used as a reference in the service methods */
String getId();
- List<? extends HistoryComment> getComments();
-
/** the execution that was related to this activity occurrence */
String getExecutionId();
Deleted: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Discussable.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Discussable.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Discussable.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -1,48 +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.api.model;
-
-import java.util.List;
-
-import org.jbpm.api.TaskService;
-import org.jbpm.api.history.HistoryComment;
-
-
-/** something that people can discuss like a task
- * or a process instance.
- *
- * for now, only task discussions are supported in
- * the {@link TaskService}
- *
- * @author Tom Baeyens
- */
-public interface Discussable {
-
- /** all comments. */
- List<HistoryComment> getComments();
-
- /** create a comment */
- HistoryComment createComment(String message);
-
- /** remove a comment */
- void removeComment(HistoryComment comment);
-}
Added: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.history.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.history.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.identity.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.identity.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.repo.and.runtime.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/erd.repo.and.runtime.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/jbpm.erd.png
===================================================================
(Binary files differ)
Modified: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch10-Persistence.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch10-Persistence.xml 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch10-Persistence.xml 2009-07-08 18:12:04 UTC (rev 5259)
@@ -10,16 +10,19 @@
<ulink url="http://dev.mysql.com/workbench/">MySQL Workbench></ulink>.
</para>
- <figure id="schema ">
- <title>The jBPM Schema ER Diagram</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/jbpm.erd.png"/></imageobject></mediaobject>
+ <figure id="erd.repo.and.runtime">
+ <title>The jBPM repository and runtime schema ER diagram</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/erd.repo.and.runtime.png"/></imageobject></mediaobject>
</figure>
+ <figure id="erd.history">
+ <title>The jBPM history schema ER diagram</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/erd.history.png"/></imageobject></mediaobject>
+ </figure>
- <para>TODO: hibernate-session and the standard transaction
- </para>
+ <figure id="erd.identity">
+ <title>The jBPM identity schema ER diagram</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/erd.identity.png"/></imageobject></mediaobject>
+ </figure>
- <para>TODO: process definition caching
- </para>
-
</chapter>
\ No newline at end of file
Modified: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch14-History.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch14-History.xml 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/modules/ch14-History.xml 2009-07-08 18:12:04 UTC (rev 5259)
@@ -1,24 +1,20 @@
<chapter id="history">
<title>History</title>
- <section id="overview">
- <title>Overview</title>
+ <para>History information is the information that will be maintained in the database
+ for querying purposes. This information is kept in the database after the
+ process or task has ended. But it is always up to date with the runtime
+ information. History information is updated inside of the runtime
+ transaction.
+ </para>
- <para>HistoryEvents are fired during process execution.
+ <para>We maintain history information on 4 entities: process instance, activity instance
+ task and variable. Each entity has a list of details associated to it.
+ Preferably use the history queries to access this information through the API.
</para>
- <para>We maintain history information on 2 levels: process instance and activity instance.
- </para>
-
- <para>Process instance start and process instance end generate history events are fired directly
- from within the implementation.
- </para>
-
- <para>ActivityBehaviour implementations are responsible for calling the historyXxx methods that
- are exposed on the ActivityExecution
- </para>
-
- <para>All the HistoryEvents are delegated to a HistorySession. The default HistorySessionImpl
+ <para>HistoryEvents are fired during process execution and dispatched to the configured
+ HistorySession. (see HistoryEvent.fire) All the HistoryEvents are delegated to a HistorySession. The default HistorySessionImpl
will invoke the process() method on the history events themselves.
</para>
@@ -27,7 +23,7 @@
</para>
<para>In the HistoryEvent.process methods, the history events create model entities or merge
- information into the model entities. For instance, a ProcessInstanceStart history event will
+ information into the history entities. For instance, a ProcessInstanceCreate history event will
create a HistoryProcessInstance entity/record. And the ProcessInstanceEnd will set the endTime
property in the existing HistoryProcessInstance entity/record.
</para>
@@ -37,6 +33,4 @@
this happens inside 1 transaction).
</para>
- </section>
-
</chapter>
\ No newline at end of file
Modified: jbpm4/branches/jbpm-4.0/modules/distro/src/main/files/readme.html
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/distro/src/main/files/readme.html 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/distro/src/main/files/readme.html 2009-07-08 18:12:04 UTC (rev 5259)
@@ -78,6 +78,8 @@
</li>
<li>[<a href='https://jira.jboss.org/jira/browse/JBPM-2390'>JBPM-2390</a>] - add tasks and task comments the history
</li>
+<li>[<a href='https://jira.jboss.org/jira/browse/JBPM-2393'>JBPM-2393</a>] - expand task history to full audit logs
+</li>
</ul>
<h2> Feature Request
Modified: jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -21,12 +21,8 @@
*/
package org.jbpm.enterprise.internal.custom;
-import java.sql.SQLException;
-
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
-import org.jbpm.pvm.internal.session.DbSession;
/**
* @author Alejandro Guizar
@@ -48,11 +44,11 @@
}
public Void execute(Environment environment) throws Exception {
- HistoryCommentImpl comment = new HistoryCommentImpl();
- comment.setMessage(message);
- environment.get(DbSession.class).save(comment);
- if (fail)
- throw new SQLException("simulated failure");
+// HistoryDetailImpl comment = new HistoryDetailImpl();
+// comment.setMessage(message);
+// environment.get(DbSession.class).save(comment);
+// if (fail)
+// throw new SQLException("simulated failure");
return null;
}
Modified: jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -28,7 +28,7 @@
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
/**
* @author Alejandro Guizar
@@ -45,13 +45,13 @@
public Boolean execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- List<?> comments = session.createCriteria(HistoryCommentImpl.class)
+ List<?> comments = session.createCriteria(HistoryDetailImpl.class)
.add(Restrictions.eq("message", message))
.setMaxResults(1)
.list();
if (comments.isEmpty())
return false;
- HistoryCommentImpl phrase = (HistoryCommentImpl) comments.get(0);
+ HistoryDetailImpl phrase = (HistoryDetailImpl) comments.get(0);
session.delete(phrase);
return true;
}
Added: jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.task.comments;
+
+import java.util.List;
+
+import org.jbpm.api.history.HistoryComment;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskCommentsTest extends JbpmTestCase {
+
+ String deploymentId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ deploymentId = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/task/comments/process.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+
+ super.tearDown();
+ }
+
+ public void testTaskComments() {
+ executionService.startProcessInstanceByKey("TaskComments");
+
+ List<Task> taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals(1, taskList.size());
+ String taskId = taskList.get(0).getId();
+
+ taskService.addTaskComment(taskId, "hi");
+ taskService.addTaskComment(taskId, "yo");
+
+ List<HistoryComment> comments = taskService.getTaskComments(taskId);
+
+ assertEquals("expected 2 comments: "+comments, 2, comments.size());
+
+ assertEquals("hi", comments.get(0).getMessage());
+ assertEquals("yo", comments.get(1).getMessage());
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/task/comments/TaskCommentsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/jbpm-4.0/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml 2009-07-08 18:12:04 UTC (rev 5259)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="TaskComments" xmlns="http://jbpm.org/4.0/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="review" />
+ </start>
+
+ <task name="review"
+ assignee="johndoe"
+ g="96,16,127,52">
+
+ <transition to="wait" />
+ </task>
+
+ <state name="wait" g="255,16,88,52"/>
+
+</process>
Property changes on: jbpm4/branches/jbpm-4.0/modules/examples/src/test/resources/org/jbpm/examples/task/comments/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -52,7 +52,7 @@
if (parentComment==null) {
throw new JbpmException("parent comment doesn't exist: "+commentId);
}
- HistoryComment replyComment = parentComment.createComment(message);
+ HistoryComment replyComment = parentComment.createReply(message);
return replyComment;
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -50,7 +50,9 @@
if (historyTask==null) {
throw new JbpmException("task "+taskDbid+" doesn't exist");
}
- HistoryCommentImpl comment = historyTask.createComment(message);
+ HistoryCommentImpl comment = new HistoryCommentImpl(message);
+ historyTask.addDetail(comment);
+ dbSession.save(comment);
return comment;
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -23,7 +23,7 @@
import org.jbpm.api.JbpmException;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.session.DbSession;
@@ -45,7 +45,7 @@
public Object execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- HistoryCommentImpl comment = (HistoryCommentImpl) dbSession.get(HistoryCommentImpl.class, Long.parseLong(commentId));
+ HistoryDetailImpl comment = (HistoryDetailImpl) dbSession.get(HistoryDetailImpl.class, Long.parseLong(commentId));
if (comment!=null) {
dbSession.delete(comment);
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -27,7 +27,7 @@
import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.session.DbSession;
@@ -47,15 +47,10 @@
public List<HistoryComment> execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- HistoryTaskImpl historyTask = dbSession.get(HistoryTaskImpl.class, Long.parseLong(taskId));
-
- if (historyTask != null) {
- List<HistoryComment> comments = historyTask.getComments();
- forceInitializationAndClean(comments);
- return comments;
- } else {
- return Collections.emptyList();
- }
+
+ List<HistoryComment> comments = dbSession.findCommentsByTaskId(taskId);
+ forceInitializationAndClean(comments);
+ return comments;
}
protected void forceInitializationAndClean(List<HistoryComment> comments) {
@@ -74,7 +69,7 @@
if (comment==null) {
comments.remove(i);
} else {
- forceInitializationAndClean(comment.getComments());
+ forceInitializationAndClean(comment.getReplies());
}
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -31,15 +31,15 @@
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.client.ClientExecution;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.HistorySession;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
-import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
@@ -425,4 +425,21 @@
public DeploymentQueryImpl createDeploymentQuery() {
return new DeploymentQueryImpl();
}
+
+ public List<HistoryComment> findCommentsByTaskId(String taskId) {
+ Long taskDbid = null;
+ try {
+ taskDbid = Long.parseLong(taskId);
+ } catch (Exception e) {
+ throw new JbpmException("invalid taskId: "+taskId);
+ }
+ return session.createQuery(
+ "select hc " +
+ "from "+HistoryCommentImpl.class.getName()+" as hc " +
+ "where hc.historyTask.dbid = :taskDbid " +
+ "order by hc.historyTaskIndex asc "
+ ).setLong("taskDbid", taskDbid)
+ .list();
+ }
+
}
Copied: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java (from rev 5258, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceStart.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.events;
+
+import java.io.Serializable;
+
+import org.hibernate.Session;
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessInstanceCreate extends HistoryEvent implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public void process() {
+ HistoryProcessInstance historyProcessInstanceImpl = new HistoryProcessInstanceImpl(execution);
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(historyProcessInstanceImpl);
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceCreate.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceStart.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceStart.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceStart.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -1,45 +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.history.events;
-
-import java.io.Serializable;
-
-import org.hibernate.Session;
-import org.jbpm.api.history.HistoryProcessInstance;
-import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ProcessInstanceStart extends HistoryEvent implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- public void process() {
- HistoryProcessInstance historyProcessInstanceImpl = new HistoryProcessInstanceImpl(execution);
- Session session = Environment.getFromCurrent(Session.class);
- session.save(historyProcessInstanceImpl);
- }
-}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -44,7 +44,6 @@
public void process() {
DbSession dbSession = Environment.getFromCurrent(DbSession.class);
HistoryTaskImpl historyTask = dbSession.get(HistoryTaskImpl.class, task.getDbid());
-
historyTask.updated(task);
}
}
Added: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -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.pvm.internal.history.events;
+
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.api.history.HistoryTask;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
+import org.jbpm.pvm.internal.history.model.HistoryVariableImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.pvm.internal.type.Variable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class VariableCreate extends HistoryEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ Variable variable;
+
+ public VariableCreate(Variable variable) {
+ this.variable = variable;
+ }
+
+ public void process() {
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+
+ dbSession.save(variable);
+
+ HistoryProcessInstanceImpl historyProcessInstance = null;
+ ExecutionImpl processInstance = variable.getProcessInstance();
+ if (processInstance!=null) {
+ long processInstanceDbid = processInstance.getDbid();
+ historyProcessInstance = (HistoryProcessInstanceImpl)
+ dbSession.get(HistoryProcessInstanceImpl.class, processInstanceDbid);
+ }
+
+ HistoryTaskImpl historyTask = null;
+ TaskImpl task = variable.getTask();
+ if (task!=null) {
+ long taskDbid = task.getDbid();
+ historyTask = (HistoryTaskImpl)
+ dbSession.get(HistoryTaskImpl.class, taskDbid);
+ }
+
+ HistoryVariableImpl historyVariable = new HistoryVariableImpl(historyProcessInstance, historyTask, variable);
+ dbSession.save(historyVariable);
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableCreate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -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.history.events;
+
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryVariableImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.type.Variable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class VariableUpdate extends HistoryEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ Variable variable;
+
+ public VariableUpdate(Variable variable) {
+ this.variable = variable;
+ }
+
+ @Override
+ public void process() {
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+ HistoryVariableImpl historyVariable = dbSession.get(HistoryVariableImpl.class, variable.getDbid());
+ historyVariable.updated(variable);
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/VariableUpdate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryActivityInstanceImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -22,7 +22,11 @@
package org.jbpm.pvm.internal.history.model;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import org.jbpm.api.history.HistoryActivityInstance;
import org.jbpm.api.history.HistoryProcessInstance;
@@ -51,6 +55,12 @@
protected long duration;
protected String transitionName;
+
+ protected int nextDetailIndex = 1;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryDetailImpl> details = new HashSet<HistoryDetailImpl>();
+
public HistoryActivityInstanceImpl() {
}
@@ -62,6 +72,13 @@
this.activityName = activity.getName();
this.startTime = execution.getHistoryActivityStart();
}
+
+ // details //////////////////////////////////////////////////////////////////
+
+ public void addDetail(HistoryDetailImpl detail) {
+ detail.setHistoryActivityInstance(this, nextDetailIndex);
+ nextDetailIndex++;
+ }
public void setEndTime(Date endTime) {
this.endTime = endTime;
Deleted: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -1,124 +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.history.model;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.history.HistoryComment;
-import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.util.Clock;
-import org.jbpm.pvm.internal.util.EqualsUtil;
-
-public class HistoryCommentImpl implements Serializable, HistoryComment {
-
- private static final long serialVersionUID = 1L;
-
- protected long dbid;
- protected int dbversion;
- protected String userId = null;
- protected Date time = null;
- protected String message = null;
- protected List<HistoryCommentImpl> comments = new ArrayList<HistoryCommentImpl>();
-
- public HistoryCommentImpl() {
- }
-
- public HistoryCommentImpl(String message) {
- this.message = message;
- this.time = Clock.getCurrentTime();
-
- Environment environment = Environment.getCurrent();
- if (environment!=null) {
- this.userId = environment.getUserId();
- }
- }
-
- // replies //////////////////////////////////////////////////////////////////
-
- public HistoryComment createComment(String message) {
- if (message==null) {
- throw new JbpmException("message is null");
- }
- HistoryCommentImpl reply = new HistoryCommentImpl(message);
- comments.add(reply);
- return reply;
- }
-
- public void removeComment(HistoryComment comment) {
- if (comment==null) {
- throw new JbpmException("reply is null");
- }
- if (comments.contains(comment)) {
- comments.remove(comment);
- }
- }
-
- public List<HistoryComment> getComments() {
- return (List)comments;
- }
-
-
- public void setComments(List<HistoryCommentImpl> replies) {
- this.comments = replies;
- }
-
- // equals ///////////////////////////////////////////////////////////////////
- // hack to support comparing hibernate proxies against the real objects
- // since this always falls back to ==, we don't need to overwrite the hashcode
- public boolean equals(Object o) {
- return EqualsUtil.equals(this, o);
- }
-
- // cusomtized getters and setters ////////////////////////////////////////////
-
- public String getId() {
- return Long.toString(dbid);
- }
-
- // getters and setters //////////////////////////////////////////////////////
-
- public long getDbid() {
- return dbid;
- }
- public String getUserId() {
- return userId;
- }
- public String getMessage() {
- return message;
- }
- public Date getTime() {
- return time;
- }
- public void setUserId(String userId) {
- this.userId = userId;
- }
- public void setTime(Date time) {
- this.time = time;
- }
- public void setMessage(String message) {
- this.message = message;
- }
-}
Added: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -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.pvm.internal.history.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.history.HistoryComment;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryCommentImpl extends HistoryDetailImpl implements HistoryComment {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String message;
+ protected List<HistoryCommentImpl> replies = new ArrayList<HistoryCommentImpl>();
+
+ public HistoryCommentImpl() {
+ }
+
+ public HistoryCommentImpl(String message) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ if (message==null) {
+ throw new JbpmException("message is null");
+ }
+ this.message = message;
+ }
+
+ // replies //////////////////////////////////////////////////////////////////
+
+ public HistoryCommentImpl createReply(String message) {
+ HistoryCommentImpl reply = new HistoryCommentImpl(message);
+ replies.add(reply);
+ return reply;
+ }
+
+ public List<HistoryComment> getReplies() {
+ return (List) replies;
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java (from rev 5258, jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -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.pvm.internal.history.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.util.Clock;
+import org.jbpm.pvm.internal.util.EqualsUtil;
+
+public class HistoryDetailImpl implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int dbversion;
+ protected String userId = null;
+ protected Date time = null;
+
+ protected HistoryProcessInstanceImpl historyProcessInstance;
+ protected Integer historyProcessInstanceIndex;
+
+ protected HistoryActivityInstanceImpl historyActivityInstance;
+ protected Integer historyActivityInstanceIndex;
+
+ protected HistoryTaskImpl historyTask;
+ protected Integer historyTaskIndex;
+
+ protected HistoryVariableImpl historyVariable;
+ protected Integer historyVariableIndex;
+
+ protected HistoryDetailImpl() {
+ }
+
+ // dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ protected HistoryDetailImpl(String dummy) {
+ this.time = Clock.getCurrentTime();
+
+ Environment environment = Environment.getCurrent();
+ if (environment!=null) {
+ this.userId = environment.getUserId();
+ }
+ }
+
+ // equals ///////////////////////////////////////////////////////////////////
+ // hack to support comparing hibernate proxies against the real objects
+ // since this always falls back to ==, we don't need to overwrite the hashcode
+ public boolean equals(Object o) {
+ return EqualsUtil.equals(this, o);
+ }
+
+ // cusomtized getters and setters ////////////////////////////////////////////
+
+ public String getId() {
+ return Long.toString(dbid);
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public long getDbid() {
+ return dbid;
+ }
+ public String getUserId() {
+ return userId;
+ }
+ public Date getTime() {
+ return time;
+ }
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+ public void setHistoryProcessInstance(HistoryProcessInstanceImpl historyProcessInstance, int historyProcessInstanceIndex) {
+ this.historyProcessInstance = historyProcessInstance;
+ this.historyProcessInstanceIndex = historyProcessInstanceIndex;
+ }
+
+ public void setHistoryActivityInstance(HistoryActivityInstanceImpl historyActivityInstance, int historyActivityInstanceIndex) {
+ this.historyActivityInstance = historyActivityInstance;
+ this.historyActivityInstanceIndex = historyActivityInstanceIndex;
+ }
+
+ public void setHistoryTask(HistoryTaskImpl historyTask, int historyTaskIndex) {
+ this.historyTask = historyTask;
+ this.historyTaskIndex = historyTaskIndex;
+ }
+
+ public void setHistoryVariable(HistoryVariableImpl historyVariable, int historyVariableIndex) {
+ this.historyVariable = historyVariable;
+ this.historyVariableIndex = historyVariableIndex;
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.model;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryPriorityUpdateImpl extends HistoryDetailImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ public int oldPriority;
+ public int newPriority;
+
+ public HistoryPriorityUpdateImpl() {
+ }
+
+ public HistoryPriorityUpdateImpl(int oldPriority, int newPriority) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ this.oldPriority = oldPriority;
+ this.newPriority = newPriority;
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryPriorityUpdateImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import java.util.Date;
+import java.util.HashSet;
import java.util.Set;
import org.jbpm.api.history.HistoryProcessInstance;
@@ -49,11 +50,24 @@
protected String endActivityName;
protected Date startTime;
protected Date endTime;
- protected Long duration = null;
-
- /** only here to get hibernate cascade deletes */
+ protected Long duration;
+ protected int nextDetailIndex = 1;
+
+ /** only here to get hibernate cascade */
protected Set<HistoryActivityInstanceImpl> historyActivityInstances;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryVariableImpl> historyVariables;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryDetailImpl> details = new HashSet<HistoryDetailImpl>();
+
+ public void addDetail(HistoryDetailImpl detail) {
+ detail.setHistoryProcessInstance(this, nextDetailIndex);
+ nextDetailIndex++;
+ }
+
public HistoryProcessInstanceImpl() {
}
Added: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.model;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryTaskAssignmentImpl extends HistoryDetailImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String oldAssignee;
+ protected String newAssignee;
+
+ public HistoryTaskAssignmentImpl() {
+ }
+
+ public HistoryTaskAssignmentImpl(String oldAssignee, String newAssignee) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ this.oldAssignee = oldAssignee;
+ this.newAssignee = newAssignee;
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskAssignmentImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.model;
+
+import java.util.Date;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryTaskDuedateUpdateImpl extends HistoryDetailImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Date oldDuedate;
+ protected Date newDuedate;
+
+ public HistoryTaskDuedateUpdateImpl() {
+ }
+
+ public HistoryTaskDuedateUpdateImpl(Date oldDuedate, Date newDuedate) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ this.oldDuedate = oldDuedate;
+ this.newDuedate = newDuedate;
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskDuedateUpdateImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -28,8 +28,6 @@
import java.util.List;
import java.util.Set;
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.history.HistoryTask;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.util.Clock;
@@ -45,18 +43,26 @@
protected long dbid;
protected int dbversion;
+
protected String executionId;
protected String assignee;
protected String state;
protected String outcome;
- protected Integer priority;
+ protected int priority;
protected Date duedate;
protected Date createTime;
protected Date endTime;
protected long duration;
+ protected int nextDetailIndex = 1;
+
protected Set<HistoryTaskImpl> subTasks = new HashSet<HistoryTaskImpl>();
- protected List<HistoryCommentImpl> comments = new ArrayList<HistoryCommentImpl>();
-
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryVariableImpl> historyVariables;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryDetailImpl> details = new HashSet<HistoryDetailImpl>();
+
public HistoryTaskImpl() {
}
@@ -69,37 +75,33 @@
}
public void updated(TaskImpl task) {
- this.assignee = task.getAssignee();
- this.priority = task.getPriority();
- this.duedate = task.getDuedate();
- }
-
- // comments /////////////////////////////////////////////////////////////////
- public List<HistoryComment> getComments() {
- return (List)comments;
- }
-
- public HistoryCommentImpl createComment(String commentText) {
- HistoryCommentImpl comment = new HistoryCommentImpl(commentText);
- comments.add(comment);
- return comment;
- }
-
- public void removeComment(HistoryCommentImpl comment) {
- if (comment == null) {
- throw new JbpmException("comment is null");
+ if ( (assignee==null && task.getAssignee()!=null)
+ || (assignee!=null) && (!assignee.equals(task.getAssignee()))
+ ) {
+ addDetail(new HistoryTaskAssignmentImpl(assignee, task.getAssignee()));
+ this.assignee = task.getAssignee();
}
- if (comments.contains(comment)) {
- comments.remove(comment);
+ if (priority!=task.getPriority()) {
+ addDetail(new HistoryPriorityUpdateImpl(priority, task.getPriority()));
+ this.priority = task.getPriority();
}
+ if ( (duedate==null && task.getDuedate()!=null)
+ || (duedate!=null) && (!duedate.equals(task.getDuedate()))
+ ) {
+ addDetail(new HistoryTaskDuedateUpdateImpl(duedate, task.getDuedate()));
+ this.duedate = task.getDuedate();
+ }
}
- // subtasks /////////////////////////////////////////////////////////////////
+ // details //////////////////////////////////////////////////////////////////
- public Set<HistoryTask> getSubTasks() {
- return (Set)subTasks;
+ public void addDetail(HistoryDetailImpl detail) {
+ detail.setHistoryTask(this, nextDetailIndex);
+ nextDetailIndex++;
}
+ // subtasks /////////////////////////////////////////////////////////////////
+
public void addSubTask(HistoryTaskImpl historyTask) {
subTasks.add(historyTask);
}
Added: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -0,0 +1,87 @@
+/*
+ * 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.history.model;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.type.Variable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryVariableImpl implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int dbversion;
+
+ protected HistoryProcessInstanceImpl historyProcessInstance;
+ protected HistoryTaskImpl historyTask;
+
+ protected String processInstanceId;
+ protected String executionId;
+ protected String variableName;
+ protected String value;
+ protected int nextDetailIndex = 1;
+
+ /** only here to get hibernate cascade */
+ protected Set<HistoryDetailImpl> details = new HashSet<HistoryDetailImpl>();
+
+ protected HistoryVariableImpl() {
+ }
+
+ public HistoryVariableImpl(HistoryProcessInstanceImpl historyProcessInstance, HistoryTaskImpl historyTask, Variable variable) {
+ this.dbid = variable.getDbid();
+
+ this.historyProcessInstance = historyProcessInstance;
+ this.historyTask = historyTask;
+
+ ExecutionImpl processInstance = variable.getProcessInstance();
+ if (processInstance!=null) {
+ this.processInstanceId = processInstance.getId();
+ }
+ // this.executionId = variable.getExecution().getId();
+
+ this.variableName = variable.getKey();
+ this.value = variable.getTextValue();
+ }
+
+ public void updated(Variable variable) {
+ String newValue = variable.getTextValue();
+ if ( (value==null && newValue!=null)
+ || (value!=null && (!value.equals(newValue)))
+ ) {
+ addDetail(new HistoryVariableUpdateImpl(value, newValue));
+ }
+ }
+
+ public void addDetail(HistoryDetailImpl detail) {
+ detail.setHistoryVariable(this, nextDetailIndex);
+ nextDetailIndex++;
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.model;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryVariableUpdateImpl extends HistoryDetailImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String oldValue;
+ protected String newValue;
+
+ public HistoryVariableUpdateImpl() {
+ }
+
+ public HistoryVariableUpdateImpl(String oldValue, String newValue) {
+ // superclass has dummy string constructor to differentiate from
+ // the default constructor which is used by hibernate
+ super(null);
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+}
Property changes on: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryVariableUpdateImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -57,7 +57,7 @@
import org.jbpm.pvm.internal.history.events.AutomaticEnd;
import org.jbpm.pvm.internal.history.events.DecisionEnd;
import org.jbpm.pvm.internal.history.events.ProcessInstanceEnd;
-import org.jbpm.pvm.internal.history.events.ProcessInstanceStart;
+import org.jbpm.pvm.internal.history.events.ProcessInstanceCreate;
import org.jbpm.pvm.internal.history.events.TaskActivityStart;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.job.MessageImpl;
@@ -188,6 +188,8 @@
if (idGenerator!=null) {
this.id = idGenerator.createId(processDefinition, null, this);
}
+
+ HistoryEvent.fire(new ProcessInstanceCreate(), this);
}
// execution method : start /////////////////////////////////////////////////
@@ -199,7 +201,6 @@
this.state = STATE_ACTIVE_ROOT;
ExecutionImpl scopedExecution = initializeScopes();
- HistoryEvent.fire(new ProcessInstanceStart(), this);
fire(Event.START, getProcessDefinition());
if (getActivity()!=null) {
scopedExecution.performAtomicOperation(AtomicOperation.EXECUTE_ACTIVITY);
@@ -1155,6 +1156,12 @@
return parent==null;
}
+ // getters and setters for scope instance //////////////////////////////////////
+
+ public ExecutionImpl getExecution() {
+ return this;
+ }
+
// getters and setters /////////////////////////////////////////////////////////
public TransitionImpl getTransition() {
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -33,7 +33,10 @@
import org.jbpm.api.JbpmException;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.events.VariableCreate;
import org.jbpm.pvm.internal.job.TimerImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.type.Converter;
import org.jbpm.pvm.internal.type.Type;
import org.jbpm.pvm.internal.type.TypeSet;
@@ -85,8 +88,6 @@
Variable variable = createVariableObject(key, value, typeName);
variables.put(variable.getKey(), variable);
hasVariables = true;
-
- // TODO add createTime-variable-log
}
protected Variable createVariableObject(String key, Object value, String typeName) {
@@ -130,8 +131,12 @@
}
variable.setKey(key);
+ variable.setExecution(getExecution());
+ variable.setTask(getTask());
+
+ HistoryEvent.fire(new VariableCreate(variable));
+
variable.setValue(value);
- variable.setProcessInstance(getProcessInstance());
return variable;
}
@@ -353,10 +358,14 @@
// customizable methods /////////////////////////////////////////////////////
- public ExecutionImpl getProcessInstance() {
+ public ExecutionImpl getExecution() {
return null;
}
+ public TaskImpl getTask() {
+ return null;
+ }
+
public ExecutionImpl getTimerExecution() {
return null;
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -24,6 +24,7 @@
import java.util.List;
import org.jbpm.api.Execution;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.task.Task;
import org.jbpm.pvm.internal.client.ClientExecution;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
@@ -79,7 +80,9 @@
/** create a history activity instance query */
HistoryActivityInstanceQueryImpl createHistoryActivityInstanceQuery();
-
+
+ List<HistoryComment> findCommentsByTaskId(String taskId);
+
/** create a process instance query */
JobQueryImpl createJobQuery();
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -21,15 +21,18 @@
*/
package org.jbpm.pvm.internal.svc;
+import java.util.List;
import java.util.Map;
import org.jbpm.api.HistoryService;
import org.jbpm.api.history.HistoryActivityInstanceQuery;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.history.HistoryProcessInstanceQuery;
import org.jbpm.api.history.HistoryTaskQuery;
import org.jbpm.pvm.internal.cmd.CreateHistoryActivityInstanceQueryCmd;
import org.jbpm.pvm.internal.cmd.CreateHistoryProcessInstanceQueryCmd;
import org.jbpm.pvm.internal.cmd.CreateHistoryTaskQueryCmd;
+import org.jbpm.pvm.internal.cmd.GetTaskCommentsCmd;
import org.jbpm.pvm.internal.query.AvgDurationPerActivityQueryCmd;
import org.jbpm.pvm.internal.query.ChoiceDistributionQueryCmd;
import org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl;
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -101,6 +101,10 @@
public ScopeInstanceImpl getParentVariableScope() {
return execution;
}
+
+ public TaskImpl getTask() {
+ return this;
+ }
// assignment ///////////////////////////////////////////////////////////////
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/Variable.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -24,7 +24,12 @@
import java.io.Serializable;
import org.jbpm.api.JbpmException;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.HistorySession;
+import org.jbpm.pvm.internal.history.events.VariableUpdate;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
/**
* is a jbpm-internal class that serves as a base class for classes
@@ -39,9 +44,11 @@
protected String key = null;
protected Converter converter = null;
- protected String queryText = null;
- protected ExecutionImpl processInstance;
+ protected String textValue = null;
+ protected ExecutionImpl execution;
+ protected TaskImpl task;
+
// constructors /////////////////////////////////////////////////////////////
// abstract methods /////////////////////////////////////////////////////////
@@ -80,6 +87,11 @@
throw new JbpmException("variable instance '"+this.getClass().getName()+"' does not support values of type '"+value.getClass().getName()+"'. to change the type of a variable, you have to delete it first");
}
setObject(value);
+
+ HistorySession historySession = Environment.getFromCurrent(HistorySession.class, false);
+ if (historySession!=null) {
+ HistoryEvent.fire(new VariableUpdate(this));
+ }
}
public Object getValue() {
@@ -104,11 +116,18 @@
return type;
}
+ public ExecutionImpl getProcessInstance() {
+ return (execution!=null ? execution.getProcessInstance() : null);
+ }
+
// getters and setters //////////////////////////////////////////////////////
public String getKey() {
return key;
}
+ public long getDbid() {
+ return dbid;
+ }
public Converter getConverter() {
return converter;
}
@@ -118,10 +137,19 @@
public void setKey(String key) {
this.key = key;
}
- public ExecutionImpl getProcessInstance() {
- return processInstance;
+ public String getTextValue() {
+ return textValue;
}
- public void setProcessInstance(ExecutionImpl processInstance) {
- this.processInstance = processInstance;
+ public ExecutionImpl getExecution() {
+ return execution;
}
+ public void setExecution(ExecutionImpl execution) {
+ this.execution = execution;
+ }
+ public TaskImpl getTask() {
+ return task;
+ }
+ public void setTask(TaskImpl task) {
+ this.task = task;
+ }
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DateVariable.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DateVariable.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DateVariable.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -47,9 +47,9 @@
public void setObject(Object value) {
this.date = (Date) value;
if (value!=null) {
- this.queryText = new SimpleDateFormat(dateFormat).format(value);
+ this.textValue = new SimpleDateFormat(dateFormat).format(value);
} else {
- this.queryText = null;
+ this.textValue = null;
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DoubleVariable.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DoubleVariable.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/DoubleVariable.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -42,9 +42,9 @@
public void setObject(Object value) {
this.d = (Double) value;
if (value!=null) {
- this.queryText = value.toString();
+ this.textValue = value.toString();
} else {
- this.queryText = null;
+ this.textValue = null;
}
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/LongVariable.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/LongVariable.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/LongVariable.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -42,9 +42,9 @@
public void setObject(Object value) {
this.l = (Long) value;
if (value!=null) {
- this.queryText = value.toString();
+ this.textValue = value.toString();
} else {
- this.queryText = null;
+ this.textValue = null;
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/StringVariable.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/StringVariable.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/type/variable/StringVariable.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -42,9 +42,9 @@
public void setObject(Object value) {
this.string = (String) value;
if (value!=null) {
- this.queryText = string;
+ this.textValue = string;
} else {
- this.queryText = null;
+ this.textValue = null;
}
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-08 18:12:04 UTC (rev 5259)
@@ -124,13 +124,15 @@
<version name="dbversion" column="DBVERSION_" />
<property name="key" column="KEY_"/>
- <property name="queryText" column="QUERYTEXT_" />
<property name="converter" type="converter" column="CONVERTER_" />
- <many-to-one name="processInstance"
- column="PROCINST_"
+ <many-to-one name="execution"
+ column="EXECUTION_"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
- foreign-key="FK_VAR_PROCINST"
- index="IDX_VAR_PROCINST"/>
+ foreign-key="none"/>
+ <many-to-one name="task"
+ column="TASK_"
+ class="org.jbpm.pvm.internal.task.TaskImpl"
+ foreign-key="none"/>
</class>
<subclass name="org.jbpm.pvm.internal.type.variable.DateVariable" extends="org.jbpm.pvm.internal.type.Variable" discriminator-value="date">
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.history.hbm.xml 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.history.hbm.xml 2009-07-08 18:12:04 UTC (rev 5259)
@@ -19,20 +19,32 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <!-- many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCDEF_"
- foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" / -->
-
+ <property name="nextDetailIndex" column="NEXTIDX_" />
+
<set name="historyActivityInstances"
cascade="all">
- <key>
- <column name="HPI_" />
+ <key foreign-key="FK_HACTI_HPROCI">
+ <column name="HPROCI_" index="IDX_HACTI_HPROCI" />
</key>
- <one-to-many class="HistoryActivityInstanceImpl" />
+ <one-to-many class="HistoryActivityInstanceImpl" />
</set>
+ <set name="historyVariables"
+ cascade="all">
+ <key foreign-key="FK_HVAR_HPROCI">
+ <column name="HPROCI_" index="IDX_HVAR_HPROCI" />
+ </key>
+ <one-to-many class="HistoryVariableImpl" />
+ </set>
+
+ <set name="details"
+ cascade="all">
+ <key foreign-key="FK_HDETAIL_HPROCI">
+ <column name="HPROCI_" index="IDX_HDETAIL_HPROCI" />
+ </key>
+ <one-to-many class="HistoryDetailImpl" />
+ </set>
+
</class>
<!-- ### HISTORY ACTIVITY INSTANCE ####################################### -->
@@ -43,18 +55,12 @@
<discriminator column="CLASS_" />
<version name="dbversion" column="DBVERSION_" />
+ <!-- the foreign-key is set on the other side of the relation: see historyActivityInstances above -->
<many-to-one name="historyProcessInstance"
class="HistoryProcessInstanceImpl"
- column="HPI_"
- foreign-key="FK_HAI_HPI"
- index="IDX_HAI_HPI" />
+ column="HPROCI_"
+ foreign-key="none" />
- <!-- many-to-one name="activity"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="ACTIVITY_"
- foreign-key="FK_HISTAI_ACT"
- index="IDX_HISTAI_ACT" / -->
-
<property name="type" column="TYPE_" />
<property name="executionId" column="EXECUTION_" />
<property name="activityName" column="ACTIVITY_NAME_" />
@@ -62,7 +68,16 @@
<property name="endTime" column="END_" type="timestamp" />
<property name="duration" column="DURATION_" />
<property name="transitionName" column="TRANSITION_" />
+ <property name="nextDetailIndex" column="NEXTIDX_" />
+ <set name="details"
+ cascade="all">
+ <key foreign-key="FK_HDETAIL_HACTI">
+ <column name="HACTI_" index="IDX_HDETAIL_HACTI" />
+ </key>
+ <one-to-many class="HistoryDetailImpl" />
+ </set>
+
<subclass name="HistoryAutomaticInstanceImpl" discriminator-value="aut">
<subclass name="HistoryDecisionInstanceImpl" discriminator-value="excl" />
</subclass>
@@ -84,35 +99,75 @@
</id>
<version name="dbversion" column="DBVERSION_" />
- <!-- many-to-one name="historyTaskInstance"
- class="HistoryTaskInstanceImpl"
- column="HTI_"
- foreign-key="none"
- index="IDX_HTASK_HTI" / -->
-
<property name="executionId" column="EXECUTION_" />
<property name="outcome" column="OUTCOME_" />
<property name="assignee" column="ASSIGNEE_" />
+ <property name="priority" column="PRIORITY_" />
<property name="state" column="STATE_" />
<property name="createTime" column="CREATE_" type="timestamp" />
<property name="endTime" column="END_" type="timestamp" />
<property name="duration" column="DURATION_" />
+ <property name="nextDetailIndex" column="NEXTIDX_" />
- <list name="comments" cascade="all-delete-orphan">
- <key column="HTASK_" />
- <list-index column="HTASK_IDX_" />
- <one-to-many class="HistoryCommentImpl" />
- </list>
-
+ <set name="details"
+ cascade="all">
+ <key foreign-key="FK_HDETAIL_HTASK">
+ <column name="HTASK_" index="IDX_HDETAIL_HTASK" />
+ </key>
+ <one-to-many class="HistoryDetailImpl" />
+ </set>
+
+ <set name="historyVariables"
+ cascade="all">
+ <key foreign-key="FK_HVAR_HTASK">
+ <column name="HTASK_" index="IDX_HVAR_HTASK" />
+ </key>
+ <one-to-many class="HistoryVariableImpl" />
+ </set>
+
<set name="subTasks" cascade="all-delete-orphan">
- <key column="SUPERTASK_" />
- <one-to-many class="HistoryTaskImpl" />
+ <key column="SUPERTASK_" foreign-key="FK_HSUPERT_SUB" />
+ <one-to-many class="HistoryTaskImpl" />
</set>
</class>
+ <!-- ### HISTORY VARIABLE ################################################# -->
+ <class name="HistoryVariableImpl" table="JBPM4_HIST_VAR">
+ <id name="dbid" column="DBID_">
+ <generator class="assigned" />
+ </id>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="processInstanceId" column="PROCINSTID_" />
+ <property name="executionId" column="EXECUTIONID_" />
+ <property name="variableName" column="VARNAME_" />
+ <property name="value" column="VALUE_" />
+
+ <!-- the foreign-key is set on the other side of the relation: see historyVariables above in HistoryProcessInstanceImpl -->
+ <many-to-one name="historyProcessInstance"
+ class="HistoryProcessInstanceImpl"
+ column="HPROCI_"
+ foreign-key="none" />
+
+ <!-- the foreign-key is set on the other side of the relation: see historyVariables above in HistoryTaskImpl -->
+ <many-to-one name="historyTask"
+ class="HistoryTaskImpl"
+ column="HTASK_"
+ foreign-key="none" />
+
+ <set name="details"
+ cascade="all">
+ <key foreign-key="FK_HDETAIL_HVAR">
+ <column name="HVAR_" index="IDX_HDETAIL_HVAR" />
+ </key>
+ <one-to-many class="HistoryDetailImpl" />
+ </set>
+
+ </class>
+
<!-- ### HISTORY COMMENTS ################################################# -->
- <class name="HistoryCommentImpl" table="JBPM4_HIST_COMMENT">
+ <class name="HistoryDetailImpl" table="JBPM4_HIST_DETAIL">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -121,15 +176,66 @@
<property name="userId" column="USERID_" />
<property name="time" column="TIME_" />
- <property name="message" column="MESSAGE_" type="text" />
+
+ <many-to-one name="historyProcessInstance"
+ class="HistoryProcessInstanceImpl"
+ column="HPROCI_"
+ foreign-key="FK_HDET_HPROCI"
+ index="IDX_HDET_HPROCI" />
+ <property name="historyProcessInstanceIndex" column="HPROCIIDX_" />
- <list name="comments"
- cascade="all-delete-orphan"
- inverse="false">
- <key column="PARENT_" foreign-key="none" />
- <list-index column="PARENT_IDX_" />
- <one-to-many class="HistoryCommentImpl" />
- </list>
+ <many-to-one name="historyActivityInstance"
+ class="HistoryActivityInstanceImpl"
+ column="HACTI_"
+ foreign-key="FK_HDET_HACTI"
+ index="IDX_HDET_HACTI" />
+ <property name="historyActivityInstanceIndex" column="HACTIIDX_" />
+
+ <many-to-one name="historyTask"
+ class="HistoryTaskImpl"
+ column="HTASK_"
+ foreign-key="FK_HDET_HTASK"
+ index="IDX_HDET_HTASK" />
+ <property name="historyTaskIndex" column="HTASKIDX_" />
+
+ <many-to-one name="historyVariable"
+ class="HistoryVariableImpl"
+ column="HVAR_"
+ foreign-key="FK_HDET_HVAR"
+ index="IDX_HDET_HVAR" />
+ <property name="historyVariableIndex" column="HVARIDX_" />
+
+ <subclass name="HistoryCommentImpl" discriminator-value="comment">
+ <property name="message" column="MESSAGE_" type="text" />
+ <list name="replies"
+ cascade="all-delete-orphan"
+ inverse="false">
+ <key column="PARENT_" foreign-key="none" />
+ <list-index column="PARENT_IDX_" />
+ <one-to-many class="HistoryCommentImpl" />
+ </list>
+ </subclass>
+
+ <subclass name="HistoryPriorityUpdateImpl" discriminator-value="priority-update">
+ <property name="oldPriority" column="OLD_INT_" />
+ <property name="newPriority" column="NEW_INT_" />
+ </subclass>
+
+ <subclass name="HistoryTaskAssignmentImpl" discriminator-value="assignment">
+ <property name="oldAssignee" column="OLD_STR_" />
+ <property name="newAssignee" column="NEW_STR_" />
+ </subclass>
+
+ <subclass name="HistoryTaskDuedateUpdateImpl" discriminator-value="duedate-update">
+ <property name="oldDuedate" column="OLD_TIME_" type="timestamp" />
+ <property name="newDuedate" column="NEW_TIME_" type="timestamp" />
+ </subclass>
+
+ <subclass name="HistoryVariableUpdateImpl" discriminator-value="variable-update">
+ <property name="oldValue" column="OLD_STR_" />
+ <property name="newValue" column="NEW_STR_" />
+ </subclass>
+
</class>
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -32,6 +32,7 @@
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.env.Transaction;
import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.type.variable.StringVariable;
import org.jbpm.test.JbpmTestCase;
@@ -89,7 +90,7 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
+ List<HistoryDetailImpl> comments = session.createQuery("from " + HistoryDetailImpl.class.getName()).list();
assertEquals(0, comments.size());
return null;
}
@@ -119,7 +120,7 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
+ List<HistoryDetailImpl> comments = session.createQuery("from " + HistoryDetailImpl.class.getName()).list();
assertEquals(0, comments.size());
return null;
}
@@ -129,11 +130,8 @@
public static class SuccessfulSynchronization implements Synchronization {
public void beforeCompletion() {
- Environment environment = Environment.getCurrent();
- Session session = environment.get(Session.class);
- StringVariable stringVariable = new StringVariable();
- stringVariable.setValue("hello");
- session.save(stringVariable);
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(new HistoryCommentImpl("b) hello from before completion"));
}
public void afterCompletion(int arg0) {
@@ -144,7 +142,7 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- session.save(new HistoryCommentImpl("if i only had the time to write code"));
+ session.save(new HistoryCommentImpl("a) if i only had the time to write code"));
Transaction transaction = environment.get(Transaction.class);
SuccessfulSynchronization successfulSynchronization = new SuccessfulSynchronization();
transaction.registerSynchronization(successfulSynchronization);
@@ -155,12 +153,13 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
- assertEquals("if i only had the time to write code", comments.get(0).getMessage());
+ List<HistoryCommentImpl> comments = session.createQuery(
+ "from " + HistoryCommentImpl.class.getName()+" as hc " +
+ "order by hc.message asc ").list();
+ assertEquals("a) if i only had the time to write code", comments.get(0).getMessage());
+ assertEquals("b) hello from before completion", comments.get(1).getMessage());
session.delete(comments.get(0));
- List<StringVariable> stringVariables = session.createQuery("from " + StringVariable.class.getName()).list();
- assertEquals("hello", stringVariables.get(0).getValue());
- session.delete(stringVariables.get(0));
+ session.delete(comments.get(1));
return null;
}
});
@@ -169,11 +168,8 @@
public static class UnsuccessfulSynchronization implements Synchronization {
public void beforeCompletion() {
- Environment environment = Environment.getCurrent();
- Session session = environment.get(Session.class);
- StringVariable stringVariable = new StringVariable();
- stringVariable.setValue("hello");
- session.save(stringVariable);
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(new HistoryCommentImpl("b) hello from before completion"));
throw new MyOwnRuntimeException();
}
@@ -187,7 +183,7 @@
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- session.save(new HistoryCommentImpl("if i only had the time to write code"));
+ session.save(new HistoryCommentImpl("a) if i only had the time to write code"));
Transaction transaction = environment.get(Transaction.class);
UnsuccessfulSynchronization unsuccessfulSynchronization = new UnsuccessfulSynchronization();
transaction.registerSynchronization(unsuccessfulSynchronization);
@@ -207,10 +203,8 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
+ List<HistoryDetailImpl> comments = session.createQuery("from " + HistoryDetailImpl.class.getName()).list();
assertEquals(0, comments.size());
- List<StringVariable> stringVariables = session.createQuery("from " + StringVariable.class.getName()).list();
- assertEquals(0, stringVariables.size());
return null;
}
});
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -54,10 +54,10 @@
assertEquals("what a party yesterday", taskComments.get(0).getMessage());
assertEquals("i'll clean up the mess", taskComments.get(1).getMessage());
- taskComments = taskComments.get(0).getComments();
+ taskComments = taskComments.get(0).getReplies();
assertEquals("what! you had a party while i was out ?!", taskComments.get(0).getMessage());
- taskComments = taskComments.get(0).getComments();
+ taskComments = taskComments.get(0).getReplies();
assertEquals("euh yes. it was a great party :-)", taskComments.get(0).getMessage());
taskService.deleteComment(whatAPartyId);
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -30,7 +30,7 @@
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.session.MessageSession;
@@ -70,7 +70,7 @@
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- List<HistoryComment> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
+ List<HistoryComment> comments = session.createQuery("from " + HistoryDetailImpl.class.getName()).list();
for (HistoryComment comment : comments) {
log.debug("retrieved message: "+comment.getMessage());
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -27,7 +27,6 @@
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -28,7 +28,7 @@
import org.jbpm.api.job.Job;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.session.MessageSession;
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -24,7 +24,7 @@
import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -41,8 +41,8 @@
DbSession dbSession = environment.get(DbSession.class);
// this message execution should be rolled back
- HistoryComment comment = new HistoryCommentImpl("failing update");
- dbSession.save(comment);
+// HistoryComment comment = new HistoryDetailImpl("failing update");
+// dbSession.save(comment);
throw new RuntimeException("ooops");
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -27,6 +27,7 @@
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -57,7 +58,7 @@
}
public Void execute(Environment environment) throws Exception {
- HistoryCommentImpl comment = new HistoryCommentImpl(Integer.toString(messageId));
+ HistoryDetailImpl comment = new HistoryCommentImpl(Integer.toString(messageId));
Session session = environment.get(Session.class);
session.save(comment);
return null;
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -28,7 +28,7 @@
import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.session.MessageSession;
@@ -67,7 +67,7 @@
public List<Integer> execute(Environment environment) {
List<Integer> processedMessageNumbers = new ArrayList<Integer>();
Session session = environment.get(Session.class);
- List<HistoryComment> comments = session.createCriteria(HistoryCommentImpl.class).list();
+ List<HistoryComment> comments = session.createCriteria(HistoryDetailImpl.class).list();
for (HistoryComment comment: comments) {
int processedMessageNumber = Integer.parseInt(comment.getMessage());
processedMessageNumbers.add(processedMessageNumber);
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -24,7 +24,7 @@
import org.hibernate.Session;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
/**
* @author Tom Baeyens
@@ -36,10 +36,10 @@
protected String message;
public Void execute(Environment environment) throws Exception {
- HistoryCommentImpl comment = new HistoryCommentImpl(message);
- Session session = environment.get(Session.class);
- session.save(comment);
- MessageProcessingTest.commentAdded();
+// HistoryDetailImpl comment = new HistoryDetailImpl(message);
+// Session session = environment.get(Session.class);
+// session.save(comment);
+// MessageProcessingTest.commentAdded();
return null;
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java 2009-07-08 09:38:46 UTC (rev 5258)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java 2009-07-08 18:12:04 UTC (rev 5259)
@@ -31,7 +31,7 @@
import org.jbpm.pvm.internal.cmd.CompositeCmd;
import org.jbpm.pvm.internal.cmd.SendMessageCmd;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -119,7 +119,7 @@
public List<Integer> execute(Environment environment) {
List<Integer> processedMessageNumbers = new ArrayList<Integer>();
Session session = environment.get(Session.class);
- List<HistoryComment> comments = session.createCriteria(HistoryCommentImpl.class).list();
+ List<HistoryComment> comments = session.createCriteria(HistoryDetailImpl.class).list();
for (HistoryComment comment: comments) {
int processedMessageNumber = Integer.parseInt(comment.getMessage());
processedMessageNumbers.add(processedMessageNumber);
15 years, 3 months
JBoss JBPM SVN: r5258 - in jbpm3/branches/jbpm-3.2-soa: modules/simulation and 3 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-08 05:38:46 -0400 (Wed, 08 Jul 2009)
New Revision: 5258
Removed:
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/SimulationTestCase.java
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/simulation/pom.xml
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationExperiment.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/exe/ExperimentReader.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/BusinessFiguresTest.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/LanguageDefinitionTest.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/OneStateTest.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/OneTaskTest.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/ScenarioTest.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/SteadyStateResetTest.java
jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/VariableSourceAndFilterTest.java
jbpm3/branches/jbpm-3.2-soa/pom.xml
Log:
JBPM-1292: Integrate simulation tests in automated testrun (CODING IN PROGRESS)
Remove fixed dependency versions |
write report files to build directory |
do not show graphical progress bar in automated tests
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/pom.xml 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/pom.xml 2009-07-08 09:38:46 UTC (rev 5258)
@@ -10,13 +10,14 @@
<!-- ====================================================================== -->
<!-- $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">
+<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 - Simulation</name>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm-simulation</artifactId>
<packaging>jar</packaging>
-
+
<!-- Parent -->
<parent>
<groupId>org.jbpm.jbpm3</groupId>
@@ -24,7 +25,33 @@
<version>3.2.7</version>
<relativePath>../../pom.xml</relativePath>
</parent>
-
+
+ <!-- Profiles -->
+ <profiles>
+ <!--
+ Name: jdk14
+ Desc: dependencies specific to jdk 1.4
+ -->
+ <profile>
+ <id>jdk14</id>
+ <activation>
+ <jdk>1.4</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
<!-- Dependencies -->
<dependencies>
<!-- jBPM Dependencies -->
@@ -33,7 +60,7 @@
<artifactId>jbpm-jpdl</artifactId>
<version>${version}</version>
</dependency>
-
+
<!-- Compile Dependencies -->
<dependency>
<groupId>desmoj</groupId>
@@ -44,16 +71,6 @@
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>1.6</version>
- </dependency>
- <dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<exclusions>
@@ -65,13 +82,17 @@
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
</exclusion>
+ <exclusion>
+ <artifactId>jdtcore</artifactId>
+ <groupId>eclipse</groupId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
</dependency>
-
+
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
@@ -79,17 +100,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <!-- Plugins -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- [JBPM-1292] Integrate simulation tests in automated testrun -->
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
</project>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationExperiment.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationExperiment.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationExperiment.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -6,10 +6,8 @@
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
-import org.jbpm.JbpmContext;
import org.jbpm.sim.exception.ExperimentConfigurationException;
import org.jbpm.sim.exe.SimulationProgressListener;
import org.jbpm.sim.report.ExperimentReport;
@@ -209,7 +207,8 @@
new SimpleDateFormat(JbpmSimulationScenario.DATE_PATTERN).parse(realStartTimeString));
}
catch (ParseException e) {
- throw new ExperimentConfigurationException("format of real start date ('" + realStartTimeString +"') is invalid. The cirrect pattern is '" + JbpmSimulationScenario.DATE_PATTERN + "'", e);
+ throw new ExperimentConfigurationException("real start date '" + realStartTimeString +
+ "' does not match pattern '" + JbpmSimulationScenario.DATE_PATTERN + "'", e);
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/exe/ExperimentReader.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/exe/ExperimentReader.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/main/java/org/jbpm/sim/exe/ExperimentReader.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -1,7 +1,6 @@
package org.jbpm.sim.exe;
import java.io.StringReader;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -40,6 +39,7 @@
*/
public class ExperimentReader implements ProblemListener {
+ private static final long serialVersionUID = 1L;
private static Log log = LogFactory.getLog(ExperimentReader.class);
private InputSource inputSource = null;
@@ -139,7 +139,7 @@
// read output parameters
Element outputElement = root.element("output");
if (outputElement!=null) {
- String outputPathName = root.attributeValue("path");
+ String outputPathName = outputElement.attributeValue("path");
experiment.setOutputPathName(outputPathName);
}
@@ -374,8 +374,6 @@
private void readNodeOverwrite(ProcessDefinition pd, Element e) {
String nodeName = e.attributeValue("node-name");
-
- SimulationDefinition sd = ((SimulationDefinition)pd.getDefinition(SimulationDefinition.class));
Node node = pd.getNode(nodeName);
readUseDataSourceEvent(node, e, Event.EVENTTYPE_NODE_ENTER);
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/BusinessFiguresTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/BusinessFiguresTest.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/BusinessFiguresTest.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -10,40 +10,41 @@
public class BusinessFiguresTest extends TestCase {
- private String testProcessXml = "<process-definition name='test' start-distribution='startDist'>"
- +
+ private static final String testProcessXml = "<process-definition name='test' start-distribution='startDist'>"
- " <start-state name='start'>"
+ + " <start-state name='start'>"
+ " <transition to='node1' />"
+ " </start-state>"
- +
- " <node name='node1'>"
+ + " <node name='node1'>"
+ " <transition to='end'>"
+ " <simulation-action class='org.jbpm.sim.kpi.BusinessFigureAction'>"
+ " <name>testFigure</name> "
+ " </simulation-action>"
+ " </transition>"
+ " </node>"
- +
- " <end-state name='end'/>"
- +
+ + " <end-state name='end'/>"
- "</process-definition>";
+ + "</process-definition>";
- private String experimentConfiguration = "<experiment name='MySimulationExperiment'"
+ private static final String experimentConfiguration = "<experiment name='MySimulationExperiment'"
+ " run-time='100'"
+ " real-start-time='01.01.1970 01:00:00:002'"
+ " time-unit='minute'>"
+ " <scenario name ='test'>"
+ " <distribution name='startDist' sample-type='real' type='constant' value='20' /> "
+
+ " <sim-process name='test' />"
+
+ " <business-figure name='testFigure' type='costs' "
+ " automatic-calculation='none'"
+ // | process - start | process -end"
" handler='org.jbpm.sim.BusinessFiguresTest$BusinessFigureHandler' />"
+ " </scenario>"
+
+ + " <output path='target' />" // currently just used as parameter for DESMO-J
+
+ "</experiment>";
public static class BusinessFigureHandler implements BusinessFigureCalculator {
@@ -75,52 +76,47 @@
* process definition required
*/
- private String testProcessXml2 = "<process-definition name='test' start-distribution='startDist'>"
- +
+ private static final String testProcessXml2 = "<process-definition name='test' start-distribution='startDist'>"
- " <start-state name='start'>"
+ + " <start-state name='start'>"
+ " <transition to='node1' />"
+ " </start-state>"
- +
- " <node name='node1'>"
+ + " <node name='node1'>"
+ " <transition to='end' />"
+ " </node>"
- +
- " <end-state name='end'/>"
- +
+ + " <end-state name='end'/>"
- "</process-definition>";
+ + "</process-definition>";
- private String experimentConfiguration2 = "<experiment name='MySimulationExperiment'"
+ private static final String experimentConfiguration2 = "<experiment name='MySimulationExperiment'"
+ " run-time='100'"
+ " real-start-time='01.01.1970 01:00:00:002'"
+ " time-unit='minute'>"
+ " <scenario name ='test'>"
+ " <distribution name='startDist' sample-type='real' type='constant' value='20' /> "
- +
- " <business-figure name='testFigure' type='costs' "
+ + " <business-figure name='testFigure' type='costs' "
+ " automatic-calculation='none'"
+ // | process - start | process -end"
" handler='org.jbpm.sim.BusinessFiguresTest$BusinessFigureHandler' />"
- +
- " <sim-process name='test'>"
+ + " <sim-process name='test'>"
+ " <node-overwrite node-name='node1'>"
+ " <calculate-business-figure name='testFigure' /> "
+ " </node-overwrite> "
+ " </sim-process>"
- +
+ + " </scenario>"
- " </scenario>"
+ + " <output path='target' />" // currently just used as parameter for DESMO-J
+
+ "</experiment>";
public void testBusinessFigureConfiguredInExperiment() {
- ExperimentReader reader = new ExperimentReader(experimentConfiguration);
+ ExperimentReader reader = new ExperimentReader(experimentConfiguration2);
// inject process definition
- reader.addProcessDefinition("test", testProcessXml);
+ reader.addProcessDefinition("test", testProcessXml2);
JbpmSimulationExperiment experiment = reader.readExperiment();
experiment.run();
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/LanguageDefinitionTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/LanguageDefinitionTest.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/LanguageDefinitionTest.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -4,7 +4,6 @@
import java.util.Iterator;
import java.util.List;
-import org.jbpm.graph.def.Action;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ExecutionContext;
@@ -22,7 +21,8 @@
public class LanguageDefinitionTest extends TestCase {
public void testDistributionsOnProcessElements() {
- Experiment exp = new Experiment("Test");
+ Experiment exp = new Experiment(getName(), "target");
+ exp.setShowProgressBar(false);
// distributions: type=real constant|empirical|erlang|exponential|normal|uniform
// distributions: type=int constant|empirical|poison|uniform
@@ -105,6 +105,8 @@
public static class TestAction implements ActionHandler {
private boolean shouldBeExecuted;
+ private static final long serialVersionUID = 1L;
+
public void execute(ExecutionContext executionContext) throws Exception {
if (!shouldBeExecuted)
throw new RuntimeException("action '"+executionContext.getAction().getName()+"' should not be executed in a simulation run.");
@@ -113,6 +115,8 @@
}
public static class SimTestAction implements ActionHandler {
+ private static final long serialVersionUID = 1L;
+
public void execute(ExecutionContext executionContext) throws Exception {
executedActions.add(executionContext.getAction());
}
@@ -266,7 +270,9 @@
"</process-definition>" ;
- Experiment exp = new Experiment("Test");
+ Experiment exp = new Experiment(getName(), "target");
+ exp.setShowProgressBar(false);
+
// make a new model with the given process
DefaultJbpmSimulationModel model = new DefaultJbpmSimulationModel(processXml);
// connect Experiment and Model
@@ -316,7 +322,9 @@
"</process-definition>" ;
- Experiment exp = new Experiment("Test");
+ Experiment exp = new Experiment(getName(), "target");
+ exp.setShowProgressBar(false);
+
DefaultJbpmSimulationModel model = new DefaultJbpmSimulationModel(processXml);
model.connectToExperiment(exp);
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/OneStateTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/OneStateTest.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/OneStateTest.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -9,8 +9,9 @@
public class OneStateTest extends TestCase {
public void testOneState() {
- Experiment exp = new Experiment("Test");
-
+ Experiment exp = new Experiment(getName(), "target");
+ exp.setShowProgressBar(false);
+
String processXml =
"<process-definition>" +
" <start-state name='a'>" +
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/OneTaskTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/OneTaskTest.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/OneTaskTest.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -14,8 +14,9 @@
public class OneTaskTest extends TestCase {
public void testOneState() {
- Experiment exp = new Experiment("Test");
-
+ Experiment exp = new Experiment(getName(), "target");
+ exp.setShowProgressBar(false);
+
String processXml =
"<process-definition>" +
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/ScenarioTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/ScenarioTest.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/ScenarioTest.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -1,6 +1,6 @@
package org.jbpm.sim;
-import java.util.Date;
+import java.util.Calendar;
import org.jbpm.sim.def.JbpmSimulationExperiment;
import org.jbpm.sim.def.JbpmSimulationScenario;
@@ -56,7 +56,7 @@
String experimentConfiguration =
"<experiment name='MySimulationExperiment'" +
" run-time='100'" +
- " real-start-time='01.01.1970 01:00:00:002'" +
+ " real-start-time='04.10.1982 14:30:10:500'" +
" time-unit='minute'>" +
" <scenario name='NormalStaffing'>" +
@@ -81,13 +81,10 @@
// maybe more <scenario ... />'s
// TODO: Think more about output options
- " <output path='.'>" + // currently just used as parameter for DESMO-J
- " </output>" +
-
+ " <output path='target' />" + // currently just used as parameter for DESMO-J
+
"</experiment>";
-
-
ExperimentReader reader = new ExperimentReader(experimentConfiguration);
reader.addProcessDefinition("test", testProcessXml );
@@ -96,9 +93,12 @@
assertNotNull(experiment);
assertEquals("MySimulationExperiment", experiment.getName());
assertEquals(100.0, experiment.getSimulationRunTime(), 0.001);
- assertEquals(new Date(2), experiment.getRealStartDate());
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(1982, Calendar.OCTOBER, 4, 14, 30, 10);
+ calendar.set(Calendar.MILLISECOND, 500);
+ assertEquals(calendar.getTime(), experiment.getRealStartDate());
assertEquals(JbpmSimulationExperiment.MINUTES, experiment.getTimeUnit());
- assertEquals(".", experiment.getOutputPathName());
+ assertEquals("target", experiment.getOutputPathName());
assertEquals(1, experiment.getScenarios().size());
JbpmSimulationScenario scenario = experiment.getScenario("NormalStaffing");
@@ -136,9 +136,8 @@
// maybe more <scenario ... />'s
// TODO: Think more about output options
- " <output path='./'>" + // currently just used as parameter for DESMO-J
- " </output>" +
-
+ " <output path='target' />" + // currently just used as parameter for DESMO-J
+
"</experiment>";
ExperimentReader reader = new ExperimentReader(experimentConfiguration);
@@ -161,6 +160,7 @@
" <resource-pool name='tester' pool-size='5' />" +
" <sim-process name='test' />" +
" </scenario>" +
+ " <output path='target' />" + // currently just used as parameter for DESMO-J
"</experiment>";
ExperimentReader reader = new ExperimentReader(experimentConfiguration);
@@ -189,7 +189,6 @@
assertEquals(3, report2.getStateWaitingTimes().size());
assertEquals(1, report1.getCycleTimesValueStatistics().size());
assertEquals(2, report2.getResourcePoolWaitingTimes().size());
-
}
/**
@@ -239,6 +238,7 @@
" <resource-pool name='clerk' pool-size='10' />" +
" <sim-process name='test' />" +
" </scenario>" +
+ " <output path='target' />" + // currently just used as parameter for DESMO-J
"</experiment>";
ExperimentReader reader = new ExperimentReader(experimentConfiguration);
@@ -327,6 +327,5 @@
assertEquals(20.89189, report5.getCycleTimesValueStatistics("test").getMean(), 0.0001);
assertEquals( 0.0 , report5.getResourcePoolWaitingTimes("clerk").getAverageLength(), 0.0001);
assertEquals( 0.0 , report5.getResourcePoolWaitingTimes("clerk").getAverageWaitTime(), 0.0001);
-
}
}
Deleted: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/SimulationTestCase.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/SimulationTestCase.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/SimulationTestCase.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -1,68 +0,0 @@
-package org.jbpm.sim;
-
-import java.io.StringReader;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.graph.def.Event;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.instantiation.UserCodeInterceptorConfig;
-import org.jbpm.jpdl.xml.JpdlXmlReader;
-import org.jbpm.logging.log.ProcessLog;
-import org.jbpm.sim.action.StartTaskAndPlanCompletion;
-import org.jbpm.sim.def.JbpmSimulationClock;
-import org.jbpm.sim.jpdl.SimulationDefinition;
-import org.jbpm.util.Clock;
-import org.jbpm.util.XmlUtil;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-
-/**
- * @deprecated
- * @author bernd.ruecker(a)camunda.com
- */
-public abstract class SimulationTestCase extends TestCase {
-
- private static Log log = LogFactory.getLog(SimulationTestCase.class);
-
- static DateFormat dateFormat = new SimpleDateFormat("HH:mm");
-// static JbpmSimulationClock simulationClock = new JbpmSimulationClock();
- static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance("org/jbpm/sim/simulation.cfg.xml");
- static DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
-
- static {
-// Clock.dateGenerator = simulationClock;
-// UserCodeInterceptorConfig.userCodeInterceptor = new SimulationUserCodeInterceptor();
- }
-
- public static void setCurrentTime(String timeText) {
- try {
- JbpmSimulationClock.currentTime = dateFormat.parse(timeText);
- } catch (ParseException e) {
- throw new RuntimeException("invalid timeText: "+timeText, e);
- }
- }
-
- public void produceReports(ProcessInstance processInstance) {
- List logs = processInstance.getLoggingInstance().getLogs();
- Iterator iter = logs.iterator();
- while (iter.hasNext()) {
- ProcessLog processLog = (ProcessLog) iter.next();
- log.info(dateFormat.format(processLog.getDate())+" | "+processLog.toString());
- }
- }
-}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/SteadyStateResetTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/SteadyStateResetTest.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/SteadyStateResetTest.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -40,6 +40,9 @@
" </sim-process>" +
" </scenario>" +
+
+ " <output path='target' />" + // currently just used as parameter for DESMO-J
+
"</experiment>";
public void testExperimentReader() {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/VariableSourceAndFilterTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/VariableSourceAndFilterTest.java 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/modules/simulation/src/test/java/org/jbpm/sim/VariableSourceAndFilterTest.java 2009-07-08 09:38:46 UTC (rev 5258)
@@ -46,6 +46,7 @@
+ " </task-overwrite> "
+ " </sim-process>"
+ " </scenario>"
+ + " <output path='target' />" // currently just used as parameter for DESMO-J
+ "</experiment>";
private static boolean dataSourceIsCalled = false;
@@ -116,6 +117,7 @@
+ " <task-overwrite task-name='change order' time-distribution='taskDist' />"
+ " </sim-process>"
+ " </scenario>"
+ + " <output path='target' />" // currently just used as parameter for DESMO-J
+ "</experiment>";
private static int calledCount = 0;
Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml 2009-07-08 09:29:32 UTC (rev 5257)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml 2009-07-08 09:38:46 UTC (rev 5258)
@@ -74,6 +74,7 @@
<richfaces.ui.version>3.2.1.GA</richfaces.ui.version>
<report-server.version>1.0.0.Beta1</report-server.version>
<sun.facelets.version>1.1.14</sun.facelets.version>
+ <xerces.version>2.6.2</xerces.version>
<!-- Database Driver Versions -->
<hsqldb.version>1.8.0.7</hsqldb.version>
@@ -83,7 +84,7 @@
<jconnect.version>6.0.5</jconnect.version>
<ojdbc.version>10.2.0.4</ojdbc.version>
<db2jcc.version>3.1.57</db2jcc.version>
- </properties>
+ </properties>
<!-- DependencyManagement -->
<dependencyManagement>
@@ -256,6 +257,8 @@
<artifactId>richfaces-ui</artifactId>
<version>${richfaces.ui.version}</version>
</dependency>
+
+ <!-- Database Driver Versions -->
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
@@ -271,8 +274,6 @@
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
-
- <!-- Database Driver Versions -->
</dependencies>
</dependencyManagement>
@@ -351,6 +352,31 @@
</build>
</profile>
+ <!--
+ Name: jdk14
+ Desc: dependencies specific to jdk 1.4
+ -->
+ <profile>
+ <id>jdk14</id>
+ <activation>
+ <jdk>1.4</jdk>
+ </activation>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ <version>${xerces.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>${xerces.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ </profile>
+
<!-- DATABASE PROFILES ***************************************************************************** -->
<!--
15 years, 3 months
JBoss JBPM SVN: r5257 - in jbpm3/branches/jbpm-3.2-soa/modules/core: src/test/java/org/jbpm/taskmgmt/exe and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-08 05:29:32 -0400 (Wed, 08 Jul 2009)
New Revision: 5257
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java
Log:
make TaskTimerExecutionDbTest resistant to stale state exceptions
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-07-07 20:01:12 UTC (rev 5256)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-07-08 09:29:32 UTC (rev 5257)
@@ -215,6 +215,29 @@
</build>
</profile>
+ <!--
+ Name: jdk14
+ Desc: dependencies specific to jdk 1.4
+ -->
+ <profile>
+ <id>jdk14</id>
+ <activation>
+ <jdk>1.4</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
<!--
Name: no-database
Descr: Setup the default database
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java 2009-07-07 20:01:12 UTC (rev 5256)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java 2009-07-08 09:29:32 UTC (rev 5257)
@@ -34,22 +34,16 @@
public class TaskTimerExecutionDbTest extends AbstractDbTestCase {
- static int counter = 0;
-
public static class PlusPlus implements ActionHandler {
-
private static final long serialVersionUID = 1L;
public void execute(ExecutionContext executionContext) throws Exception {
- counter++;
+ Integer count = (Integer) executionContext.getVariable("count");
+ count = new Integer(count != null ? count.intValue() + 1 : 1);
+ executionContext.setVariable("count", count);
}
}
- protected void setUp() throws Exception {
- super.setUp();
- counter = 0;
- }
-
public void testTimerCreation() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ " <start-state>"
@@ -58,7 +52,7 @@
+ " <task-node name='a'>"
+ " <task name='clean ceiling'>"
+ " <timer name='ceiling-timer' duedate='0 seconds'>"
- + " <action class='org.jbpm.taskmgmt.exe.TaskTimerExecutionDbTest$PlusPlus' />"
+ + " <action class='" + PlusPlus.class.getName() + "' />"
+ " </timer>"
+ " </task>"
+ " </task-node>"
@@ -87,7 +81,7 @@
+ " <task-node name='a'>"
+ " <task name='clean ceiling'>"
+ " <timer name='ceiling-timer' duedate='0 seconds'>"
- + " <action class='org.jbpm.taskmgmt.exe.TaskTimerExecutionDbTest$PlusPlus' />"
+ + " <action class='" + PlusPlus.class.getName() + "' />"
+ " </timer>"
+ " </task>"
+ " <transition to='b' />"
@@ -113,7 +107,9 @@
newTransaction();
- assertEquals(0, getTimerCount());
+ processInstance = jbpmContext.loadProcessInstance(processInstance.getId());
+ assertNull("expected variable 'count' to be null", processInstance.getContextInstance()
+ .getVariable("count"));
}
finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
@@ -128,7 +124,7 @@
+ " <task-node name='a'>"
+ " <task name='clean ceiling'>"
+ " <timer name='ceiling-timer' duedate='0 seconds'>"
- + " <action class='org.jbpm.taskmgmt.exe.TaskTimerExecutionDbTest$PlusPlus' />"
+ + " <action class='" + PlusPlus.class.getName() + "' />"
+ " </timer>"
+ " </task>"
+ " </task-node>"
@@ -142,12 +138,13 @@
processJobs(5000);
- assertEquals(1, counter);
+ processInstance = jbpmContext.loadProcessInstance(processInstance.getId());
+ assertEquals(new Integer(1), processInstance.getContextInstance()
+ .getVariable("count"));
}
finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
-
}
public void testTaskNodeTimerExecution() {
@@ -157,7 +154,7 @@
+ " </start-state>"
+ " <task-node name='a'>"
+ " <timer name='ceiling-timer' duedate='0 seconds'>"
- + " <action class='org.jbpm.taskmgmt.exe.TaskTimerExecutionDbTest$PlusPlus' />"
+ + " <action class='" + PlusPlus.class.getName() + "' />"
+ " </timer>"
+ " <task name='clean ceiling' />"
+ " </task-node>"
@@ -169,10 +166,11 @@
processInstance.signal();
jbpmContext.save(processInstance);
- newTransaction();
+ processJobs(5000);
- processJobs(5000);
- assertEquals(1, counter);
+ processInstance = jbpmContext.loadProcessInstance(processInstance.getId());
+ assertEquals(new Integer(1), processInstance.getContextInstance()
+ .getVariable("count"));
}
finally {
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
@@ -187,7 +185,7 @@
+ " <task-node name='a'>"
+ " <task name='clean ceiling'>"
+ " <timer name='ceiling-timer' duedate='0 seconds' repeat='60 second'>"
- + " <action class='org.jbpm.taskmgmt.exe.TaskTimerExecutionDbTest$PlusPlus' />"
+ + " <action class='" + PlusPlus.class.getName() + "' />"
+ " </timer>"
+ " </task>"
+ " </task-node>"
@@ -207,8 +205,10 @@
long originalDueDate = timer.getDueDate().getTime();
timer.execute(jbpmContext);
- assertEquals(1, counter);
+ processInstance = timer.getProcessInstance();
+ assertEquals(new Integer(1), processInstance.getContextInstance().getVariable("count"));
+
// check if the timer has be re-scheduled because of the repeat.
timer = getTimer();
assertNotNull(timer);
@@ -229,7 +229,7 @@
+ " <task-node name='a'>"
+ " <task name='clean ceiling'>"
+ " <timer name='ceiling-timer' duedate='#{baseDate} + 2 days'>"
- + " <action class='org.jbpm.taskmgmt.exe.TaskTimerExecutionDbTest$PlusPlus' />"
+ + " <action class='" + PlusPlus.class.getName() + "' />"
+ " </timer>"
+ " </task>"
+ " </task-node>"
15 years, 3 months
JBoss JBPM SVN: r5256 - in jbpm4/branches/jbpm-4.0: modules/api/src/main/java/org/jbpm/api/history and 33 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-07-07 16:01:12 -0400 (Tue, 07 Jul 2009)
New Revision: 5256
Added:
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryTaskQueryCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskActivityStart.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskCreated.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryTaskQueryImpl.java
Removed:
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Comment.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskStart.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CommentImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskHandler.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
Modified:
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/ExecutionService.java
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/HistoryService.java
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/TaskService.java
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryProcessInstanceQuery.java
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Discussable.java
jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/task/Task.java
jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/jbpm.erd.png
jbpm4/branches/jbpm-4.0/modules/distro/src/main/files/readme.html
jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java
jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java
jbpm4/branches/jbpm-4.0/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AssignTaskCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/HistoryEvent.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/HistorySessionImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ActivityStart.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceEnd.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskAssign.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskComplete.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskDelete.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskInstanceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryProcessInstanceQueryImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/TimerSession.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/test/JobTestHelper.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.history.hbm.xml
jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.task.hbm.xml
jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/AutoWireTest.java
jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/eventlistener/HqlEventListenerTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskParticipationsTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryCandidatesTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskVariablesTest.java
jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java
jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java
jbpm4/branches/jbpm-4.0/qa/hudson-jbpm4-jboss.bat
Log:
JBPM-2390 fix tasks and task comments the history
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/ExecutionService.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/ExecutionService.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/ExecutionService.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -119,6 +119,10 @@
/** end a process instance */
void endProcessInstance(String processInstanceId, String state);
- /** delete a process instance */
+ /** delete a process instance. The history information will still be
+ * in the database. */
void deleteProcessInstance(String processInstanceId);
+
+ /** delete a process instance, including the history information. */
+ void deleteProcessInstanceCascade(String processInstanceId);
}
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/HistoryService.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/HistoryService.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/HistoryService.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -25,6 +25,7 @@
import org.jbpm.api.history.HistoryActivityInstanceQuery;
import org.jbpm.api.history.HistoryProcessInstanceQuery;
+import org.jbpm.api.history.HistoryTaskQuery;
/** exposes the history information for ongoing and past
@@ -40,6 +41,9 @@
/** search in history activity instance information */
HistoryActivityInstanceQuery createHistoryActivityInstanceQuery();
+ /** search in history task information */
+ HistoryTaskQuery createHistoryTaskQuery();
+
/** returns the average duration in milliseconds for each activity in the given process definition */
Map<String, Long> avgDurationPerActivity(String processDefinitionId);
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/TaskService.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -21,8 +21,8 @@
*/
package org.jbpm.api;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.history.HistoryActivityInstance;
-import org.jbpm.api.model.Comment;
import org.jbpm.api.task.Participation;
import org.jbpm.api.task.Task;
@@ -32,7 +32,7 @@
/** task management.
*
- * @author Tome Baeyens
+ * @author Tom Baeyens
* @author Alejandro Guizar
* @author Heiko Braun <heiko.braun(a)jboss.com>
*/
@@ -87,13 +87,18 @@
void completeTask(String taskId, String outcome);
/** Deletes the task without completing it.
+ * The history information is kept in the DB.
* If this task was created in the context of a process execution,
* the execution remains active and the {@link ExecutionService#signalExecutionById(String)}
* is to be given explicitly. */
void deleteTask(String taskId);
+ /** deletes this task, including all history information */
+ void deleteTaskCascade(String taskId);
+
/** Deletes the task without completing indicating the reason. Example reasons
* could be: "failed", "error", "exited", "obsolete" or "deleted".
+ * The history information is kept in the DB.
* The reason ends up as the state in the {@link HistoryActivityInstance}.
* If this task was created in the context of a process execution,
* the execution remains active and the {@link ExecutionService#signalExecutionById(String)}
@@ -140,15 +145,15 @@
List<Task> getSubTasks(String taskId);
/** add a comment to a task */
- Comment addTaskComment(String taskId, String message);
+ HistoryComment addTaskComment(String taskId, String message);
/** get the list of comments made to a task. this will
* fetch all the comments and recursively all replies to those
* comments. */
- List<Comment> getTaskComments(String taskId);
+ List<HistoryComment> getTaskComments(String taskId);
/** add a reply to another comment */
- Comment addReplyComment(String commentId, String message);
+ HistoryComment addReplyComment(String commentId, String message);
/** delete a comment.
* this will recursively delete all replies to this comment. */
Copied: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java (from rev 5254, jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryComment.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -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.api.history;
+
+import java.util.Date;
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.model.Discussable;
+
+/** a free text comment that can be made to an {@link Execution}
+ * or a task.
+ *
+ * This class also supports threaded discussions with the
+ * {@link #getComments() parent-child relation}.
+ *
+ * @author Tom Baeyens
+ */
+public interface HistoryComment extends Discussable {
+
+ /** the unique id for this comment that is used as a reference in the service methods */
+ String getId();
+
+ /** the id of the user that made this comment. The term actorId is an abstract
+ * reference to an entity in an external identity component. */
+ String getUserId();
+
+ /** the actual message. Both plain text as well as HTML can be stored
+ * as the message. */
+ String getMessage();
+
+ /** time that specifies when the comment was made */
+ Date getTime();
+
+ /** threaded replies to this comment */
+ List<HistoryComment> getComments();
+}
\ No newline at end of file
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryProcessInstanceQuery.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryProcessInstanceQuery.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryProcessInstanceQuery.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -41,12 +41,18 @@
/** duration property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
String PROPERTY_DURATION = "duration";
+ /** select only the process instances with the given id */
HistoryProcessInstanceQuery processInstanceId(String processInstanceId);
+
+ /** select only process instances within the given process definition */
HistoryProcessInstanceQuery processDefinitionId(String processDefinitionId);
+
+ /** select only process instances in the given state */
HistoryProcessInstanceQuery state(String state);
/** order selected process instances ascending for certain {@link #PROPERTY_STARTTIME properties} */
HistoryProcessInstanceQuery orderAsc(String property);
+
/** order selected process instances ascending for certain {@link #PROPERTY_STARTTIME properties} */
HistoryProcessInstanceQuery orderDesc(String property);
Copied: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java (from rev 5254, jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTask.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -0,0 +1,66 @@
+/*
+ * 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.api.history;
+
+import java.util.Date;
+import java.util.List;
+
+import org.jbpm.api.task.Task;
+
+
+/** history record for a task instance.
+ *
+ * In contrast to the {@link Task}, this entity will remain
+ * after the task has been completed for history purposes.
+ *
+ * @author Tom Baeyens
+ */
+public interface HistoryTask {
+
+ String STATE_COMPLETED = "completed";
+
+ /** the unique id for this task that is used as a reference in the service methods */
+ String getId();
+
+ List<? extends HistoryComment> getComments();
+
+ /** the execution that was related to this activity occurrence */
+ String getExecutionId();
+
+ /** time when the activity was entered */
+ Date getCreateTime();
+
+ /** might be null in case the activity is still active */
+ Date getEndTime();
+
+ /** duration in milleseconds */
+ long getDuration();
+
+ /** history task state */
+ String getState();
+
+ /** userId of the person that is responsible for this task */
+ String getAssignee();
+
+ /** the outcome of this task */
+ String getOutcome();
+}
\ No newline at end of file
Copied: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java (from rev 5254, jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/history/HistoryTaskQuery.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -0,0 +1,92 @@
+/*
+ * 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.api.history;
+
+import java.util.Date;
+import java.util.List;
+
+
+/** query for history tasks.
+ *
+ * @author Tom Baeyens
+ */
+public interface HistoryTaskQuery {
+
+ /** id property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+ String PROPERTY_ID = "dbid";
+ /** starttime property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+ String PROPERTY_STARTTIME = "startTime";
+ /** endtime property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+ String PROPERTY_ENDTIME = "endTime";
+ /** executionId property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+ String PROPERTY_EXECUTIONID = "executionId";
+ /** outcome property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+ String PROPERTY_OUTCOME = "outcome";
+ /** outcome property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+ String PROPERTY_ASSIGNEE = "assignee";
+ /** state property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+ String PROPERTY_STATE = "state";
+ /** duration property to be used as property in {@link #orderAsc(String)} and {@link #orderDesc(String)} */
+ String PROPERTY_DURATION = "duration";
+
+ /** only select the history task for the given id */
+ HistoryTaskQuery taskId(String taskId);
+
+ /** only select history tasks within the given execution */
+ HistoryTaskQuery executionId(String executionId);
+
+ /** only select history tasks for the given assignee */
+ HistoryTaskQuery assignee(String assignee);
+
+ /** only select history tasks in the given state */
+ HistoryTaskQuery state(String state);
+
+ /** only select history tasks that have the given outcome */
+ HistoryTaskQuery outcome(String outcome);
+
+ /** order selected history tasks ascending for certain {@link #PROPERTY_ID properties} */
+ HistoryTaskQuery orderAsc(String property);
+
+ /** order selected process definitions descending for certain {@link #PROPERTY_ID properties} */
+ HistoryTaskQuery orderDesc(String property);
+
+ /** select a specific page in the result set */
+ HistoryTaskQuery page(int firstResult, int maxResults);
+
+ /** only select history tasks started after the given time */
+ HistoryTaskQuery startedAfter(Date time);
+
+ /** only select history tasks started before the given time */
+ HistoryTaskQuery startedBefore(Date time);
+
+ /** only select history tasks that took less then the given duration in milliseconds */
+ HistoryTaskQuery tookLessThen(long durationInMillis);
+
+ /** only select history tasks that took longer then the given duration in milliseconds */
+ HistoryTaskQuery tookLongerThen(long durationInMillis);
+
+ /** execute the query and obtain the list of {@link HistoryTask}s */
+ List<HistoryTask> list();
+
+ /** execute the query and obtain the unique {@link HistoryTask} */
+ HistoryTask uniqueResult();
+}
Deleted: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Comment.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Comment.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Comment.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -1,55 +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.api.model;
-
-import java.util.Date;
-import java.util.List;
-
-import org.jbpm.api.Execution;
-
-/** a free text comment that can be made to an {@link Execution}
- * or a task.
- *
- * This class also supports threaded discussions with the
- * {@link #getComments() parent-child relation}.
- *
- * @author Tom Baeyens
- */
-public interface Comment extends Discussable {
-
- /** the unique id for this comment that is used as a reference in the service methods */
- String getId();
-
- /** the id of the user that made this comment. The term actorId is an abstract
- * reference to an entity in an external identity component. */
- String getUserId();
-
- /** the actual message. Both plain text as well as HTML can be stored
- * as the message. */
- String getMessage();
-
- /** time that specifies when the comment was made */
- Date getTime();
-
- /** threaded replies to this comment */
- List<Comment> getComments();
-}
\ No newline at end of file
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Discussable.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Discussable.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/model/Discussable.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -24,6 +24,7 @@
import java.util.List;
import org.jbpm.api.TaskService;
+import org.jbpm.api.history.HistoryComment;
/** something that people can discuss like a task
@@ -37,11 +38,11 @@
public interface Discussable {
/** all comments. */
- List<Comment> getComments();
+ List<HistoryComment> getComments();
/** create a comment */
- Comment createComment(String message);
+ HistoryComment createComment(String message);
/** remove a comment */
- void removeComment(Comment comment);
+ void removeComment(HistoryComment comment);
}
Modified: jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/task/Task.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/task/Task.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/api/src/main/java/org/jbpm/api/task/Task.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -25,9 +25,13 @@
import java.util.Date;
import org.jbpm.api.TaskService;
+import org.jbpm.api.history.HistoryTask;
-/** a task.
+/** a runtime task.
*
+ * In contrast to {@link HistoryTask}, a Task only represents the runtime
+ * state of a task and hence it will be deleted after it is completed.
+ *
* @author Tom Baeyens
*/
public interface Task extends Serializable {
@@ -70,14 +74,14 @@
void setAssignee(String assignee);
/** date and time when this task was created */
- Date getCreate();
+ Date getCreateTime();
/** date and time when this task must be completed. This might be null. */
- Date getDueDate();
+ Date getDuedate();
/** update the date and time when this task must be completed.
* Updates like this require you to invoke {@link TaskService#saveTask(Task)} afterwards. */
- void setDueDate(Date dueDate);
+ void setDuedate(Date duedate);
/** the priority of this task. This is only a data item for user purposes.
* The engine doesn't do anything different for different priorities. */
Modified: jbpm4/branches/jbpm-4.0/modules/devguide/src/main/docbook/en/images/jbpm.erd.png
===================================================================
(Binary files differ)
Modified: jbpm4/branches/jbpm-4.0/modules/distro/src/main/files/readme.html
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/distro/src/main/files/readme.html 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/distro/src/main/files/readme.html 2009-07-07 20:01:12 UTC (rev 5256)
@@ -76,6 +76,8 @@
</li>
<li>[<a href='https://jira.jboss.org/jira/browse/JBPM-2389'>JBPM-2389</a>] - Reassignment is not reflected in task history
</li>
+<li>[<a href='https://jira.jboss.org/jira/browse/JBPM-2390'>JBPM-2390</a>] - add tasks and task comments the history
+</li>
</ul>
<h2> Feature Request
Modified: jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/InsertCommentCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -25,7 +25,7 @@
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.session.DbSession;
/**
@@ -48,7 +48,7 @@
}
public Void execute(Environment environment) throws Exception {
- CommentImpl comment = new CommentImpl();
+ HistoryCommentImpl comment = new HistoryCommentImpl();
comment.setMessage(message);
environment.get(DbSession.class).save(comment);
if (fail)
Modified: jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/custom/RemoveCommentCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -28,7 +28,7 @@
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
/**
* @author Alejandro Guizar
@@ -45,13 +45,13 @@
public Boolean execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- List<?> comments = session.createCriteria(CommentImpl.class)
+ List<?> comments = session.createCriteria(HistoryCommentImpl.class)
.add(Restrictions.eq("message", message))
.setMaxResults(1)
.list();
if (comments.isEmpty())
return false;
- CommentImpl phrase = (CommentImpl) comments.get(0);
+ HistoryCommentImpl phrase = (HistoryCommentImpl) comments.get(0);
session.delete(phrase);
return true;
}
Modified: jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/hql/HqlTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -67,9 +67,9 @@
protected void tearDown() throws Exception {
repositoryService.deleteDeploymentCascade(deploymentId);
- taskService.deleteTask(taskLaundryId);
- taskService.deleteTask(taskDishesId);
- taskService.deleteTask(taskIronId);
+ taskService.deleteTaskCascade(taskLaundryId);
+ taskService.deleteTaskCascade(taskDishesId);
+ taskService.deleteTaskCascade(taskIronId);
super.tearDown();
}
Modified: jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/examples/src/test/java/org/jbpm/examples/sql/SqlTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -67,9 +67,9 @@
protected void tearDown() throws Exception {
repositoryService.deleteDeploymentCascade(deploymentId);
- taskService.deleteTask(taskLaundryId);
- taskService.deleteTask(taskDishesId);
- taskService.deleteTask(taskIronId);
+ taskService.deleteTaskCascade(taskLaundryId);
+ taskService.deleteTaskCascade(taskDishesId);
+ taskService.deleteTaskCascade(taskIronId);
super.tearDown();
}
Modified: jbpm4/branches/jbpm-4.0/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -158,8 +158,8 @@
// prio and duedate
task.setPriority(t0.getPriority());
- task.setDueDate(t0.getDueDate());
- task.setCreateDate(t0.getCreate());
+ task.setDueDate(t0.getDuedate());
+ task.setCreateDate(t0.getCreateTime());
// task formResourceName url
String url = t0.getFormResourceName()!=null ? t0.getFormResourceName() : "";
Modified: jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -81,6 +81,8 @@
inParameter.produce(executionImpl, subProcessInstance);
}
+ executionImpl.historyActivityStart();
+
subProcessInstance.start();
execution.waitForSignal();
}
@@ -143,6 +145,8 @@
environment.setContext(originalExecutionContext);
}
}
+
+ executionImpl.historyActivityEnd();
if (transitionName!=null) {
execution.take(transitionName);
Modified: jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -28,12 +28,16 @@
import org.jbpm.api.task.Task;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.events.TaskActivityStart;
import org.jbpm.pvm.internal.model.Activity;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.Transition;
import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.ParticipationImpl;
+import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.task.TaskHandler;
import org.jbpm.pvm.internal.task.TaskImpl;
@@ -49,8 +53,47 @@
protected TaskDefinitionImpl taskDefinition;
public void execute(ActivityExecution execution) {
- ExecutionImpl executionImpl = (ExecutionImpl) execution;
- TaskImpl task = executionImpl.createTask(taskDefinition);
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+ TaskImpl task = (TaskImpl) dbSession.createTask();
+ task.setTaskDefinition(taskDefinition);
+ task.setExecution(execution);
+ task.setProcessInstance(execution.getProcessInstance());
+ task.setSignalling(true);
+
+ // initialize the name
+ if (taskDefinition.getName()!=null) {
+ task.setName(taskDefinition.getName());
+ } else {
+ task.setName(execution.getActivityName());
+ }
+
+ task.setDescription(taskDefinition.getDescription());
+ task.setPriority(taskDefinition.getPriority());
+ task.setFormResourceName(taskDefinition.getFormResourceName());
+
+ // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
+ dbSession.save(task);
+
+ SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
+ if (swimlaneDefinition!=null) {
+ SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
+ task.setSwimlane(swimlane);
+
+ // copy the swimlane assignments to the task
+ task.setAssignee(swimlane.getAssignee());
+ for (ParticipationImpl participant: swimlane.getParticipations()) {
+ task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
+ }
+ }
+
+ execution.initializeAssignments(taskDefinition, task);
+
+ HistoryEvent.fire(new TaskActivityStart(task), execution);
+
execution.waitForSignal();
}
@@ -70,8 +113,7 @@
DbSession taskDbSession = Environment
.getFromCurrent(DbSession.class);
TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
- TaskHandler taskHandler = task.getTaskHandler();
- taskHandler.executionSignal(task);
+ task.setSignalling(false);
Transition transition = null;
List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
Modified: jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -61,7 +61,6 @@
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.task.TaskHandler;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
@@ -490,13 +489,6 @@
}
}
- Element taskHandlerElement = XmlUtil.element(element, "task-handler");
- if (taskHandlerElement!=null) {
- ObjectDescriptor objectDescriptor = parseObjectDescriptor(taskHandlerElement, parse);
- TaskHandler taskHandler = (TaskHandler) WireContext.create(objectDescriptor);
- taskDefinition.setTaskHandler(taskHandler);
- }
-
JpdlParser.parseAssignmentAttributes(element, taskDefinition, parse);
// parse notification mail producer
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -22,16 +22,16 @@
package org.jbpm.pvm.internal.cmd;
import org.jbpm.api.JbpmException;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.session.DbSession;
/**
* @author Tom Baeyens
*/
-public class AddReplyCommentCmd extends AbstractCommand<Comment> {
+public class AddReplyCommentCmd extends AbstractCommand<HistoryComment> {
private static final long serialVersionUID = 1L;
@@ -46,13 +46,13 @@
this.message = message;
}
- public Comment execute(Environment environment) throws Exception {
+ public HistoryComment execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- CommentImpl parentComment = dbSession.get(CommentImpl.class, Long.parseLong(commentId));
+ HistoryCommentImpl parentComment = dbSession.get(HistoryCommentImpl.class, Long.parseLong(commentId));
if (parentComment==null) {
throw new JbpmException("parent comment doesn't exist: "+commentId);
}
- Comment replyComment = parentComment.createComment(message);
+ HistoryComment replyComment = parentComment.createComment(message);
return replyComment;
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -21,16 +21,18 @@
*/
package org.jbpm.pvm.internal.cmd;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.TaskImpl;
/**
* @author Tom Baeyens
*/
-public class AddTaskCommentCmd extends AbstractCommand<Comment> {
+public class AddTaskCommentCmd extends AbstractCommand<HistoryComment> {
private static final long serialVersionUID = 1L;
@@ -42,10 +44,13 @@
this.message = message;
}
- public Comment execute(Environment environment) throws Exception {
+ public HistoryComment execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- TaskImpl task = dbSession.get(TaskImpl.class, taskDbid);
- Comment comment = task.createComment(message);
+ HistoryTaskImpl historyTask = dbSession.get(HistoryTaskImpl.class, taskDbid);
+ if (historyTask==null) {
+ throw new JbpmException("task "+taskDbid+" doesn't exist");
+ }
+ HistoryCommentImpl comment = historyTask.createComment(message);
return comment;
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AssignTaskCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AssignTaskCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AssignTaskCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -23,6 +23,8 @@
import org.jbpm.api.JbpmException;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.events.TaskAssign;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.task.TaskImpl;
@@ -60,6 +62,9 @@
} else {
task.setAssignee(userId, true);
}
+
+ HistoryEvent.fire(new TaskAssign(task, userId));
+
return null;
}
}
Copied: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryTaskQueryCmd.java (from rev 5254, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryTaskQueryCmd.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryTaskQueryCmd.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateHistoryTaskQueryCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.query.HistoryTaskQueryImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CreateHistoryTaskQueryCmd implements Command<HistoryTaskQueryImpl> {
+
+ private static final long serialVersionUID = 1L;
+
+ public HistoryTaskQueryImpl execute(Environment environment) throws Exception {
+ return new HistoryTaskQueryImpl();
+ }
+
+}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -23,7 +23,7 @@
import org.jbpm.api.JbpmException;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.session.DbSession;
@@ -45,7 +45,7 @@
public Object execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- CommentImpl comment = (CommentImpl) dbSession.get(CommentImpl.class, Long.parseLong(commentId));
+ HistoryCommentImpl comment = (HistoryCommentImpl) dbSession.get(HistoryCommentImpl.class, Long.parseLong(commentId));
if (comment!=null) {
dbSession.delete(comment);
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -29,7 +29,7 @@
import org.jbpm.api.ProcessInstance;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.query.ProcessInstanceQueryImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.pvm.internal.repository.RepositoryCache;
import org.jbpm.pvm.internal.session.DbSession;
@@ -67,20 +67,18 @@
for (ProcessDefinition processDefinition: processDefinitions) {
String processDefinitionId = processDefinition.getId();
- List<ProcessInstance> processInstances = dbSession.createProcessInstanceQuery()
- .processDefinitionId(processDefinitionId)
- .list();
+ List<String> processInstanceIds = dbSession.findProcessInstanceIds(processDefinitionId);
if (cascade) {
- for (ProcessInstance processInstance: processInstances) {
- dbSession.deleteProcessInstance(processInstance.getId(), true);
+ for (String processInstanceId: processInstanceIds) {
+ dbSession.deleteProcessInstance(processInstanceId, true);
}
dbSession.deleteProcessDefinitionHistory(processDefinitionId);
} else {
- if (!processInstances.isEmpty()) {
- throw new JbpmException("cannot delete deployment "+deploymentId+": still executions for "+processDefinition+": "+processInstances);
+ if (!processInstanceIds.isEmpty()) {
+ throw new JbpmException("cannot delete deployment "+deploymentId+": still executions for "+processDefinition+": "+processInstanceIds);
}
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -33,14 +33,20 @@
private static final long serialVersionUID = 1L;
String processInstanceId;
+ boolean cascade = false;
public DeleteProcessInstance(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
+ public DeleteProcessInstance(String processInstanceId, boolean cascade) {
+ this.processInstanceId = processInstanceId;
+ this.cascade = cascade;
+ }
+
public Void execute(Environment environment) throws Exception {
DbSession dbSession = Environment.getFromCurrent(DbSession.class);
- dbSession.deleteProcessInstance(processInstanceId);
+ dbSession.deleteProcessInstance(processInstanceId, cascade);
return null;
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -23,36 +23,50 @@
import org.jbpm.api.JbpmException;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.task.TaskImpl;
/**
+ * @author Tom Baeyens
* @author Alejandro Guizar
*/
public class DeleteTaskCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
- protected String taskId;
+ protected long taskDbid;
protected String reason;
+ protected boolean deleteHistory = false;
public DeleteTaskCmd(String taskId) {
- this.taskId = taskId;
+ this.taskDbid = Long.parseLong(taskId);
}
public DeleteTaskCmd(String taskId, String reason) {
- this.taskId = taskId;
+ this.taskDbid = Long.parseLong(taskId);
this.reason = reason;
}
+ public DeleteTaskCmd(String taskId, boolean deleteHistory) {
+ this.taskDbid = Long.parseLong(taskId);
+ this.deleteHistory = deleteHistory;
+ }
+
public Void execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- TaskImpl task = (TaskImpl) dbSession.get(TaskImpl.class, Long.parseLong(taskId));
+ TaskImpl task = (TaskImpl) dbSession.get(TaskImpl.class, taskDbid);
if (task!=null) {
task.delete(reason);
dbSession.delete(task);
+ if (deleteHistory) {
+ HistoryTaskImpl historyTask = (HistoryTaskImpl) dbSession.get(HistoryTaskImpl.class, taskDbid);
+ if (historyTask!=null) {
+ dbSession.delete(historyTask);
+ }
+ }
} else {
- throw new JbpmException("task "+taskId+" doesn't exist");
+ throw new JbpmException("task "+taskDbid+" doesn't exist");
}
return null;
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -25,16 +25,17 @@
import java.util.Collections;
import java.util.List;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.TaskImpl;
/**
* @author Tom Baeyens
*/
-public class GetTaskCommentsCmd extends AbstractCommand<List<Comment>> {
+public class GetTaskCommentsCmd extends AbstractCommand<List<HistoryComment>> {
private static final long serialVersionUID = 1L;
@@ -44,12 +45,12 @@
this.taskId = taskId;
}
- public List<Comment> execute(Environment environment) throws Exception {
+ public List<HistoryComment> execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
+ HistoryTaskImpl historyTask = dbSession.get(HistoryTaskImpl.class, Long.parseLong(taskId));
- if (task != null) {
- List<Comment> comments = task.getComments();
+ if (historyTask != null) {
+ List<HistoryComment> comments = historyTask.getComments();
forceInitializationAndClean(comments);
return comments;
} else {
@@ -57,12 +58,12 @@
}
}
- protected void forceInitializationAndClean(List<Comment> comments) {
+ protected void forceInitializationAndClean(List<HistoryComment> comments) {
if (comments!=null) {
comments.size();
- List<Comment> copy = new ArrayList<Comment>(comments);
+ List<HistoryComment> copy = new ArrayList<HistoryComment>(comments);
for (int i=0; i<copy.size(); i++) {
- Comment comment = copy.get(i);
+ HistoryComment comment = copy.get(i);
// when comments get deleted, it's possible that we
// get null values in the list as the indexes of the
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -22,10 +22,15 @@
package org.jbpm.pvm.internal.cmd;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.HistorySession;
+import org.jbpm.pvm.internal.history.events.TaskCreated;
+import org.jbpm.pvm.internal.history.events.TaskUpdated;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.task.TaskImpl;
/**
+ * @author Tom Baeyens
* @author Alejandro Guizar
*/
public class SaveTaskCmd extends AbstractCommand<String> {
@@ -40,9 +45,24 @@
public String execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
-
- dbSession.saveTask(task);
-
+
+ if (task.isNew()) {
+ if (task.getSuperTaskDbid()!=null) {
+ TaskImpl parentTask = (TaskImpl) dbSession.get(TaskImpl.class, task.getSuperTaskDbid());
+ parentTask.addSubTask(task);
+ task.setSuperTaskDbid(null);
+ }
+
+ dbSession.save(task);
+
+ HistoryEvent.fire(new TaskCreated(task));
+
+ } else {
+ dbSession.update(task);
+
+ HistoryEvent.fire(new TaskUpdated(task));
+ }
+
return task.getId();
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -37,8 +37,9 @@
import org.jbpm.pvm.internal.client.ClientExecution;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
+import org.jbpm.pvm.internal.history.HistorySession;
import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
@@ -84,6 +85,10 @@
session.save(entity);
}
+ public void update(Object entity) {
+ session.update(entity);
+ }
+
public void merge(Object entity) {
session.merge(entity);
}
@@ -144,7 +149,7 @@
if (deleteProcessInstances) {
for (String processInstanceId : processInstanceIds) {
- deleteProcessInstance(processInstanceId);
+ deleteProcessInstance(processInstanceId, deleteHistory);
}
} else {
if (processInstanceIds.size()>0) {
@@ -167,11 +172,6 @@
.list();
for (HistoryProcessInstanceImpl hpi: historyProcessInstances) {
- session.createQuery(
- "delete "+HistoryActivityInstanceImpl.class.getName()+" hai " +
- "where hai.historyProcessInstance = :historyProcessInstance ")
- .setEntity("historyProcessInstance", hpi)
- .executeUpdate();
session.delete(hpi);
}
}
@@ -219,7 +219,7 @@
query.setString("processDefinitionId", processDefinitionId);
return query.list();
}
-
+
public void deleteProcessInstance(String processInstanceId) {
deleteProcessInstance(processInstanceId, true);
}
@@ -234,8 +234,7 @@
&& (isHistoryEnabled())
) {
// try to get the history
- HistoryProcessInstanceImpl historyProcessInstance = (HistoryProcessInstanceImpl)
- session.get(HistoryProcessInstanceImpl.class, processInstanceId);
+ HistoryProcessInstanceImpl historyProcessInstance = findHistoryProcessInstanceById(processInstanceId);
// if there is a history process instance in the db
if (historyProcessInstance!=null) {
@@ -271,6 +270,15 @@
}
}
+ public HistoryProcessInstanceImpl findHistoryProcessInstanceById(String processInstanceId) {
+ return (HistoryProcessInstanceImpl) session
+ .createQuery(
+ "select hpi " +
+ "from "+HistoryProcessInstance.class.getName()+" as hpi " +
+ "where hpi.processInstanceId = '"+processInstanceId+"'"
+ ).uniqueResult();
+ }
+
List<TaskImpl> findTasks(String processInstanceId) {
Query query = session.createQuery(
"select task " +
@@ -349,12 +357,14 @@
public Task createTask() {
TaskImpl task = newTask();
- task.setCreate(Clock.getCurrentTime());
+ task.setCreateTime(Clock.getCurrentTime());
return task;
}
protected TaskImpl newTask() {
- return new TaskImpl();
+ TaskImpl task = new TaskImpl();
+ task.setNew(true);
+ return task;
}
public TaskImpl findTaskByDbid(long taskDbid) {
@@ -372,18 +382,6 @@
return (Task) query.uniqueResult();
}
- public void saveTask(Task task) {
- TaskImpl taskImpl = (TaskImpl) task;
-
- if (taskImpl.getSuperTaskDbid()!=null) {
- TaskImpl parentTask = (TaskImpl) session.load(TaskImpl.class, taskImpl.getSuperTaskDbid());
- parentTask.addSubTask(taskImpl);
- taskImpl.setSuperTaskDbid(null);
- }
-
- session.saveOrUpdate(task);
- }
-
public JobImpl<?> findFirstAcquirableJob() {
Query query = session.getNamedQuery("findFirstAcquirableJob");
query.setTimestamp("now", Clock.getCurrentTime());
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/HistoryEvent.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/HistoryEvent.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/HistoryEvent.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -23,6 +23,7 @@
import java.io.Serializable;
+import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.model.ExecutionImpl;
/** base class for process logs. Process logs are dispatched to the
@@ -46,4 +47,19 @@
}
public abstract void process();
+
+ public static void fire(HistoryEvent historyEvent) {
+ fire(historyEvent, null);
+ }
+
+ public static void fire(HistoryEvent historyEvent, ExecutionImpl execution) {
+ Environment environment = Environment.getCurrent();
+ if (environment!=null) {
+ HistorySession historySession = environment.get(HistorySession.class);
+ if (historySession!=null) {
+ historyEvent.setExecution(execution);
+ historySession.process(historyEvent);
+ }
+ }
+ }
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/HistorySessionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/HistorySessionImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/HistorySessionImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -28,8 +28,6 @@
public class HistorySessionImpl implements HistorySession {
public void process(HistoryEvent historyEvent) {
- if (historyEvent.execution.getId()!=null) {
- historyEvent.process();
- }
+ historyEvent.process();
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ActivityStart.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ActivityStart.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ActivityStart.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -21,12 +21,12 @@
*/
package org.jbpm.pvm.internal.history.events;
-import org.hibernate.Session;
import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.history.HistoryEvent;
import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
+import org.jbpm.pvm.internal.session.DbSession;
/**
@@ -37,22 +37,22 @@
private static final long serialVersionUID = 1L;
public void process() {
- Session session = Environment.getFromCurrent(Session.class);
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
- String processInstanceId = execution.getProcessInstance().getId();
+ long processInstanceDbid = execution.getProcessInstance().getDbid();
HistoryProcessInstance historyProcessInstanceImpl = (HistoryProcessInstance)
- session.load(HistoryProcessInstanceImpl.class, processInstanceId);
+ dbSession.get(HistoryProcessInstanceImpl.class, processInstanceDbid);
- HistoryActivityInstanceImpl historyActivityInstanceImpl =
+ HistoryActivityInstanceImpl historyActivityInstance =
createHistoryActivityInstance(historyProcessInstanceImpl);
String activityType = execution.getActivity().getType();
- historyActivityInstanceImpl.setType(activityType);
+ historyActivityInstance.setType(activityType);
- session.save(historyActivityInstanceImpl);
+ dbSession.save(historyActivityInstance);
- execution.setHistoryActivityInstanceDbid(historyActivityInstanceImpl.getDbid());
+ execution.setHistoryActivityInstanceDbid(historyActivityInstance.getDbid());
}
protected HistoryActivityInstanceImpl createHistoryActivityInstance(HistoryProcessInstance historyProcessInstanceImpl) {
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceEnd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceEnd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/ProcessInstanceEnd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -37,7 +37,7 @@
public void process() {
Session session = Environment.getFromCurrent(Session.class);
HistoryProcessInstanceImpl historyProcessInstanceImpl = (HistoryProcessInstanceImpl)
- session.load(HistoryProcessInstanceImpl.class, execution.getId());
+ session.load(HistoryProcessInstanceImpl.class, execution.getDbid());
historyProcessInstanceImpl.setEndTime(Clock.getCurrentTime());
historyProcessInstanceImpl.setState(execution.getState());
historyProcessInstanceImpl.setEndActivityName(execution.getActivityName());
Copied: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskActivityStart.java (from rev 5254, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskActivityStart.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskActivityStart.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskActivityStart.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -0,0 +1,72 @@
+/*
+ * 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.history.events;
+
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
+import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskInstanceImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskActivityStart extends HistoryEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ protected TaskImpl task;
+
+ public TaskActivityStart(TaskImpl task) {
+ this.task = task;
+ }
+
+ public void process() {
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+
+ ExecutionImpl processInstance = execution.getProcessInstance();
+ long processInstanceDbid = processInstance.getDbid();
+
+ HistoryProcessInstance historyProcessInstance =
+ dbSession.get(HistoryProcessInstanceImpl.class, processInstanceDbid);
+
+ HistoryTaskImpl historyTask = new HistoryTaskImpl(task);
+ historyTask.setExecutionId(execution.getId());
+
+ HistoryActivityInstanceImpl historyActivityInstance =
+ new HistoryTaskInstanceImpl(historyProcessInstance, execution, historyTask);
+
+ String activityType = execution.getActivity().getType();
+ historyActivityInstance.setType(activityType);
+
+ dbSession.save(historyActivityInstance);
+
+ execution.setHistoryActivityInstanceDbid(historyActivityInstance.getDbid());
+ }
+
+}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskAssign.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskAssign.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskAssign.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -23,7 +23,7 @@
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.history.HistoryEvent;
-import org.jbpm.pvm.internal.history.model.HistoryTaskInstanceImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.task.TaskImpl;
@@ -34,18 +34,18 @@
private static final long serialVersionUID = 1L;
- protected TaskImpl taskImpl;
+ protected TaskImpl task;
protected String assignee;
- public TaskAssign(TaskImpl taskImpl, String assignee) {
+ public TaskAssign(TaskImpl task, String assignee) {
+ this.task = task;
this.assignee = assignee;
}
public void process() {
DbSession dbSession = Environment.getFromCurrent(DbSession.class);
- Long historyActivityInstanceDbId = execution.getHistoryActivityInstanceDbid();
- HistoryTaskInstanceImpl historyTaskInstance = (HistoryTaskInstanceImpl)
- dbSession.get(HistoryTaskInstanceImpl.class, historyActivityInstanceDbId);
+ HistoryTaskImpl historyTaskInstance = (HistoryTaskImpl)
+ dbSession.get(HistoryTaskImpl.class, task.getDbid());
historyTaskInstance.setAssignee(assignee);
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskComplete.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskComplete.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskComplete.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -21,18 +21,42 @@
*/
package org.jbpm.pvm.internal.history.events;
+import org.hibernate.Session;
+import org.jbpm.api.history.HistoryTask;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskInstanceImpl;
+import org.jbpm.pvm.internal.util.Clock;
+
/**
* @author Tom Baeyens
*/
-public class TaskComplete extends ActivityEnd {
+public class TaskComplete extends HistoryEvent {
private static final long serialVersionUID = 1L;
protected String outcome;
public TaskComplete(String outcome) {
- this.transitionName = outcome;
+ this.outcome = outcome;
}
+
+ public void process() {
+ Session session = Environment.getFromCurrent(Session.class);
+ Long historyActivityInstanceDbId = execution.getHistoryActivityInstanceDbid();
+ HistoryTaskInstanceImpl historyTaskInstance = (HistoryTaskInstanceImpl)
+ session.load(HistoryTaskInstanceImpl.class, historyActivityInstanceDbId);
+ historyTaskInstance.setEndTime(Clock.getCurrentTime());
+ historyTaskInstance.setTransitionName(outcome);
+
+ HistoryTaskImpl historyTask = historyTaskInstance.getHistoryTask();
+ historyTask.setOutcome(outcome);
+ historyTask.setEndTime(Clock.getCurrentTime());
+ historyTask.setState(HistoryTask.STATE_COMPLETED);
+
+ session.update(historyTaskInstance);
+ }
}
Copied: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskCreated.java (from rev 5254, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskCreated.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskCreated.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskCreated.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.history.events;
+
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskCreated extends HistoryEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ protected TaskImpl task;
+
+ public TaskCreated(TaskImpl task) {
+ this.task = task;
+ }
+
+ public void process() {
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+ HistoryTaskImpl historyTask = new HistoryTaskImpl(task);
+ dbSession.save(historyTask);
+
+ if (task.getSuperTask()!=null) {
+ HistoryTaskImpl superHistoryTask = dbSession.get(HistoryTaskImpl.class, task.getSuperTask().getDbid());
+ superHistoryTask.addSubTask(historyTask);
+ }
+ }
+}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskDelete.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskDelete.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskDelete.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -21,8 +21,14 @@
*/
package org.jbpm.pvm.internal.history.events;
+import org.jbpm.api.JbpmException;
+import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
import org.jbpm.pvm.internal.history.model.HistoryTaskInstanceImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.pvm.internal.util.Clock;
/**
@@ -32,17 +38,25 @@
private static final long serialVersionUID = 1L;
+ protected TaskImpl task;
protected String reason;
- public TaskDelete(String reason) {
+ public TaskDelete(TaskImpl task, String reason) {
+ if (task.getExecution()!=null) {
+ throw new JbpmException("tasks related to an execution must be completed. they cannot just be deleted");
+ }
+
+ this.task = task;
this.reason = reason;
}
protected void updateHistoryActivityInstance(HistoryActivityInstanceImpl historyActivityInstance) {
super.updateHistoryActivityInstance(historyActivityInstance);
- HistoryTaskInstanceImpl historyTaskInstance = (HistoryTaskInstanceImpl) historyActivityInstance;
- historyTaskInstance.setState(reason);
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+ HistoryTaskImpl historyTask = (HistoryTaskImpl) dbSession.get(HistoryTaskImpl.class, task.getDbid());
+ historyTask.setState(reason);
+ historyTask.setEndTime(Clock.getCurrentTime());
}
protected Class<? extends HistoryActivityInstanceImpl> getHistoryActivityInstanceClass() {
Deleted: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskStart.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskStart.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskStart.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -1,46 +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.history.events;
-
-import org.jbpm.api.history.HistoryProcessInstance;
-import org.jbpm.api.task.Task;
-import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
-import org.jbpm.pvm.internal.history.model.HistoryTaskInstanceImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class TaskStart extends ActivityStart {
-
- private static final long serialVersionUID = 1L;
-
- protected String assignee;
-
- public TaskStart(Task task) {
- this.assignee = task.getAssignee();
- }
-
- protected HistoryActivityInstanceImpl createHistoryActivityInstance(HistoryProcessInstance historyProcessInstanceImpl) {
- return new HistoryTaskInstanceImpl(historyProcessInstanceImpl, execution, assignee);
- }
-}
Copied: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java (from rev 5254, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/events/TaskUpdated.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -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.history.events;
+
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.HistoryEvent;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskUpdated extends HistoryEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ protected TaskImpl task;
+
+ public TaskUpdated(TaskImpl task) {
+ this.task = task;
+ }
+
+ public void process() {
+ DbSession dbSession = Environment.getFromCurrent(DbSession.class);
+ HistoryTaskImpl historyTask = dbSession.get(HistoryTaskImpl.class, task.getDbid());
+
+ historyTask.updated(task);
+ }
+}
Copied: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java (from rev 5254, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryCommentImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -0,0 +1,124 @@
+/*
+ * 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.history.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.history.HistoryComment;
+import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.util.Clock;
+import org.jbpm.pvm.internal.util.EqualsUtil;
+
+public class HistoryCommentImpl implements Serializable, HistoryComment {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int dbversion;
+ protected String userId = null;
+ protected Date time = null;
+ protected String message = null;
+ protected List<HistoryCommentImpl> comments = new ArrayList<HistoryCommentImpl>();
+
+ public HistoryCommentImpl() {
+ }
+
+ public HistoryCommentImpl(String message) {
+ this.message = message;
+ this.time = Clock.getCurrentTime();
+
+ Environment environment = Environment.getCurrent();
+ if (environment!=null) {
+ this.userId = environment.getUserId();
+ }
+ }
+
+ // replies //////////////////////////////////////////////////////////////////
+
+ public HistoryComment createComment(String message) {
+ if (message==null) {
+ throw new JbpmException("message is null");
+ }
+ HistoryCommentImpl reply = new HistoryCommentImpl(message);
+ comments.add(reply);
+ return reply;
+ }
+
+ public void removeComment(HistoryComment comment) {
+ if (comment==null) {
+ throw new JbpmException("reply is null");
+ }
+ if (comments.contains(comment)) {
+ comments.remove(comment);
+ }
+ }
+
+ public List<HistoryComment> getComments() {
+ return (List)comments;
+ }
+
+
+ public void setComments(List<HistoryCommentImpl> replies) {
+ this.comments = replies;
+ }
+
+ // equals ///////////////////////////////////////////////////////////////////
+ // hack to support comparing hibernate proxies against the real objects
+ // since this always falls back to ==, we don't need to overwrite the hashcode
+ public boolean equals(Object o) {
+ return EqualsUtil.equals(this, o);
+ }
+
+ // cusomtized getters and setters ////////////////////////////////////////////
+
+ public String getId() {
+ return Long.toString(dbid);
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public long getDbid() {
+ return dbid;
+ }
+ public String getUserId() {
+ return userId;
+ }
+ public String getMessage() {
+ return message;
+ }
+ public Date getTime() {
+ return time;
+ }
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+ public void setTime(Date time) {
+ this.time = time;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryProcessInstanceImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -58,9 +58,9 @@
}
public HistoryProcessInstanceImpl(ExecutionImpl processInstance) {
+ this.dbid = processInstance.getDbid();
this.processDefinition = processInstance.getProcessDefinition();
this.processDefinitionId = processDefinition.getId();
- this.dbid = processInstance.getDbid();
this.processInstanceId = processInstance.getId();
this.key = processInstance.getKey();
this.state = "active";
Copied: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java (from rev 5254, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -0,0 +1,163 @@
+/*
+ * 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.history.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.history.HistoryComment;
+import org.jbpm.api.history.HistoryTask;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.pvm.internal.util.Clock;
+import org.jbpm.pvm.internal.util.EqualsUtil;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryTaskImpl implements Serializable, HistoryTask {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int dbversion;
+ protected String executionId;
+ protected String assignee;
+ protected String state;
+ protected String outcome;
+ protected Integer priority;
+ protected Date duedate;
+ protected Date createTime;
+ protected Date endTime;
+ protected long duration;
+ protected Set<HistoryTaskImpl> subTasks = new HashSet<HistoryTaskImpl>();
+ protected List<HistoryCommentImpl> comments = new ArrayList<HistoryCommentImpl>();
+
+ public HistoryTaskImpl() {
+ }
+
+ public HistoryTaskImpl(TaskImpl task) {
+ this.dbid = task.getDbid();
+ this.assignee = task.getAssignee();
+ this.priority = task.getPriority();
+ this.duedate = task.getDuedate();
+ this.createTime = Clock.getCurrentTime();
+ }
+
+ public void updated(TaskImpl task) {
+ this.assignee = task.getAssignee();
+ this.priority = task.getPriority();
+ this.duedate = task.getDuedate();
+ }
+
+ // comments /////////////////////////////////////////////////////////////////
+ public List<HistoryComment> getComments() {
+ return (List)comments;
+ }
+
+ public HistoryCommentImpl createComment(String commentText) {
+ HistoryCommentImpl comment = new HistoryCommentImpl(commentText);
+ comments.add(comment);
+ return comment;
+ }
+
+ public void removeComment(HistoryCommentImpl comment) {
+ if (comment == null) {
+ throw new JbpmException("comment is null");
+ }
+ if (comments.contains(comment)) {
+ comments.remove(comment);
+ }
+ }
+
+ // subtasks /////////////////////////////////////////////////////////////////
+
+ public Set<HistoryTask> getSubTasks() {
+ return (Set)subTasks;
+ }
+
+ public void addSubTask(HistoryTaskImpl historyTask) {
+ subTasks.add(historyTask);
+ }
+
+ // equals ///////////////////////////////////////////////////////////////////
+ // hack to support comparing hibernate proxies against the real objects
+ // since this always falls back to ==, we don't need to overwrite the hashcode
+ public boolean equals(Object o) {
+ return EqualsUtil.equals(this, o);
+ }
+
+ // customized getters and setters ///////////////////////////////////////////
+
+ public String getId() {
+ return Long.toString(dbid);
+ }
+
+ public void setEndTime(Date endTime) {
+ this.endTime = endTime;
+ this.duration = endTime.getTime() - createTime.getTime();
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public String getState() {
+ return state;
+ }
+ public String getAssignee() {
+ return assignee;
+ }
+ public String getOutcome() {
+ return outcome;
+ }
+ public void setOutcome(String outcome) {
+ this.outcome = outcome;
+ }
+ public void setAssignee(String assignee) {
+ this.assignee = assignee;
+ }
+ public Date getCreateTime() {
+ return createTime;
+ }
+ public Date getEndTime() {
+ return endTime;
+ }
+ public long getDuration() {
+ return duration;
+ }
+ public void setDuration(long duration) {
+ this.duration = duration;
+ }
+ public String getExecutionId() {
+ return executionId;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+ public void setExecutionId(String executionId) {
+ this.executionId = executionId;
+ }
+}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskInstanceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskInstanceImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryTaskInstanceImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -31,29 +31,18 @@
public class HistoryTaskInstanceImpl extends HistoryActivityInstanceImpl {
private static final long serialVersionUID = 1L;
-
- protected String assignee;
- protected String state;
+ HistoryTaskImpl historyTask;
+
public HistoryTaskInstanceImpl() {
- this.state = "active";
}
- public HistoryTaskInstanceImpl(HistoryProcessInstance historyProcessInstanceImpl, ExecutionImpl execution, String assignee) {
+ public HistoryTaskInstanceImpl(HistoryProcessInstance historyProcessInstanceImpl, ExecutionImpl execution, HistoryTaskImpl historyTask) {
super(historyProcessInstanceImpl, execution);
- this.assignee = assignee;
+ this.historyTask = historyTask;
}
-
- public String getAssignee() {
- return assignee;
+
+ public HistoryTaskImpl getHistoryTask() {
+ return historyTask;
}
- public void setAssignee(String assignee) {
- this.assignee = assignee;
- }
- public String getState() {
- return state;
- }
- public void setState(String state) {
- this.state = state;
- }
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -28,7 +28,7 @@
protected int dbversion;
/** date until which the command should not be executed
- * for async messages, this dueDate should be set to null. */
+ * for async messages, this duedate should be set to null. */
protected Date dueDate = null;
/** job state. */
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -84,7 +84,7 @@
) {
Environment environment = Environment.getCurrent();
if (environment==null) {
- throw new JbpmException("no environment to get business calendar for calculating dueDate "+dueDateDescription);
+ throw new JbpmException("no environment to get business calendar for calculating duedate "+dueDateDescription);
}
BusinessCalendar businessCalendar = environment.get(BusinessCalendar.class);
dueDate = businessCalendar.add(now, duration);
@@ -132,7 +132,7 @@
} else { // there is a repeat on this timer
deleteThisJob = false;
// suppose that it took the timer runner thread a very long time to execute the timers
- // then the repeat action dueDate could already have passed
+ // then the repeat action duedate could already have passed
do {
setDueDateDescription(repeat);
} while (dueDate.getTime() <= Clock.getCurrentTime().getTime());
Deleted: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CommentImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CommentImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CommentImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.model;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.model.Comment;
-import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.util.Clock;
-import org.jbpm.pvm.internal.util.EqualsUtil;
-
-public class CommentImpl implements Serializable, Comment {
-
- private static final long serialVersionUID = 1L;
-
- protected long dbid;
- protected int dbversion;
- protected String userId = null;
- protected Date time = null;
- protected String message = null;
- protected List<CommentImpl> comments = new ArrayList<CommentImpl>();
-
- public CommentImpl() {
- }
-
- public CommentImpl(String message) {
- this.message = message;
- this.time = Clock.getCurrentTime();
-
- Environment environment = Environment.getCurrent();
- if (environment!=null) {
- this.userId = environment.getUserId();
- }
- }
-
- // replies //////////////////////////////////////////////////////////////////
-
- public Comment createComment(String message) {
- if (message==null) {
- throw new JbpmException("message is null");
- }
- CommentImpl reply = new CommentImpl(message);
- comments.add(reply);
- return reply;
- }
-
- public void removeComment(Comment comment) {
- if (comment==null) {
- throw new JbpmException("reply is null");
- }
- if (comments.contains(comment)) {
- comments.remove(comment);
- }
- }
-
- public List<Comment> getComments() {
- return (List)comments;
- }
-
-
- public void setComments(List<CommentImpl> replies) {
- this.comments = replies;
- }
-
- // equals ///////////////////////////////////////////////////////////////////
- // hack to support comparing hibernate proxies against the real objects
- // since this always falls back to ==, we don't need to overwrite the hashcode
- public boolean equals(Object o) {
- return EqualsUtil.equals(this, o);
- }
-
- // cusomtized getters and setters ////////////////////////////////////////////
-
- public String getId() {
- return Long.toString(dbid);
- }
-
- // getters and setters //////////////////////////////////////////////////////
-
- public long getDbid() {
- return dbid;
- }
- public String getUserId() {
- return userId;
- }
- public String getMessage() {
- return message;
- }
- public Date getTime() {
- return time;
- }
- public void setUserId(String userId) {
- this.userId = userId;
- }
- public void setTime(Date time) {
- this.time = time;
- }
- public void setMessage(String message) {
- this.message = message;
- }
-}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -27,7 +27,6 @@
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -41,7 +40,6 @@
import org.jbpm.api.job.Job;
import org.jbpm.api.job.Timer;
import org.jbpm.api.listener.EventListenerExecution;
-import org.jbpm.api.model.Comment;
import org.jbpm.api.model.Event;
import org.jbpm.api.model.OpenExecution;
import org.jbpm.api.task.Assignable;
@@ -60,6 +58,7 @@
import org.jbpm.pvm.internal.history.events.DecisionEnd;
import org.jbpm.pvm.internal.history.events.ProcessInstanceEnd;
import org.jbpm.pvm.internal.history.events.ProcessInstanceStart;
+import org.jbpm.pvm.internal.history.events.TaskActivityStart;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.model.op.AtomicOperation;
@@ -75,13 +74,10 @@
import org.jbpm.pvm.internal.task.SwimlaneDefinitionImpl;
import org.jbpm.pvm.internal.task.SwimlaneImpl;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
-import org.jbpm.pvm.internal.task.TaskHandler;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.type.Variable;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
/**
* @author Tom Baeyens
@@ -125,9 +121,6 @@
/** swimlanes */
protected Map<String, SwimlaneImpl> swimlanes = new HashMap<String, SwimlaneImpl>();
- /** the free text comments users make on this execution */
- protected Set<CommentImpl> comments = new LinkedHashSet<CommentImpl>();
-
/** reference to the current activity instance history record */
protected Long historyActivityInstanceDbid;
@@ -206,7 +199,7 @@
this.state = STATE_ACTIVE_ROOT;
ExecutionImpl scopedExecution = initializeScopes();
- fireHistoryEvent(new ProcessInstanceStart());
+ HistoryEvent.fire(new ProcessInstanceStart(), this);
fire(Event.START, getProcessDefinition());
if (getActivity()!=null) {
scopedExecution.performAtomicOperation(AtomicOperation.EXECUTE_ACTIVITY);
@@ -361,7 +354,7 @@
parent.removeExecution(this);
} else { // this is a process instance
- fireHistoryEvent(new ProcessInstanceEnd());
+ HistoryEvent.fire(new ProcessInstanceEnd(), this);
fire(Event.END, getProcessDefinition());
if (superProcessExecution!=null) {
@@ -708,49 +701,7 @@
// tasks ////////////////////////////////////////////////////////////////////
-
- public TaskImpl createTask(TaskDefinitionImpl taskDefinition) {
- DbSession dbSession = Environment.getFromCurrent(DbSession.class);
- TaskImpl task = (TaskImpl) dbSession.createTask();
- task.setTaskDefinition(taskDefinition);
- task.setExecution(this);
- task.setProcessInstance(processInstance);
- task.setSignalling(true);
-
- // initialize the name
- if (taskDefinition.getName()!=null) {
- task.setName(taskDefinition.getName());
- } else {
- task.setName(getActivityName());
- }
- task.setDescription(taskDefinition.getDescription());
- task.setPriority(taskDefinition.getPriority());
- task.setFormResourceName(taskDefinition.getFormResourceName());
-
- // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
- dbSession.saveTask(task);
-
- TaskHandler taskHandler = task.getTaskHandler();
- boolean wait = taskHandler.executionCreateTask(task);
-
- SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
- if (swimlaneDefinition!=null) {
- SwimlaneImpl swimlane = getInitializedSwimlane(swimlaneDefinition);
- task.setSwimlane(swimlane);
-
- // copy the swimlane assignments to the task
- task.setAssignee(swimlane.getAssignee());
- for (ParticipationImpl participant: swimlane.getParticipations()) {
- task.addParticipation(participant.getUserId(), participant.getGroupId(), participant.getType());
- }
- }
-
- initializeAssignments(taskDefinition, task);
-
- return task;
- }
-
/** tasks and swimlane assignment.
* SwimlaneDefinitionImpl is base class for TaskDefinitionImpl.
* Both Task and Swimlane implement Assignable. */
@@ -844,28 +795,6 @@
return swimlane;
}
- // comments /////////////////////////////////////////////////////////////////
-
- public Comment createComment(String message) {
- if (message==null) {
- throw new JbpmException("message is null");
- }
- CommentImpl comment = new CommentImpl(message);
- addComment(comment);
- return comment;
- }
-
- public void removeComment(Comment comment) {
- throw new UnsupportedOperationException("please implement me");
- }
-
- public void addComment(CommentImpl comment) {
- if (comment==null) {
- throw new JbpmException("comment is null");
- }
- comments.add(comment);
- }
-
// child executions /////////////////////////////////////////////////////////
public ExecutionImpl createExecution() {
@@ -1105,17 +1034,6 @@
////////////////////////////////////////////////////////////////////////////////
- public void fireHistoryEvent(HistoryEvent historyEvent) {
- Environment environment = Environment.getCurrent();
- if (environment!=null) {
- HistorySession historySession = environment.get(HistorySession.class);
- if (historySession!=null) {
- historyEvent.setExecution(this);
- historySession.process(historyEvent);
- }
- }
- }
-
// overriding the ScopeInstanceImpl methods /////////////////////////////////
public ScopeInstanceImpl getParentVariableScope() {
@@ -1143,23 +1061,23 @@
// history //////////////////////////////////////////////////////////////////
public void historyAutomatic() {
- fireHistoryEvent(new AutomaticEnd());
+ HistoryEvent.fire(new AutomaticEnd(), this);
}
public void historyDecision(String transitionName) {
- fireHistoryEvent(new DecisionEnd(transitionName));
+ HistoryEvent.fire(new DecisionEnd(transitionName), this);
}
public void historyActivityStart() {
- fireHistoryEvent(new ActivityStart());
+ HistoryEvent.fire(new ActivityStart(), this);
}
public void historyActivityEnd() {
- fireHistoryEvent(new ActivityEnd());
+ HistoryEvent.fire(new ActivityEnd(), this);
}
public void historyActivityEnd(String transitionName) {
- fireHistoryEvent(new ActivityEnd(transitionName));
+ HistoryEvent.fire(new ActivityEnd(transitionName), this);
}
// equals ///////////////////////////////////////////////////////////////////
@@ -1233,10 +1151,6 @@
return false;
}
- public List<Comment> getComments() {
- return new ArrayList<Comment>(comments);
- }
-
public boolean isProcessInstance() {
return parent==null;
}
@@ -1282,9 +1196,6 @@
public void setProcessInstance(ExecutionImpl processInstance) {
this.processInstance = processInstance;
}
- public void setComments(Set<CommentImpl> comments) {
- this.comments = comments;
- }
public String getKey() {
return key;
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -86,7 +86,7 @@
variables.put(variable.getKey(), variable);
hasVariables = true;
- // TODO add create-variable-log
+ // TODO add createTime-variable-log
}
protected Variable createVariableObject(String key, Object value, String typeName) {
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryProcessInstanceQueryImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryProcessInstanceQueryImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryProcessInstanceQueryImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -26,7 +26,6 @@
import org.hibernate.Query;
import org.jbpm.api.history.HistoryProcessInstance;
import org.jbpm.api.history.HistoryProcessInstanceQuery;
-import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
/**
@@ -48,7 +47,7 @@
hql.append(" as hpi ");
if (processInstanceId!=null) {
- appendWhereClause(" hpi.id = '"+processInstanceId+"' ", hql);
+ appendWhereClause(" hpi.processInstanceId = '"+processInstanceId+"' ", hql);
}
if (processDefinitionId!=null) {
Copied: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryTaskQueryImpl.java (from rev 5254, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryTaskQueryImpl.java)
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryTaskQueryImpl.java (rev 0)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryTaskQueryImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -0,0 +1,179 @@
+/*
+ * 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.query;
+
+import java.util.Date;
+import java.util.List;
+
+import org.hibernate.Query;
+import org.jbpm.api.history.HistoryTask;
+import org.jbpm.api.history.HistoryTaskQuery;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryTaskQueryImpl extends AbstractQuery implements HistoryTaskQuery {
+
+ protected String taskId;
+ protected String executionId;
+ protected String assignee;
+ protected String state;
+ protected String outcome;
+ protected Long tookLessThen;
+ protected Long tookLongerThen;
+ protected Date startedBefore;
+ protected Date startedAfter;
+
+ public String hql() {
+ StringBuilder hql = new StringBuilder();
+ hql.append("select ht ");
+ hql.append("from ");
+ hql.append(HistoryTaskImpl.class.getName());
+ hql.append(" as ht ");
+
+ if (taskId!=null) {
+ appendWhereClause(" ht.dbid = "+taskId+" ", hql);
+ }
+
+ if (executionId!=null) {
+ appendWhereClause(" ht.executionId = '"+executionId+"' ", hql);
+ }
+
+ if (assignee!=null) {
+ appendWhereClause(" ht.assignee = '"+assignee+"' ", hql);
+ }
+
+ if (state!=null) {
+ appendWhereClause(" ht.state = '"+state+"' ", hql);
+ }
+
+ if (outcome!=null) {
+ appendWhereClause(" ht.outcome = '"+outcome+"' ", hql);
+ }
+
+ if (tookLessThen!=null) {
+ appendWhereClause(" ht.duration < :tookLessThen ", hql);
+ }
+
+ if (tookLongerThen!=null) {
+ appendWhereClause(" ht.duration > :tookLongerThen ", hql);
+ }
+
+ if (startedBefore!=null) {
+ appendWhereClause(" ht.startTime < :startedBefore ", hql);
+ }
+
+ if (startedAfter!=null) {
+ appendWhereClause(" ht.startTime > :startedAfter ", hql);
+ }
+
+ return hql.toString();
+ }
+
+ protected void applyParameters(Query query) {
+ if (tookLessThen!=null) {
+ query.setLong("tookLessThen", tookLessThen);
+ }
+
+ if (tookLongerThen!=null) {
+ query.setLong("tookLongerThen", tookLongerThen);
+ }
+
+ if (startedBefore!=null) {
+ query.setTime("startedBefore", startedBefore);
+ }
+
+ if (startedAfter!=null) {
+ query.setTime("startedAfter", startedAfter);
+ }
+ }
+
+ public List<HistoryTask> list() {
+ return (List) untypedList();
+ }
+
+ public HistoryTask uniqueResult() {
+ return (HistoryTask) untypedUniqueResult();
+ }
+
+ public HistoryTaskQuery taskId(String taskId) {
+ this.taskId = taskId;
+ return this;
+ }
+
+ public HistoryTaskQuery executionId(String executionId) {
+ this.executionId = executionId;
+ return this;
+ }
+
+ public HistoryTaskQuery assignee(String assignee) {
+ this.assignee = assignee;
+ return this;
+ }
+
+ public HistoryTaskQuery state(String state) {
+ this.state = state;
+ return this;
+ }
+
+ public HistoryTaskQuery outcome(String outcome) {
+ this.outcome = outcome;
+ return this;
+ }
+
+ public HistoryTaskQuery orderAsc(String property) {
+ addOrderByClause("ht."+property+" asc");
+ return this;
+ }
+
+ public HistoryTaskQuery orderDesc(String property) {
+ addOrderByClause("ht."+property+" desc");
+ return this;
+ }
+
+ public HistoryTaskQuery page(int firstResult, int maxResults) {
+ this.page = new Page(firstResult, maxResults);
+ return this;
+ }
+
+ public HistoryTaskQuery startedAfter(Date time) {
+ this.startedAfter = time;
+ return this;
+ }
+
+ public HistoryTaskQuery startedBefore(Date time) {
+ this.startedBefore = time;
+ return this;
+ }
+
+ public HistoryTaskQuery tookLessThen(long durationInMillis) {
+ this.tookLessThen = durationInMillis;
+ return this;
+ }
+
+ public HistoryTaskQuery tookLongerThen(long durationInMillis) {
+ this.tookLongerThen = durationInMillis;
+ return this;
+ }
+}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -27,6 +27,7 @@
import org.jbpm.api.task.Task;
import org.jbpm.pvm.internal.client.ClientExecution;
import org.jbpm.pvm.internal.client.ClientProcessDefinition;
+import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
@@ -43,6 +44,8 @@
public interface DbSession {
void save(Object entity);
+ void update(Object entity);
+
<T> T get(Class<T> entityClass, Object primaryKey);
void delete(Object entity);
void flush();
@@ -90,12 +93,8 @@
/** the process instance uniquely identified by the given executionKey. */
ClientExecution findProcessInstanceById(String processInstanceId);
- /* find ids for all process instances for a given process definition. */
List<String> findProcessInstanceIds(String processDefinitionId);
-
- /** delete the process instance including the history. */
- void deleteProcessInstance(String processInstanceId);
-
+
/** deletes the history information for all process instances for
* the given process definition */
void deleteProcessDefinitionHistory(String processDefinitionId);
@@ -111,8 +110,6 @@
Task createTask();
- void saveTask(Task task);
-
Task findTaskByExecution(Execution execution);
// job methods //////////////////////////////////////////////////////////////
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/TimerSession.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/TimerSession.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/TimerSession.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -36,9 +36,9 @@
* @param timerImpl
* the timer to be executed.
* @throws IllegalArgumentException
- * if the timer is null or if its activity is null or if its dueDate
- * is null or if its dueDate is negative or if its dueDate is past
- * or if its dueDate is equals to Long.MAX_VALUE
+ * if the timer is null or if its activity is null or if its duedate
+ * is null or if its duedate is negative or if its duedate is past
+ * or if its duedate is equals to Long.MAX_VALUE
*/
void schedule(Timer timer);
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -119,6 +119,10 @@
public void deleteProcessInstance(String processInstanceId) {
commandService.execute(new DeleteProcessInstance(processInstanceId));
}
+
+ public void deleteProcessInstanceCascade(String processInstanceId) {
+ commandService.execute(new DeleteProcessInstance(processInstanceId, true));
+ }
public Object getVariable(String executionId, String variableName) {
Set<String> variableNames = new HashSet<String>();
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/HistoryServiceImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -26,12 +26,15 @@
import org.jbpm.api.HistoryService;
import org.jbpm.api.history.HistoryActivityInstanceQuery;
import org.jbpm.api.history.HistoryProcessInstanceQuery;
+import org.jbpm.api.history.HistoryTaskQuery;
import org.jbpm.pvm.internal.cmd.CreateHistoryActivityInstanceQueryCmd;
import org.jbpm.pvm.internal.cmd.CreateHistoryProcessInstanceQueryCmd;
+import org.jbpm.pvm.internal.cmd.CreateHistoryTaskQueryCmd;
import org.jbpm.pvm.internal.query.AvgDurationPerActivityQueryCmd;
import org.jbpm.pvm.internal.query.ChoiceDistributionQueryCmd;
import org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl;
import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
+import org.jbpm.pvm.internal.query.HistoryTaskQueryImpl;
/**
@@ -58,4 +61,10 @@
query.setCommandService(commandService);
return query;
}
+
+ public HistoryTaskQuery createHistoryTaskQuery() {
+ HistoryTaskQueryImpl query = commandService.execute(new CreateHistoryTaskQueryCmd());
+ query.setCommandService(commandService);
+ return query;
+ }
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -28,7 +28,7 @@
import org.jbpm.api.TaskQuery;
import org.jbpm.api.TaskService;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.task.Participation;
import org.jbpm.api.task.Task;
import org.jbpm.pvm.internal.cmd.AddParticipationCmd;
@@ -78,6 +78,10 @@
public void deleteTask(String taskId, String reason) {
commandService.execute(new DeleteTaskCmd(taskId, reason));
}
+
+ public void deleteTaskCascade(String taskId) {
+ commandService.execute(new DeleteTaskCmd(taskId, true));
+ }
public void completeTask(String taskId) {
completeTask(taskId, null);
@@ -136,11 +140,11 @@
return commandService.execute(new NewTaskCmd(parentTaskId));
}
- public Comment addTaskComment(String taskId, String message) {
+ public HistoryComment addTaskComment(String taskId, String message) {
return commandService.execute(new AddTaskCommentCmd(taskId, message));
}
- public List<Comment> getTaskComments(String taskId) {
+ public List<HistoryComment> getTaskComments(String taskId) {
return commandService.execute(new GetTaskCommentsCmd(taskId));
}
@@ -148,7 +152,7 @@
commandService.execute(new DeleteCommentCmd(commentId));
}
- public Comment addReplyComment(String commentId, String message) {
+ public HistoryComment addReplyComment(String commentId, String message) {
return commandService.execute(new AddReplyCommentCmd(commentId, message));
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -39,7 +39,6 @@
protected List<TaskDefinitionImpl> subTaskDefinitions = new ArrayList<TaskDefinitionImpl>();
protected int priority = Priority.NORMAL;
protected SwimlaneDefinitionImpl swimlaneDefinition;
- protected TaskHandler taskHandler;
public int getPriority() {
return priority;
@@ -71,10 +70,4 @@
public void setFormResourceName(String form) {
this.formResourceName = form;
}
- public TaskHandler getTaskHandler() {
- return taskHandler;
- }
- public void setTaskHandler(TaskHandler taskHandler) {
- this.taskHandler = taskHandler;
- }
}
Deleted: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskHandler.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskHandler.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskHandler.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -1,91 +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.task;
-
-import java.io.Serializable;
-
-import org.jbpm.pvm.internal.client.ClientExecution;
-
-/** for advanced task customization.
- *
- * The default implementation can be found in {@link DefaultTaskHandler}.
- *
- * @author Tom Baeyens
- */
-public class TaskHandler implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /** called after the task is created according
- * to the task definition. This method allows to
- * create subtasks.
- * @return indicates if the process execution should wait. */
- public boolean executionCreateTask(TaskImpl task) {
- task.historyTaskStart();
- return true;
- }
-
- /** called when the related execution gets a
- * signal. this method must either
- * {@link OpenTask#setSignalling(boolean) remove signalling} from this task
- * or {@link OpenTask#delete(String) cancel} it. */
- public void executionSignal(TaskImpl task) {
- task.setSignalling(false);
- }
-
- /** called when the given task is assigned to an actor. */
- public void taskAssign(TaskImpl task, String assignee) {
- task.historyTaskAssign(assignee);
- }
-
- /** called when the given task is cancelled. */
- public void taskDelete(TaskImpl task, String reason) {
- task.historyTaskDelete(reason);
-// TODO if task is deleted, the related execution should be
-// suspended. But in the API and console, there is no
-// way yet to resume individual instances.
-// if (task.getExecution()!=null) {
-// task.getExecution().suspend();
-// }
- }
-
- /** called when the given task completes. The default behaviour
- * will send a signal to the execution if this task is still signalling. */
- public void taskComplete(TaskImpl task, String outcome) {
- task.historyTaskComplete(outcome);
-
- if (task.isSignalling()) {
- ClientExecution execution = (ClientExecution) task.getExecution();
- execution.signal(outcome);
- }
- }
-
- /** is called when a subtask completes. this can be used to
- * prematurely signal the execution. e.g. for "5 out of 7" scenarios.*/
- public void taskSubTaskComplete(TaskImpl task, OpenTask subTask, String outcome) {
- }
-
- /** is called when a variable is updated. This can be used to
- * propagate the execution based on availability of variables. */
- public void taskVariableUpdate(TaskImpl task, String key, Object value) {
- }
-}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -22,27 +22,23 @@
package org.jbpm.pvm.internal.task;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
-import org.jbpm.api.model.Comment;
import org.jbpm.api.model.Event;
import org.jbpm.api.task.Assignable;
import org.jbpm.api.task.Participation;
import org.jbpm.api.task.Swimlane;
import org.jbpm.api.task.Task;
+import org.jbpm.pvm.internal.client.ClientExecution;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.history.events.TaskAssign;
-import org.jbpm.pvm.internal.history.events.TaskDelete;
+import org.jbpm.pvm.internal.history.HistoryEvent;
import org.jbpm.pvm.internal.history.events.TaskComplete;
-import org.jbpm.pvm.internal.history.events.TaskStart;
-import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.history.events.TaskDelete;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
@@ -60,8 +56,7 @@
// private static Log log = Log.getLog(TaskImpl.class.getName());
- private static final TaskHandler DEFAULT_TASK_HANDLER = new TaskHandler();
-
+ protected boolean isNew;
protected String name;
protected String description;
@@ -69,14 +64,11 @@
protected Set<ParticipationImpl> participations = new HashSet<ParticipationImpl>();
protected String formResourceName;
- protected Date create;
- protected Date dueDate;
+ protected Date createTime;
+ protected Date duedate;
protected Integer progress;
protected boolean isSignalling;
- // protected VariableMap variableMap;
- protected List<CommentImpl> comments = new ArrayList<CommentImpl>();
-
protected int priority = Priority.NORMAL;
protected String state = Task.STATE_OPEN;
@@ -130,7 +122,6 @@
}
if (execution != null) {
execution.fire(Event.ASSIGN, execution.getActivity());
- getTaskHandler().taskAssign(this, assignee);
}
}
@@ -192,18 +183,23 @@
}
public void complete(String outcome) {
- getTaskHandler().taskComplete(this, outcome);
+ historyTaskComplete(outcome);
+
+ if (isSignalling()) {
+ ClientExecution execution = (ClientExecution) getExecution();
+ execution.signal(outcome);
+ }
+
if (superTask != null) {
superTask.subTaskComplete(this, outcome);
}
}
protected void subTaskComplete(TaskImpl subTask, String outcome) {
- getTaskHandler().taskSubTaskComplete(this, subTask, outcome);
}
public void delete(String reason) {
- getTaskHandler().taskDelete(this, reason);
+ historyTaskDelete(reason);
}
// state ////////////////////////////////////////////////////////////////////
@@ -218,34 +214,6 @@
return true;
}
- // variables ////////////////////////////////////////////////////////////////
-
- public void setVariable(String key, Object value) {
- super.setVariable(key, value);
- getTaskHandler().taskVariableUpdate(this, key, value);
- }
-
- // comments /////////////////////////////////////////////////////////////////
-
- public List<Comment> getComments() {
- return (List) comments;
- }
-
- public Comment createComment(String commentText) {
- CommentImpl comment = new CommentImpl(commentText);
- comments.add(comment);
- return comment;
- }
-
- public void removeComment(Comment comment) {
- if (comment == null) {
- throw new JbpmException("comment is null");
- }
- if (comments.contains(comment)) {
- comments.remove(comment);
- }
- }
-
// subtasks /////////////////////////////////////////////////////////////////
public Set<Task> getSubTasks() {
@@ -322,27 +290,15 @@
}
}
- public void historyTaskStart() {
- if (execution != null) {
- execution.fireHistoryEvent(new TaskStart(this));
- }
- }
-
- public void historyTaskAssign(String assignee) {
- if (execution != null) {
- execution.fireHistoryEvent(new TaskAssign(this, assignee));
- }
- }
-
public void historyTaskDelete(String reason) {
if (execution != null) {
- execution.fireHistoryEvent(new TaskDelete(reason));
+ HistoryEvent.fire(new TaskDelete(this, reason), execution);
}
}
public void historyTaskComplete(String outcome) {
if (execution != null) {
- execution.fireHistoryEvent(new TaskComplete(outcome));
+ HistoryEvent.fire(new TaskComplete(outcome), execution);
}
}
@@ -352,15 +308,6 @@
}
}
- public TaskHandler getTaskHandler() {
- if ((getTaskDefinition() == null) || (taskDefinition.getTaskHandler() == null)) {
- return DEFAULT_TASK_HANDLER;
- }
-
- TaskHandler taskHandler = taskDefinition.getTaskHandler();
- return taskHandler;
- }
-
// special getters and setters //////////////////////////////////////////////
public TaskDefinitionImpl getTaskDefinition() {
@@ -415,26 +362,22 @@
this.priority = priority;
}
- public void setComments(List<CommentImpl> comments) {
- this.comments = comments;
+ public Date getCreateTime() {
+ return createTime;
}
- public Date getCreate() {
- return create;
+ public void setCreateTime(Date create) {
+ this.createTime = create;
}
- public void setCreate(Date create) {
- this.create = create;
+ public Date getDuedate() {
+ return duedate;
}
- public Date getDueDate() {
- return dueDate;
+ public void setDuedate(Date duedate) {
+ this.duedate = duedate;
}
- public void setDueDate(Date dueDate) {
- this.dueDate = dueDate;
- }
-
public ExecutionImpl getExecution() {
return execution;
}
@@ -534,6 +477,10 @@
public void setFormResourceName(String form) {
this.formResourceName = form;
}
-
-
+ public boolean isNew() {
+ return isNew;
+ }
+ public void setNew(boolean isNew) {
+ this.isNew = isNew;
+ }
}
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/test/JobTestHelper.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/test/JobTestHelper.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/test/JobTestHelper.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -35,7 +35,7 @@
/** helper class for testing that executes messages and timers
* in the test runner thread. This way, the test can simulate
- * timers and messages being executed. The dueDate is ignored.
+ * timers and messages being executed. The duedate is ignored.
*
* @author Tom Baeyens
*/
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireContext.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -239,9 +239,9 @@
/**
* allows for postponing the creation of this wire context.
- * @param delayCreate specifies if creation should be postponed till {@link #create()} is called explicitly.
+ * @param delayCreate specifies if creation should be postponed till {@link #createTime()} is called explicitly.
* If delayCreate is set to false, creation is done as part of the constructor. If delayCreate is
- * set to true, the {@link #create()} method needs to be called explicitly by the client after
+ * set to true, the {@link #createTime()} method needs to be called explicitly by the client after
* construction is complete. The use case is creation of environment where the transactionName needs to be
* set and the scope needs to be added to the environment before the creation of this wire scope is done.
* @see JbpmConfiguration#openEnvironment()
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -26,7 +26,7 @@
* <p>This {@link Descriptor} creates and initializes an object.
* Objects can be instantiated from a constructor or from a method invocation.</p>
*
- * <p>The way to create an object is specified one of these methods (see <a href='#create'>creating objects</a>):
+ * <p>The way to create an object is specified one of these methods (see <a href='#createTime'>creating objects</a>):
* <ul>
* <li>className ({@link #setClassName(String)})</li>
* <li>factoryObjectName ({@link #setFactoryObjectName(String)})</li>
@@ -35,7 +35,7 @@
* Only one of these methods can be used.
* </p>
*
- * <h3 id='create'>Creating objects</h3>
+ * <h3 id='createTime'>Creating objects</h3>
* <h4>Creating object from a constructor</h4>
*
* <p>This method is used when <code>{@link #getClassName()}!=null && {@link #getMethodName()}==null</code>.</p>
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-07-07 20:01:12 UTC (rev 5256)
@@ -103,27 +103,6 @@
</class>
- <!-- ### COMMENTS ####################################################### -->
- <class name="CommentImpl" table="JBPM4_COMMENT">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <discriminator column="CLASS_" />
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="userId" column="USERID_" />
- <property name="time" column="TIME_" />
- <property name="message" column="MESSAGE_" type="text" />
-
- <list name="comments"
- cascade="all-delete-orphan"
- inverse="false">
- <key column="PARENT_" foreign-key="none" />
- <list-index column="PARENT_IDX_" />
- <one-to-many class="CommentImpl" />
- </list>
- </class>
-
<!-- ### VARIABLE ####################################################### -->
<class name="org.jbpm.pvm.internal.type.Variable" abstract="true" discriminator-value=" " table="JBPM4_VARIABLE">
<!-- discriminator values:
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.history.hbm.xml 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.history.hbm.xml 2009-07-07 20:01:12 UTC (rev 5256)
@@ -5,11 +5,12 @@
<!-- ### HISTORY PROCESS INSTANCE ####################################### -->
<class name="HistoryProcessInstanceImpl" table="JBPM4_HIST_PROCINST">
- <id name="processInstanceId" column="ID_">
+ <id name="dbid" column="DBID_">
<generator class="assigned" />
</id>
<version name="dbversion" column="DBVERSION_" />
+ <property name="processInstanceId" column="ID_" />
<property name="processDefinitionId" column="PROCDEFID_" />
<property name="key" column="KEY_" />
<property name="startTime" column="START_" type="timestamp" />
@@ -34,8 +35,8 @@
</class>
- <!-- ### HISTORY PROCESS INSTANCE ####################################### -->
- <class name="HistoryActivityInstanceImpl" table="JBPM4_HIST_ACTINST" discriminator-value="ACT">
+ <!-- ### HISTORY ACTIVITY INSTANCE ####################################### -->
+ <class name="HistoryActivityInstanceImpl" table="JBPM4_HIST_ACTINST" discriminator-value="act">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -62,14 +63,73 @@
<property name="duration" column="DURATION_" />
<property name="transitionName" column="TRANSITION_" />
- <subclass name="HistoryAutomaticInstanceImpl" discriminator-value="AUT">
- <subclass name="HistoryDecisionInstanceImpl" discriminator-value="EXCL" />
+ <subclass name="HistoryAutomaticInstanceImpl" discriminator-value="aut">
+ <subclass name="HistoryDecisionInstanceImpl" discriminator-value="excl" />
</subclass>
- <subclass name="HistoryTaskInstanceImpl" discriminator-value="TASK">
- <property name="assignee" column="ASSIGNEE_" />
- <property name="state" column="STATE_" />
+ <subclass name="HistoryTaskInstanceImpl" discriminator-value="task">
+ <many-to-one name="historyTask"
+ class="HistoryTaskImpl"
+ column="HTASK_"
+ cascade="all"
+ foreign-key="FK_HTI_HTASK"
+ index="IDX_HTI_HTASK" />
</subclass>
</class>
+
+ <!-- ### HISTORY TASK ################################################# -->
+ <class name="HistoryTaskImpl" table="JBPM4_HIST_TASK">
+ <id name="dbid" column="DBID_">
+ <generator class="assigned" />
+ </id>
+ <version name="dbversion" column="DBVERSION_" />
+ <!-- many-to-one name="historyTaskInstance"
+ class="HistoryTaskInstanceImpl"
+ column="HTI_"
+ foreign-key="none"
+ index="IDX_HTASK_HTI" / -->
+
+ <property name="executionId" column="EXECUTION_" />
+ <property name="outcome" column="OUTCOME_" />
+ <property name="assignee" column="ASSIGNEE_" />
+ <property name="state" column="STATE_" />
+ <property name="createTime" column="CREATE_" type="timestamp" />
+ <property name="endTime" column="END_" type="timestamp" />
+ <property name="duration" column="DURATION_" />
+
+ <list name="comments" cascade="all-delete-orphan">
+ <key column="HTASK_" />
+ <list-index column="HTASK_IDX_" />
+ <one-to-many class="HistoryCommentImpl" />
+ </list>
+
+ <set name="subTasks" cascade="all-delete-orphan">
+ <key column="SUPERTASK_" />
+ <one-to-many class="HistoryTaskImpl" />
+ </set>
+
+ </class>
+
+ <!-- ### HISTORY COMMENTS ################################################# -->
+ <class name="HistoryCommentImpl" table="JBPM4_HIST_COMMENT">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <discriminator column="CLASS_" />
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="userId" column="USERID_" />
+ <property name="time" column="TIME_" />
+ <property name="message" column="MESSAGE_" type="text" />
+
+ <list name="comments"
+ cascade="all-delete-orphan"
+ inverse="false">
+ <key column="PARENT_" foreign-key="none" />
+ <list-index column="PARENT_IDX_" />
+ <one-to-many class="HistoryCommentImpl" />
+ </list>
+ </class>
+
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.task.hbm.xml 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/main/resources/jbpm.task.hbm.xml 2009-07-07 20:01:12 UTC (rev 5256)
@@ -27,8 +27,8 @@
</set>
<property name="priority" column="PRIORITY_"/>
- <property name="create" column="CREATE_"/>
- <property name="dueDate" column="DUEDATE_"/>
+ <property name="createTime" column="CREATE_"/>
+ <property name="duedate" column="DUEDATE_"/>
<property name="progress" column="PROGRESS_"/>
<property name="isSignalling" column="SIGNALLING_"/>
@@ -68,12 +68,6 @@
<property name="taskDefinitionName" column="TASKDEFNAME_"/>
- <list name="comments" cascade="all-delete-orphan">
- <key column="TASK_" />
- <list-index column="TASK_IDX_" />
- <one-to-many class="org.jbpm.pvm.internal.model.CommentImpl" />
- </list>
-
<set name="subTasks" cascade="all-delete-orphan">
<key column="SUPERTASK_" />
<one-to-many class="TaskImpl" />
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/AutoWireTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/AutoWireTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/AutoWireTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -38,7 +38,7 @@
public static class PieceOfCake {
- // auto-wire means that when an object like this is create,
+ // auto-wire means that when an object like this is createTime,
// that the WireScope will try to look for objects with
// the same name as the fields in the class. If it finds
// an object with that name, and if it is assignable to the
Modified: jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/pvm/src/test/java/org/jbpm/pvm/tx/BasicTransactionTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -31,7 +31,7 @@
import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.env.Transaction;
-import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.type.variable.StringVariable;
import org.jbpm.test.JbpmTestCase;
@@ -51,7 +51,7 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- session.save(new CommentImpl("if i only had the time to write code"));
+ session.save(new HistoryCommentImpl("if i only had the time to write code"));
return null;
}
});
@@ -59,7 +59,7 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
+ List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
assertEquals("if i only had the time to write code", comments.get(0).getMessage());
session.delete(comments.get(0));
return null;
@@ -76,7 +76,7 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- session.save(new CommentImpl("if i only had the time to write code"));
+ session.save(new HistoryCommentImpl("if i only had the time to write code"));
throw new MyOwnRuntimeException();
}
});
@@ -89,7 +89,7 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
+ List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
assertEquals(0, comments.size());
return null;
}
@@ -105,7 +105,7 @@
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- session.save(new CommentImpl("if i only had the time to write code"));
+ session.save(new HistoryCommentImpl("if i only had the time to write code"));
throw new MyOwnCheckedException();
}
});
@@ -119,7 +119,7 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
+ List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
assertEquals(0, comments.size());
return null;
}
@@ -144,7 +144,7 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- session.save(new CommentImpl("if i only had the time to write code"));
+ session.save(new HistoryCommentImpl("if i only had the time to write code"));
Transaction transaction = environment.get(Transaction.class);
SuccessfulSynchronization successfulSynchronization = new SuccessfulSynchronization();
transaction.registerSynchronization(successfulSynchronization);
@@ -155,7 +155,7 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
+ List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
assertEquals("if i only had the time to write code", comments.get(0).getMessage());
session.delete(comments.get(0));
List<StringVariable> stringVariables = session.createQuery("from " + StringVariable.class.getName()).list();
@@ -187,7 +187,7 @@
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- session.save(new CommentImpl("if i only had the time to write code"));
+ session.save(new HistoryCommentImpl("if i only had the time to write code"));
Transaction transaction = environment.get(Transaction.class);
UnsuccessfulSynchronization unsuccessfulSynchronization = new UnsuccessfulSynchronization();
transaction.registerSynchronization(unsuccessfulSynchronization);
@@ -207,7 +207,7 @@
public Object execute(Environment environment) {
Session session = environment.get(Session.class);
- List<CommentImpl> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
+ List<HistoryCommentImpl> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
assertEquals(0, comments.size());
List<StringVariable> stringVariables = session.createQuery("from " + StringVariable.class.getName()).list();
assertEquals(0, stringVariables.size());
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/eventlistener/HqlEventListenerTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/eventlistener/HqlEventListenerTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/eventlistener/HqlEventListenerTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -35,9 +35,9 @@
}
protected void tearDown() throws Exception {
- taskService.deleteTask(taskLaundryId);
- taskService.deleteTask(taskDishesId);
- taskService.deleteTask(taskIronId);
+ taskService.deleteTaskCascade(taskLaundryId);
+ taskService.deleteTaskCascade(taskDishesId);
+ taskService.deleteTaskCascade(taskIronId);
super.tearDown();
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/SubTaskTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -34,7 +34,7 @@
*/
public class SubTaskTest extends JbpmTestCase {
- public void testTaskParticipants() {
+ public void testSubTasks() {
// create top level task
// * clean da house
@@ -116,7 +116,7 @@
assertEquals(expectedTaskNames, subTaskNames);
// delete task dishes
- taskService.deleteTask(dishesTaskId);
+ taskService.deleteTaskCascade(dishesTaskId);
// verify all the sub tasks of 'clean da house' and 'sweep floor'
@@ -139,8 +139,8 @@
// delete laundry and delete sweep floor
// NOTE: deleting sweep floor should recursively delete the subtasks
- taskService.deleteTask(laundryTaskId);
- taskService.deleteTask(sweepFloorTaskId);
+ taskService.deleteTaskCascade(laundryTaskId);
+ taskService.deleteTaskCascade(sweepFloorTaskId);
subTaskNames = getTaskNames(taskService.getSubTasks(taskId));
@@ -152,7 +152,7 @@
expectedTaskNames = new HashSet<String>();
assertEquals(expectedTaskNames, subTaskNames);
- taskService.deleteTask(taskId);
+ taskService.deleteTaskCascade(taskId);
}
private Set<String> getTaskNames(List<Task> tasks) {
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -23,7 +23,7 @@
import java.util.List;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -42,7 +42,7 @@
// - what! you had a party while i was out ?!
// - euh yes. it was a great party :-)
// i'll clean up the mess
- Comment comment = taskService.addTaskComment(taskId, "what a party yesterday");
+ HistoryComment comment = taskService.addTaskComment(taskId, "what a party yesterday");
String whatAPartyId = comment.getId();
comment = taskService.addReplyComment(whatAPartyId, "what! you had a party while i was out ?!");
String youHadAPartyId = comment.getId();
@@ -50,7 +50,7 @@
taskService.addTaskComment(taskId, "i'll clean up the mess");
- List<Comment> taskComments = taskService.getTaskComments(taskId);
+ List<HistoryComment> taskComments = taskService.getTaskComments(taskId);
assertEquals("what a party yesterday", taskComments.get(0).getMessage());
assertEquals("i'll clean up the mess", taskComments.get(1).getMessage());
@@ -65,13 +65,12 @@
taskComments = taskService.getTaskComments(taskId);
assertEquals("i'll clean up the mess", taskComments.get(0).getMessage());
- // the following should delete the remaining comment. if not, this
- // will show up as a fixme.
- taskService.deleteTask(taskId);
+ // the following should delete the remaining comment. if not, this will show up as a fixme.
+ taskService.deleteTaskCascade(taskId);
}
-
+
public void testGetTaskCommentsWithUnexistingTaskId() {
- List<Comment> comments = taskService.getTaskComments("-1234");
+ List<HistoryComment> comments = taskService.getTaskComments("-1234");
assertTrue(comments.isEmpty());
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskCreateUpdateDeleteTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -47,16 +47,16 @@
assertNotNull("expected non-null task", task);
// make some change
Date dueDate = new Date();
- task.setDueDate(dueDate);
+ task.setDuedate(dueDate);
taskService.saveTask(task);
// verify change is applied
task = taskService.getTask(taskId);
// task.getDueDate() return an java.sql.Timestamp
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
- assertEquals(df.format(dueDate), df.format(task.getDueDate()));
+ assertEquals(df.format(dueDate), df.format(task.getDuedate()));
- taskService.deleteTask(taskId);
+ taskService.deleteTaskCascade(taskId);
}
public void testDeleteTask() {
@@ -66,7 +66,7 @@
// task was made persistent
assertNotNull("expected non-null task", taskService.getTask(taskId));
// delete task and verify it does not exist
- taskService.deleteTask(taskId);
+ taskService.deleteTaskCascade(taskId);
task = taskService.getTask(taskId);
assertNull("expected null, but was " + task, task);
}
Deleted: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -1,151 +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.task;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.task.Task;
-import org.jbpm.pvm.internal.task.OpenTask;
-import org.jbpm.pvm.internal.task.TaskHandler;
-import org.jbpm.pvm.internal.task.TaskImpl;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class TaskHandlerTest extends JbpmTestCase {
-
- public static class ReviewHandler extends TaskHandler {
- private static final long serialVersionUID = 1L;
- public boolean executionCreateTask(TaskImpl task) {
- task.getExecution().setVariable("isExecutionCreateTaskCalled", "true");
- return super.executionCreateTask(task);
- }
-
- public void executionSignal(TaskImpl task) {
- task.getExecution().setVariable("isExecutionSignalledCalled", "true");
- super.executionSignal(task);
- }
-
- public void taskDelete(TaskImpl task, String reason) {
- task.getExecution().setVariable("isTaskCancelCalled", "true");
- super.taskDelete(task, reason);
- }
-
- public void taskComplete(TaskImpl task, String outcome) {
- task.getExecution().setVariable("isTaskCompleteCalled", "true");
- super.taskComplete(task, outcome);
- }
-
- public void taskSubTaskComplete(TaskImpl task, OpenTask subTask, String outcome) {
- task.getExecution().setVariable("isSubTaskCompleteCalled", "true");
- super.taskSubTaskComplete(task, subTask, outcome);
- }
-
- public void taskVariableUpdate(TaskImpl task, String key, Object value) {
- task.getExecution().setVariable("isTaskVariableUpdateCalled", "true");
- super.taskVariableUpdate(task, key, value);
- }
- }
-
- public void testTaskHandlerBasicScenario() {
- deployJpdlXmlString(
- "<process name='TaskHandler'>" +
- " <start>" +
- " <transition to='review' />" +
- " </start>" +
- " <task name='review'>" +
- " <task-handler class='"+ReviewHandler.class.getName()+"' />" +
- " <transition to='wait' />" +
- " </task>" +
- " <state name='wait'/>" +
- "</process>"
- );
-
- String processInstanceId = executionService.startProcessInstanceByKey("TaskHandler").getId();
-
- assertEquals("true", executionService.getVariable(processInstanceId, "isExecutionCreateTaskCalled"));
-
- Task task = taskService.createTaskQuery().list().get(0);
-
- String taskId = task.getId();
- taskService.setVariable(taskId, "checked", "true");
-
- assertEquals("true", executionService.getVariable(processInstanceId, "isExecutionCreateTaskCalled"));
-
- Task subTask = taskService.newTask(taskId);
- String subTaskId = taskService.saveTask(subTask);
- taskService.completeTask(subTaskId);
-
- assertEquals("true", executionService.getVariable(processInstanceId, "isSubTaskCompleteCalled"));
-
- taskService.completeTask(taskId);
-
- assertEquals("true", executionService.getVariable(processInstanceId, "isTaskCompleteCalled"));
- }
-
- public void testTaskHandlerCancelScenario() {
- deployJpdlXmlString(
- "<process name='TaskHandler'>" +
- " <start>" +
- " <transition to='review' />" +
- " </start>" +
- " <task name='review'>" +
- " <task-handler class='"+ReviewHandler.class.getName()+"' />" +
- " <transition to='wait' />" +
- " </task>" +
- " <state name='wait'/>" +
- "</process>"
- );
-
- String processInstanceId = executionService.startProcessInstanceByKey("TaskHandler").getId();
-
- Task task = taskService.createTaskQuery().list().get(0);
- String taskId = task.getId();
-
- taskService.deleteTask(taskId);
-
- assertEquals("true", executionService.getVariable(processInstanceId, "isTaskCancelCalled"));
- }
-
- public void testTaskHandlerExecutionSignalScenario() {
- deployJpdlXmlString(
- "<process name='TaskHandler'>" +
- " <start>" +
- " <transition to='review' />" +
- " </start>" +
- " <task name='review'>" +
- " <task-handler class='"+ReviewHandler.class.getName()+"' />" +
- " <transition to='wait' />" +
- " </task>" +
- " <state name='wait'/>" +
- "</process>"
- );
-
- Execution execution = executionService.startProcessInstanceByKey("TaskHandler");
- String executionId = execution.getId();
-
- executionService.signalExecutionById(executionId);
-
- assertEquals("true", executionService.getVariable(executionId, "isExecutionSignalledCalled"));
- }
-}
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskListTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -68,10 +68,10 @@
assertEquals(3, taskList.size());
- taskService.deleteTask(startBusinessTaskId);
- taskService.deleteTask(capitalTaskId);
- taskService.deleteTask(ideaTaskId);
- taskService.deleteTask(laundryTaskId);
+ taskService.deleteTaskCascade(startBusinessTaskId);
+ taskService.deleteTaskCascade(capitalTaskId);
+ taskService.deleteTaskCascade(ideaTaskId);
+ taskService.deleteTaskCascade(laundryTaskId);
}
public void testPersonalTaskListDefaultSortOrder() {
@@ -117,10 +117,10 @@
assertEquals(5, taskList.size());
- taskService.deleteTask(profitTaskId);
- taskService.deleteTask(dayOffTaskId);
- taskService.deleteTask(startBusinessTaskId);
- taskService.deleteTask(capitalTaskId);
- taskService.deleteTask(ideaTaskId);
+ taskService.deleteTaskCascade(profitTaskId);
+ taskService.deleteTaskCascade(dayOffTaskId);
+ taskService.deleteTaskCascade(startBusinessTaskId);
+ taskService.deleteTaskCascade(capitalTaskId);
+ taskService.deleteTaskCascade(ideaTaskId);
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskParticipationsTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskParticipationsTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskParticipationsTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -93,7 +93,7 @@
assertEquals(expectedIds, candidateGroupIds);
- taskService.deleteTask(taskId);
+ taskService.deleteTaskCascade(taskId);
}
public Set<String> extractParticipatingUserIds(List<Participation> taskParticipations, String participationType) {
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryCandidatesTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryCandidatesTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryCandidatesTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -90,9 +90,9 @@
groupTasks = taskService.findGroupTasks("jackblack");
assertEquals(0, groupTasks.size());
- taskService.deleteTask(taskId);
- taskService.deleteTask(johnsOtherTaskId);
- taskService.deleteTask(joesOtherTaskId);
+ taskService.deleteTaskCascade(taskId);
+ taskService.deleteTaskCascade(johnsOtherTaskId);
+ taskService.deleteTaskCascade(joesOtherTaskId);
}
public void testGroupCandidate() {
@@ -123,8 +123,8 @@
groupTasks = taskService.findGroupTasks("jackblack");
assertEquals(0, groupTasks.size());
- taskService.deleteTask(taskId);
- taskService.deleteTask(johnsOtherTaskId);
- taskService.deleteTask(joesOtherTaskId);
+ taskService.deleteTaskCascade(taskId);
+ taskService.deleteTaskCascade(johnsOtherTaskId);
+ taskService.deleteTaskCascade(joesOtherTaskId);
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -69,10 +69,10 @@
assertEquals(4, taskList.size());
- taskService.deleteTask(capitalTaskId);
- taskService.deleteTask(startBusinessTaskId);
- taskService.deleteTask(dyperTaskId);
- taskService.deleteTask(laudryTaskId);
+ taskService.deleteTaskCascade(capitalTaskId);
+ taskService.deleteTaskCascade(startBusinessTaskId);
+ taskService.deleteTaskCascade(dyperTaskId);
+ taskService.deleteTaskCascade(laudryTaskId);
}
public void testSimplestTaskQuerySortBy() {
@@ -112,9 +112,9 @@
assertEquals(4, taskList.size());
- taskService.deleteTask(capitalTaskId);
- taskService.deleteTask(startBusinessTaskId);
- taskService.deleteTask(dyperTaskId);
- taskService.deleteTask(laudryTaskId);
+ taskService.deleteTaskCascade(capitalTaskId);
+ taskService.deleteTaskCascade(startBusinessTaskId);
+ taskService.deleteTaskCascade(dyperTaskId);
+ taskService.deleteTaskCascade(laudryTaskId);
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskVariablesTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskVariablesTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/task/TaskVariablesTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -41,6 +41,6 @@
assertEquals("hello", taskService.getVariable(taskId, "text"));
assertEquals(new Integer(5), taskService.getVariable(taskId, "number"));
- taskService.deleteTask(taskId);
+ taskService.deleteTaskCascade(taskId);
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-db/src/test/java/org/jbpm/test/taskactivity/TaskReassignTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -24,10 +24,9 @@
import java.util.List;
import org.jbpm.api.ProcessInstance;
-import org.jbpm.api.history.HistoryActivityInstance;
+import org.jbpm.api.history.HistoryTask;
import org.jbpm.api.task.Task;
import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.internal.history.model.HistoryTaskInstanceImpl;
import org.jbpm.test.JbpmTestCase;
/**
@@ -66,12 +65,12 @@
assertEquals("johndoe", taskService.getTask(taskId).getAssignee());
taskService.completeTask(taskId);
- List<HistoryActivityInstance> aiHistory = historyService
- .createHistoryActivityInstanceQuery()
- .executionId(pi.getId())
- .list();
- HistoryTaskInstanceImpl hai = (HistoryTaskInstanceImpl) aiHistory.get(0);
+
+ HistoryTask historyTask = historyService
+ .createHistoryTaskQuery()
+ .taskId(taskId)
+ .uniqueResult();
- assertEquals("John Doe completed the Task, but someone else got the credit", "johndoe", hai.getAssignee());
+ assertEquals("John Doe completed the Task, but someone else got the credit", "johndoe", historyTask.getAssignee());
}
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceMessageTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -26,12 +26,12 @@
import java.util.List;
import org.hibernate.Session;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.session.MessageSession;
@@ -70,9 +70,9 @@
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- List<Comment> comments = session.createQuery("from " + CommentImpl.class.getName()).list();
+ List<HistoryComment> comments = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
- for (Comment comment : comments) {
+ for (HistoryComment comment : comments) {
log.debug("retrieved message: "+comment.getMessage());
Integer messageId = new Integer(comment.getMessage());
assertTrue("message " + messageId + " committed twice", failOnceMessageIds.remove(messageId));
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailOnceTestCommand.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -21,13 +21,13 @@
*/
package org.jbpm.test.load.async;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -58,7 +58,7 @@
DbSession dbSession = environment.get(DbSession.class);
// this message execution should be rolled back
- Comment comment = new CommentImpl(Integer.toString(messageId));
+ HistoryComment comment = new HistoryCommentImpl(Integer.toString(messageId));
dbSession.save(comment);
if (!FailOnceMessageTest.failOnceMessageIds.contains(messageId)) {
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingMessageTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -28,8 +28,8 @@
import org.jbpm.api.job.Job;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.session.MessageSession;
@@ -65,7 +65,7 @@
throw new JbpmException("todo get the jobs with exception");
// Session session = environment.get(Session.class);
-// List commands = session.createQuery("from " + CommentImpl.class.getName()).list();
+// List commands = session.createQuery("from " + HistoryCommentImpl.class.getName()).list();
// assertTrue("command insertion should have been rolled back", commands.isEmpty());
// return null;
}
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/FailingTestCommand.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -21,11 +21,11 @@
*/
package org.jbpm.test.load.async;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.session.DbSession;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -41,7 +41,7 @@
DbSession dbSession = environment.get(DbSession.class);
// this message execution should be rolled back
- Comment comment = new CommentImpl("failing update");
+ HistoryComment comment = new HistoryCommentImpl("failing update");
dbSession.save(comment);
throw new RuntimeException("ooops");
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageCommand.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -26,8 +26,8 @@
import org.hibernate.Session;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
-import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
@@ -57,7 +57,7 @@
}
public Void execute(Environment environment) throws Exception {
- CommentImpl comment = new CommentImpl(Integer.toString(messageId));
+ HistoryCommentImpl comment = new HistoryCommentImpl(Integer.toString(messageId));
Session session = environment.get(Session.class);
session.save(comment);
return null;
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/async/NormalMessageTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -25,12 +25,12 @@
import java.util.List;
import org.hibernate.Session;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
-import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.session.MessageSession;
import org.jbpm.test.Db;
@@ -67,8 +67,8 @@
public List<Integer> execute(Environment environment) {
List<Integer> processedMessageNumbers = new ArrayList<Integer>();
Session session = environment.get(Session.class);
- List<Comment> comments = session.createCriteria(CommentImpl.class).list();
- for (Comment comment: comments) {
+ List<HistoryComment> comments = session.createCriteria(HistoryCommentImpl.class).list();
+ for (HistoryComment comment: comments) {
int processedMessageNumber = Integer.parseInt(comment.getMessage());
processedMessageNumbers.add(processedMessageNumber);
// make sure the db stays clean
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/AddCommentCmd.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -24,7 +24,7 @@
import org.hibernate.Session;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.env.Environment;
-import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
/**
* @author Tom Baeyens
@@ -36,7 +36,7 @@
protected String message;
public Void execute(Environment environment) throws Exception {
- CommentImpl comment = new CommentImpl(message);
+ HistoryCommentImpl comment = new HistoryCommentImpl(message);
Session session = environment.get(Session.class);
session.save(comment);
MessageProcessingTest.commentAdded();
Modified: jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java
===================================================================
--- jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/modules/test-load/src/test/java/org/jbpm/test/load/messages/MessageProcessingTest.java 2009-07-07 20:01:12 UTC (rev 5256)
@@ -25,15 +25,15 @@
import java.util.List;
import org.hibernate.Session;
-import org.jbpm.api.model.Comment;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.cmd.Command;
import org.jbpm.pvm.internal.cmd.CompositeCmd;
import org.jbpm.pvm.internal.cmd.SendMessageCmd;
import org.jbpm.pvm.internal.env.Environment;
+import org.jbpm.pvm.internal.history.model.HistoryCommentImpl;
import org.jbpm.pvm.internal.job.CommandMessage;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
-import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
import org.jbpm.test.load.LoadTestCase;
@@ -119,8 +119,8 @@
public List<Integer> execute(Environment environment) {
List<Integer> processedMessageNumbers = new ArrayList<Integer>();
Session session = environment.get(Session.class);
- List<Comment> comments = session.createCriteria(CommentImpl.class).list();
- for (Comment comment: comments) {
+ List<HistoryComment> comments = session.createCriteria(HistoryCommentImpl.class).list();
+ for (HistoryComment comment: comments) {
int processedMessageNumber = Integer.parseInt(comment.getMessage());
processedMessageNumbers.add(processedMessageNumber);
// make sure the db stays clean
Modified: jbpm4/branches/jbpm-4.0/qa/hudson-jbpm4-jboss.bat
===================================================================
--- jbpm4/branches/jbpm-4.0/qa/hudson-jbpm4-jboss.bat 2009-07-07 19:48:16 UTC (rev 5255)
+++ jbpm4/branches/jbpm-4.0/qa/hudson-jbpm4-jboss.bat 2009-07-07 20:01:12 UTC (rev 5256)
@@ -7,7 +7,7 @@
cmd /C ant -f qa/build.xml -Djbpm.debug=true integration.testrun.setup
-cmd /C mvn -U -Djboss.bind.address=localhost test
+cmd /C mvn -U -Djboss.bind.address=localhost -Ddatabase=hsqldb test
cmd /C ant -f qa/build.xml integration.testrun.teardown
15 years, 4 months
JBoss JBPM SVN: r5255 - in jbpm3/branches/jbpm-3.2-soa: modules/core/src/test/java/org/jbpm/perf and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-07 15:48:16 -0400 (Tue, 07 Jul 2009)
New Revision: 5255
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
Log:
change to jbpm3xa sybase user
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa 2009-07-07 18:00:05 UTC (rev 5254)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa 2009-07-07 19:48:16 UTC (rev 5255)
@@ -22,8 +22,8 @@
<jdbc.sybase.port>4100</jdbc.sybase.port>
<jdbc.sybase.database>jbpm3</jdbc.sybase.database>
<jdbc.sybase.url>jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
- <jdbc.sybase.username>jbpm3</jdbc.sybase.username>
- <jdbc.sybase.password>jbpm3jbpm3</jdbc.sybase.password>
+ <jdbc.sybase.username>jbpm3xa</jdbc.sybase.username>
+ <jdbc.sybase.password>jbpm3xa</jdbc.sybase.password>
<jdbc.sybase.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.sybase.driver>
<jdbc.sybase.datasource>com.sybase.jdbc3.jdbc.SybXADataSource</jdbc.sybase.datasource>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2009-07-07 18:00:05 UTC (rev 5254)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/perf/SimplePerformanceTest.java 2009-07-07 19:48:16 UTC (rev 5255)
@@ -21,6 +21,8 @@
*/
package org.jbpm.perf;
+import java.text.NumberFormat;
+
import org.jbpm.db.AbstractDbTestCase;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
@@ -68,9 +70,11 @@
launchProcessInstances(MEASURED_INSTANCES);
processJobs((secondTime - firstTime) * MEASURED_INSTANCES / WARMUP_INSTANCES);
- long duration = (System.currentTimeMillis() - secondTime) / 1000;
+ long duration = System.currentTimeMillis() - secondTime;
+ NumberFormat format = NumberFormat.getNumberInstance();
+ format.setMaximumFractionDigits(1);
System.out.println("==> Processed " +
- (MEASURED_INSTANCES / duration) +
+ format.format(1000.0 * MEASURED_INSTANCES / duration) +
" instances per second <==");
}
15 years, 4 months