[jbpm-commits] JBoss JBPM SVN: r3179 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/session and 26 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 3 07:25:58 EST 2008


Author: tom.baeyens at jboss.com
Date: 2008-12-03 07:25:57 -0500 (Wed, 03 Dec 2008)
New Revision: 3179

Added:
   jbpm4/trunk/modules/distro/.project
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/ConfigurationTest.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/BasicVariablesTest.java
   jbpm4/trunk/modules/userguide/.settings/
   jbpm4/trunk/modules/userguide/.settings/attachedFile.properties
   jbpm4/trunk/modules/userguide/src/main/diagrams/bpmn/
   jbpm4/trunk/modules/userguide/src/main/diagrams/bpmn/loan.process.bpm
   jbpm4/trunk/modules/userguide/src/main/docbook/en/images/loan.executions.png
   jbpm4/trunk/modules/userguide/src/main/docbook/en/images/loan.process.definition.png
   jbpm4/trunk/modules/userguide/src/main/docbook/en/images/loan.process.instance.png
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
Removed:
   jbpm4/trunk/modules/task/src/main/resources/jbpm.task.queries.hbm.xml
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml
Modified:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java
   jbpm4/trunk/modules/distro/
   jbpm4/trunk/modules/distro/src/main/resources/readme.html
   jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.definition.hbm.xml
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/example02/PersistentExecutionModeTest.java
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java
   jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ProcessTest.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/StateTest.java
   jbpm4/trunk/modules/userguide/.project
   jbpm4/trunk/modules/userguide/src/main/diagrams/diagrams.mdzip
   jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml
Log:
docs and api improvements

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -23,6 +23,7 @@
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 
 /** manages runtime process executions.
@@ -33,36 +34,36 @@
 
   /** starts a new execution for the ProcessDefinition with the given processDefinitionDbid.
    * @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition. */
-  Execution startExecution(String processDefinitionId);
+  Execution startExecutionById(String processDefinitionId);
   
   /** starts a new execution for the ProcessDefinition with the given processDefinitionDbid. 
    * @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition.
    * @param executionKey is a user provided reference for the new execution that must be unique over all 
    *    process versions with the same name. */
-  Execution startExecution(String processDefinitionId, String executionKey);
+  Execution startExecutionById(String processDefinitionId, String executionKey);
 
   /** starts a new execution for the ProcessDefinition with the given processDefinitionDbid. 
    * @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition.
    * @param variables are the initial values of the process variables that will be set before the execution starts. */
-  Execution startExecution(String processDefinitionId, Map<String, Object> variables);
+  Execution startExecutionById(String processDefinitionId, Map<String, Object> variables);
 
   /** starts a new execution for the ProcessDefinition with the given processDefinitionDbid.
    * @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition.
    * @param variables are the initial values of the process variables that will be set before the execution starts.
    * @param executionKey is a user provided reference for the new execution that must be unique over all 
    *    process versions with the same name. */
-  Execution startExecution(String processDefinitionId, Map<String, Object> variables, String executionKey);
+  Execution startExecutionById(String processDefinitionId, Map<String, Object> variables, String executionKey);
 
   /** starts a new execution in the latest version of the given process definition.
   * @param processDefinitionName is the name of the process definition for which the latest version will be taken. */ 
-  Execution startExecutionInLatest(String processDefinitionName);
+  Execution startExecutionByName(String processDefinitionName);
 
   /** starts a new execution in the latest version of the given processDefinitionName.
    * @param processDefinitionName is the name of the process definition 
    *   for which the latest version will be taken. 
    * @param executionKey is a user provided reference for the new execution 
    *   that must be unique over all process versions with the same name. */
-  Execution startExecutionInLatest(String processDefinitionName, String executionKey);
+  Execution startExecutionByName(String processDefinitionName, String executionKey);
 
   /** starts a new execution in the latest version of the given processDefinitionName. 
    * @param processDefinitionName is the name of the process definition 
@@ -70,15 +71,41 @@
    * @param variables are the initial values of the process variables that 
    *   will be set before the execution starts (read: before the initial 
    *   node is executed). */
-  Execution startExecutionInLatest(String processDefinitionName, Map<String, Object> variables);
+  Execution startExecutionByName(String processDefinitionName, Map<String, Object> variables);
 
   /** starts a new execution in the latest version of the given processDefinitionName. 
    * @param processDefinitionName is the name of the process definition for which the latest version will be taken. 
    * @param variables are the initial values of the process variables that will be set before the execution starts.
    * @param executionKey is a user provided reference for the new execution that must be unique over all 
    *    process versions with the same name. */
-  Execution startExecutionInLatest(String processDefinitionName, Map<String, Object> variables, String executionKey);
+  Execution startExecutionByName(String processDefinitionName, Map<String, Object> variables, String executionKey);
 
+  /** starts a new execution in the latest version of the given process definition.
+   * @param processDefinitionKey is the key of the process definition for which the latest version will be taken. */ 
+   Execution startExecutionByKey(String processDefinitionKey);
+
+   /** starts a new execution in the latest version of the given processDefinitionName.
+    * @param processDefinitionKey is the key of the process definition 
+    *   for which the latest version will be taken. 
+    * @param executionKey is a user provided reference for the new execution 
+    *   that must be unique over all process versions with the same name. */
+   Execution startExecutionByKey(String processDefinitionKey, String executionKey);
+
+   /** starts a new execution in the latest version of the given processDefinitionName. 
+    * @param processDefinitionKey is the key of the process definition 
+    *   for which the latest version will be taken. 
+    * @param variables are the initial values of the process variables that 
+    *   will be set before the execution starts (read: before the initial 
+    *   node is executed). */
+   Execution startExecutionByKey(String processDefinitionKey, Map<String, Object> variables);
+
+   /** starts a new execution in the latest version of the given processDefinitionName. 
+    * @param processDefinitionKey is the key of the process definition for which the latest version will be taken. 
+    * @param variables are the initial values of the process variables that will be set before the execution starts.
+    * @param executionKey is a user provided reference for the new execution that must be unique over all 
+    *    process versions with the same name. */
+   Execution startExecutionByKey(String processDefinitionKey, Map<String, Object> variables, String executionKey);
+
   /** the execution that is uniquely defined by the process definition and the business key. */
   Execution findExecution(String processDefinitionName, String executionKey);
 
@@ -112,6 +139,7 @@
   Execution signalExecutionByKey(String processDefinitionName, String executionKey, String signalName, Map<String, Object> parameters);
 
   
+
   /** creates or overwrites a variable value on the referenced execution */ 
   Execution setVariable(String executionId, String name, Object value);
   
@@ -120,9 +148,12 @@
   
   /** retrieves a variable */ 
   Object getVariable(String executionId, String variableName);
-  
+
+  /** all the variables visible in the given execution scope */
+  Set<String> getVariableNames(String executionId);
+
   /** retrieves a map of variables */ 
-  Map<String, Object> getVariables(String executionId, List<String> variableNames);
+  Map<String, Object> getVariables(String executionId, Set<String> variableNames);
 
   /* delete a process instance */
   void deleteProcessInstance(String processInstanceId);

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -30,14 +30,46 @@
  */
 public interface ProcessEngine {
 
+  /** the {@link ProcessService process service} that provides access
+   * to the process repository. */ 
   ProcessService getProcessService();
+
+  /** the {@link ProcessService process service} and supply some 
+   * transactional resources.  The given transactional resources will only 
+   * be associated to the returned process service.  */ 
   ProcessService getProcessService(Map<String, Object> txResources);
+
+  /** the {@link ExecutionService execution service} that provides access
+   * to the runtime executions repository. */ 
   ExecutionService getExecutionService();
+
+  /** the {@link ExecutionService execution service} and supply some 
+   * transactional resources.  The given transactional resources will only 
+   * be associated to the returned execution service.  */ 
   ExecutionService getExecutionService(Map<String, Object> txResources);
+
+  /** the {@link TaskService task service} that exposes the 
+   * runtime human task lists. */ 
   TaskService getTaskService();
+
+  /** the {@link TaskService task service} and supply some 
+   * transactional resources.  The given transactional resources will only 
+   * be associated to the returned task service.  */ 
   TaskService getTaskService(Map<String, Object> txResources);
+
+  /** the {@link ManagementService management service} that exposes the 
+   * management operations to operators that have to keep the jBPM system 
+   * up and running. */ 
   ManagementService getManagementService();
+
+  /** the {@link ManagementService management service} and supply some 
+   * transactional resources.  The given transactional resources will only 
+   * be associated to the returned management service. */ 
   ManagementService getManagementService(Map<String, Object> txResources);
 
+  /** retrieve and object defined in the process engine by type */
   <T> T get(Class<T> type);
+
+  /** retrieve and object defined in the process engine by name */
+  Object get(String name);
 }

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/PvmDbSession.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -31,7 +31,7 @@
 import org.jbpm.job.Timer;
 
 /**
- * @author Tom Baeyens, Pascal Verdage
+ * @author Tom Baeyens
  */
 public interface PvmDbSession extends DbSession {
 
@@ -44,13 +44,16 @@
   /** specific version of a named processDefinition. */
   ClientProcessDefinition findProcessDefinitionByName(String name, int version);
 
-  /** latest version of the processDefinition with the given name. */
+  /** latest version of the processDefinition for the given name. */
   ClientProcessDefinition findLatestProcessDefinitionByName(String name);
 
   /** the process definition uniquely identified by the given 
    * processDefinition id. */
   ClientProcessDefinition findProcessDefinitionById(String processDefinitionId);
 
+  /** latest version of the processDefinition for the given key. */
+  ClientProcessDefinition findLatestProcessDefinitionByKey(String processDefinitionKey);
+
   /** the execution uniquely identified by the given executionKey. */ 
   ClientExecution findExecutionById(String executionId);
 
@@ -76,4 +79,5 @@
 
   /** delete process definition */
   void deleteProcessDefinition(String processDefinitionId, boolean deleteProcessInstances);
+
 }


Property changes on: jbpm4/trunk/modules/distro
___________________________________________________________________
Name: svn:ignore
   - target

   + target
.settings


Added: jbpm4/trunk/modules/distro/.project
===================================================================
--- jbpm4/trunk/modules/distro/.project	                        (rev 0)
+++ jbpm4/trunk/modules/distro/.project	2008-12-03 12:25:57 UTC (rev 3179)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>distro</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.stp.bpmn.validation.BatchValidationBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.stp.bpmn.validation.BatchValidationBuildAbleNature</nature>
+	</natures>
+</projectDescription>

Modified: jbpm4/trunk/modules/distro/src/main/resources/readme.html
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/readme.html	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/distro/src/main/resources/readme.html	2008-12-03 12:25:57 UTC (rev 3179)
@@ -5,6 +5,11 @@
   <body>
     <h1>Docs</h1>
     
+    <p>Currently the userguide and devguide only show well in <a href="http://www.mozilla.com/firefox">firefox</a>.
+    We'll fix this in one of the next versions.  
+    See <a href="https://jira.jboss.org/jira/browse/JBPM-1895">JBPM-1895</a>.
+    </p>
+    
     <table>
       <tr>
         <th>Link</th>

Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/test/TimerTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -21,9 +21,9 @@
  */
 package org.jbpm.enterprise.test;
 
-import java.util.ArrayList;
 import java.util.Date;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
 
 import javax.ejb.CreateException;
 import javax.naming.InitialContext;
@@ -155,7 +155,7 @@
     Date executionDate = NoisyActivity.waitFor();
     assertTrue(dueDate.compareTo(executionDate) <= 0);
 
-    List<String> variableNames = new ArrayList<String>();
+    Set<String> variableNames = new HashSet<String>();
     variableNames.add("executionDate");
     Object variableValue = commandExecutor.execute(new GetVariablesCmd(execution.getId(), variableNames));
     assertNull(variableValue);

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import java.util.Set;
+
+import org.jbpm.JbpmException;
+import org.jbpm.client.ClientExecution;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.session.PvmDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GetVariableNamesCmd implements Command<Set<String>> {
+
+  private static final long serialVersionUID = 1L;
+  
+  String executionId;
+  
+  public GetVariableNamesCmd(String executionId) {
+    if (executionId==null) {
+      throw new JbpmException("executionId is null");
+    }
+    this.executionId = executionId;
+  }
+
+  public Set<String> execute(Environment environment) throws Exception {
+    PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+    ClientExecution execution = pvmDbSession.findExecutionById(executionId);
+    return execution.getVariableKeys();
+  }
+
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -22,8 +22,8 @@
 package org.jbpm.pvm.internal.cmd;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.jbpm.JbpmException;
 import org.jbpm.client.ClientExecution;
@@ -39,9 +39,9 @@
   private static final long serialVersionUID = 1L;
   
   protected String executionId;
-  protected List<String> variableNames;
+  protected Set<String> variableNames;
   
-  public GetVariablesCmd(String executionId, List<String> variableNames) {
+  public GetVariablesCmd(String executionId, Set<String> variableNames) {
     if (executionId==null) {
       throw new JbpmException("executionId is null");
     }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -39,10 +39,24 @@
   private static final long serialVersionUID = 1L;
 
   protected String processDefinitionName;
+  protected String processDefinitionKey;
   protected String executionKey;
 
-  public StartExecutionInLatestCmd(String processDefinitionName, Map<String, Object> variables, String executionKey) {
+  public StartExecutionInLatestCmd(String processDefinitionName, String processDefinitionKey, Map<String, Object> variables, String executionKey) {
+    if ( (processDefinitionName==null)
+         && (processDefinitionKey==null)
+       ) {
+      throw new JbpmException("processDefinitionName and processDefinitionKey are both null");
+    }
+
+    if ( (processDefinitionName!=null)
+         && (processDefinitionKey!=null)
+       ) {
+      throw new JbpmException("processDefinitionName and processDefinitionKey are both not-null.  only one should be not null.");
+    }
+
     this.processDefinitionName = processDefinitionName;
+    this.processDefinitionKey = processDefinitionKey;
     this.variables = variables;
     this.executionKey = executionKey;
   }
@@ -52,9 +66,14 @@
 
     ClientProcessDefinition processDefinition = null;
     
-    processDefinition = pvmDbSession.findLatestProcessDefinitionByName(processDefinitionName);
+    if (processDefinitionName!=null) {
+      processDefinition = pvmDbSession.findLatestProcessDefinitionByName(processDefinitionName);
+    } else {
+      processDefinition = pvmDbSession.findLatestProcessDefinitionByKey(processDefinitionKey);
+    }
+
     if (processDefinition==null) {
-      throw new JbpmException("no process definition with name '"+processDefinitionName+"'");
+      throw new JbpmException("no process definition with "+(processDefinitionName!=null ? "name '"+processDefinitionName : "key '"+processDefinitionKey)+"'");
     }
     
     ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -44,7 +44,7 @@
   }
 
   private void createId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
-    if (processDefinition.getId()==null) {
+    if (processDefinition.getKey()==null) {
       String key = processDefinition.getKey();
       if (key==null) {
         key = processDefinition.getName();
@@ -57,7 +57,11 @@
       // replace any non-word character with an underscore
       key = key.replaceAll("\\W", "_");
 
-      String id = key+":"+processDefinition.getVersion();
+      processDefinition.setKey(key);
+    }
+
+    if (processDefinition.getId()==null) {
+      String id = processDefinition.getKey()+":"+processDefinition.getVersion();
       
       log.trace("created id '"+id+"' for "+processDefinition);
       processDefinition.setId(id);

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -50,30 +50,39 @@
     return session.getNamedQuery("findProcessDefinitionNames").list();
   }
 
-  public List<ClientProcessDefinition> findProcessDefinitionsByName(String name) {
+  public List<ClientProcessDefinition> findProcessDefinitionsByName(String processDefinitionName) {
     // query definition can be found at the bottom of resource jbpm.pvm.definition.hbm.xml
     Query query = session.getNamedQuery("findProcessDefinitionsByName");
-    query.setString("name", name);
+    query.setString("name", processDefinitionName);
     return query.list();
   }
 
-  public ClientProcessDefinition findProcessDefinitionByName(String name, int version) {
+  public ClientProcessDefinition findProcessDefinitionByName(String processDefinitionName, int version) {
     // query definition can be found at the bottom of resource jbpm.pvm.definition.hbm.xml
     Query query = session.getNamedQuery("findProcessDefinitionByNameAndVersion");
-    query.setString("name", name);
+    query.setString("name", processDefinitionName);
     query.setInteger("version", version);
     ClientProcessDefinition processDefinition = (ClientProcessDefinition) query.uniqueResult();
     return processDefinition;
   }
 
-  public ClientProcessDefinition findLatestProcessDefinitionByName(String name) {
+  public ClientProcessDefinition findLatestProcessDefinitionByName(String processDefinitionName) {
     // query definition can be found at the bottom of resource jbpm.pvm.definition.hbm.xml
     Query query = session.getNamedQuery("findProcessDefinitionsByName");
-    query.setString("name", name);
+    query.setString("name", processDefinitionName);
     query.setMaxResults(1);
     ClientProcessDefinition processDefinition = (ClientProcessDefinition) query.uniqueResult();
     return processDefinition;
   }
+  
+  public ClientProcessDefinition findLatestProcessDefinitionByKey(String processDefinitionKey) {
+    // query definition can be found at the bottom of resource jbpm.pvm.definition.hbm.xml
+    Query query = session.getNamedQuery("findProcessDefinitionsByKey");
+    query.setString("key", processDefinitionKey);
+    query.setMaxResults(1);
+    ClientProcessDefinition processDefinition = (ClientProcessDefinition) query.uniqueResult();
+    return processDefinition;
+  }
 
   public ClientProcessDefinition findProcessDefinitionById(String processDefinitionId) {
     // query definition can be found at the bottom of resource jbpm.pvm.definition.hbm.xml

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -25,6 +25,7 @@
 import org.jbpm.Execution;
 import org.jbpm.ProcessDefinition;
 import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
 import org.jbpm.model.IdGenerator;
 
 
@@ -32,12 +33,16 @@
  * @author Tom Baeyens
  */
 public class DefaultIdGenerator implements IdGenerator {
+  
+  private static Log log = Log.getLog(DefaultIdGenerator.class.getName());
 
   public String createId(ProcessDefinition processDefinition, Execution parent, Execution execution) {
 
     String base = null;
     if (parent!=null) {
       base = parent.getId(); 
+    } else if (processDefinition.getKey()!=null){
+      base = processDefinition.getKey();
     } else {
       base = processDefinition.getId();
     }
@@ -56,7 +61,11 @@
       executionPart = Long.toString(executionImpl.getDbid());
     }
 
-    return base+"/"+executionPart;
+    String executionId = base+"/"+executionPart;
+    
+    if (log.isDebugEnabled()) log.debug("generated execution id "+executionId);
+    
+    return executionId;
   }
 
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -28,6 +28,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
 
 import org.jbpm.Execution;
 import org.jbpm.JbpmException;
@@ -240,7 +242,7 @@
     if (parentScope!=null) {
       variableKeys = parentScope.getVariableKeys();
     } else {
-      variableKeys = new HashSet<String>();
+      variableKeys = new TreeSet<String>();
     }
     if (hasVariables) {
       variableKeys.addAll(variables.keySet());
@@ -254,7 +256,7 @@
     if (parentScope!=null) {
       values = parentScope.getVariables();
     } else {
-      values = new HashMap<String, Object>();
+      values = new TreeMap<String, Object>();
     }
     if (hasVariables) {
       for (Map.Entry<String, Variable> entry: variables.entrySet()) {

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -21,15 +21,16 @@
  */
 package org.jbpm.pvm.internal.svc;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import org.jbpm.Execution;
 import org.jbpm.ExecutionService;
 import org.jbpm.cmd.CommandService;
 import org.jbpm.pvm.internal.cmd.DeleteProcessInstance;
 import org.jbpm.pvm.internal.cmd.FindExecutionCmd;
+import org.jbpm.pvm.internal.cmd.GetVariableNamesCmd;
 import org.jbpm.pvm.internal.cmd.GetVariablesCmd;
 import org.jbpm.pvm.internal.cmd.SetVariablesCmd;
 import org.jbpm.pvm.internal.cmd.SignalCmd;
@@ -44,39 +45,57 @@
 
   protected CommandService commandService;
 
-  public Execution startExecution(String processDefinitionId){
+  public Execution startExecutionById(String processDefinitionId){
     return commandService.execute(new StartExecutionCmd(processDefinitionId, null, null));
   }
 
-  public Execution startExecution(String processDefinitionId, String executionKey) {
+  public Execution startExecutionById(String processDefinitionId, String executionKey) {
     return commandService.execute(new StartExecutionCmd(processDefinitionId, null, executionKey));
   }
 
-  public Execution startExecution(String processDefinitionId, Map<String, Object> variables){
+  public Execution startExecutionById(String processDefinitionId, Map<String, Object> variables){
     return commandService.execute(new StartExecutionCmd(processDefinitionId, variables, null));
   }
 
-  public Execution startExecution(String processDefinitionId, Map<String, Object> variables, String executionKey){
+  public Execution startExecutionById(String processDefinitionId, Map<String, Object> variables, String executionKey){
     return commandService.execute(new StartExecutionCmd(processDefinitionId, variables, executionKey));
   }
 
-  public Execution startExecutionInLatest(String processDefinitionName) {
-    return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, null, null));
+  
+  public Execution startExecutionByName(String processDefinitionName) {
+    return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, null, null, null));
   }
   
-  public Execution startExecutionInLatest(String processDefinitionName, Map<String, Object> variables){
-    return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, variables, null));
+  public Execution startExecutionByName(String processDefinitionName, Map<String, Object> variables){
+    return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, null, variables, null));
   }
   
-  public Execution startExecutionInLatest(String processDefinitionName, String executionKey) {
-    return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, null, executionKey));
+  public Execution startExecutionByName(String processDefinitionName, String executionKey) {
+    return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, null, null, executionKey));
   }
 
-  public Execution startExecutionInLatest(String processDefinitionName, Map<String, Object> variables, String executionKey){
-    return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, variables, executionKey));
+  public Execution startExecutionByName(String processDefinitionName, Map<String, Object> variables, String executionKey){
+    return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, null, variables, executionKey));
   }
 
   
+  public Execution startExecutionByKey(String processDefinitionKey) {
+    return commandService.execute(new StartExecutionInLatestCmd(null, processDefinitionKey, null, null));
+  }
+  
+  public Execution startExecutionByKey(String processDefinitionKey, Map<String, Object> variables){
+    return commandService.execute(new StartExecutionInLatestCmd(null, processDefinitionKey, variables, null));
+  }
+  
+  public Execution startExecutionByKey(String processDefinitionKey, String executionKey) {
+    return commandService.execute(new StartExecutionInLatestCmd(null, processDefinitionKey, null, executionKey));
+  }
+
+  public Execution startExecutionByKey(String processDefinitionKey, Map<String, Object> variables, String executionKey){
+    return commandService.execute(new StartExecutionInLatestCmd(null, processDefinitionKey, variables, executionKey));
+  }
+
+  
   public Execution signalExecution(String executionId) {
     return commandService.execute(new SignalCmd(executionId, null, null));
   }
@@ -139,13 +158,17 @@
   }
 
   public Object getVariable(String executionId, String variableName) {
-    List<String> variableNames = new ArrayList<String>();
+    Set<String> variableNames = new HashSet<String>();
     variableNames.add(variableName);
     Map<String, Object> variables = commandService.execute(new GetVariablesCmd(executionId, variableNames));
     return variables.get(variableName);
   }
 
-  public Map<String, Object> getVariables(String executionId, List<String> variableNames) {
+  public Set<String> getVariableNames(String executionId) {
+    return commandService.execute(new GetVariableNamesCmd(executionId));
+  }
+
+  public Map<String, Object> getVariables(String executionId, Set<String> variableNames) {
     return commandService.execute(new GetVariablesCmd(executionId, variableNames));
   }
 

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.definition.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.definition.hbm.xml	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.definition.hbm.xml	2008-12-03 12:25:57 UTC (rev 3179)
@@ -400,6 +400,15 @@
     ]]>
   </query>
 
+  <query name="findProcessDefinitionsByKey">
+    <![CDATA[
+     select process
+     from org.jbpm.pvm.internal.model.ProcessDefinitionImpl as process
+     where process.key = :key
+     order by process.version desc    
+    ]]>
+  </query>
+
   <query name="findProcessDefinitionByNameAndVersion">
     <![CDATA[
      select process

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -78,7 +78,7 @@
     Map<String, Object> variables = new HashMap<String, Object>();
     variables.put("creditRate", 7);
 
-    Execution execution = executionService.startExecutionInLatest("creditProcess", variables);
+    Execution execution = executionService.startExecutionByName("creditProcess", variables);
 
     assertEquals("priority delivery", execution.getNodeName());
   }
@@ -90,7 +90,7 @@
     Map<String, Object> variables = new HashMap<String, Object>();
     variables.put("creditRate", 2);
 
-    Execution execution = executionService.startExecutionInLatest("creditProcess", variables);
+    Execution execution = executionService.startExecutionByName("creditProcess", variables);
 
 
     assertEquals("bulk delivery", execution.getNodeName());
@@ -103,7 +103,7 @@
     Map<String, Object> variables = new HashMap<String, Object>();
     variables.put("creditRate", -7);
 
-    Execution execution = executionService.startExecutionInLatest("creditProcess", variables);
+    Execution execution = executionService.startExecutionByName("creditProcess", variables);
 
     assertEquals("payment upfront", execution.getNodeName());
   }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -23,8 +23,9 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import junit.framework.Test;
 
@@ -35,8 +36,8 @@
 import org.jbpm.client.ClientProcessDefinition;
 import org.jbpm.pvm.internal.svc.DeploymentImpl;
 import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.test.EnvironmentFactoryTestSetup;
 import org.jbpm.test.OldDbTestCase;
-import org.jbpm.test.EnvironmentFactoryTestSetup;
 
 /**
  * @author Tom Baeyens
@@ -68,7 +69,7 @@
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
 
     // start an execution for the process with the given id
-    Execution execution = executionService.startExecution("NCLFU:1");
+    Execution execution = executionService.startExecutionById("NCLFU:1");
     assertNotNull(execution);
 
     // checking the state
@@ -97,7 +98,7 @@
 
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
 
-    Execution execution = executionService.startExecution("NCLFU:1", "TheFirstTime");
+    Execution execution = executionService.startExecutionById("NCLFU:1", "TheFirstTime");
     assertNotNull(execution);
 
     // checking the state
@@ -128,7 +129,7 @@
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
 
     // provide the variables in the start execution method
-    Execution execution = executionService.startExecution("NCLFU:1", variables);
+    Execution execution = executionService.startExecutionById("NCLFU:1", variables);
     String executionId = execution.getId();
 
     assertEquals(new Integer(1), executionService.getVariable(executionId, "a"));
@@ -150,7 +151,7 @@
 
     // start a nuclear fusion in the latest version of
     // the process definition with name 'nuclear fusion'
-    Execution execution = executionService.startExecutionInLatest("nuclear fusion");
+    Execution execution = executionService.startExecutionByName("nuclear fusion");
     assertNotNull(execution);
 
     // in the generated id, we can see if the right process definition version was taken
@@ -177,7 +178,7 @@
     variables.put("b", "text");
 
     // feed the variables in
-    Execution execution = executionService.startExecutionInLatest("nuclear fusion", variables);
+    Execution execution = executionService.startExecutionByName("nuclear fusion", variables);
     String executionId = execution.getId();
 
     // verify that the variables are actually set
@@ -202,7 +203,7 @@
 
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
 
-    Execution execution = executionService.startExecutionInLatest("nuclear fusion", "TheFirstTime");
+    Execution execution = executionService.startExecutionByName("nuclear fusion", "TheFirstTime");
     assertNotNull(execution);
     assertEquals("TheFirstTime", execution.getKey());
     assertEquals("NFU:3/TheFirstTime", execution.getId());
@@ -246,7 +247,7 @@
 
     Map<String, Object> expected = new HashMap<String, Object>(variables);
 
-    List<String> variableNames = new ArrayList<String>();
+    Set<String> variableNames = new HashSet<String>();
     variableNames.add("a");
     variableNames.add("b");
 
@@ -319,6 +320,6 @@
 
     ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
 
-    return executionService.startExecutionInLatest("nuclear fusion");
+    return executionService.startExecutionByName("nuclear fusion");
   }
 }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -74,7 +74,7 @@
     DeploymentImpl deploymentImpl = new DeploymentImpl(definition);
     processService.deploy(deploymentImpl);
 
-    Execution processInstance = getExecutionService().startExecutionInLatest(definition.getName());   
+    Execution processInstance = getExecutionService().startExecutionByName(definition.getName());   
 
     return (ExecutionImpl) processInstance;
   }

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/example02/PersistentExecutionModeTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/example02/PersistentExecutionModeTest.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/example02/PersistentExecutionModeTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -61,7 +61,7 @@
     DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
     processService.deploy(deploymentImpl);
     
-    Execution execution = executionService.startExecution("loan:1", "request7836");
+    Execution execution = executionService.startExecutionById("loan:1", "request7836");
     
     assertEquals("evaluate", execution.getNodeName());
     

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -60,7 +60,7 @@
 
     ExecutionService executionService = ExamplesConfiguration.getExecutionService();
     
-    Execution execution = executionService.startExecutionInLatest("basic", "one");
+    Execution execution = executionService.startExecutionByName("basic", "one");
 
     assertEquals("a", execution.getNodeName());
 

Modified: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml	2008-12-03 12:25:57 UTC (rev 3179)
@@ -150,5 +150,15 @@
     </set>
 
   </class>
+  
+  
+  <!-- ### QUERIES ######################################################## -->
 
+  <query name="findTasks">
+    <![CDATA[
+     select task
+     from org.jbpm.task.impl.TaskImpl as task
+    ]]>
+  </query>
+
 </hibernate-mapping>

Deleted: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.queries.hbm.xml
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/jbpm.task.queries.hbm.xml	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/task/src/main/resources/jbpm.task.queries.hbm.xml	2008-12-03 12:25:57 UTC (rev 3179)
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE hibernate-mapping PUBLIC
-      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-      "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
-
-
-  <query name="findTasks">
-    <![CDATA[
-     select task
-     from org.jbpm.task.impl.TaskImpl as task
-    ]]>
-  </query>
-
-
-</hibernate-mapping>
\ No newline at end of file

Deleted: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test.basicfeatures;
-
-import org.jbpm.Configuration;
-import org.jbpm.ProcessEngine;
-import org.jbpm.test.JbpmTestCase;
-
-/**
- * @author Tom Baeyens
- */
-public class ConfigurationTest extends JbpmTestCase {
-
-  public void testDefaultConfiguration() {
-    ProcessEngine processEngine = new Configuration()
-        .buildProcessEngine();
-    assertNotNull(processEngine);
-  }
-
-  public void testMinimalConfiguration() {
-    ProcessEngine processEngine = new Configuration()
-        .setXmlString("<jbpm-configuration />")
-        .buildProcessEngine();
-    assertNotNull(processEngine);
-  }
-
-  public void testConfigurationServices() {
-    ProcessEngine processEngine = new Configuration()
-        .setXmlString(
-            "<jbpm-configuration>" +
-            "  <process-engine>" +
-            "    <process-service />" +
-            "    <execution-service />" +
-            "    <management-service />" +
-            "  </process-engine>" +
-            "</jbpm-configuration>"
-        )
-        .buildProcessEngine();
-    assertNotNull(processEngine);
-    assertNotNull(processEngine.getProcessService());
-    assertNotNull(processEngine.getExecutionService());
-    assertNotNull(processEngine.getManagementService());
-  }
-}

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ProcessTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ProcessTest.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ProcessTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -23,6 +23,7 @@
 
 import org.jbpm.Execution;
 import org.jbpm.ProcessDefinition;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
 import org.jbpm.test.DbTestCase;
 
 
@@ -41,7 +42,7 @@
       "</process>"
     );
     
-    Execution execution = executionService.startExecutionInLatest("minimal");
+    Execution execution = executionService.startExecutionByName("minimal");
     
     assertEquals("end", execution.getNodeName());
     assertTrue(execution.isEnded());
@@ -56,7 +57,7 @@
       "</process>"
     );
 
-    Execution execution = executionService.startExecutionInLatest("minimal");
+    Execution execution = executionService.startExecutionByName("minimal");
     
     assertTrue(execution.isEnded());
     assertTrue(execution.isFinished());
@@ -72,6 +73,7 @@
 
     ProcessDefinition processDefinition = processService.findLatestProcessDefinition("minimal");
     
+    
     assertEquals("M", processDefinition.getKey());
     assertEquals("M:1", processDefinition.getId());
     assertEquals(1, processDefinition.getVersion());

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/StateTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/StateTest.java	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/StateTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -46,7 +46,7 @@
       "</process>"
     );
     
-    Execution execution = executionService.startExecution("ThreeStates:1");
+    Execution execution = executionService.startExecutionById("ThreeStates:1");
     assertEquals("b", execution.getNodeName());
 
     String executionId = execution.getId();
@@ -75,17 +75,17 @@
       "</process>"
     );
 
-    Execution execution = executionService.startExecution("p:1", "one");
+    Execution execution = executionService.startExecutionByName("p", "one");
     assertEquals("ed", execution.getNodeName());
-    execution = executionService.signalExecution("p:1/one", "left");
+    execution = executionService.signalExecution("p/one", "left");
     assertEquals("b", execution.getNodeName());
 
-    executionService.startExecution("p:1", "two");
-    execution = executionService.signalExecution("p:1/two", "middle");
+    executionService.startExecutionById("p:1", "two");
+    execution = executionService.signalExecution("p/two", "middle");
     assertEquals("c", execution.getNodeName());
 
-    executionService.startExecution("p:1", "three");
-    execution = executionService.signalExecution("p:1/three", "right");
+    executionService.startExecutionById("p:1", "three");
+    execution = executionService.signalExecution("p/three", "right");
     assertEquals("d", execution.getNodeName());
   }
 
@@ -106,9 +106,9 @@
       "</process>"
     );
 
-    executionService.startExecution("p:1", "one");
+    executionService.startExecutionByName("p", "one");
     try {
-      executionService.signalExecution("p:1/one", "left");
+      executionService.signalExecution("p/one", "left");
     } catch (JbpmException e) {
       assertTextPresent("no matching transition or event for default signal in state(a)", e.getMessage());
     }
@@ -131,8 +131,8 @@
       "</process>"
     );
 
-    executionService.startExecution("p:1", "one");
-    Execution execution = executionService.signalExecution("p:1/one", "up");
+    executionService.startExecutionByName("p", "one");
+    Execution execution = executionService.signalExecution("p/one", "up");
     assertEquals("a", execution.getNodeName());
   }
 
@@ -146,8 +146,8 @@
       "</process>"
     );
 
-    executionService.startExecution("p:1", "one");
-    Execution execution = executionService.signalExecution("p:1/one");
+    executionService.startExecutionByName("p", "one");
+    Execution execution = executionService.signalExecution("p/one");
     assertEquals("a", execution.getNodeName());
   }
 }

Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/ConfigurationTest.java (from rev 3150, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/ConfigurationTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/ConfigurationTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/ConfigurationTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.cfg;
+
+import org.jbpm.Configuration;
+import org.jbpm.ProcessEngine;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ConfigurationTest extends JbpmTestCase {
+
+  public void testDefaultConfiguration() {
+    ProcessEngine processEngine = new Configuration()
+        .buildProcessEngine();
+    assertNotNull(processEngine);
+  }
+
+  public void testMinimalConfiguration() {
+    ProcessEngine processEngine = new Configuration()
+        .setXmlString("<jbpm-configuration />")
+        .buildProcessEngine();
+    assertNotNull(processEngine);
+  }
+
+  public void testConfigurationServices() {
+    ProcessEngine processEngine = new Configuration()
+        .setXmlString(
+            "<jbpm-configuration>" +
+            "  <process-engine>" +
+            "    <process-service />" +
+            "    <execution-service />" +
+            "    <management-service />" +
+            "  </process-engine>" +
+            "</jbpm-configuration>"
+        )
+        .buildProcessEngine();
+    assertNotNull(processEngine);
+    assertNotNull(processEngine.getProcessService());
+    assertNotNull(processEngine.getExecutionService());
+    assertNotNull(processEngine.getManagementService());
+  }
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/cfg/ConfigurationTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/BasicVariablesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/BasicVariablesTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/BasicVariablesTest.java	2008-12-03 12:25:57 UTC (rev 3179)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.variables;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class BasicVariablesTest extends DbTestCase {
+
+  public void testNoVariables() {
+    deployJpdlXmlString(
+      "<process name='var'>" +
+      "  <start name='a'>" +
+      "    <flow to='b' />" +
+      "  </start>" +
+      "  <state name='b'/>" +
+      "</process>"
+    );
+    
+    executionService.startExecutionByName("var", "one");
+    Set<String> variableNames = executionService.getVariableNames("var/one");
+    assertNotNull(variableNames);
+    assertEquals(0, variableNames.size());
+  }
+
+  public void testThreeVariables() {
+    deployJpdlXmlString(
+      "<process name='var'>" +
+      "  <start name='a'>" +
+      "    <flow to='b' />" +
+      "  </start>" +
+      "  <state name='b'/>" +
+      "</process>"
+    );
+    
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("customer", "John Doe");
+    variables.put("type", "Accident");
+    variables.put("amount", new Float(763.74));
+
+    Set<String> expectedVariableNames = new HashSet<String>(variables.keySet());
+    Map<String, Object> expectedVariables = new HashMap<String, Object>(variables);
+
+    executionService.startExecutionByName("var", variables, "one");
+    
+    Set<String> variableNames = executionService.getVariableNames("var/one");
+    assertNotNull(variableNames);
+    
+    assertEquals(expectedVariableNames, variableNames);
+
+    variables = executionService.getVariables("var/one", variableNames);
+
+    assertEquals(expectedVariables, variables);
+  }
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/BasicVariablesTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/modules/userguide/.project
===================================================================
--- jbpm4/trunk/modules/userguide/.project	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/userguide/.project	2008-12-03 12:25:57 UTC (rev 3179)
@@ -1,17 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>userguide</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.maven.ide.eclipse.maven2Builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.maven.ide.eclipse.maven2Nature</nature>
-	</natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>userguide</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.stp.bpmn.validation.BatchValidationBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.stp.bpmn.validation.BatchValidationBuildAbleNature</nature>
+	</natures>
+</projectDescription>

Added: jbpm4/trunk/modules/userguide/.settings/attachedFile.properties
===================================================================
--- jbpm4/trunk/modules/userguide/.settings/attachedFile.properties	                        (rev 0)
+++ jbpm4/trunk/modules/userguide/.settings/attachedFile.properties	2008-12-03 12:25:57 UTC (rev 3179)
@@ -0,0 +1,2 @@
+## index of importer -> set(imports)
+#Wed Dec 03 08:29:43 CET 2008

Added: jbpm4/trunk/modules/userguide/src/main/diagrams/bpmn/loan.process.bpm
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/userguide/src/main/diagrams/bpmn/loan.process.bpm
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: jbpm4/trunk/modules/userguide/src/main/diagrams/diagrams.mdzip
===================================================================
(Binary files differ)

Added: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/loan.executions.png
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/loan.executions.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/loan.process.definition.png
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/loan.process.definition.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/loan.process.instance.png
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/loan.process.instance.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml	2008-12-03 12:25:57 UTC (rev 3179)
@@ -2,8 +2,9 @@
 
 <!DOCTYPE book [
   <!ENTITY ch01-Introduction                   SYSTEM "modules/ch01-Introduction.xml">
-  <!ENTITY ch02-Environments                   SYSTEM "modules/ch02-Environments.xml">
+  <!ENTITY ch02-Installation                   SYSTEM "modules/ch02-Installation.xml">
   <!ENTITY ch03-Services                       SYSTEM "modules/ch03-Services.xml">
+  <!ENTITY ch04-Jpdl                           SYSTEM "modules/ch04-Jpdl.xml">
 ]>
 
 <book lang="en">
@@ -15,7 +16,8 @@
   <toc />
 
   &ch01-Introduction;
-  &ch02-Environments;
+  &ch02-Installation;
   &ch03-Services;
+  &ch04-Jpdl;
 
 </book>
\ No newline at end of file

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml	2008-12-03 12:25:57 UTC (rev 3179)
@@ -44,6 +44,49 @@
     The developers guide explains more advanced customization options that 
     are not supported. 
     </para>
-  </section>  
+  </section>
+  
+  <section id="processdefinitionprocessinstanceandexecutions">
+    <title>Process definition, process instance and executions</title>
+    <para>A process definition is description of the steps in a procedure.
+    For example, an insurance company could have a <literal>loan</literal> 
+    process definition that describes the steps of how the company deals 
+    with loan requests.
+    </para> 
+    <figure id="loan.process.definition.example">
+      <title>The loan process definition example</title>
+      <mediaobject><imageobject><imagedata align="center" fileref="images/loan.process.definition.png"/></imageobject></mediaobject>
+    </figure>
+    <para>One process instance represents one particular run of a process definition.
+    For example, the loan request of John Doe last Friday to finance his new boat 
+    is represented in one process instance of the loan process definition.
+    </para>
+    <para>A process instance contains all the runtime state.  The 
+    most prominent property is the pointer that keeps track of the current node.
+    </para>
+    <figure id="loan.process.instance.example">
+      <title>The loan process instance example</title>
+      <mediaobject><imageobject><imagedata align="center" fileref="images/loan.process.instance.png"/></imageobject></mediaobject>
+    </figure>
+    <para>Suppose that wiring the money and archiving can be done in parallel.
+    Then the main process instance will have two child executions to keep 
+    track of the state like this:   
+    </para>
+    <figure id="loan.executions.example">
+      <title>The loan executions example</title>
+      <mediaobject><imageobject><imagedata align="center" fileref="images/loan.executions.png"/></imageobject></mediaobject>
+    </figure>
+    <para>More general, a process instance is the root of a tree of executions.
+    When a new process instance is started, the process instance is in fact the root 
+    execution scope.  Only leaf executions can be active.
+    </para>
+    <para>The motivation to work with a tree structure like this is that
+    this conceptually remains simple in the case where there is only one path 
+    of execution.  The services API doesn't need to make a functional difference 
+    between process instances and executions.  Therefore, the API has only 
+    Execution as a type to refer to both <literal>ProcessInstance</literal>s and 
+    <literal>Execution</literal>s. 
+    </para>
+  </section>
 
 </chapter>

Deleted: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml	2008-12-03 12:25:57 UTC (rev 3179)
@@ -1,23 +0,0 @@
-<chapter id="environments">
-  <title>Environments</title>
-  
-  <para>This chapter describes the supported environments 
-  and the supported configurations for these environments.
-  </para>
-  
-  <section id="plainjava">
-    <title>Plain Java</title>
-    <para>TODO : specify library dependencies</para>
-  </section>
-
-  <section id="tomcat-xxx">
-    <title>Tomcat xxx</title>
-    <para>TODO</para>
-  </section>
-
-  <section id="jboss-xxx">
-    <title>JBoss xxx</title>
-    <para>TODO</para>
-  </section>
-
-</chapter>
\ No newline at end of file

Copied: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml (from rev 3159, jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml)
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml	                        (rev 0)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml	2008-12-03 12:25:57 UTC (rev 3179)
@@ -0,0 +1,38 @@
+<chapter id="installation">
+  <title>Installation</title>
+  
+  <para>This chapter describes how to install jBPM in different 
+  application environments.
+  </para>
+
+  <section id="libraries">
+    <title>Libraries</title>
+    <para>jBPM can run on a JVM without a dependency on any library.
+    See object execution mode in the developers guide.  But in this 
+    userguide we'll cover the most common way to use jBPM, which is 
+    where jBPM stores its process definitions, executions and 
+    history in a relational database.  In that case, hibernate has to 
+    be added to the classpath.  Also some of the jPDL features require 
+    extra libraries.   Therefore, by including all the libraries in the 
+    lib directory, you get access to all those features and persistence.
+    </para>
+  </section>
+  
+  <section id="tomcat-xxx">
+    <title>Tomcat xxx</title>
+    <para>TODO: this will contain a description of how to use the 
+    installer to install jbpm on tomcat</para>
+  </section>
+
+  <section id="jboss-xxx">
+    <title>JBoss xxx</title>
+    <para>TODO: this will contain a description of how to use the 
+    installer to install jbpm on jboss</para>
+  </section>
+
+  <section id="database">
+    <title>Database</title>
+    <para>TODO</para>
+  </section>
+
+</chapter>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml	2008-12-03 11:26:16 UTC (rev 3178)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml	2008-12-03 12:25:57 UTC (rev 3179)
@@ -38,14 +38,22 @@
     can be obtained:
     </para>
     
-    <programlisting>ProcessService processService = processEngine.getProcessService();
-ExecutionService executionService = processEngine.getExecutionService();
-ManagementService managementService = processEngine.getManagementService();
-TaskService taskService = processEngine.getTaskService();</programlisting>
+    <programlisting><emphasis role="bold">ProcessService</emphasis> processService = processEngine.getProcessService();
+<emphasis role="bold">ExecutionService</emphasis> executionService = processEngine.getExecutionService();
+<emphasis role="bold">ManagementService</emphasis> managementService = processEngine.getManagementService();
+<emphasis role="bold">TaskService</emphasis> taskService = processEngine.getTaskService();</programlisting>
+
+    <para>Process engine objects defined in the configuration can also be retrieved by 
+    type (<literal>processEngine.get(Class&lt;T&gt; T)</literal>) 
+    or by name (<literal>processEngine.get(String name)</literal>)</para>
+
   </section>
-  
+
   <section id="deployingaprocess">
     <title>Deploying a process</title>
+    <para>The <literal>ProcessService</literal> groups all methods that access 
+    the repository of process definitions.
+    </para>
     <para>A jPDL process file like e.g. <literal>order.jpdl.xml</literal> that is 
     accessible as a resource on the classpath can be deployed programmatically with the 
     <literal>ProcessService</literal> like this:
@@ -59,14 +67,17 @@
     input stream, zip or jar archive and a directory.
     </para>
     <para>During deployment, an <literal>id</literal> is assigned to the process 
-    definition.  Process definition properties <literal>name</literal> and 
-    <literal>id</literal> are important for referencing the deployed process 
-    definition later on.  The <literal>id</literal> is based on the <literal>name</literal>
-    or <literal>key</literal> and <literal>version</literal>.
+    definition.  The <literal>id</literal> will have format 
+    <literal>{key}:{version}</literal>
     </para>
-    <para>If a <literal>key</literal> is provided, the <literal>id</literal> 
-    will be <literal>{key}:{version}</literal>, otherwise it's 
-    <literal>{name}:{version}</literal>.  If no <literal>version</literal> is specified,
+    <para>Process definition properties <literal>name</literal>, <literal>key</literal> 
+    and <literal>id</literal> are important for referencing the deployed process 
+    definition later on.  
+    </para>
+    <para>If a <literal>key</literal> is not provided, it is generated based on the 
+    name.  All non alpha numeric characters in the name will be replaced by underscores.
+    </para>
+    <para>If no <literal>version</literal> is specified,
     a <literal>version</literal> (<literal>int</literal>) will be assigned.  For version 
     assignment, the versions of all deployed process definitions with the same name will 
     be taken into account.  The assigned <literal>version</literal> will be one higher 
@@ -74,51 +85,170 @@
     with the same name.  If no similarly named process definitions have been deployed,
     version number 1 is assigned. 
     </para>
-    <para>For example, the first time when the process</para>
-    <programlisting>&lt;process name=&quot;order&quot;&gt;
-...
-&lt;/process&gt;</programlisting>
-    <para>is deployed, version 1 will be assigned and the generated <literal>id</literal> 
-    will be <literal>order:1</literal>  The second time when this process is deployed, 
-    version 2 will be assigned and the generated id will be <literal>order:2</literal>
-    </para>
-    <para>The generated id will also replace all non digits and non [a-Z] characters 
-    with underscores.  So the first time when process</para>
+    <para>In this first example, we'll supply a name and nothing else.</para>
     <programlisting>&lt;process name=&quot;Insurance claim&quot;&gt;
 ...
 &lt;/process&gt;</programlisting>
-    <para>is deployed, the assigned id will be <literal>Insurance_claim:1</literal> 
+    <para>Let's assume that this is the first time that this process gets deployed.
+    Then it will get the following properties:
     </para>
-    <para>To get short <literal>id</literal>s, a <literal>key</literal> like this:</para>
+    <table><title>Process properties without key</title>
+      <tgroup cols="2" rowsep="1" colsep="1">
+        <thead>
+          <row>
+            <entry>Property</entry>
+            <entry>Value</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry><literal>name</literal></entry>
+            <entry>Insurance claim</entry>
+          </row>
+          <row>
+            <entry><literal>key</literal></entry>
+            <entry>Insurance_claim</entry>
+          </row>
+          <row>
+            <entry><literal>version</literal></entry>
+            <entry>1</entry>
+          </row>
+          <row>
+            <entry><literal>id</literal></entry>
+            <entry>Insurance_claim:1</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+
+    <para>And as a second example, we'll show how you can get shorter ids by 
+    specifying a process key in the process element:</para>
     <programlisting>&lt;process name=&quot;Insurance claim&quot; key=&quot;ICL&quot;&gt;
 ...
 &lt;/process&gt;</programlisting>
-    <para>resulting in id <literal>ICL:1</literal> being generated.</para>
-    <para>The <literal>ProcessService</literal> groups all methods that access 
-    the repository of process definitions.
-    </para>
+    <para>Then the process definition properties look like this:</para>
+    <table><title>Process properties with key</title>
+      <tgroup cols="2" rowsep="1" colsep="1">
+        <thead>
+          <row>
+            <entry>Property</entry>
+            <entry>Value</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry><literal>name</literal></entry>
+            <entry>Insurance claim</entry>
+          </row>
+          <row>
+            <entry><literal>key</literal></entry>
+            <entry>ICL</entry>
+          </row>
+          <row>
+            <entry><literal>version</literal></entry>
+            <entry>1</entry>
+          </row>
+          <row>
+            <entry><literal>id</literal></entry>
+            <entry>ICL:1</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
   </section>
-  
+
   <section id="startinganewprocessinstance">
     <title>Starting a new process instance</title>
-    <para>Starting a new process instance for a given 
+    
+    <section id="inlatest">
+      <title>In latest</title>
+      <para>Simplest and most common way to start a new process instance for a process 
+      definition is like this: 
+      </para>
+      <programlisting>executionService.startExecutionByKey("ICL");</programlisting>
+      <para>In this case, the service method will first look up the latest version of 
+      the processes with key <literal>ICL</literal>.  Then a new 
+      process instance is started in that latest process definition.
+      </para>
+      <para>Analogue, method <literal>startExecutionByName</literal> will 
+      start a new execution in the latest version of the process definitions 
+      with the given name.
+      </para>
+      <para>When a new version of the insurance claim process 
+      is deployed, all invocations of <literal>startExecutionByKey</literal> 
+      and <literal>startExecutionByName</literal>
+      will automatically switch to the newly deployed version.
+      </para>
+    </section>
+    
+    <section id="specificprocessversion">
+      <title>Specific process version</title>
+      <para>If instead you want to start a new process instance in a very 
+      specific version, you can use the id of the process definition like this:
+      </para>
+      <programlisting>executionService.startExecutionById("ICL:1");</programlisting>
+    </section>
+
+    <section id="withakey">
+      <title>With a key</title>
+      <para>A new process instance can optionally be given a key.  A key is 
+      a user defined reference to the execution.  A key must be unique within the 
+      scope of all versions of a process definition.  Typically it is easy 
+      to find such a key in the domain of the business process.  For example, an 
+      order id or an insurance claim number.
+      </para>
+      <programlisting>executionService.startExecutionByKey("ICL", "CL92837");</programlisting>
+      <para>The key is used to create the id of the process instance.  
+      The format used is <literal>{process-key}/{execution-id}</literal>.
+      So execution created in the previous code snippet will have id 
+      <literal>ICL/CL92837</literal>.
+      </para>  
+      <para>If no user defined key is provided, the DB primary key is taken
+      as the key.  In that case, the id can be retrieved like this:   
+      <programlisting>Execution execution = executionService.startExecutionByKey("ICL");
+String executionId = execution.getId();</programlisting>
+      </para> 
+      <para>We recommend the use of a user defined keys.  Typically in your application 
+      code, you'll have the key available.  By providing a user defined key, you can 
+      then compose the id of the execution, rather then performing a query based 
+      on the process variables.
+      </para>
+    </section>
+    
+    <section id="withvariables">
+      <title>With variables</title>
+      <para>A map of named parameter objects can be provided when starting a 
+      new process instance.  These parameters will be set as variables on the process 
+      instance between creation and start of the process instance.
+      </para>
+      <programlisting>Map&lt;String,Object&gt; variables = new HashMap&lt;String,Object&gt;();
+variables.put("customer", "John Doe");
+variables.put("type", "Accident");
+variables.put("amount", new Float(763.74));
+executionService.startExecution("insurance_claim:1", variables);</programlisting>
+    </section>
+  </section>
+
+  <section id="retrievinganexecution">
+    <title>Retrieving an execution</title>
+    <para>
     </para>
   </section>
-  
+
   <section id="singallingawaitingexecution">
-    <title>Starting a new process instance</title>
+    <title>Signalling a waiting execution</title>
     <para>
     </para>
   </section>
-  
+
   <section id="taskservice">
     <title>TaskService</title>
     <para></para>
   </section>
-  
+
   <section id="managementservice">
     <title>ManagementService</title>
     <para></para>
   </section>
-  
+
 </chapter>
\ No newline at end of file

Added: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml	2008-12-03 12:25:57 UTC (rev 3179)
@@ -0,0 +1,23 @@
+<chapter id="jpdl">
+  <title>jPDL</title>
+  
+  <para>This chapter will explain the jPDL file format for describing 
+  process definitions.
+  </para>
+  
+  <section id="process">
+    <title><literal>process</literal></title>
+    <para></para>
+  </section>
+
+  <section id="activities">
+    <title>Activities</title>
+    <para>Diff between node and activity?</para>
+    
+    <section id="start">
+      <title><literal>start</literal></title>
+      <para></para>
+    </section>
+  </section>
+
+</chapter>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Jpdl.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbpm-commits mailing list