[jbpm-commits] JBoss JBPM SVN: r5492 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src: main/java/org/jbpm/graph/def and 14 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Aug 19 07:34:10 EDT 2009


Author: alex.guizar at jboss.com
Date: 2009-08-19 07:34:10 -0400 (Wed, 19 Aug 2009)
New Revision: 5492

Added:
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2489/
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2489/JBPM2489Test.java
Modified:
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Transition.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/ExecutionContext.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/ProcessInstance.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Token.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessFactory.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/TaskNode.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskMgmtDefinition.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskInstance.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/context/exe/ContextInstance.hbm.xml
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/JbpmContextTest.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/graph/exe/ActionExceptionsTest.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2094/JBPM2094Test.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskInstanceEndTest.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/log4j.xml
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/gpd.xml
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/processdefinition.xml
Log:
[JBPM-2489] process loses access to variables when timer is used within fork
provide adequate equals and hash code functions

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -65,7 +65,7 @@
 
   public void deployProcessDefinition(ProcessDefinition processDefinition) {
     String processDefinitionName = processDefinition.getName();
-    // if the process definition has a name (versioning applies to named process definitions only)
+    // versioning applies to named process definitions only
     if (processDefinitionName != null) {
       // find the current latest process definition
       ProcessDefinition previousLatestVersion = findLatestProcessDefinition(processDefinitionName);
@@ -107,12 +107,13 @@
    */
   public ProcessDefinition loadProcessDefinition(long processDefinitionId) {
     try {
-      return (ProcessDefinition) session.load(ProcessDefinition.class, new Long(processDefinitionId));
+      return (ProcessDefinition) session.load(ProcessDefinition.class, new Long(
+          processDefinitionId));
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException(
-          "could not load process definition " + processDefinitionId, e);
+      throw new JbpmPersistenceException("could not load process definition "
+          + processDefinitionId, e);
     }
   }
 
@@ -123,12 +124,13 @@
    */
   public ProcessDefinition getProcessDefinition(long processDefinitionId) {
     try {
-      return (ProcessDefinition) session.get(ProcessDefinition.class, new Long(processDefinitionId));
+      return (ProcessDefinition) session.get(ProcessDefinition.class, new Long(
+          processDefinitionId));
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException("could not get process definition " + processDefinitionId,
-          e);
+      throw new JbpmPersistenceException("could not get process definition "
+          + processDefinitionId, e);
     }
   }
 
@@ -144,10 +146,8 @@
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException("could not find process definition '"
-          + name
-          + "' at version "
-          + version, e);
+      throw new JbpmPersistenceException("could not find process definition '" + name
+          + "' at version " + version, e);
     }
   }
 
@@ -168,8 +168,8 @@
   }
 
   /**
-   * queries the database for the latest version of each process definition. Process definitions are
-   * distinct by name.
+   * queries the database for the latest version of each process definition. Process definitions
+   * are distinct by name.
    */
   public List findLatestProcessDefinitions() {
     try {
@@ -185,7 +185,8 @@
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException("could not find latest versions of process definitions", e);
+      throw new JbpmPersistenceException(
+          "could not find latest versions of process definitions", e);
     }
   }
 
@@ -196,8 +197,8 @@
   }
 
   /**
-   * queries the database for all process definitions, ordered by name (ascending), then by version
-   * (descending).
+   * queries the database for all process definitions, ordered by name (ascending), then by
+   * version (descending).
    */
   public List findAllProcessDefinitions() {
     try {
@@ -210,8 +211,8 @@
   }
 
   /**
-   * queries the database for all versions of process definitions with the given name, ordered by
-   * version (descending).
+   * queries the database for all versions of process definitions with the given name, ordered
+   * by version (descending).
    */
   public List findAllProcessDefinitionVersions(String name) {
     try {
@@ -222,8 +223,7 @@
     catch (HibernateException e) {
       log.error(e);
       throw new JbpmPersistenceException("could not find all versions of process definition '"
-          + name
-          + "'", e);
+          + name + "'", e);
     }
   }
 
@@ -273,15 +273,15 @@
 
   /**
    * @deprecated use {@link org.jbpm.JbpmContext#save(ProcessInstance)} instead.
-   * @throws UnsupportedOperationException
+   * @throws UnsupportedOperationException to prevent invocation
    */
   public void saveProcessInstance(ProcessInstance processInstance) {
     throw new UnsupportedOperationException("use JbpmContext.save(ProcessInstance) instead");
   }
 
   /**
-   * loads a process instance from the database by the identifier. This throws an exception in case
-   * the process instance doesn't exist.
+   * loads a process instance from the database by the identifier. This throws an exception in
+   * case the process instance does not exist.
    * 
    * @see #getProcessInstance(long)
    * @throws JbpmPersistenceException in case the process instance doesn't exist.
@@ -292,13 +292,14 @@
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException("could not load process instance " + processInstanceId, e);
+      throw new JbpmPersistenceException(
+          "could not load process instance " + processInstanceId, e);
     }
   }
 
   /**
-   * gets a process instance from the database by the identifier. This method returns null in case
-   * the given process instance doesn't exist.
+   * gets a process instance from the database by the identifier. This method returns null in
+   * case the given process instance does not exist.
    */
   public ProcessInstance getProcessInstance(long processInstanceId) {
     try {
@@ -306,7 +307,8 @@
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException("could not get process instance " + processInstanceId, e);
+      throw new JbpmPersistenceException("could not get process instance " + processInstanceId,
+          e);
     }
   }
 
@@ -350,7 +352,8 @@
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException("could not lock process instance " + processInstanceId, e);
+      throw new JbpmPersistenceException(
+          "could not lock process instance " + processInstanceId, e);
     }
   }
 
@@ -368,8 +371,8 @@
   }
 
   /**
-   * fetches all processInstances for the given process definition from the database. The returned
-   * list of process instances is sorted start date, youngest first.
+   * fetches all processInstances for the given process definition from the database. The
+   * returned list of process instances is sorted start date, youngest first.
    */
   public List findProcessInstances(long processDefinitionId) {
     try {
@@ -379,8 +382,8 @@
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException("could not find process instances for process definition "
-          + processDefinitionId, e);
+      throw new JbpmPersistenceException(
+          "could not find process instances for process definition " + processDefinitionId, e);
     }
   }
 
@@ -400,43 +403,21 @@
 
     try {
       // delete outstanding jobs
-      if (includeJobs) {
-        log.debug("deleting jobs for " + processInstance);
-        int entityCount = session.getNamedQuery("GraphSession.deleteJobsForProcessInstance")
-            .setEntity("processInstance", processInstance)
-            .executeUpdate();
-        log.debug("deleted " + entityCount + " jobs for " + processInstance);
-      }
+      if (includeJobs) deleteJobs(processInstance);
 
       // delete logs
-      log.debug("deleting logs for " + processInstance);
       deleteLogs(processInstance);
 
-      // detach from parent process token
+      // detach from superprocess token
       Token superProcessToken = processInstance.getSuperProcessToken();
-      if (superProcessToken != null) {
-        log.debug("detaching "
-            + processInstance
-            + " from super process token "
-            + superProcessToken.getId());
-        processInstance.setSuperProcessToken(null);
-        superProcessToken.setSubProcessInstance(null);
-      }
+      if (superProcessToken != null)
+        detachFromSuperProcess(processInstance, superProcessToken);
 
-      // delete tokens and subprocess instances
-      log.debug("deleting subprocesses for " + processInstance);
+      // delete subprocess instances
       deleteSubProcesses(processInstance);
 
-      // delete tasks (TaskLogs reference tasks, so tasks must be deleted after logs)
-      if (includeTasks) {
-        log.debug("deleting tasks for " + processInstance);
-        List tasks = session.getNamedQuery("GraphSession.findTaskInstancesForProcessInstance")
-            .setEntity("processInstance", processInstance)
-            .list();
-        for (Iterator i = tasks.iterator(); i.hasNext();) {
-          session.delete(i.next());
-        }
-      }
+      // delete tasks; since TaskLogs reference tasks, logs are deleted first
+      if (includeTasks) deleteTasks(processInstance);
 
       // delete the process instance
       log.debug("deleting " + processInstance);
@@ -448,7 +429,16 @@
     }
   }
 
+  void deleteJobs(ProcessInstance processInstance) {
+    log.debug("deleting jobs for " + processInstance);
+    int entityCount = session.getNamedQuery("GraphSession.deleteJobsForProcessInstance")
+        .setEntity("processInstance", processInstance)
+        .executeUpdate();
+    log.debug("deleted " + entityCount + " jobs for " + processInstance);
+  }
+
   void deleteLogs(ProcessInstance processInstance) {
+    log.debug("deleting logs for " + processInstance);
     List logs = session.getNamedQuery("GraphSession.findLogsForProcessInstance")
         .setEntity("processInstance", processInstance)
         .list();
@@ -457,25 +447,40 @@
     }
   }
 
+  void detachFromSuperProcess(ProcessInstance processInstance, Token superProcessToken) {
+    log.debug("detaching " + processInstance + " from " + superProcessToken);
+    processInstance.setSuperProcessToken(null);
+    superProcessToken.setSubProcessInstance(null);
+  }
+
   void deleteSubProcesses(ProcessInstance processInstance) {
-    if (processInstance != null) {
-      List subProcessInstances = session.getNamedQuery("GraphSession.findSubProcessInstances")
-          .setEntity("processInstance", processInstance)
-          .list();
+    log.debug("deleting subprocesses for " + processInstance);
+    List subProcessInstances = session.getNamedQuery("GraphSession.findSubProcessInstances")
+        .setEntity("processInstance", processInstance)
+        .list();
 
-      if (subProcessInstances.isEmpty()) {
-        log.debug("no subprocesses to delete for " + processInstance);
-        return;
-      }
+    if (subProcessInstances.isEmpty()) {
+      log.debug("no subprocesses to delete for " + processInstance);
+      return;
+    }
 
-      for (Iterator i = subProcessInstances.iterator(); i.hasNext();) {
-        ProcessInstance subProcessInstance = (ProcessInstance) i.next();
-        log.debug("preparing to delete sub process instance " + subProcessInstance.getId());
-        deleteProcessInstance(subProcessInstance);
-      }
+    for (Iterator i = subProcessInstances.iterator(); i.hasNext();) {
+      ProcessInstance subProcessInstance = (ProcessInstance) i.next();
+      log.debug("preparing to delete Sub" + subProcessInstance);
+      deleteProcessInstance(subProcessInstance);
     }
   }
 
+  void deleteTasks(ProcessInstance processInstance) {
+    log.debug("deleting tasks for " + processInstance);
+    List tasks = session.getNamedQuery("GraphSession.findTaskInstancesForProcessInstance")
+        .setEntity("processInstance", processInstance)
+        .list();
+    for (Iterator i = tasks.iterator(); i.hasNext();) {
+      session.delete(i.next());
+    }
+  }
+
   public static class AverageNodeTimeEntry {
 
     private long nodeId;
@@ -565,9 +570,8 @@
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException(
-          "could not calculate average time by node for process definition " + processDefinitionId,
-          e);
+      throw new JbpmPersistenceException("could not calculate average time by node for "
+          + processDefinitionId, e);
     }
   }
 
@@ -579,7 +583,8 @@
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException("could not find active nodes for " + processInstance, e);
+      throw new JbpmPersistenceException("could not find active nodes for " + processInstance,
+          e);
     }
   }
 
@@ -592,7 +597,8 @@
     }
     catch (HibernateException e) {
       handle(e);
-      throw new JbpmPersistenceException("could not get process instance with key '" + key + "'", e);
+      throw new JbpmPersistenceException("could not get process instance with key '" + key
+          + "'", e);
     }
   }
 

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -48,7 +48,6 @@
 import org.jbpm.svc.Service;
 import org.jbpm.svc.Services;
 import org.jbpm.util.ClassUtil;
-import org.jbpm.util.EqualsUtil;
 
 public abstract class GraphElement implements Identifiable, Serializable {
 
@@ -71,14 +70,14 @@
   // events ///////////////////////////////////////////////////////////////////
 
   /**
-   * indicative set of event types supported by this graph element. this is currently only used by
-   * the process designer to know which event types to show on a given graph element. in process
-   * definitions and at runtime, there are no contstraints on the event-types.
+   * indicative set of event types supported by this graph element. this is currently only used
+   * by the process designer to know which event types to show on a given graph element. in
+   * process definitions and at runtime, there are no constraints on the event-types.
    */
   public abstract String[] getSupportedEventTypes();
 
   /**
-   * gets the events, keyd by eventType (java.lang.String).
+   * gets the events, keyed by eventType (java.lang.String).
    */
   public Map getEvents() {
     return events;
@@ -117,7 +116,8 @@
       throw new IllegalArgumentException("can't remove null event from graph element");
     }
     if (event.getEventType() == null) {
-      throw new IllegalArgumentException("can't remove an event without type from graph element");
+      throw new IllegalArgumentException(
+          "can't remove an event without type from graph element");
     }
     if (events != null) {
       removedEvent = (Event) events.remove(event.getEventType());
@@ -151,7 +151,8 @@
 
   public void removeExceptionHandler(ExceptionHandler exceptionHandler) {
     if (exceptionHandler == null) {
-      throw new IllegalArgumentException("can't remove null exceptionHandler from graph element");
+      throw new IllegalArgumentException(
+          "can't remove null exceptionHandler from graph element");
     }
     if (exceptionHandlers != null && exceptionHandlers.remove(exceptionHandler)) {
       exceptionHandler.graphElement = null;
@@ -159,19 +160,14 @@
   }
 
   public void reorderExceptionHandler(int oldIndex, int newIndex) {
-    if (exceptionHandlers != null
-        && Math.min(oldIndex, newIndex) >= 0
+    if (exceptionHandlers != null && Math.min(oldIndex, newIndex) >= 0
         && Math.max(oldIndex, newIndex) < exceptionHandlers.size()) {
       Object o = exceptionHandlers.remove(oldIndex);
       exceptionHandlers.add(newIndex, o);
     }
     else {
-      throw new IndexOutOfBoundsException("couldn't reorder element from index '"
-          + oldIndex
-          + "' to index '"
-          + newIndex
-          + "' in "
-          + exceptionHandlers);
+      throw new IndexOutOfBoundsException("couldn't reorder element from index '" + oldIndex
+          + "' to index '" + newIndex + "' in " + exceptionHandlers);
     }
   }
 
@@ -289,7 +285,8 @@
       }
     }
     catch (Exception exception) {
-      // NOTE that Errors are not caught because that might halt the JVM and mask the original Error
+      // NOTE that Errors are not caught because that might halt the JVM and mask the original
+      // Error
       log.error("action threw exception: " + exception.getMessage(), exception);
 
       // log the action exception
@@ -323,8 +320,8 @@
   }
 
   /**
-   * throws an ActionException if no applicable exception handler is found. An ExceptionHandler is
-   * searched for in this graph element and then recursively up the parent hierarchy. If an
+   * throws an ActionException if no applicable exception handler is found. An ExceptionHandler
+   * is searched for in this graph element and then recursively up the parent hierarchy. If an
    * exception handler is found, it is applied. If the exception handler does not throw an
    * exception, the exception is considered handled. Otherwise the search for an applicable
    * exception handler continues where it left of with the newly thrown exception.
@@ -359,7 +356,7 @@
     // rollbackActions(executionContext);
 
     // if there is no parent we need to throw a delegation exception to the client
-    throw exception instanceof JbpmException ? (JbpmException) exception 
+    throw exception instanceof JbpmException ? (JbpmException) exception
         : new DelegationException(exception, executionContext);
   }
 
@@ -372,16 +369,16 @@
    */
   private static boolean isAbleToHandleExceptions(ExecutionContext executionContext) {
     /*
-     * if an exception is already set, we are already handling an exception;
-     * in this case don't give the exception to the handlers but throw it to the client
-     * see https://jira.jboss.org/jira/browse/JBPM-1887
+     * if an exception is already set, we are already handling an exception; in this case don't
+     * give the exception to the handlers but throw it to the client see
+     * https://jira.jboss.org/jira/browse/JBPM-1887
      */
     if (executionContext.getException() != null) return false;
 
     /*
      * check whether the transaction is still active before scanning the exception handlers.
-     * that way we can load the exception handlers lazily
-     * see https://jira.jboss.org/jira/browse/JBPM-1775
+     * that way we can load the exception handlers lazily see
+     * https://jira.jboss.org/jira/browse/JBPM-1775
      */
     JbpmContext jbpmContext = executionContext.getJbpmContext();
     if (jbpmContext != null) {
@@ -444,18 +441,34 @@
     }
   }
 
+  // equals ///////////////////////////////////////////////////////////////////
+
+  public boolean equals(Object o) {
+    if (o == this) return true;
+    if (!getClass().isInstance(o)) return false;
+
+    GraphElement other = (GraphElement) o;
+    if (id != 0) return id == other.getId();
+
+    GraphElement parent = getParent();
+    return (name != null ? name.equals(other.getName()) : other.getName() == null)
+        && (parent != null ? parent.equals(other.getParent()) : other.getParent() == null);
+  }
+
+  public int hashCode() {
+    if (id != 0) return (int) (id ^ (id >>> 32));
+
+    int result = 580399073 + (name != null ? name.hashCode() : 0);
+    GraphElement parent = getParent();
+    result = 345105097 * result + (parent != null ? parent.hashCode() : 0);
+    return result;
+  }
+
   public String toString() {
     return ClassUtil.getSimpleName(getClass())
         + (name != null ? '(' + name + ')' : '@' + Integer.toHexString(hashCode()));
   }
 
-  // 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);
-  }
-
   // getters and setters //////////////////////////////////////////////////////
 
   public long getId() {

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -179,8 +179,8 @@
       throw new IllegalArgumentException("can't add a null leaving transition to an node");
 
     if (leavingTransitions == null) leavingTransitions = new ArrayList();
+    leavingTransition.from = this;
     leavingTransitions.add(leavingTransition);
-    leavingTransition.from = this;
     leavingTransitionMap = null;
     return leavingTransition;
   }
@@ -310,8 +310,8 @@
       throw new IllegalArgumentException("can't add a null arrivingTransition to a node");
 
     if (arrivingTransitions == null) arrivingTransitions = new HashSet();
+    arrivingTransition.to = this;
     arrivingTransitions.add(arrivingTransition);
-    arrivingTransition.to = this;
     return arrivingTransition;
   }
 

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -56,22 +56,22 @@
   private static final long serialVersionUID = 1L;
 
   protected int version = -1;
-  protected boolean isTerminationImplicit = false;
-  protected Node startState = null;
-  protected List nodes = null;
-  transient Map nodesMap = null;
-  protected Map actions = null;
-  protected Map definitions = null;
+  protected boolean isTerminationImplicit;
+  protected Node startState;
+  protected List nodes;
+  transient Map nodesMap;
+  protected Map actions;
+  protected Map definitions;
 
   // event types //////////////////////////////////////////////////////////////
 
-  public static final String[] supportedEventTypes = new String[] { Event.EVENTTYPE_PROCESS_START,
-      Event.EVENTTYPE_PROCESS_END, Event.EVENTTYPE_NODE_ENTER, Event.EVENTTYPE_NODE_LEAVE,
-      Event.EVENTTYPE_TASK_CREATE, Event.EVENTTYPE_TASK_ASSIGN, Event.EVENTTYPE_TASK_START,
-      Event.EVENTTYPE_TASK_END, Event.EVENTTYPE_TRANSITION, Event.EVENTTYPE_BEFORE_SIGNAL,
-      Event.EVENTTYPE_AFTER_SIGNAL, Event.EVENTTYPE_SUPERSTATE_ENTER,
-      Event.EVENTTYPE_SUPERSTATE_LEAVE, Event.EVENTTYPE_SUBPROCESS_CREATED,
-      Event.EVENTTYPE_SUBPROCESS_END, Event.EVENTTYPE_TIMER };
+  public static final String[] supportedEventTypes = new String[] {
+      Event.EVENTTYPE_PROCESS_START, Event.EVENTTYPE_PROCESS_END, Event.EVENTTYPE_NODE_ENTER,
+      Event.EVENTTYPE_NODE_LEAVE, Event.EVENTTYPE_TASK_CREATE, Event.EVENTTYPE_TASK_ASSIGN,
+      Event.EVENTTYPE_TASK_START, Event.EVENTTYPE_TASK_END, Event.EVENTTYPE_TRANSITION,
+      Event.EVENTTYPE_BEFORE_SIGNAL, Event.EVENTTYPE_AFTER_SIGNAL,
+      Event.EVENTTYPE_SUPERSTATE_ENTER, Event.EVENTTYPE_SUPERSTATE_LEAVE,
+      Event.EVENTTYPE_SUBPROCESS_CREATED, Event.EVENTTYPE_SUBPROCESS_END, Event.EVENTTYPE_TIMER };
 
   public String[] getSupportedEventTypes() {
     return supportedEventTypes;
@@ -80,7 +80,7 @@
   // constructors /////////////////////////////////////////////////////////////
 
   public ProcessDefinition() {
-    this.processDefinition = this;
+    processDefinition = this;
   }
 
   public static ProcessDefinition createNewProcessDefinition() {
@@ -98,19 +98,20 @@
 
       }
       catch (Exception e) {
-        throw new JbpmException("couldn't instantiate default module '" + moduleClassName + "'", e);
+        throw new JbpmException(
+            "couldn't instantiate default module '" + moduleClassName + "'", e);
       }
     }
     return processDefinition;
   }
 
   public ProcessDefinition(String name) {
-    this.processDefinition = this;
+    this();
     this.name = name;
   }
 
   public ProcessDefinition(String[] nodes, String[] transitions) {
-    this.processDefinition = this;
+    this();
     ProcessFactory.addNodesAndTransitions(this, nodes, transitions);
   }
 
@@ -128,11 +129,31 @@
 
   public void setProcessDefinition(ProcessDefinition processDefinition) {
     if (!equals(processDefinition)) {
-      throw new JbpmException(
-          "can't set the process-definition-property of a process defition to something else then a self-reference");
+      throw new IllegalArgumentException(
+          "process definition cannot reference another process definition");
     }
   }
 
+  // equals ///////////////////////////////////////////////////////////////////
+
+  public boolean equals(Object o) {
+    if (o == this) return true;
+    if (!(o instanceof ProcessDefinition)) return false;
+
+    ProcessDefinition other = (ProcessDefinition) o;
+    return id != 0 ? id == other.getId() : (name != null ? name.equals(other.getName())
+        : other.getName() == null)
+        && version == other.getVersion();
+  }
+
+  public int hashCode() {
+    if (id != 0) return (int) (id ^ (id >>> 32));
+
+    int result = 224001527 + (name != null ? name.hashCode() : 0);
+    result = 1568661329 * result + version;
+    return result;
+  }
+
   // parsing //////////////////////////////////////////////////////////////////
 
   /**
@@ -268,17 +289,14 @@
 
   // javadoc description in NodeCollection
   public void reorderNode(int oldIndex, int newIndex) {
-    if (nodes != null
-        && Math.min(oldIndex, newIndex) >= 0
+    if (nodes != null && Math.min(oldIndex, newIndex) >= 0
         && Math.max(oldIndex, newIndex) < nodes.size()) {
       Object node = nodes.remove(oldIndex);
       nodes.add(newIndex, node);
     }
     else {
-      throw new IndexOutOfBoundsException("couldn't reorder element from index "
-          + oldIndex
-          + " to index "
-          + newIndex);
+      throw new IndexOutOfBoundsException("couldn't reorder element from index " + oldIndex
+          + " to index " + newIndex);
     }
   }
 
@@ -329,8 +347,7 @@
         String namePart = tokenizer.nextToken();
         if ("..".equals(namePart)) {
           if (nodeCollection instanceof ProcessDefinition) {
-            throw new JbpmException("couldn't find node '"
-                + hierarchicalName
+            throw new JbpmException("could not find node '" + hierarchicalName
                 + "' because of a '..' on the process definition.");
           }
           nodeCollection = (NodeCollection) ((GraphElement) nodeCollection).getParent();
@@ -385,8 +402,10 @@
    *         actions of this process definition.
    */
   public void removeAction(Action action) {
-    if (action == null)
-      throw new IllegalArgumentException("can't remove a null action from an process definition");
+    if (action == null) {
+      throw new IllegalArgumentException(
+          "can't remove a null action from an process definition");
+    }
     if (actions != null) {
       if (!actions.containsValue(action)) {
         throw new IllegalArgumentException(

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Transition.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Transition.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Transition.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -33,118 +33,105 @@
 import org.jbpm.graph.log.TransitionLog;
 import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
 
-public class Transition extends GraphElement
-{
+public class Transition extends GraphElement {
+
   private static final long serialVersionUID = 1L;
 
-  protected Node from = null;
-  protected Node to = null;
-  protected String condition = null;
+  protected Node from;
+  protected Node to;
+  protected String condition;
   transient boolean isConditionEnforced = true;
 
   // event types //////////////////////////////////////////////////////////////
 
   public static final String[] supportedEventTypes = new String[] { Event.EVENTTYPE_TRANSITION };
 
-  public String[] getSupportedEventTypes()
-  {
+  public String[] getSupportedEventTypes() {
     return supportedEventTypes;
   }
 
   // constructors /////////////////////////////////////////////////////////////
 
-  public Transition()
-  {
+  public Transition() {
   }
 
-  public Transition(String name)
-  {
+  public Transition(String name) {
     super(name);
   }
 
   // from /////////////////////////////////////////////////////////////////////
 
-  public Node getFrom()
-  {
+  public Node getFrom() {
     return from;
   }
 
-  /*
-   * sets the from node unidirectionally. use {@link Node#addLeavingTransition(Transition)} to get bidirectional relations mgmt.
+  /**
+   * sets the from node unidirectionally. use {@link Node#addLeavingTransition(Transition)} to
+   * get bidirectional relations mgmt.
    */
-  public void setFrom(Node from)
-  {
+  public void setFrom(Node from) {
     this.from = from;
   }
 
   // to ///////////////////////////////////////////////////////////////////////
 
-  /*
-   * sets the to node unidirectionally. use {@link Node#addArrivingTransition(Transition)} to get bidirectional relations mgmt.
+  /**
+   * sets the to node unidirectionally. use {@link Node#addArrivingTransition(Transition)} to
+   * get bidirectional relations mgmt.
    */
-  public void setTo(Node to)
-  {
+  public void setTo(Node to) {
     this.to = to;
   }
 
-  public Node getTo()
-  {
+  public Node getTo() {
     return to;
   }
 
-  /*
-   * the condition expresssion for this transition.
+  /**
+   * the condition expression for this transition.
    */
-  public String getCondition()
-  {
+  public String getCondition() {
     return condition;
   }
 
-  public void setCondition(String conditionExpression)
-  {
+  public void setCondition(String conditionExpression) {
     this.condition = conditionExpression;
   }
 
-  public void removeConditionEnforcement()
-  {
+  public void removeConditionEnforcement() {
     isConditionEnforced = false;
   }
 
   // behaviour ////////////////////////////////////////////////////////////////
 
-  /*
+  /**
    * passes execution over this transition.
    */
-  public void take(ExecutionContext executionContext)
-  {
+  public void take(ExecutionContext executionContext) {
     // update the runtime context information
     executionContext.getToken().setNode(null);
 
     Token token = executionContext.getToken();
 
-    if ((condition != null) && (isConditionEnforced))
-    {
+    if (condition != null && isConditionEnforced) {
       Object result = JbpmExpressionEvaluator.evaluate(condition, executionContext);
-      if (result == null)
-      {
+      if (result == null) {
         throw new JbpmException("transition condition " + condition + " evaluated to null");
       }
-      else if (!(result instanceof Boolean))
-      {
-        throw new JbpmException("transition condition " + condition + " evaluated to non-boolean: " + result.getClass().getName());
+      else if (!(result instanceof Boolean)) {
+        throw new JbpmException("transition condition " + condition
+            + " evaluated to non-boolean: " + result.getClass().getName());
       }
-      else if (!((Boolean)result).booleanValue())
-      {
+      else if (!((Boolean) result).booleanValue()) {
         throw new JbpmException("transition condition " + condition + " evaluated to 'false'");
       }
     }
 
     // start the transition log
-    TransitionLog transitionLog = new TransitionLog(this, executionContext.getTransitionSource());
+    TransitionLog transitionLog = new TransitionLog(this,
+        executionContext.getTransitionSource());
     token.startCompositeLog(transitionLog);
-    try
-    {
-
+    try {
       // fire leave events for superstates (if any)
       fireSuperStateLeaveEvents(executionContext);
 
@@ -155,37 +142,31 @@
       Node destination = fireSuperStateEnterEvents(executionContext);
       // update the ultimate destinationNode of this transition
       transitionLog.setDestinationNode(destination);
-
     }
-    finally
-    {
+    finally {
       // end the transition log
       token.endCompositeLog();
     }
-
     // pass the token to the destinationNode node
     to.enter(executionContext);
   }
 
-  Node fireSuperStateEnterEvents(ExecutionContext executionContext)
-  {
+  Node fireSuperStateEnterEvents(ExecutionContext executionContext) {
     // calculate the actual destinationNode node
     Node destination = to;
-    while (destination != null && destination.isSuperStateNode())
-    {
+    while (destination != null && destination.isSuperStateNode()) {
       List nodes = destination.getNodes();
-      destination = nodes != null && !nodes.isEmpty() ? (Node)nodes.get(0) : null;
+      destination = nodes != null && !nodes.isEmpty() ? (Node) nodes.get(0) : null;
     }
 
-    if (destination == null)
-    {
+    if (destination == null) {
       String transitionName = (name != null ? "'" + name + "'" : "in node '" + from + "'");
-      throw new JbpmException("transition " + transitionName + " doesn't have destination. check your processdefinition.xml");
+      throw new JbpmException("transition " + transitionName
+          + " doesn't have destination. check your processdefinition.xml");
     }
 
-    // performance optimisation: check if at least there is a candidate superstate to be entered.
-    if (destination.getSuperState() != null)
-    {
+    // optimisation: check if there is a candidate superstate to be entered.
+    if (destination.getSuperState() != null) {
       // collect all the superstates being left
       List leavingSuperStates = collectAllSuperStates(destination, from);
       // reverse the order so that events are fired from outer to inner superstates
@@ -197,11 +178,9 @@
     return destination;
   }
 
-  void fireSuperStateLeaveEvents(ExecutionContext executionContext)
-  {
-    // performance optimisation: check if at least there is a candidate superstate to be left.
-    if (executionContext.getTransitionSource().getSuperState() != null)
-    {
+  void fireSuperStateLeaveEvents(ExecutionContext executionContext) {
+    // optimisation: check if there is a candidate superstate to be left.
+    if (executionContext.getTransitionSource().getSuperState() != null) {
       // collect all the superstates being left
       List leavingSuperStates = collectAllSuperStates(executionContext.getTransitionSource(), to);
       // fire a node-leave event for all superstates being left
@@ -209,52 +188,70 @@
     }
   }
 
-  /*
+  /**
    * collect all superstates of a that do not contain node b.
    */
-  static List collectAllSuperStates(Node a, Node b)
-  {
+  static List collectAllSuperStates(Node a, Node b) {
     SuperState superState = a.getSuperState();
     List leavingSuperStates = new ArrayList();
-    while (superState != null)
-    {
-      if (!superState.containsNode(b))
-      {
+    while (superState != null) {
+      if (!superState.containsNode(b)) {
         leavingSuperStates.add(superState);
         superState = superState.getSuperState();
       }
-      else
-      {
+      else {
         superState = null;
       }
     }
     return leavingSuperStates;
   }
 
-  /*
+  /**
    * fires the give event on all the superstates in the list.
    */
-  void fireSuperStateEvents(List superStates, String eventType, ExecutionContext executionContext)
-  {
+  void fireSuperStateEvents(List superStates, String eventType,
+      ExecutionContext executionContext) {
     Iterator iter = superStates.iterator();
-    while (iter.hasNext())
-    {
-      SuperState leavingSuperState = (SuperState)iter.next();
+    while (iter.hasNext()) {
+      SuperState leavingSuperState = (SuperState) iter.next();
       leavingSuperState.fireEvent(eventType, executionContext);
     }
   }
 
+  // equals ///////////////////////////////////////////////////////////////////
+
+  public boolean equals(Object o) {
+    if (o == this) return true;
+    if (!(o instanceof Transition)) return false;
+
+    Transition other = (Transition) o;
+    return id != 0 ? id == other.getId() : (name != null ? name.equals(other.getName())
+        : other.getName() == null)
+        && (from != null ? from.equals(other.getFrom()) : other.getFrom() == null)
+        && (to != null ? to.equals(other.getTo()) : other.getTo() == null);
+  }
+
+  public int hashCode() {
+    if (id != 0) return (int) (id ^ (id >>> 32));
+
+    int result = 580399073 + (name != null ? name.hashCode() : 0);
+    result = 345105097 * result + (from != null ? from.hashCode() : 0);
+    result = 345105097 * result + (to != null ? to.hashCode() : 0);
+    return result;
+  }
+
   // other
   // ///////////////////////////////////////////////////////////////////////////
 
-  public void setName(String name)
-  {
-    if (from != null)
-    {
-      if (from.hasLeavingTransition(name))
-      {
-        throw new IllegalArgumentException("couldn't set name '" + name + "' on transition '" + this
-            + "'cause the from-node of this transition has already another leaving transition with the same name");
+  public void setName(String name) {
+    if (from != null) {
+      if (from.hasLeavingTransition(name)) {
+        throw new IllegalArgumentException(
+            "couldn't set name '"
+                + name
+                + "' on transition '"
+                + this
+                + "'cause the from-node of this transition has already another leaving transition with the same name");
       }
       Map fromLeavingTransitions = from.getLeavingTransitionsMap();
       fromLeavingTransitions.remove(this.name);
@@ -263,35 +260,16 @@
     this.name = name;
   }
 
-  public GraphElement getParent()
-  {
-    GraphElement parent = null;
-    if ((from != null) && (to != null))
-    {
-      if (from.equals(to))
-      {
-        parent = from.getParent();
-      }
-      else
-      {
-        List fromParentChain = from.getParentChain();
-        List toParentChain = to.getParentChain();
-        Iterator fromIter = fromParentChain.iterator();
-        while (fromIter.hasNext() && (parent == null))
-        {
-          GraphElement fromParent = (GraphElement)fromIter.next();
-          Iterator toIter = toParentChain.iterator();
-          while (toIter.hasNext() && (parent == null))
-          {
-            GraphElement toParent = (GraphElement)toIter.next();
-            if (fromParent == toParent)
-            {
-              parent = fromParent;
-            }
-          }
+  public GraphElement getParent() {
+    if (from != null && to != null) {
+      if (from.equals(to)) return from.getParent();
+
+      for (GraphElement fromParent = from; fromParent != null; fromParent = fromParent.getParent()) {
+        for (GraphElement toParent = to; toParent != null; toParent = toParent.getParent()) {
+          if (fromParent.equals(toParent)) return fromParent;
         }
       }
     }
-    return parent;
+    return processDefinition;
   }
 }

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/ExecutionContext.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/ExecutionContext.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/ExecutionContext.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -39,60 +39,51 @@
 import org.jbpm.taskmgmt.exe.TaskInstance;
 import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
 
-public class ExecutionContext
-{
+public class ExecutionContext {
 
-  protected Token token = null;
-  protected Event event = null;
-  protected GraphElement eventSource = null;
-  protected Action action = null;
-  protected Throwable exception = null;
-  protected Transition transition = null;
-  protected Node transitionSource = null;
-  protected Task task = null;
-  protected Timer timer = null;
-  protected TaskInstance taskInstance = null;
-  protected ProcessInstance subProcessInstance = null;
+  protected Token token;
+  protected Event event;
+  protected GraphElement eventSource;
+  protected Action action;
+  protected Throwable exception;
+  protected Transition transition;
+  protected Node transitionSource;
+  protected Task task;
+  protected Timer timer;
+  protected TaskInstance taskInstance;
+  protected ProcessInstance subProcessInstance;
 
-  public ExecutionContext(Token token)
-  {
+  public ExecutionContext(Token token) {
     this.token = token;
   }
 
-  public ExecutionContext(ExecutionContext other)
-  {
+  public ExecutionContext(ExecutionContext other) {
     this.token = other.token;
     this.event = other.event;
     this.action = other.action;
   }
 
-  public Node getNode()
-  {
+  public Node getNode() {
     return token.getNode();
   }
 
-  public ProcessDefinition getProcessDefinition()
-  {
+  public ProcessDefinition getProcessDefinition() {
     ProcessInstance processInstance = getProcessInstance();
     return (processInstance != null ? processInstance.getProcessDefinition() : null);
   }
 
-  public void setAction(Action action)
-  {
+  public void setAction(Action action) {
     this.action = action;
-    if (action != null)
-    {
+    if (action != null) {
       this.event = action.getEvent();
     }
   }
 
-  public ProcessInstance getProcessInstance()
-  {
+  public ProcessInstance getProcessInstance() {
     return token.getProcessInstance();
   }
 
-  public String toString()
-  {
+  public String toString() {
     return "ExecutionContext[" + token + "]";
   }
 
@@ -101,14 +92,11 @@
   /**
    * set a process variable.
    */
-  public void setVariable(String name, Object value)
-  {
-    if (taskInstance != null)
-    {
+  public void setVariable(String name, Object value) {
+    if (taskInstance != null) {
       taskInstance.setVariable(name, value);
     }
-    else
-    {
+    else {
       getContextInstance().setVariable(name, value, token);
     }
   }
@@ -116,171 +104,143 @@
   /**
    * get a process variable.
    */
-  public Object getVariable(String name)
-  {
-    if (taskInstance != null)
-    {
+  public Object getVariable(String name) {
+    if (taskInstance != null) {
       return taskInstance.getVariable(name);
     }
-    else
-    {
+    else {
       return getContextInstance().getVariable(name, token);
     }
   }
 
   /**
-   * leave this node over the default transition. This method is only available on node actions. Not on actions that are
-   * executed on events. Actions on events cannot change the flow of execution.
+   * leave this node over the default transition. This method is only available on node actions.
+   * Not on actions that are executed on events. Actions on events cannot change the flow of
+   * execution.
    */
-  public void leaveNode()
-  {
+  public void leaveNode() {
     getNode().leave(this);
   }
 
   /**
-   * leave this node over the given transition. This method is only available on node actions. Not on actions that are
-   * executed on events. Actions on events cannot change the flow of execution.
+   * leave this node over the given transition. This method is only available on node actions.
+   * Not on actions that are executed on events. Actions on events cannot change the flow of
+   * execution.
    */
-  public void leaveNode(String transitionName)
-  {
+  public void leaveNode(String transitionName) {
     getNode().leave(this, transitionName);
   }
 
   /**
-   * leave this node over the given transition. This method is only available on node actions. Not on actions that are
-   * executed on events. Actions on events cannot change the flow of execution.
+   * leave this node over the given transition. This method is only available on node actions.
+   * Not on actions that are executed on events. Actions on events cannot change the flow of
+   * execution.
    */
-  public void leaveNode(Transition transition)
-  {
+  public void leaveNode(Transition transition) {
     getNode().leave(this, transition);
   }
 
-  public ModuleDefinition getDefinition(Class clazz)
-  {
+  public ModuleDefinition getDefinition(Class clazz) {
     return getProcessDefinition().getDefinition(clazz);
   }
 
-  public ModuleInstance getInstance(Class clazz)
-  {
+  public ModuleInstance getInstance(Class clazz) {
     ProcessInstance processInstance = (token != null ? token.getProcessInstance() : null);
     return (processInstance != null ? processInstance.getInstance(clazz) : null);
   }
 
-  public ContextInstance getContextInstance()
-  {
-    return (ContextInstance)getInstance(ContextInstance.class);
+  public ContextInstance getContextInstance() {
+    return (ContextInstance) getInstance(ContextInstance.class);
   }
 
-  public TaskMgmtInstance getTaskMgmtInstance()
-  {
-    return (TaskMgmtInstance)getInstance(TaskMgmtInstance.class);
+  public TaskMgmtInstance getTaskMgmtInstance() {
+    return (TaskMgmtInstance) getInstance(TaskMgmtInstance.class);
   }
 
-  public JbpmContext getJbpmContext()
-  {
+  public JbpmContext getJbpmContext() {
     return JbpmContext.getCurrentJbpmContext();
   }
 
   // getters and setters //////////////////////////////////////////////////////
 
-  public void setTaskInstance(TaskInstance taskInstance)
-  {
+  public void setTaskInstance(TaskInstance taskInstance) {
     this.taskInstance = taskInstance;
     this.task = (taskInstance != null ? taskInstance.getTask() : null);
   }
 
-  public Token getToken()
-  {
+  public Token getToken() {
     return token;
   }
 
-  public Action getAction()
-  {
+  public Action getAction() {
     return action;
   }
 
-  public Event getEvent()
-  {
+  public Event getEvent() {
     return event;
   }
 
-  public void setEvent(Event event)
-  {
+  public void setEvent(Event event) {
     this.event = event;
   }
 
-  public Throwable getException()
-  {
+  public Throwable getException() {
     return exception;
   }
 
-  public void setException(Throwable exception)
-  {
+  public void setException(Throwable exception) {
     this.exception = exception;
   }
 
-  public Transition getTransition()
-  {
+  public Transition getTransition() {
     return transition;
   }
 
-  public void setTransition(Transition transition)
-  {
+  public void setTransition(Transition transition) {
     this.transition = transition;
   }
 
-  public Node getTransitionSource()
-  {
+  public Node getTransitionSource() {
     return transitionSource;
   }
 
-  public void setTransitionSource(Node transitionSource)
-  {
+  public void setTransitionSource(Node transitionSource) {
     this.transitionSource = transitionSource;
   }
 
-  public GraphElement getEventSource()
-  {
+  public GraphElement getEventSource() {
     return eventSource;
   }
 
-  public void setEventSource(GraphElement eventSource)
-  {
+  public void setEventSource(GraphElement eventSource) {
     this.eventSource = eventSource;
   }
 
-  public Task getTask()
-  {
+  public Task getTask() {
     return task;
   }
 
-  public void setTask(Task task)
-  {
+  public void setTask(Task task) {
     this.task = task;
   }
 
-  public TaskInstance getTaskInstance()
-  {
+  public TaskInstance getTaskInstance() {
     return taskInstance;
   }
 
-  public ProcessInstance getSubProcessInstance()
-  {
+  public ProcessInstance getSubProcessInstance() {
     return subProcessInstance;
   }
 
-  public void setSubProcessInstance(ProcessInstance subProcessInstance)
-  {
+  public void setSubProcessInstance(ProcessInstance subProcessInstance) {
     this.subProcessInstance = subProcessInstance;
   }
 
-  public Timer getTimer()
-  {
+  public Timer getTimer() {
     return timer;
   }
 
-  public void setTimer(Timer timer)
-  {
+  public void setTimer(Timer timer) {
     this.timer = timer;
   }
 
@@ -288,37 +248,31 @@
 
   static ThreadLocal threadLocalContextStack = new ThreadLocal();
 
-  static Stack getContextStack()
-  {
-    Stack stack = (Stack)threadLocalContextStack.get();
-    if (stack == null)
-    {
+  static Stack getContextStack() {
+    Stack stack = (Stack) threadLocalContextStack.get();
+    if (stack == null) {
       stack = new Stack();
       threadLocalContextStack.set(stack);
     }
     return stack;
   }
 
-  public static void pushCurrentContext(ExecutionContext executionContext)
-  {
+  public static void pushCurrentContext(ExecutionContext executionContext) {
     getContextStack().push(executionContext);
   }
 
-  public static void popCurrentContext(ExecutionContext executionContext)
-  {
-    if (getContextStack().pop() != executionContext)
-    {
-      throw new JbpmException("current execution context mismatch.  make sure that every pushed context gets popped");
+  public static void popCurrentContext(ExecutionContext executionContext) {
+    if (getContextStack().pop() != executionContext) {
+      throw new JbpmException(
+          "current execution context mismatch.  make sure that every pushed context gets popped");
     }
   }
 
-  public static ExecutionContext currentExecutionContext()
-  {
+  public static ExecutionContext currentExecutionContext() {
     ExecutionContext executionContext = null;
     Stack stack = getContextStack();
-    if (!stack.isEmpty())
-    {
-      executionContext = (ExecutionContext)stack.peek();
+    if (!stack.isEmpty()) {
+      executionContext = (ExecutionContext) stack.peek();
     }
     return executionContext;
   }

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/ProcessInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/ProcessInstance.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/ProcessInstance.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -50,7 +50,6 @@
 import org.jbpm.svc.Services;
 import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
 import org.jbpm.util.Clock;
-import org.jbpm.util.EqualsUtil;
 
 /**
  * is one execution of a {@link org.jbpm.graph.def.ProcessDefinition}. To create a new process
@@ -82,9 +81,10 @@
 
   /**
    * creates a new process instance for the given process definition, puts the root-token (=main
-   * path of execution) in the start state and executes the initial node. In case the initial node
-   * is a start-state, it will behave as a wait state. For each of the optional module definitions
-   * contained in the {@link ProcessDefinition}, the corresponding module instance will be created.
+   * path of execution) in the start state and executes the initial node. In case the initial
+   * node is a start-state, it will behave as a wait state. For each of the optional module
+   * definitions contained in the {@link ProcessDefinition}, the corresponding module instance
+   * will be created.
    * 
    * @throws JbpmException if processDefinition is null.
    */
@@ -94,13 +94,14 @@
 
   /**
    * creates a new process instance for the given process definition, puts the root-token (=main
-   * path of execution) in the start state and executes the initial node. In case the initial node
-   * is a start-state, it will behave as a wait state. For each of the optional module definitions
-   * contained in the {@link ProcessDefinition}, the corresponding module instance will be created.
+   * path of execution) in the start state and executes the initial node. In case the initial
+   * node is a start-state, it will behave as a wait state. For each of the optional module
+   * definitions contained in the {@link ProcessDefinition}, the corresponding module instance
+   * will be created.
    * 
-   * @param variables will be inserted into the context variables after the context submodule has
-   *        been created and before the process-start event is fired, which is also before the
-   *        execution of the initial node.
+   * @param variables will be inserted into the context variables after the context submodule
+   *        has been created and before the process-start event is fired, which is also before
+   *        the execution of the initial node.
    * @throws JbpmException if processDefinition is null.
    */
   public ProcessInstance(ProcessDefinition processDefinition, Map variables) {
@@ -109,13 +110,14 @@
 
   /**
    * creates a new process instance for the given process definition, puts the root-token (=main
-   * path of execution) in the start state and executes the initial node. In case the initial node
-   * is a start-state, it will behave as a wait state. For each of the optional module definitions
-   * contained in the {@link ProcessDefinition}, the corresponding module instance will be created.
+   * path of execution) in the start state and executes the initial node. In case the initial
+   * node is a start-state, it will behave as a wait state. For each of the optional module
+   * definitions contained in the {@link ProcessDefinition}, the corresponding module instance
+   * will be created.
    * 
-   * @param variables will be inserted into the context variables after the context submodule has
-   *        been created and before the process-start event is fired, which is also before the
-   *        execution of the initial node.
+   * @param variables will be inserted into the context variables after the context submodule
+   *        has been created and before the process-start event is fired, which is also before
+   *        the execution of the initial node.
    * @throws JbpmException if processDefinition is null.
    */
   public ProcessInstance(ProcessDefinition processDefinition, Map variables, String key) {
@@ -187,7 +189,8 @@
    */
   public ModuleInstance addInstance(ModuleInstance moduleInstance) {
     if (moduleInstance == null) {
-      throw new IllegalArgumentException("can't add a null moduleInstance to a process instance");
+      throw new IllegalArgumentException(
+          "can't add a null moduleInstance to a process instance");
     }
     if (instances == null) instances = new HashMap();
     instances.put(moduleInstance.getClass().getName(), moduleInstance);
@@ -205,7 +208,8 @@
           "can't remove a null moduleInstance from a process instance");
     }
     if (instances != null) {
-      removedModuleInstance = (ModuleInstance) instances.remove(moduleInstance.getClass().getName());
+      removedModuleInstance = (ModuleInstance) instances.remove(moduleInstance.getClass()
+          .getName());
       if (removedModuleInstance != null) {
         moduleInstance.setProcessInstance(null);
       }
@@ -235,8 +239,7 @@
 
         }
         catch (Exception e) {
-          throw new JbpmException("couldn't instantiate transient module '"
-              + clazz.getName()
+          throw new JbpmException("couldn't instantiate transient module '" + clazz.getName()
               + "' with the default constructor");
         }
         transientInstances.put(clazz.getName(), moduleInstance);
@@ -261,8 +264,9 @@
   }
 
   /**
-   * process instance extension for logging. Probably you don't need to access the logging instance
-   * directly. Mostly, {@link Token#addLog(ProcessLog)} is sufficient and more convenient.
+   * process instance extension for logging. Probably you don't need to access the logging
+   * instance directly. Mostly, {@link Token#addLog(ProcessLog)} is sufficient and more
+   * convenient.
    */
   public LoggingInstance getLoggingInstance() {
     return (LoggingInstance) getInstance(LoggingInstance.class);
@@ -336,7 +340,7 @@
         superProcessToken.signal(superExecutionContext);
       }
 
-      // make sure jobs for this process instance are canceled 
+      // make sure jobs for this process instance are canceled
       // after the process end updates are posted to the database
       JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
       if (jbpmContext != null) {
@@ -355,8 +359,8 @@
   }
 
   /**
-   * suspends this execution. This will make sure that tasks, timers and messages related to this
-   * process instance will not show up in database queries.
+   * suspends this execution. This will make sure that tasks, timers and messages related to
+   * this process instance will not show up in database queries.
    * 
    * @see #resume()
    */
@@ -366,9 +370,10 @@
   }
 
   /**
-   * resumes a suspended execution. All timers that have been suspended might fire if the duedate
-   * has been passed. If an admin resumes a process instance, the option should be offered to
-   * update, remove and create the timers and messages related to this process instance.
+   * resumes a suspended execution. All timers that have been suspended might fire if the
+   * duedate has been passed. If an admin resumes a process instance, the option should be
+   * offered to update, remove and create the timers and messages related to this process
+   * instance.
    * 
    * @see #suspend()
    */
@@ -471,12 +476,25 @@
   }
 
   // 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);
+    if (o == this) return true;
+    if (!(o instanceof ProcessInstance)) return false;
+
+    ProcessInstance other = (ProcessInstance) o;
+    return id != 0 ? id == other.getId() : (key != null ? key.equals(other.getKey())
+        : other.getKey() == null)
+        && processDefinition.equals(other.getProcessDefinition());
   }
 
+  public int hashCode() {
+    if (id != 0) return (int) (id ^ (id >>> 32));
+
+    int result = 295436291 + (key != null ? key.hashCode() : 0);
+    result = 1367411281 * result + processDefinition.hashCode();
+    return result;
+  }
+
   public String toString() {
     return "ProcessInstance"
         + (key != null ? '(' + key + ')' : id != 0 ? "(" + id + ')'

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Token.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Token.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/exe/Token.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -52,39 +52,37 @@
 import org.jbpm.svc.Services;
 import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
 import org.jbpm.util.Clock;
-import org.jbpm.util.EqualsUtil;
 
 /**
  * represents one path of execution and maintains a pointer to a node in the
- * {@link org.jbpm.graph.def.ProcessDefinition}. Most common way to get a hold of the token objects
- * is with {@link ProcessInstance#getRootToken()} or
+ * {@link org.jbpm.graph.def.ProcessDefinition}. Most common way to get a hold of the token
+ * objects is with {@link ProcessInstance#getRootToken()} or
  * {@link org.jbpm.graph.exe.ProcessInstance#findToken(String)}.
  */
 public class Token implements Identifiable, Serializable {
 
   private static final long serialVersionUID = 1L;
 
-  long id = 0;
-  int version = 0;
-  protected String name = null;
-  protected Date start = null;
-  protected Date end = null;
-  protected Node node = null;
-  protected Date nodeEnter = null;
-  protected ProcessInstance processInstance = null;
-  protected Token parent = null;
-  protected Map children = null;
-  protected List comments = null;
-  protected ProcessInstance subProcessInstance = null;
-  protected int nextLogIndex = 0;
+  long id;
+  int version;
+  protected String name;
+  protected Date start;
+  protected Date end;
+  protected Node node;
+  protected Date nodeEnter;
+  protected ProcessInstance processInstance;
+  protected Token parent;
+  protected Map children;
+  protected List comments;
+  protected ProcessInstance subProcessInstance;
+  protected int nextLogIndex;
   boolean isAbleToReactivateParent = true;
-  boolean isTerminationImplicit = false;
-  boolean isSuspended = false;
-  String lock = null;
+  boolean isTerminationImplicit;
+  boolean isSuspended;
+  String lock;
 
   // constructors
-  // ////////////////////
-  ///////////////////////////////////////////////////////
+  // /////////////////////////////////////////////////////
 
   public Token() {
   }
@@ -98,8 +96,8 @@
     this.node = processInstance.getProcessDefinition().getStartState();
     this.isTerminationImplicit = processInstance.getProcessDefinition().isTerminationImplicit();
 
-    // optimization: assigning an id is not necessary since the process instance will be saved shortly.
-    // Services.assignId(this);
+    // assign an id to this token before events get fired
+    Services.assignId(this);
   }
 
   /**
@@ -130,33 +128,30 @@
   }
 
   /**
-   * provides a signal to the token. this method activates this token and leaves the current state
-   * over the default transition.
+   * provides a signal to the token. this method activates this token and leaves the current
+   * state over the default transition.
    */
   public void signal() {
     if (node == null) {
-      throw new JbpmException("token '"
-          + this
+      throw new JbpmException("token '" + this
           + "' can't be signalled cause it is currently not positioned in a node");
     }
     if (node.getDefaultLeavingTransition() == null) {
-      throw new JbpmException("couldn't signal "
-          + this
-          + " : node "
-          + node
+      throw new JbpmException("couldn't signal " + this + " : node " + node
           + " has no default transition");
     }
     signal(node.getDefaultLeavingTransition(), new ExecutionContext(this));
   }
 
   /**
-   * Provides a signal to the token. This leave the current state over the given transition name.
+   * Provides a signal to the token. This leave the current state over the given transition
+   * name.
    */
   public void signal(String transitionName) {
-    if (node == null)
-      throw new JbpmException("token '"
-          + this
+    if (node == null) {
+      throw new JbpmException("token '" + this
           + "' can't be signalled cause it is currently not positioned in a node");
+    }
 
     Transition leavingTransition = node.getLeavingTransition(transitionName);
 
@@ -178,7 +173,8 @@
   }
 
   /**
-   * provides a signal to the token. this leave the current state over the given transition name.
+   * provides a signal to the token. this leave the current state over the given transition
+   * name.
    */
   public void signal(Transition transition) {
     signal(transition, new ExecutionContext(this));
@@ -204,10 +200,7 @@
       throw new JbpmException("this token is locked by " + lock);
     }
     if (hasEnded()) {
-      throw new JbpmException("Token '"
-          + name
-          + "' ("
-          + id
+      throw new JbpmException("Token '" + name + "' (" + id
           + ") is already ended and cannot be signaled");
     }
 
@@ -245,8 +238,8 @@
   }
 
   /**
-   * adds available transitions of that node to the Set and after that calls itself recursivly for
-   * the SuperSate of the Node if it has a super state
+   * adds available transitions of that node to the Set and after that calls itself recursivly
+   * for the SuperSate of the Node if it has a super state
    */
   private void addAvailableTransitionsOfNode(Node currentNode, Set availableTransitions) {
     List leavingTransitions = currentNode.getLeavingTransitions();
@@ -256,8 +249,8 @@
         Transition transition = (Transition) iter.next();
         String conditionExpression = transition.getCondition();
         if (conditionExpression != null) {
-          Object result = JbpmExpressionEvaluator.evaluate(conditionExpression,
-              new ExecutionContext(this));
+          Object result = JbpmExpressionEvaluator.evaluate(conditionExpression, new ExecutionContext(
+              this));
           if ((result instanceof Boolean) && (((Boolean) result).booleanValue())) {
             availableTransitions.add(transition);
           }
@@ -273,9 +266,9 @@
   }
 
   /**
-   * ends this token and all of its children (if any). this is the last active (=not-ended) child of
-   * a parent token, the parent token will be ended as well and that verification will continue to
-   * propagate.
+   * ends this token and all of its children (if any). this is the last active (=not-ended)
+   * child of a parent token, the parent token will be ended as well and that verification will
+   * continue to propagate.
    */
   public void end() {
     end(true);
@@ -284,10 +277,10 @@
   /**
    * ends this token with optional parent ending verification.
    * 
-   * @param verifyParentTermination specifies if the parent token should be checked for termination.
-   *          if verifyParentTermination is set to true and this is the last non-ended child of a
-   *          parent token, the parent token will be ended as well and the verification will
-   *          continue to propagate.
+   * @param verifyParentTermination specifies if the parent token should be checked for
+   *        termination. if verifyParentTermination is set to true and this is the last
+   *        non-ended child of a parent token, the parent token will be ended as well and the
+   *        verification will continue to propagate.
    */
   public void end(boolean verifyParentTermination) {
     // if not already ended
@@ -315,7 +308,7 @@
         subProcessInstance.end();
       }
 
-      // only log the end of child-tokens. the process instance logs replace the root token logs.
+      // only log child-token ends. process instance logs replace root token logs.
       if (parent != null) {
         // add a log
         parent.addLog(new TokenEndLog(this));
@@ -402,8 +395,8 @@
   }
 
   /**
-   * convenience method for starting a composite log. When you add composite logs, make sure you put
-   * the {@link #endCompositeLog()} in a finally block.
+   * convenience method for starting a composite log. When you add composite logs, make sure you
+   * put the {@link #endCompositeLog()} in a finally block.
    */
   public void startCompositeLog(CompositeLog compositeLog) {
     LoggingInstance li = (LoggingInstance) processInstance.getInstance(LoggingInstance.class);
@@ -425,10 +418,6 @@
 
   // various information extraction methods ///////////////////////////////////
 
-  public String toString() {
-    return "Token(" + getFullName() + ')';
-  }
-
   public boolean hasEnded() {
     return (end != null);
   }
@@ -645,12 +634,31 @@
   }
 
   // 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);
+    if (o == this) return true;
+    if (!(o instanceof Token)) return false;
+
+    Token other = (Token) o;
+    return id != 0 ? id == other.getId() : (name != null ? name.equals(other.getName())
+        : other.getName() == null)
+        && (parent != null ? parent.equals(other.getParent())
+            : processInstance.equals(other.getProcessInstance()));
   }
 
+  public int hashCode() {
+    if (id != 0) return (int) (id ^ (id >>> 32));
+
+    int result = 2080763213 + (name != null ? name.hashCode() : 0);
+    result = 1076685199 * result
+        + (parent != null ? parent.hashCode() : processInstance.hashCode());
+    return result;
+  }
+
+  public String toString() {
+    return "Token(" + getFullName() + ')';
+  }
+
   public ProcessInstance createSubProcessInstance(ProcessDefinition subProcessDefinition) {
     // create the new sub process instance
     subProcessInstance = new ProcessInstance(subProcessDefinition);
@@ -663,9 +671,9 @@
   }
 
   /**
-   * locks a process instance for further execution. A locked token cannot continue execution. This
-   * is a non-persistent operation. This is used to prevent tokens being propagated during the
-   * execution of actions.
+   * locks a process instance for further execution. A locked token cannot continue execution.
+   * This is a non-persistent operation. This is used to prevent tokens being propagated during
+   * the execution of actions.
    * 
    * @see #unlock(String)
    */
@@ -674,13 +682,8 @@
       throw new JbpmException("can't lock with null value for the lockOwnerId");
     }
     if ((lock != null) && (!lock.equals(lockOwnerId))) {
-      throw new JbpmException("token '"
-          + id
-          + "' can't be locked by '"
-          + lockOwnerId
-          + "' cause it's already locked by '"
-          + lock
-          + "'");
+      throw new JbpmException(this + " cannot be locked by '" + lockOwnerId
+          + "' because it is already locked by '" + lock + "'");
     }
     log.debug("token[" + id + "] is locked by " + lockOwnerId);
     lock = lockOwnerId;
@@ -691,29 +694,21 @@
    */
   public void unlock(String lockOwnerId) {
     if (lock == null) {
-      log.warn("lock owner '"
-          + lockOwnerId
-          + "' tries to unlock token '"
-          + id
+      log.warn("lock owner '" + lockOwnerId + "' tries to unlock token '" + id
           + "' which is not locked");
     }
     else if (!lock.equals(lockOwnerId)) {
-      throw new JbpmException("'"
-          + lockOwnerId
-          + "' can't unlock token '"
-          + id
-          + "' because it was already locked by '"
-          + lock
-          + "'");
+      throw new JbpmException("'" + lockOwnerId + "' can't unlock token '" + id
+          + "' because it was already locked by '" + lock + "'");
     }
     log.debug("token[" + id + "] is unlocked by " + lockOwnerId);
     lock = null;
   }
 
   /**
-   * force unlocking the token, even if the owner is not known. In some use cases (e.g. in the jbpm
-   * esb integration) the lock is persistent, so a state can be reached where the client needs a
-   * possibility to force unlock of a token without knowing the owner. See
+   * force unlocking the token, even if the owner is not known. In some use cases (e.g. in the
+   * jbpm esb integration) the lock is persistent, so a state can be reached where the client
+   * needs a possibility to force unlock of a token without knowing the owner. See
    * https://jira.jboss.org/jira/browse/JBPM-1888
    */
   public void foreUnlock() {

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Decision.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Decision.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/Decision.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -43,7 +43,6 @@
  */
 public class Decision extends Node implements Parsable {
 
-  static final String NEWLINE = System.getProperty("line.separator");
   static final String DECISION_CONDITION_RESULT = "decision_condition_result";
   static final long serialVersionUID = 1L;
 
@@ -63,7 +62,6 @@
   }
 
   public void read(Element decisionElement, JpdlXmlReader jpdlReader) {
-
     String expression = decisionElement.attributeValue("expression");
     Element decisionHandlerElement = decisionElement.element("handler");
 
@@ -166,7 +164,6 @@
       catch (Exception exception) {
         raiseException(exception, executionContext);
       }
-
     }
     finally {
       Thread.currentThread().setContextClassLoader(surroundingClassLoader);

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessFactory.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessFactory.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/ProcessFactory.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -44,6 +44,7 @@
       Node from = pd.getNode( parsedTransition[0] );
       Node to = pd.getNode( parsedTransition[2] );
       Transition t = new Transition( parsedTransition[1] );
+      t.setProcessDefinition(pd);
       from.addLeavingTransition(t);
       to.addArrivingTransition(t);
     }

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/TaskNode.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/TaskNode.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/node/TaskNode.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -168,8 +168,8 @@
 
   public void addTask(Task task) {
     if (tasks == null) tasks = new HashSet();
+    task.setTaskNode(this);
     tasks.add(task);
-    task.setTaskNode(this);
   }
 
   // node behaviour methods

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -32,42 +32,48 @@
  * defines a task and how the actor must be calculated at runtime.
  */
 public class Task extends GraphElement {
-  
+
   private static final long serialVersionUID = 1L;
-  
+
   public static final int PRIORITY_HIGHEST = 1;
   public static final int PRIORITY_HIGH = 2;
   public static final int PRIORITY_NORMAL = 3;
   public static final int PRIORITY_LOW = 4;
   public static final int PRIORITY_LOWEST = 5;
-  
+
   public static int parsePriority(String priorityText) {
-    if ("highest".equalsIgnoreCase(priorityText)) return PRIORITY_HIGHEST;
-    else if ("high".equalsIgnoreCase(priorityText)) return PRIORITY_HIGH;
-    else if ("normal".equalsIgnoreCase(priorityText)) return PRIORITY_NORMAL;
-    else if ("low".equalsIgnoreCase(priorityText)) return PRIORITY_LOW;
+    if ("highest".equalsIgnoreCase(priorityText))
+      return PRIORITY_HIGHEST;
+    else if ("high".equalsIgnoreCase(priorityText))
+      return PRIORITY_HIGH;
+    else if ("normal".equalsIgnoreCase(priorityText))
+      return PRIORITY_NORMAL;
+    else if ("low".equalsIgnoreCase(priorityText))
+      return PRIORITY_LOW;
     else if ("lowest".equalsIgnoreCase(priorityText)) return PRIORITY_LOWEST;
     try {
       return Integer.parseInt(priorityText);
-    } catch (NumberFormatException e) {
-      throw new JbpmException("priority '"+priorityText+"' could not be parsed as a priority");
     }
+    catch (NumberFormatException e) {
+      throw new JbpmException("'" + priorityText
+          + "' could not be parsed as a priority");
+    }
   }
 
-  protected boolean isBlocking = false;
+  protected boolean isBlocking;
   protected boolean isSignalling = true;
-  protected String condition = null;
-  protected String dueDate = null;
+  protected String condition;
+  protected String dueDate;
   protected int priority = PRIORITY_NORMAL;
-  protected TaskNode taskNode = null;
-  protected StartState startState = null;
-  protected TaskMgmtDefinition taskMgmtDefinition = null;
-  protected Swimlane swimlane = null;
-  protected String actorIdExpression = null;
-  protected String pooledActorsExpression = null;
-  protected Delegation assignmentDelegation = null;
-  protected TaskController taskController = null;
-  
+  protected TaskNode taskNode;
+  protected StartState startState;
+  protected TaskMgmtDefinition taskMgmtDefinition;
+  protected Swimlane swimlane;
+  protected String actorIdExpression;
+  protected String pooledActorsExpression;
+  protected Delegation assignmentDelegation;
+  protected TaskController taskController;
+
   public Task() {
   }
 
@@ -77,7 +83,7 @@
 
   // event types //////////////////////////////////////////////////////////////
 
-  static final String[] supportedEventTypes = new String[]{
+  static final String[] supportedEventTypes = {
     Event.EVENTTYPE_TASK_CREATE,
     Event.EVENTTYPE_TASK_ASSIGN,
     Event.EVENTTYPE_TASK_START,
@@ -88,26 +94,26 @@
   }
 
   // task instance factory methods ////////////////////////////////////////////
-  
+
   /**
-   * sets the taskNode unidirectionally.  use {@link TaskNode#addTask(Task)} to create 
-   * a bidirectional relation.
+   * sets the taskNode unidirectionally. use {@link TaskNode#addTask(Task)} to create a
+   * bidirectional relation.
    */
   public void setTaskNode(TaskNode taskNode) {
     this.taskNode = taskNode;
   }
-  
+
   /**
-   * sets the taskMgmtDefinition unidirectionally.  use TaskMgmtDefinition.addTask to create 
-   * a bidirectional relation.
+   * sets the taskMgmtDefinition unidirectionally. use TaskMgmtDefinition.addTask to create a
+   * bidirectional relation.
    */
   public void setTaskMgmtDefinition(TaskMgmtDefinition taskMgmtDefinition) {
     this.taskMgmtDefinition = taskMgmtDefinition;
   }
 
   /**
-   * sets the swimlane.  Since a task can have max one of swimlane or assignmentHandler, 
-   * this method removes the swimlane if it is set.
+   * sets the swimlane. Since a task can have max one of swimlane or assignmentHandler, this
+   * method removes the swimlane if it is set.
    */
   public void setAssignmentDelegation(Delegation assignmentDelegation) {
     this.actorIdExpression = null;
@@ -115,35 +121,37 @@
     this.assignmentDelegation = assignmentDelegation;
     this.swimlane = null;
   }
+
   /**
-   * sets the actorId expression.  The assignmentExpression is a JSF-like
-   * expression to perform assignment.  Since a task can have max one of swimlane or 
-   * assignmentHandler, this method removes the swimlane and assignmentDelegation if 
-   * it is set.
+   * sets the actorId expression. The assignmentExpression is a JSF-like expression to perform
+   * assignment. Since a task can have max one of swimlane or assignmentHandler, this method
+   * removes the swimlane and assignmentDelegation if it is set.
    */
   public void setActorIdExpression(String actorIdExpression) {
     this.actorIdExpression = actorIdExpression;
-    // Note: combination of actorIdExpression and pooledActorsExpression is allowed 
+    // Note: combination of actorIdExpression and pooledActorsExpression is allowed
     // this.pooledActorsExpression = null;
     this.assignmentDelegation = null;
     this.swimlane = null;
   }
+
   /**
-   * sets the actorId expression.  The assignmentExpression is a JSF-like
-   * expression to perform assignment.  Since a task can have max one of swimlane or 
-   * assignmentHandler, this method removes the other forms of assignment.
+   * sets the actorId expression. The assignmentExpression is a JSF-like expression to perform
+   * assignment. Since a task can have max one of swimlane or assignmentHandler, this method
+   * removes the other forms of assignment.
    */
   public void setPooledActorsExpression(String pooledActorsExpression) {
-    // Note: combination of actorIdExpression and pooledActorsExpression is allowed 
+    // Note: combination of actorIdExpression and pooledActorsExpression is allowed
     // this.actorIdExpression = null;
     this.pooledActorsExpression = pooledActorsExpression;
     this.assignmentDelegation = null;
     this.swimlane = null;
   }
+
   /**
-   * sets the swimlane unidirectionally.  Since a task can have max one of swimlane or assignmentHandler, 
-   * this method removes the assignmentHandler and assignmentExpression if one of those isset.  To create 
-   * a bidirectional relation, use {@link Swimlane#addTask(Task)}.
+   * sets the swimlane unidirectionally. Since a task can have max one of swimlane or
+   * assignmentHandler, this method removes the assignmentHandler and assignmentExpression if
+   * one of those isset. To create a bidirectional relation, use {@link Swimlane#addTask(Task)}.
    */
   public void setSwimlane(Swimlane swimlane) {
     this.actorIdExpression = null;
@@ -155,74 +163,93 @@
   // parent ///////////////////////////////////////////////////////////////////
 
   public GraphElement getParent() {
-    if (taskNode!=null) {
+    if (taskNode != null) {
       return taskNode;
-    } 
-    if (startState!=null) {
+    }
+    if (startState != null) {
       return startState;
-    } 
+    }
     return processDefinition;
   }
-  
+
   // getters and setters //////////////////////////////////////////////////////
-  
+
   public TaskMgmtDefinition getTaskMgmtDefinition() {
     return taskMgmtDefinition;
   }
+
   public Swimlane getSwimlane() {
     return swimlane;
   }
+
   public boolean isBlocking() {
     return isBlocking;
   }
+
   public void setBlocking(boolean isBlocking) {
     this.isBlocking = isBlocking;
   }
+
   public TaskNode getTaskNode() {
     return taskNode;
   }
+
   public String getActorIdExpression() {
     return actorIdExpression;
   }
+
   public String getPooledActorsExpression() {
     return pooledActorsExpression;
   }
+
   public Delegation getAssignmentDelegation() {
     return assignmentDelegation;
   }
+
   public String getDueDate() {
     return dueDate;
   }
+
   public void setDueDate(String duedate) {
     this.dueDate = duedate;
   }
+
   public TaskController getTaskController() {
     return taskController;
   }
+
   public void setTaskController(TaskController taskController) {
     this.taskController = taskController;
   }
+
   public int getPriority() {
     return priority;
   }
+
   public void setPriority(int priority) {
     this.priority = priority;
   }
+
   public StartState getStartState() {
     return startState;
   }
+
   public void setStartState(StartState startState) {
     this.startState = startState;
   }
+
   public boolean isSignalling() {
     return isSignalling;
   }
+
   public void setSignalling(boolean isSignalling) {
     this.isSignalling = isSignalling;
   }
+
   public String getCondition() {
     return condition;
   }
+
   public void setCondition(String condition) {
     this.condition = condition;
   }

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskMgmtDefinition.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskMgmtDefinition.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskMgmtDefinition.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -68,8 +68,8 @@
 
   public void addTask( Task task ) {
     if (tasks==null) tasks = new HashMap();
+    task.setTaskMgmtDefinition(this);
     tasks.put(task.getName(), task);
-    task.setTaskMgmtDefinition(this);
   }
 
   public Map getTasks() {

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskInstance.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskInstance.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -53,37 +53,38 @@
 import org.jbpm.util.EqualsUtil;
 
 /**
- * is one task instance that can be assigned to an actor (read: put in someones task list) and that
- * can trigger the coninuation of execution of the token upon completion.
+ * is one task instance that can be assigned to an actor (read: put in someone's task list) and
+ * that can trigger the continuation of execution of the token upon completion.
  */
 public class TaskInstance extends VariableContainer implements Identifiable, Assignable {
 
   private static final long serialVersionUID = 1L;
 
-  long id = 0;
-  int version = 0;
-  protected String name = null;
-  protected String description = null;
-  protected String actorId = null;
-  protected Date create = null;
-  protected Date start = null;
-  protected Date end = null;
-  protected Date dueDate = null;
+  long id;
+  int version;
+  protected String name;
+  protected String description;
+  protected String actorId;
+  protected Date create;
+  protected Date start;
+  protected Date end;
+  protected Date dueDate;
   protected int priority = Task.PRIORITY_NORMAL;
-  protected boolean isCancelled = false;
-  protected boolean isSuspended = false;
+  protected boolean isCancelled;
+  protected boolean isSuspended;
   protected boolean isOpen = true;
   protected boolean isSignalling = true;
-  protected boolean isBlocking = false;
-  protected Task task = null;
-  protected Token token = null;
-  protected SwimlaneInstance swimlaneInstance = null;
-  protected TaskMgmtInstance taskMgmtInstance = null;
-  protected ProcessInstance processInstance = null;
-  protected Set pooledActors = null;
-  protected List comments = null;
+  protected boolean isBlocking;
+  protected Task task;
+  protected Token token;
+  protected SwimlaneInstance swimlaneInstance;
+  protected TaskMgmtInstance taskMgmtInstance;
+  protected ProcessInstance processInstance;
+  protected Set pooledActors;
+  protected List comments;
 
-  protected String previousActorId = null; // not persisted. just extra information for listeners of the assign-event
+  // not persisted. just extra information for listeners of the task-assign event
+  protected String previousActorId;
 
   public TaskInstance() {
   }
@@ -112,24 +113,19 @@
     if (taskController != null) {
       // the task controller is responsible for copying variables back into the process
       taskController.submitParameters(this);
-
-      // if there is no task controller
     }
-    else if ((token != null) && (token.getProcessInstance() != null)) {
+    // if there is no task controller
+    else if (token != null && token.getProcessInstance() != null) {
       // the default behaviour is that all task-local variables are flushed to the process
       if (variableInstances != null) {
         ContextInstance contextInstance = token.getProcessInstance().getContextInstance();
         Iterator iter = variableInstances.values().iterator();
         while (iter.hasNext()) {
           VariableInstance variableInstance = (VariableInstance) iter.next();
-          log.debug("flushing variable '"
-              + variableInstance.getName()
-              + "' from task '"
-              + name
+          log.debug("flushing variable '" + variableInstance.getName() + "' from task '" + name
               + "' to process variables");
-          // This might be optimized, but this was the simplest way to make a clone of the variable instance.
-          contextInstance.setVariable(variableInstance.getName(), variableInstance.getValue(),
-              token);
+          // this was the simplest way to clone the variable instance; might be optimized
+          contextInstance.setVariable(variableInstance.getName(), variableInstance.getValue(), token);
         }
       }
     }
@@ -160,8 +156,8 @@
       task.fireEvent(Event.EVENTTYPE_TASK_CREATE, executionContext);
     }
 
-    // WARNING: The events create and assign are fired in the right order, but
-    // the logs are still not ordered properly.
+    // WARNING: The events create and assign are fired in the right order,
+    // yet the logs are still not ordered properly.
     // See also: TaskMgmtInstance.createTaskInstance
   }
 
@@ -171,7 +167,6 @@
     Swimlane swimlane = task.getSwimlane();
     // if this task is in a swimlane
     if (swimlane != null) {
-
       // if this is a task assignment for a start-state
       if (isStartTaskInstance()) {
         // initialize the swimlane
@@ -179,23 +174,17 @@
         taskMgmtInstance.addSwimlaneInstance(swimlaneInstance);
         // with the current authenticated actor
         swimlaneInstance.setActorId(SecurityHelper.getAuthenticatedActorId());
-
       }
-      else {
-
-        // lazy initialize the swimlane...
+      else { // lazily initialize the swimlane...
         // get the swimlane instance (if there is any)
-        swimlaneInstance = taskMgmtInstance.getInitializedSwimlaneInstance(executionContext,
-            swimlane);
+        swimlaneInstance = taskMgmtInstance.getInitializedSwimlaneInstance(executionContext, swimlane);
 
         // copy the swimlaneInstance assignment into the taskInstance assignment
         copySwimlaneInstanceAssignment(swimlaneInstance);
       }
-
     }
     else { // this task is not in a swimlane
-      taskMgmtInstance.performAssignment(task.getAssignmentDelegation(),
-          task.getActorIdExpression(), task.getPooledActorsExpression(), this, executionContext);
+      taskMgmtInstance.performAssignment(task.getAssignmentDelegation(), task.getActorIdExpression(), task.getPooledActorsExpression(), this, executionContext);
     }
 
     updatePooledActorsReferences(swimlaneInstance);
@@ -203,9 +192,9 @@
 
   public boolean isStartTaskInstance() {
     boolean isStartTaskInstance = false;
-    if ((taskMgmtInstance != null) && (taskMgmtInstance.getTaskMgmtDefinition() != null)) {
-      isStartTaskInstance = ((task != null) && (task.equals(taskMgmtInstance.getTaskMgmtDefinition()
-          .getStartTask())));
+    if (taskMgmtInstance != null && taskMgmtInstance.getTaskMgmtDefinition() != null) {
+      isStartTaskInstance = task != null
+          && task.equals(taskMgmtInstance.getTaskMgmtDefinition().getStartTask());
     }
     return isStartTaskInstance;
   }
@@ -222,8 +211,8 @@
   }
 
   /**
-   * copies the assignment (that includes both the swimlaneActorId and the set of pooledActors) of
-   * the given swimlane into this taskInstance.
+   * copies the assignment (that includes both the swimlaneActorId and the set of pooledActors)
+   * of the given swimlane into this taskInstance.
    */
   public void copySwimlaneInstanceAssignment(SwimlaneInstance swimlaneInstance) {
     setSwimlaneInstance(swimlaneInstance);
@@ -243,8 +232,8 @@
   }
 
   /**
-   * (re)assign this task to the given actor. If this task is related to a swimlane instance, that
-   * swimlane instance will be updated as well.
+   * (re)assign this task to the given actor. If this task is related to a swimlane instance,
+   * that swimlane instance will be updated as well.
    */
   public void setActorId(String actorId) {
     setActorId(actorId, true);
@@ -254,8 +243,8 @@
    * (re)assign this task to the given actor.
    * 
    * @param actorId is reference to the person that is assigned to this task.
-   * @param overwriteSwimlane specifies if the related swimlane should be overwritten with the given
-   *          swimlaneActorId.
+   * @param overwriteSwimlane specifies if the related swimlane should be overwritten with the
+   *        given swimlaneActorId.
    */
   public void setActorId(String actorId, boolean overwriteSwimlane) {
     // do the actual assignment
@@ -291,7 +280,8 @@
   }
 
   /**
-   * can optionally be used to indicate that the actor is starting to work on this task instance.
+   * can optionally be used to indicate that the actor is starting to work on this task
+   * instance.
    */
   public void start() {
     if (start != null) {
@@ -315,7 +305,8 @@
   }
 
   /**
-   * convenience method that combines a {@link #setActorId(String,boolean)} and a {@link #start()}.
+   * convenience method that combines a {@link #setActorId(String,boolean)} and a
+   * {@link #start()}.
    */
   public void start(String actorId, boolean overwriteSwimlane) {
     setActorId(actorId, overwriteSwimlane);
@@ -335,8 +326,8 @@
   }
 
   /**
-   * cancels this task. This task instance will be marked as cancelled and as ended. But cancellation
-   * doesn't influence signalling and continuation of process execution.
+   * cancels this task. This task instance will be marked as cancelled and as ended. But
+   * cancellation doesn't influence signalling and continuation of process execution.
    */
   public void cancel() {
     markAsCancelled();
@@ -364,8 +355,8 @@
   }
 
   /**
-   * marks this task as done. If this task is related to a task node this might trigger a signal on
-   * the token.
+   * marks this task as done. If this task is related to a task node this might trigger a signal
+   * on the token.
    * 
    * @see #end(Transition)
    */
@@ -374,10 +365,11 @@
   }
 
   /**
-   * marks this task as done and specifies the name of a transition leaving the task-node for the
-   * case that the completion of this task instances triggers a signal on the token. If this task
-   * leads to a signal on the token, the given transition name will be used in the signal. If this
-   * task completion does not trigger execution to move on, the transitionName is ignored.
+   * marks this task as done and specifies the name of a transition leaving the task-node for
+   * the case that the completion of this task instances triggers a signal on the token. If this
+   * task leads to a signal on the token, the given transition name will be used in the signal.
+   * If this task completion does not trigger execution to move on, the transitionName is
+   * ignored.
    */
   public void end(String transitionName) {
     Transition leavingTransition = null;
@@ -393,15 +385,15 @@
       }
     }
     if (leavingTransition == null) {
-      throw new JbpmException("task node does not have leaving transition '" + transitionName + "'");
+      throw new JbpmException("task node does not have leaving transition: " + transitionName);
     }
     end(leavingTransition);
   }
 
   /**
-   * marks this task as done and specifies a transition leaving the task-node for the case that the
-   * completion of this task instances triggers a signal on the token. If this task leads to a
-   * signal on the token, the given transition name will be used in the signal. If this task
+   * marks this task as done and specifies a transition leaving the task-node for the case that
+   * the completion of this task instances triggers a signal on the token. If this task leads to
+   * a signal on the token, the given transition name will be used in the signal. If this task
    * completion does not trigger execution to move on, the transition is ignored.
    */
   public void end(Transition transition) {
@@ -437,20 +429,17 @@
       this.isSignalling = false;
 
       if (this.isStartTaskInstance() // ending start tasks always leads to a signal
-          || ((task != null) && (token != null) && (task.getTaskNode() != null) && (task.getTaskNode().completionTriggersSignal(this)))) {
+          || (task != null && token != null && task.getTaskNode() != null && task.getTaskNode()
+              .completionTriggersSignal(this))) {
 
         if (transition == null) {
-          log.debug("completion of task '"
-              + task.getName()
+          log.debug("completion of task '" + task.getName()
               + "' results in taking the default transition");
           token.signal();
         }
         else {
-          log.debug("completion of task '"
-              + task.getName()
-              + "' results in taking transition '"
-              + transition
-              + "'");
+          log.debug("completion of task '" + task.getName()
+              + "' results in taking transition '" + transition + "'");
           token.signal(transition);
         }
       }
@@ -510,8 +499,8 @@
   }
 
   /**
-   * is the list of transitions that can be used in the end method and it is null in case this is
-   * not the last task instance.
+   * is the list of transitions that can be used in the end method and it is null in case this
+   * is not the last task instance.
    */
   public List getAvailableTransitions() {
     List transitions = null;

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -21,6 +21,8 @@
  */
 package org.jbpm.util;
 
+import org.hibernate.proxy.HibernateProxy;
+
 public class EqualsUtil {
 
   private EqualsUtil() {
@@ -28,37 +30,8 @@
   }
 
   public static boolean equals(Object thisObject, Object otherObject) {
-    if ((thisObject == null) || (otherObject == null)) return false;
-
-    if (isProxy(otherObject)) {
-      return otherObject.equals(thisObject);
-    }
-    else {
-      return otherObject == thisObject;
-    }
+    return thisObject == otherObject || otherObject instanceof HibernateProxy
+        && otherObject.equals(thisObject);
   }
 
-  static boolean isInitialized = false;
-  static boolean isHibernateInClasspth = true;
-  static Class hibernateProxyClass = null;
-
-  static boolean isProxy(Object otherObject) {
-    boolean isProxy = false;
-    if (!isInitialized) initializeHibernateProxyClass();
-
-    if (isHibernateInClasspth) {
-      return hibernateProxyClass.isAssignableFrom(otherObject.getClass());
-    }
-    return isProxy;
-  }
-
-  static synchronized void initializeHibernateProxyClass() {
-    try {
-      hibernateProxyClass = ClassLoaderUtil.classForName("org.hibernate.proxy.HibernateProxy");
-    }
-    catch (RuntimeException e) {
-      isHibernateInClasspth = false;
-    }
-    isInitialized = true;
-  }
 }

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/context/exe/ContextInstance.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/context/exe/ContextInstance.hbm.xml	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/context/exe/ContextInstance.hbm.xml	2009-08-19 11:34:10 UTC (rev 5492)
@@ -15,7 +15,7 @@
       <key column="CONTEXTINSTANCE_" on-delete="cascade" />
       -->
       <key column="CONTEXTINSTANCE_" />
-      <index-many-to-many column="TOKEN_" class="org.jbpm.graph.exe.Token" />
+      <map-key-many-to-many column="TOKEN_" class="org.jbpm.graph.exe.Token"/>
       <one-to-many class="org.jbpm.context.exe.TokenVariableMap" />
     </map>
   

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/JbpmContextTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/JbpmContextTest.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/JbpmContextTest.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -21,6 +21,7 @@
  */
 package org.jbpm;
 
+import org.jbpm.graph.def.ProcessDefinition;
 import org.jbpm.graph.exe.ProcessInstance;
 import org.jbpm.logging.LoggingService;
 import org.jbpm.logging.log.MessageLog;
@@ -164,16 +165,15 @@
     try {
       customLoggingService = (CustomLoggingService) jbpmContext.getServices().getLoggingService();
       messageLog = new MessageLog("blablabla");
-      ProcessInstance processInstance = new ProcessInstance();
+      ProcessInstance processInstance = new ProcessInstance(new ProcessDefinition());
       processInstance.getLoggingInstance().addLog(messageLog);
       jbpmContext.save(processInstance);
-
     }
     finally {
       jbpmContext.close();
     }
     assertEquals(messageLog, customLoggingService.processLog);
-    assertEquals(1, customLoggingService.invocationCount);
+    assertEquals(2, customLoggingService.invocationCount); // count process instance create log
   }
 
   public static class TestSaveOperation implements SaveOperation {

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/graph/exe/ActionExceptionsTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/graph/exe/ActionExceptionsTest.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/graph/exe/ActionExceptionsTest.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -23,55 +23,64 @@
 
 import org.jbpm.AbstractJbpmTestCase;
 import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.def.DelegationException;
 import org.jbpm.graph.def.ProcessDefinition;
 
-public class ActionExceptionsTest extends AbstractJbpmTestCase
-{
+public class ActionExceptionsTest extends AbstractJbpmTestCase {
 
-  public static class FailingAction implements ActionHandler
-  {
+  public static class FailingAction implements ActionHandler {
     private static final long serialVersionUID = 1L;
 
-    public void execute(ExecutionContext context)
-    {
+    public void execute(ExecutionContext context) {
       throw new IllegalArgumentException();
     }
   }
 
-  public void testFailingReferenced() throws Exception
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>" + "  <start-state name='start'>" + "    <transition to='state'/>"
-        + "  </start-state>" + "  <state name='state'>" + "    <transition to='end'>" + "      <action ref-name='failing'/>" + "    </transition>" + "  </state>"
-        + "  <end-state name='end'/>" + "  <action name='failing' class='org.jbpm.graph.exe.ActionExceptionsTest$FailingAction'/>" + "</process-definition>");
+  public void testFailingReferenced() throws Exception {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+        + "  <start-state name='start'>"
+        + "    <transition to='state'/>"
+        + "  </start-state>"
+        + "  <state name='state'>"
+        + "    <transition to='end'>"
+        + "      <action ref-name='failing'/>"
+        + "    </transition>"
+        + "  </state>"
+        + "  <end-state name='end'/>"
+        + "  <action name='failing' class='org.jbpm.graph.exe.ActionExceptionsTest$FailingAction'/>"
+        + "</process-definition>");
     ProcessInstance pi = new ProcessInstance(processDefinition);
 
     pi.signal();
-    try
-    {
+    try {
       pi.signal();
     }
-    catch (RuntimeException e)
-    {
+    catch (DelegationException e) {
       assertTrue(e.getCause() instanceof IllegalArgumentException);
       return;
     }
     fail("should have throws IllegalArgumentException");
   }
 
-  public void testFailingNotReferenced() throws Exception
-  {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>" + "  <start-state name='start'>" + "    <transition to='state'/>"
-        + "  </start-state>" + "  <state name='state'>" + "    <transition to='end'>" + "      <action class='org.jbpm.graph.exe.ActionExceptionsTest$FailingAction'/>"
-        + "    </transition>" + "  </state>" + "  <end-state name='end'/>" + "</process-definition>");
+  public void testFailingNotReferenced() throws Exception {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+        + "  <start-state name='start'>"
+        + "    <transition to='state'/>"
+        + "  </start-state>"
+        + "  <state name='state'>"
+        + "    <transition to='end'>"
+        + "      <action class='org.jbpm.graph.exe.ActionExceptionsTest$FailingAction'/>"
+        + "    </transition>"
+        + "  </state>"
+        + "  <end-state name='end'/>"
+        + "</process-definition>");
     ProcessInstance pi = new ProcessInstance(processDefinition);
 
     pi.signal();
-    try
-    {
+    try {
       pi.signal();
     }
-    catch (RuntimeException e)
-    {
+    catch (DelegationException e) {
       assertTrue(e.getCause() instanceof IllegalArgumentException);
       return;
     }

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2094/JBPM2094Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2094/JBPM2094Test.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2094/JBPM2094Test.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -61,7 +61,7 @@
     for (int i = 0; i < INSTANCE_COUNT; i++) {
       newTransaction();
       ProcessInstance processInstance = new ProcessInstance(processDefinition);
-      processInstance.getContextInstance().setVariable("theBody", "conkersbadfurday".getBytes());
+      processInstance.getContextInstance().setVariable("theBody", getName().getBytes());
       processInstance.signal();
 
       jbpmContext.save(processInstance);
@@ -75,4 +75,5 @@
       assertTrue("expected " + processInstance + " to have ended", processInstance.hasEnded());
     }
   }
+
 }

Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2489/JBPM2489Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2489/JBPM2489Test.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2489/JBPM2489Test.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.jbpm2489;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * Process loses access to process variables when timer is used inside forked process
+ * 
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2489">JBPM-2489</a>
+ * @author Alejandro Guizar
+ */
+public class JBPM2489Test extends AbstractDbTestCase {
+
+  private long processDefinitionId;
+
+  private static final int TIMEOUT = 60 * 1000;
+
+  protected void setUp() throws Exception {
+    super.setUp();
+
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/jbpm2489/processdefinition.xml");
+    jbpmContext.deployProcessDefinition(processDefinition);
+    processDefinitionId = processDefinition.getId();
+  }
+
+  protected void tearDown() throws Exception {
+    graphSession.deleteProcessDefinition(processDefinitionId);
+
+    super.tearDown();
+  }
+
+  public void testLostAccessToVariableWithTimer() {
+    newTransaction();
+    ProcessInstance processInstance = jbpmContext.newProcessInstance("bpm_orchestration2");
+    processInstance.getContextInstance().setVariable("theBody", getName().getBytes());
+    processInstance.signal();
+    jbpmContext.save(processInstance);
+
+    processJobs(TIMEOUT);
+
+    processInstance = jbpmContext.getProcessInstance(processInstance.getId());
+    assertTrue("expected " + processInstance + " to have ended", processInstance.hasEnded());
+  }
+}

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -3,6 +3,7 @@
 import org.jbpm.AbstractJbpmTestCase;
 import org.jbpm.JbpmConfiguration;
 import org.jbpm.JbpmContext;
+import org.jbpm.JbpmException;
 import org.jbpm.graph.def.ActionHandler;
 import org.jbpm.graph.def.ProcessDefinition;
 import org.jbpm.graph.exe.ExecutionContext;
@@ -157,7 +158,7 @@
 
       contextLoadedActionInvocations++;
 
-      throw new Exception("simulate exception");
+      throw new JbpmException("simulate exception");
     }
   }
 
@@ -189,7 +190,7 @@
       processInstance.signal();
 
     }
-    catch (Exception ex) {
+    catch (JbpmException ex) {
       assertEquals(1, contextLoadedActionInvocations);
       assertEquals("simulate exception", ex.getMessage());
       assertSame(testContextClassLoader, Thread.currentThread().getContextClassLoader());

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskInstanceEndTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskInstanceEndTest.java	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskInstanceEndTest.java	2009-08-19 11:34:10 UTC (rev 5492)
@@ -35,20 +35,19 @@
 public class TaskInstanceEndTest extends AbstractJbpmTestCase {
 
   public void testStartTaskInstanceStressed() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <task name='get it going' />" +
-      "    <transition name='stressed' to='calm down' />" +
-      "    <transition name='relaxed' to='first things first' />" +
-      "  </start-state>" +
-      "  <state name='calm down' />" +
-      "  <state name='first things first' />" +
-      "</process-definition>"
-    );
-    
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+        + "  <start-state>"
+        + "    <task name='get it going' />"
+        + "    <transition name='stressed' to='calm down' />"
+        + "    <transition name='relaxed' to='first things first' />"
+        + "  </start-state>"
+        + "  <state name='calm down' />"
+        + "  <state name='first things first' />"
+        + "</process-definition>");
+
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
-    TaskInstance startTaskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
+    TaskInstance startTaskInstance = processInstance.getTaskMgmtInstance()
+        .createStartTaskInstance();
     startTaskInstance.end("stressed");
 
     Node calmDown = processDefinition.getNode("calm down");
@@ -56,20 +55,19 @@
   }
 
   public void testStartTaskInstanceRelaxed() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <task name='get it going' />" +
-      "    <transition name='stressed' to='calm down' />" +
-      "    <transition name='relaxed' to='first things first' />" +
-      "  </start-state>" +
-      "  <state name='calm down' />" +
-      "  <state name='first things first' />" +
-      "</process-definition>"
-    );
-    
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+        + "  <start-state>"
+        + "    <task name='get it going' />"
+        + "    <transition name='stressed' to='calm down' />"
+        + "    <transition name='relaxed' to='first things first' />"
+        + "  </start-state>"
+        + "  <state name='calm down' />"
+        + "  <state name='first things first' />"
+        + "</process-definition>");
+
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
-    TaskInstance startTaskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
+    TaskInstance startTaskInstance = processInstance.getTaskMgmtInstance()
+        .createStartTaskInstance();
     startTaskInstance.end("relaxed");
 
     Node ftf = processDefinition.getNode("first things first");
@@ -77,28 +75,27 @@
   }
 
   public void testTaskNodeStressed() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='get it going' />" +
-      "  </start-state>" +
-      "  <task-node name='get it going'>" +
-      "    <task name='get it going' />" +
-      "    <transition name='stressed' to='calm down' />" +
-      "    <transition name='relaxed' to='first things first' />" +
-      "  </task-node>" +
-      "  <state name='calm down' />" +
-      "  <state name='first things first' />" +
-      "</process-definition>"
-    );
-    
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+        + "  <start-state>"
+        + "    <transition to='get it going' />"
+        + "  </start-state>"
+        + "  <task-node name='get it going'>"
+        + "    <task name='get it going' />"
+        + "    <transition name='stressed' to='calm down' />"
+        + "    <transition name='relaxed' to='first things first' />"
+        + "  </task-node>"
+        + "  <state name='calm down' />"
+        + "  <state name='first things first' />"
+        + "</process-definition>");
+
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     Token rootToken = processInstance.getRootToken();
     processInstance.signal();
-    List unfinishedTasks = new ArrayList(processInstance.getTaskMgmtInstance().getUnfinishedTasks(rootToken));
+    List unfinishedTasks = new ArrayList(processInstance.getTaskMgmtInstance()
+        .getUnfinishedTasks(rootToken));
     assertNotNull(unfinishedTasks);
     assertEquals(1, unfinishedTasks.size());
-    TaskInstance startTaskInstance = (TaskInstance) unfinishedTasks.get(0); 
+    TaskInstance startTaskInstance = (TaskInstance) unfinishedTasks.get(0);
     startTaskInstance.end("stressed");
 
     Node calmDown = processDefinition.getNode("calm down");
@@ -106,28 +103,27 @@
   }
 
   public void testTaskNodeRelaxed() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='get it going' />" +
-      "  </start-state>" +
-      "  <task-node name='get it going'>" +
-      "    <task name='get it going' />" +
-      "    <transition name='stressed' to='calm down' />" +
-      "    <transition name='relaxed' to='first things first' />" +
-      "  </task-node>" +
-      "  <state name='calm down' />" +
-      "  <state name='first things first' />" +
-      "</process-definition>"
-    );
-    
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+        + "  <start-state>"
+        + "    <transition to='get it going' />"
+        + "  </start-state>"
+        + "  <task-node name='get it going'>"
+        + "    <task name='get it going' />"
+        + "    <transition name='stressed' to='calm down' />"
+        + "    <transition name='relaxed' to='first things first' />"
+        + "  </task-node>"
+        + "  <state name='calm down' />"
+        + "  <state name='first things first' />"
+        + "</process-definition>");
+
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     Token rootToken = processInstance.getRootToken();
     processInstance.signal();
-    List unfinishedTasks = new ArrayList(processInstance.getTaskMgmtInstance().getUnfinishedTasks(rootToken));
+    List unfinishedTasks = new ArrayList(processInstance.getTaskMgmtInstance()
+        .getUnfinishedTasks(rootToken));
     assertNotNull(unfinishedTasks);
     assertEquals(1, unfinishedTasks.size());
-    TaskInstance startTaskInstance = (TaskInstance) unfinishedTasks.get(0); 
+    TaskInstance startTaskInstance = (TaskInstance) unfinishedTasks.get(0);
     startTaskInstance.end("relaxed");
 
     Node ftf = processDefinition.getNode("first things first");
@@ -135,31 +131,29 @@
   }
 
   public void testLastTaskNotSignalling() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='review' />" +
-      "  </start-state>" +
-      "  <task-node name='review'>" +
-      "    <task name='primary review' />" +
-      "    <task name='required secondary review' />" +
-      "    <task name='optional secondary review' signalling='false' />" +
-      "    <transition to='next phase' />" +
-      "  </task-node>" +
-      "  <state name='next phase' />" +
-      "</process-definition>"
-    );
-    
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+        + "  <start-state>"
+        + "    <transition to='review' />"
+        + "  </start-state>"
+        + "  <task-node name='review'>"
+        + "    <task name='primary review' />"
+        + "    <task name='required secondary review' />"
+        + "    <task name='optional secondary review' signalling='false' />"
+        + "    <transition to='next phase' />"
+        + "  </task-node>"
+        + "  <state name='next phase' />" + "</process-definition>");
+
     ProcessInstance processInstance = new ProcessInstance(processDefinition);
     Token rootToken = processInstance.getRootToken();
     processInstance.signal();
 
     assertEquals("review", rootToken.getNode().getName());
-    
-    Collection unfinishedTasks = processInstance.getTaskMgmtInstance().getUnfinishedTasks(rootToken);
+
+    Collection unfinishedTasks = processInstance.getTaskMgmtInstance()
+        .getUnfinishedTasks(rootToken);
     assertNotNull(unfinishedTasks);
     assertEquals(3, unfinishedTasks.size());
-    TaskInstance taskInstance = findTaskInstance("primary review", unfinishedTasks); 
+    TaskInstance taskInstance = findTaskInstance("primary review", unfinishedTasks);
     taskInstance.end();
 
     assertEquals("review", rootToken.getNode().getName());
@@ -167,61 +161,56 @@
     unfinishedTasks = processInstance.getTaskMgmtInstance().getUnfinishedTasks(rootToken);
     assertNotNull(unfinishedTasks);
     assertEquals(2, unfinishedTasks.size());
-    taskInstance = findTaskInstance("required secondary review", unfinishedTasks); 
+    taskInstance = findTaskInstance("required secondary review", unfinishedTasks);
     taskInstance.end();
 
     assertEquals("next phase", rootToken.getNode().getName());
   }
-  
+
   public void testEndTasksAttribute() {
-	    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-	      "<process-definition>" +
-	      "  <start-state>" +
-	      "    <transition to='task1' />" +
-	      "  </start-state>" +
-	      "  <task-node name='task1'>" +
-	      "    <task name='another task' blocking='false'/>" +
-	      "    <transition to='task2' />" +
-	      "  </task-node>" +
-	      "  <task-node name='task2' end-tasks='true' signal='first'>" +
-	      "    <task name='task one' blocking='false' />" +
-	      "    <task name='task two' blocking='false' />" +
-	      "    <transition to='next phase' />" +
-	      "  </task-node>" +
-	      "  <state name='next phase' />" +
-	      "</process-definition>"
-	    );
-	    
-	    ProcessInstance processInstance = new ProcessInstance(processDefinition);
-	    Token rootToken = processInstance.getRootToken();
-	    processInstance.signal();
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+        + "  <start-state>"
+        + "    <transition to='task1' />"
+        + "  </start-state>"
+        + "  <task-node name='task1'>"
+        + "    <task name='another task' blocking='false'/>"
+        + "    <transition to='task2' />"
+        + "  </task-node>"
+        + "  <task-node name='task2' end-tasks='true' signal='first'>"
+        + "    <task name='task one' blocking='false' />"
+        + "    <task name='task two' blocking='false' />"
+        + "    <transition to='next phase' />"
+        + "  </task-node>"
+        + "  <state name='next phase' />" + "</process-definition>");
 
-	    assertEquals("task1", rootToken.getNode().getName());
-	    
-	    processInstance.signal();
-	    assertEquals("task2", rootToken.getNode().getName());
-	    
-		 Collection unfinishedTasks;
-		 unfinishedTasks = processInstance.getTaskMgmtInstance().getUnfinishedTasks(rootToken);
-	    assertNotNull(unfinishedTasks);
-	    assertEquals(3, unfinishedTasks.size());
+    ProcessInstance processInstance = new ProcessInstance(processDefinition);
+    Token rootToken = processInstance.getRootToken();
+    processInstance.signal();
 
-	    TaskInstance taskInstance = findTaskInstance("task one", unfinishedTasks); 
-	    taskInstance.end();
+    assertEquals("task1", rootToken.getNode().getName());
 
-	    int n = 0;
-		 Collection tasks = processInstance.getTaskMgmtInstance().getTaskInstances();
-	    assertNotNull(unfinishedTasks);
-	    for (Iterator it = tasks.iterator(); it.hasNext();) {
-	   	 TaskInstance ti = (TaskInstance)it.next();
-	   	 if (!ti.hasEnded()) n++;
-	    }
-	    // System.out.println("There are " + n + " unfinished tasks");
-	    assertEquals(1, n);
+    processInstance.signal();
+    assertEquals("task2", rootToken.getNode().getName());
 
-	  }
+    Collection unfinishedTasks;
+    unfinishedTasks = processInstance.getTaskMgmtInstance().getUnfinishedTasks(rootToken);
+    assertNotNull(unfinishedTasks);
+    assertEquals(3, unfinishedTasks.size());
 
+    TaskInstance taskInstance = findTaskInstance("task one", unfinishedTasks);
+    taskInstance.end();
 
+    int n = 0;
+    Collection tasks = processInstance.getTaskMgmtInstance().getTaskInstances();
+    assertNotNull(unfinishedTasks);
+    for (Iterator it = tasks.iterator(); it.hasNext();) {
+      TaskInstance ti = (TaskInstance) it.next();
+      if (!ti.hasEnded()) n++;
+    }
+    // System.out.println("There are " + n + " unfinished tasks");
+    assertEquals(1, n);
+  }
+
   private TaskInstance findTaskInstance(String taskName, Collection taskInstances) {
     TaskInstance taskInstance = null;
     Iterator iter = taskInstances.iterator();

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/log4j.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/log4j.xml	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/log4j.xml	2009-08-19 11:34:10 UTC (rev 5492)
@@ -36,12 +36,12 @@
     <priority value="INFO" />
   </category>
 
+  <!--
   <category name="org.hibernate.SQL">
     <priority value="DEBUG" />
   </category>
 
-  <!--
-  <category name="org.hibernate.connection">
+  <category name="org.hibernate.type">
     <priority value="TRACE" />
   </category>
   -->

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/gpd.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/gpd.xml	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/gpd.xml	2009-08-19 11:34:10 UTC (rev 5492)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<root-container name="processDefinition1" width="806" height="809">
-  <node name="start" x="181" y="26" width="132" height="36">
+<root-container name="bpm_orchestration2" width="494" height="548">
+  <node name="Start" x="181" y="26" width="132" height="36">
     <edge>
       <label x="5" y="-10"/>
     </edge>
@@ -11,54 +11,57 @@
       <label x="5" y="-10"/>
     </edge>
   </node>
-  <node name="Validate Order" x="350" y="89" width="132" height="36">
+  <node name="Validate Order" x="178" y="93" width="132" height="36">
     <edge>
       <label x="5" y="-10"/>
     </edge>
   </node>
   <node name="fork1" x="117" y="224" width="252" height="24">
     <edge>
-      <label x="-65" y="-8"/>
+      <label x="-20" y="-8"/>
     </edge>
     <edge>
-      <label x="-107" y="-14"/>
+      <label x="-53" y="-11"/>
     </edge>
     <edge>
       <label x="21" y="-11"/>
     </edge>
   </node>
-  <node name="Los Angeles WHSE" x="178" y="298" width="132" height="36">
+  <node name="Los Angeles WHSE" x="176" y="300" width="132" height="36">
     <edge>
       <label x="5" y="-10"/>
     </edge>
+    <edge>
+      <label x="-10" y="-33"/>
+    </edge>
   </node>
-  <node name="Dallas WHSE" x="22" y="300" width="132" height="36">
+  <node name="Dallas WHSE" x="13" y="299" width="132" height="36">
     <edge>
       <label x="5" y="-10"/>
     </edge>
   </node>
-  <node name="Atlanta WHSE" x="325" y="295" width="132" height="36">
+  <node name="Atlanta WHSE" x="339" y="300" width="132" height="36">
     <edge>
       <label x="5" y="-10"/>
     </edge>
   </node>
-  <node name="join1" x="118" y="386" width="252" height="24">
+  <node name="join1" x="115" y="387" width="252" height="24">
     <edge>
       <label x="5" y="-10"/>
     </edge>
   </node>
-  <node name="Shipment Notice" x="177" y="442" width="132" height="36">
+  <node name="Shipment Notice" x="174" y="446" width="132" height="36">
     <edge>
       <label x="5" y="-10"/>
     </edge>
   </node>
-  <node name="end1" x="176" y="511" width="132" height="36"/>
-  <node name="Credit Check" x="178" y="88" width="132" height="36">
+  <node name="End" x="174" y="511" width="132" height="36"/>
+  <node name="Inventory Check" x="177" y="156" width="132" height="36">
     <edge>
       <label x="5" y="-10"/>
     </edge>
   </node>
-  <node name="Inventory Check" x="177" y="154" width="132" height="36">
+  <node name="Credit Check" x="350" y="93" width="132" height="36">
     <edge>
       <label x="5" y="-10"/>
     </edge>

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/processdefinition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/processdefinition.xml	2009-08-18 16:17:58 UTC (rev 5491)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/resources/org/jbpm/jbpm2094/processdefinition.xml	2009-08-19 11:34:10 UTC (rev 5492)
@@ -1,137 +1,128 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="processDefinition1">
+<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="bpm_orchestration2">
 
-  <start-state name="start">
-    <transition name="" to="Receive Order"/>
+  <start-state name="Start">
+    <transition to="Receive Order"/>
   </start-state>
 
   <node async="true" name="Receive Order">
-    <action name="esbAction" class="org.jbpm.jbpm2094.EsbActionHandler">
+    <action class="org.jbpm.jbpm2094.EsbActionHandler">
       <esbCategoryName>BPM_Orchestration2_Service1</esbCategoryName>
       <esbServiceName>Service1</esbServiceName>
       <bpmToEsbVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </bpmToEsbVars>
       <esbToBpmVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </esbToBpmVars>
     </action>
-    <transition to="Validate Order"/>
+    <transition to="Credit Check"/>
   </node>
 
-  <node async="true" name="Validate Order">
-    <action name="esbAction" class="org.jbpm.jbpm2094.EsbActionHandler">
+  <node name="Validate Order">
+    <action class="org.jbpm.jbpm2094.EsbActionHandler">
       <esbCategoryName>BPM_Orchestration2_Service2</esbCategoryName>
       <esbServiceName>Service2</esbServiceName>
       <bpmToEsbVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </bpmToEsbVars>
       <esbToBpmVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </esbToBpmVars>
     </action>
-    <transition to="Credit Check"/>
+    <transition to="Inventory Check"/>
   </node>
 
   <fork name="fork1">
-    <transition to="Los Angeles WHSE" name="to Los Angeles WHSE"/>
-    <transition to="Dallas WHSE" name="to Dallas WHSE"/>
-    <transition name="to Atlanta WHSE" to="Atlanta WHSE"/>
+    <transition to="Los Angeles WHSE" name="LA"/>
+    <transition to="Dallas WHSE" name="Dallas"/>
+    <transition name="Atlanta" to="Atlanta WHSE"/>
   </fork>
 
-  <node async="true" name="Los Angeles WHSE">
-    <action name="esbAction" class="org.jbpm.jbpm2094.EsbActionHandler">
-      <esbCategoryName>BPM_Orchestration2_Service5</esbCategoryName>
-      <esbServiceName>Service5</esbServiceName>
-      <bpmToEsbVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
-      </bpmToEsbVars>
-      <esbToBpmVars>
-        <mapping bpm="la" esb="BODY_CONTENT" />
-      </esbToBpmVars>
-    </action>
-    <transition name="" to="join1"/>
-  </node>
+  <state name="Los Angeles WHSE">
+    <timer duedate="2 seconds" transition="Dallas"/>
+    <transition name="OK" to="join1"/>
+    <transition to="Dallas WHSE" name="Dallas"/>
+  </state>
 
-  <node async="true" name="Dallas WHSE">
-    <action name="esbAction" class="org.jbpm.jbpm2094.EsbActionHandler">
+  <node name="Dallas WHSE">
+    <action class="org.jbpm.jbpm2094.EsbActionHandler">
       <esbCategoryName>BPM_Orchestration2_Service6</esbCategoryName>
       <esbServiceName>Service6</esbServiceName>
       <bpmToEsbVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </bpmToEsbVars>
       <esbToBpmVars>
-        <mapping bpm="dallas" esb="BODY_CONTENT" />
+        <mapping bpm="dallas" esb="BODY_CONTENT"/>
       </esbToBpmVars>
     </action>
-    <transition name="" to="join1"/>
+    <transition to="join1"/>
   </node>
 
   <node async="true" name="Atlanta WHSE">
-
-    <action name="esbAction" class="org.jbpm.jbpm2094.EsbActionHandler">
+    <action class="org.jbpm.jbpm2094.EsbActionHandler">
       <esbCategoryName>BPM_Orchestration2_Service7</esbCategoryName>
       <esbServiceName>Service7</esbServiceName>
       <bpmToEsbVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </bpmToEsbVars>
       <esbToBpmVars>
-        <mapping bpm="atlanta" esb="BODY_CONTENT" />
+        <mapping bpm="atlanta" esb="BODY_CONTENT"/>
       </esbToBpmVars>
     </action>
-    <transition name="" to="join1"/>
+    <transition to="join1"/>
   </node>
 
   <join name="join1" async="exclusive">
     <transition to="Shipment Notice"/>
   </join>
 
-  <node async="true" name="Shipment Notice">
-    <action name="esbAction" class="org.jbpm.jbpm2094.EsbActionHandler">
+  <node name="Shipment Notice">
+    <action class="org.jbpm.jbpm2094.EsbActionHandler">
       <esbCategoryName>BPM_Orchestration2_ResultsService
       </esbCategoryName>
       <esbServiceName>ResultsService</esbServiceName>
       <bpmToEsbVars>
-        <mapping bpm="atlanta" esb="atlanta" />
-        <mapping bpm="la" esb="la" />
-        <mapping bpm="dallas" esb="dallas" />
+        <mapping bpm="atlanta" esb="atlanta"/>
+        <mapping bpm="la" esb="la"/>
+        <mapping bpm="dallas" esb="dallas"/>
       </bpmToEsbVars>
       <esbToBpmVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </esbToBpmVars>
     </action>
-    <transition name="" to="end1"/>
+    <transition to="End"/>
   </node>
 
-  <end-state name="end1"/>
+  <end-state name="End"/>
 
-  <node async="true" name="Credit Check">
-    <action name="esbAction" class="org.jbpm.jbpm2094.EsbActionHandler">
-      <esbCategoryName>BPM_Orchestration2_Service3</esbCategoryName>
-      <esbServiceName>Service3</esbServiceName>
+  <node async="true" name="Inventory Check">
+    <action class="org.jbpm.jbpm2094.EsbActionHandler">
+      <esbCategoryName>BPM_Orchestration2_Service4</esbCategoryName>
+      <esbServiceName>Service4</esbServiceName>
       <bpmToEsbVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </bpmToEsbVars>
       <esbToBpmVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </esbToBpmVars>
     </action>
-    <transition to="Inventory Check"/>
+    <transition to="fork1"/>
   </node>
 
-  <node async="true" name="Inventory Check">
-    <action name="esbAction" class="org.jbpm.jbpm2094.EsbActionHandler">
-      <esbCategoryName>BPM_Orchestration2_Service4</esbCategoryName>
-      <esbServiceName>Service4</esbServiceName>
+  <node name="Credit Check">
+    <action class="org.jbpm.jbpm2094.EsbActionHandler">
+      <esbCategoryName>BPM_Orchestration2_Service3</esbCategoryName>
+      <esbServiceName>Service3</esbServiceName>
       <bpmToEsbVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </bpmToEsbVars>
       <esbToBpmVars>
-        <mapping bpm="theBody" esb="BODY_CONTENT" />
+        <mapping bpm="theBody" esb="BODY_CONTENT"/>
       </esbToBpmVars>
     </action>
-    <transition to="fork1"/>
+    <transition to="Validate Order"/>
   </node>
 
 </process-definition>



More information about the jbpm-commits mailing list