[jbpm-commits] JBoss JBPM SVN: r5259 - in jbpm4/branches/jbpm-4.0/modules: api/src/main/java/org/jbpm/api/model and 24 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 8 14:12:05 EDT 2009


Author: tom.baeyens at 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);




More information about the jbpm-commits mailing list