[jbpm-commits] JBoss JBPM SVN: r1997 - in jbpm4/pvm/trunk/modules/core/src: main/java/org/jbpm/pvm/activity and 25 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Aug 25 10:11:52 EDT 2008
Author: tom.baeyens at jboss.com
Date: 2008-08-25 10:11:51 -0400 (Mon, 25 Aug 2008)
New Revision: 1997
Added:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ProcessDefinition.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/CreateKey.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateKeyBinding.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java
Removed:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ProcessDefinition.java
Modified:
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/Deployment.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ExecutionService.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ProcessService.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/client/ClientProcessDefinition.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/VerifyVersion.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ProcessElementImpl.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandExecutionService.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandProcessService.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/CompositeElement.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Node.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ObservableElement.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/OpenExecution.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Transition.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/session/PvmDbSession.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java
jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml
jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.execution.hbm.xml
jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/pvm.wire.bindings.xml
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/basicfeatures/BasicExecutionFlowDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/TimerTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex04/ExternalDecisionTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex05/InternalDecisionTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex07/EventListenerTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex11/AsynchronousContinuationsTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex12/TimerTest.java
jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml
Log:
introduction of the process definition keys
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/Deployment.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/Deployment.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/Deployment.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -41,7 +41,6 @@
import org.jbpm.pvm.internal.stream.UrlStreamSource;
import org.jbpm.pvm.internal.util.IoUtil;
import org.jbpm.pvm.internal.xml.Parser;
-import org.jbpm.pvm.model.ProcessDefinition;
import org.w3c.dom.Document;
@@ -64,6 +63,9 @@
protected Map<String, Document> documents;
protected ProcessDefinition processDefinition;
+ /** user provided short reference for the process definition
+ * that can be used by the KeyGenerator */
+ protected String processDefinitionRef;
public Deployment() {
}
@@ -243,4 +245,10 @@
public void setName(String name) {
this.name = name;
}
+ public String getProcessDefinitionRef() {
+ return processDefinitionRef;
+ }
+ public void setProcessDefinitionRef(String processDefinitionRef) {
+ this.processDefinitionRef = processDefinitionRef;
+ }
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ExecutionService.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ExecutionService.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ExecutionService.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -32,44 +32,48 @@
public interface ExecutionService {
/** starts a new execution for the ProcessDefinition with the given processDefinitionDbid.
- * @param processDefinitionDbid the DB id (primary key) of the process definition. */
- Execution startExecution(long processDefinitionDbid);
+ * @param processDefinitionKey the {@link ProcessDefinition#getKey() unique key} of the process definition. */
+ Execution startExecution(String processDefinitionKey);
/** starts a new execution for the ProcessDefinition with the given processDefinitionDbid.
- * @param processDefinitionDbid the DB id (primary key) of the process definition.
- * @param executionKey is a user provided ID for the new execution that must be unique over all process versions with the same name. */
- Execution startExecution(long processDefinitionDbid, String executionKey);
+ * @param processDefinitionKey the {@link ProcessDefinition#getKey() unique key} of the process definition.
+ * @param executionRef is a user provided reference for the new execution that must be unique over all
+ * process versions with the same name. */
+ Execution startExecution(String processDefinitionKey, String executionRef);
/** starts a new execution for the ProcessDefinition with the given processDefinitionDbid.
- * @param processDefinitionDbid the DB id (primary key) of the process definition.
+ * @param processDefinitionKey the {@link ProcessDefinition#getKey() unique key} of the process definition.
* @param variables are the initial values of the process variables that will be set before the execution starts. */
- Execution startExecution(long processDefinitionDbid, Map<String, Object> variables);
+ Execution startExecution(String processDefinitionKey, Map<String, Object> variables);
/** starts a new execution for the ProcessDefinition with the given processDefinitionDbid.
- * @param processDefinitionDbid the DB id (primary key) of the process definition.
+ * @param processDefinitionKey the {@link ProcessDefinition#getKey() unique key} 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 ID for the new execution that must be unique over all process versions with the same name. */
- Execution startExecution(long processDefinitionDbid, Map<String, Object> variables, String executionKey);
+ * @param executionRef is a user provided reference for the new execution that must be unique over all
+ * process versions with the same name. */
+ Execution startExecution(String processDefinitionKey, Map<String, Object> variables, String executionRef);
/** 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 startExecution(String processDefinitionName);
+ Execution startExecutionInLatest(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 ID for the new execution that must be unique over all process versions with the same name. */
- Execution startExecution(String processDefinitionName, String executionKey);
+ * @param executionRef 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 executionRef);
/** 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. */
- Execution startExecution(String processDefinitionName, Map<String, Object> variables);
+ Execution startExecutionInLatest(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 ID for the new execution that must be unique over all process versions with the same name. */
- Execution startExecution(String processDefinitionName, Map<String, Object> variables, String executionKey);
+ * @param executionRef 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 executionRef);
/** the execution with the given database primary key */
Execution findExecution(long executionDbid);
Added: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ProcessDefinition.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ProcessDefinition.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ProcessDefinition.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+
+import org.jbpm.pvm.model.ObservableElement;
+
+
+/** a graphical process which is deployed in the {@ ProcessService}.
+ *
+ * @author Tom Baeyens
+ */
+public interface ProcessDefinition extends Serializable {
+
+ /** the unique key for this process definition. */
+ String getKey();
+
+ /** the short display name given to this process definition.
+ * Multiple process definitions can have the same as long
+ * as they are given a different {@link #version}. */
+ String getName();
+
+ /** the description name given to this process definition.
+ * Multiple process definitions can have the same */
+ String getDescription();
+
+ /** the package name of this process. This can be used to create
+ * hierarchy of process categories for easy lookup. This is a
+ * similar way of grouping and creating a structure as in Java.
+ * We recommend the same conventions as with Java package names. */
+ String getPackageName();
+
+ /** automatically assigned during deployment of a process that
+ * represents the sequence number for process definitions with
+ * the same {@link ObservableElement#getName() name}. */
+ int getVersion();
+}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ProcessService.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ProcessService.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ProcessService.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -23,9 +23,7 @@
import java.util.List;
-import org.jbpm.pvm.model.ProcessDefinition;
-
/** a process definition repository.
*
* @author Tom Baeyens
@@ -35,9 +33,6 @@
/** deploy a new process definition into the process repository. */
ProcessDefinition deploy(Deployment deployment);
- /** deploy a new process definition into the process repository. */
- ProcessDefinition deploy(ProcessDefinition processDefinition);
-
/** all deployed process names. */
List<String> findProcessDefinitionNames();
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -29,7 +29,7 @@
import org.jbpm.pvm.model.Node;
import org.jbpm.pvm.model.ObservableElement;
import org.jbpm.pvm.model.OpenExecution;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.Transition;
import org.jbpm.pvm.processlog.ProcessLog;
import org.jbpm.pvm.session.PvmDbSession;
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/client/ClientProcessDefinition.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/client/ClientProcessDefinition.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/client/ClientProcessDefinition.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -21,13 +21,13 @@
*/
package org.jbpm.pvm.client;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
/**
* @author Tom Baeyens
*/
-public interface ClientProcessDefinition extends ProcessDefinition {
+public interface ClientProcessDefinition extends OpenProcessDefinition {
ClientProcessInstance createProcessInstance();
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -22,10 +22,10 @@
package org.jbpm.pvm.internal.cmd;
import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.ProcessDefinition;
import org.jbpm.pvm.PvmException;
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.internal.deploy.DeployerManager;
-import org.jbpm.pvm.model.ProcessDefinition;
/**
* @author Tom Baeyens
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -50,7 +50,7 @@
public Execution execute(Environment environment) throws Exception {
PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
if (processDefinitionName!=null) {
- return pvmDbSession.findExecution(processDefinitionName, key);
+ return pvmDbSession.findExecutionByKey(key);
}
return pvmDbSession.get(ExecutionImpl.class, executionDbid);
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionCmd.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionCmd.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -22,14 +22,14 @@
package org.jbpm.pvm.internal.cmd;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.session.PvmDbSession;
/**
* @author Tom Baeyens
*/
-public class FindLatestProcessDefinitionCmd implements Command<ProcessDefinition> {
+public class FindLatestProcessDefinitionCmd implements Command<OpenProcessDefinition> {
private static final long serialVersionUID = 1L;
@@ -39,8 +39,8 @@
this.processDefinitionName = processDefinitionName;
}
- public ProcessDefinition execute(Environment environment) throws Exception {
- return environment.get(PvmDbSession.class).findProcessDefinition(processDefinitionName);
+ public OpenProcessDefinition execute(Environment environment) throws Exception {
+ return environment.get(PvmDbSession.class).findLatestProcessDefinitionByName(processDefinitionName);
}
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionCmd.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionCmd.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -23,14 +23,14 @@
import org.jbpm.pvm.env.Environment;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.session.PvmDbSession;
/**
* @author Tom Baeyens
*/
-public class FindProcessDefinitionCmd implements Command<ProcessDefinition> {
+public class FindProcessDefinitionCmd implements Command<OpenProcessDefinition> {
private static final long serialVersionUID = 1L;
@@ -47,10 +47,10 @@
this.processDefinitionDbid = processDefinitionDbid;
}
- public ProcessDefinition execute(Environment environment) throws Exception {
+ public OpenProcessDefinition execute(Environment environment) throws Exception {
PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
if (processDefinitionName!=null) {
- return pvmDbSession.findProcessDefinition(processDefinitionName, processDefinitionVersion);
+ return pvmDbSession.findProcessDefinitionByName(processDefinitionName, processDefinitionVersion);
} else {
return pvmDbSession.get(ProcessDefinitionImpl.class, processDefinitionDbid);
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsCmd.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsCmd.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -42,7 +42,7 @@
}
public List<ClientProcessDefinition> execute(Environment environment) throws Exception {
- return environment.get(PvmDbSession.class).findProcessDefinitions(processDefinitionName);
+ return environment.get(PvmDbSession.class).findProcessDefinitionsByName(processDefinitionName);
}
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -56,7 +56,6 @@
if (executionKey==null) {
throw new PvmException("executionKey is null");
}
- this.processDefinitionName = processDefinitionName;
this.executionKey = executionKey;
this.signalName = signalName;
this.parameters = parameters;
@@ -65,13 +64,14 @@
public Execution execute(Environment environment) throws Exception {
ClientExecution execution = null;
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
if (executionDbid!=null) {
- execution = environment.get(PvmDbSession.class).get(ExecutionImpl.class, executionDbid);
+ execution = pvmDbSession.get(ExecutionImpl.class, executionDbid);
if (execution==null) {
throw new PvmException("execution "+executionDbid+" does not exist");
}
} else {
- execution = environment.get(PvmDbSession.class).findExecution(processDefinitionName, executionKey);
+ execution = pvmDbSession.findExecutionByKey(executionKey);
if (execution==null) {
throw new PvmException("execution for process "+processDefinitionName+" with executionKey "+executionKey+" does not exist");
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionCmd.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -38,37 +38,23 @@
private static final long serialVersionUID = 1L;
- protected long processDefinitionDbid;
- protected String processDefinitionName;
+ protected String processDefinitionKey;
protected String executionKey;
- public StartExecutionCmd(String processDefinitionName, Map<String, Object> variables, String executionKey) {
- this.processDefinitionName = processDefinitionName;
+ public StartExecutionCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
+ this.processDefinitionKey = processDefinitionKey;
this.variables = variables;
this.executionKey = executionKey;
}
-
- public StartExecutionCmd(long processDefinitionDbid, Map<String, Object> variables, String executionKey) {
- this.processDefinitionDbid = processDefinitionDbid;
- this.variables = variables;
- this.executionKey = executionKey;
- }
public Execution execute(Environment environment) throws Exception {
PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
ClientProcessDefinition processDefinition = null;
- if (processDefinitionName!=null) {
- processDefinition = pvmDbSession.findProcessDefinition(processDefinitionName);
- if (processDefinition==null) {
- throw new PvmException("no process definition with name '"+processDefinitionName+"'");
- }
- } else {
- processDefinition = pvmDbSession.get(ProcessDefinitionImpl.class, processDefinitionDbid);
- if (processDefinition==null) {
- throw new PvmException("no process definition with dbid '"+processDefinitionDbid+"'");
- }
+ processDefinition = pvmDbSession.findProcessDefinitionByKey(processDefinitionKey);
+ if (processDefinition==null) {
+ throw new PvmException("no process definition with key '"+processDefinitionKey+"'");
}
ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
@@ -79,11 +65,11 @@
return processInstance;
}
- public String getProcessDefinitionName() {
- return processDefinitionName;
+ public String getProcessDefinitionKey() {
+ return processDefinitionKey;
}
- public void setProcessDefinitionName(String processName) {
- this.processDefinitionName = processName;
+ public void setProcessDefinitionKey(String processDefinitionKey) {
+ this.processDefinitionKey = processDefinitionKey;
}
public String getExecutionKey() {
return executionKey;
Added: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/StartExecutionInLatestCmd.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import java.util.Map;
+
+import org.jbpm.pvm.Execution;
+import org.jbpm.pvm.PvmException;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.client.ClientProcessInstance;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.session.PvmDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String processDefinitionName;
+ protected String executionKey;
+
+ public StartExecutionInLatestCmd(String processDefinitionName, Map<String, Object> variables, String executionKey) {
+ this.processDefinitionName = processDefinitionName;
+ this.variables = variables;
+ this.executionKey = executionKey;
+ }
+
+ public Execution execute(Environment environment) throws Exception {
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+
+ ClientProcessDefinition processDefinition = null;
+
+ processDefinition = pvmDbSession.findLatestProcessDefinitionByName(processDefinitionName);
+ if (processDefinition==null) {
+ throw new PvmException("no process definition with name '"+processDefinitionName+"'");
+ }
+
+ ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
+ processInstance.setVariables(variables);
+ processInstance.begin();
+
+ pvmDbSession.save(processInstance);
+ return processInstance;
+ }
+
+ public String getProcessDefinitionName() {
+ return processDefinitionName;
+ }
+ public void setProcessDefinitionName(String processName) {
+ this.processDefinitionName = processName;
+ }
+ public String getExecutionKey() {
+ return executionKey;
+ }
+ public void setExecutionKey(String executionKey) {
+ this.executionKey = executionKey;
+ }
+}
Added: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/CreateKey.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/CreateKey.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/CreateKey.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.deploy;
+
+import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CreateKey implements Deployer {
+
+ public void deploy(Deployment deployment) {
+ ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) deployment.getProcessDefinition();
+
+ String ref = deployment.getProcessDefinitionRef();
+ if (ref==null) {
+ ref = processDefinition.getName();
+ }
+
+ String key = ref+"-"+processDefinition.getVersion();
+
+ processDefinition.setKey(key);
+ }
+}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -23,9 +23,9 @@
import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.ProcessDefinition;
import org.jbpm.pvm.PvmException;
import org.jbpm.pvm.internal.log.Log;
-import org.jbpm.pvm.model.ProcessDefinition;
/**
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -22,9 +22,9 @@
package org.jbpm.pvm.internal.deploy;
import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.ProcessDefinition;
import org.jbpm.pvm.PvmException;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.model.ProcessDefinition;
import org.jbpm.pvm.session.PvmDbSession;
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/VerifyVersion.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/VerifyVersion.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/deploy/VerifyVersion.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -22,9 +22,9 @@
package org.jbpm.pvm.internal.deploy;
import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.ProcessDefinition;
import org.jbpm.pvm.PvmException;
import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.model.ProcessDefinition;
import org.jbpm.pvm.session.PvmDbSession;
@@ -53,7 +53,7 @@
throw new PvmException(PvmDbSession.class.getName()+" is required in the environment by "+getClass().getName());
}
- if (pvmDbSession.findProcessDefinition(name, version) != null) {
+ if (pvmDbSession.findProcessDefinitionByName(name, version) != null) {
throw new PvmException("process [" + name + "|" + version + "] already exists");
}
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -24,6 +24,7 @@
import java.util.List;
import org.hibernate.Query;
+import org.jbpm.pvm.Execution;
import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.job.Job;
@@ -44,14 +45,14 @@
return session.getNamedQuery("findProcessDefinitionNames").list();
}
- public List<ClientProcessDefinition> findProcessDefinitions(String name) {
+ public List<ClientProcessDefinition> findProcessDefinitionsByName(String name) {
// query definition can be found at the bottom of resource org/jbpm/pvm/hibernate.definition.hbm.xml
Query query = session.getNamedQuery("findProcessDefinitionsByName");
query.setString("name", name);
return query.list();
}
- public ClientProcessDefinition findProcessDefinition(String name, int version) {
+ public ClientProcessDefinition findProcessDefinitionByName(String name, int version) {
// query definition can be found at the bottom of resource org/jbpm/pvm/hibernate.definition.hbm.xml
Query query = session.getNamedQuery("findProcessDefinitionByNameAndVersion");
query.setString("name", name);
@@ -60,7 +61,7 @@
return processDefinition;
}
- public ClientProcessDefinition findProcessDefinition(String name) {
+ public ClientProcessDefinition findLatestProcessDefinitionByName(String name) {
// query definition can be found at the bottom of resource org/jbpm/pvm/hibernate.definition.hbm.xml
Query query = session.getNamedQuery("findProcessDefinitionsByName");
query.setString("name", name);
@@ -69,11 +70,19 @@
return processDefinition;
}
- public ClientExecution findExecution(String processDefinitionName, String key) {
+ public ClientProcessDefinition findProcessDefinitionByKey(String processDefinitionKey) {
+ // query definition can be found at the bottom of resource org/jbpm/pvm/hibernate.definition.hbm.xml
+ Query query = session.getNamedQuery("findProcessDefinitionsByKey");
+ query.setString("key", processDefinitionKey);
+ query.setMaxResults(1);
+ ClientProcessDefinition processDefinition = (ClientProcessDefinition) query.uniqueResult();
+ return processDefinition;
+ }
+
+ public ClientExecution findExecutionByKey(String executionKey) {
// query definition can be found at the bottom of resource org/jbpm/pvm/hibernate.execution.hbm.xml
- Query query = session.getNamedQuery("findExecutionByProcessDefinitionNameAndKey");
- query.setString("name", processDefinitionName);
- query.setString("key", key);
+ Query query = session.getNamedQuery("findExecutionByKey");
+ query.setString("key", executionKey);
query.setMaxResults(1);
return (ClientExecution) query.uniqueResult();
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -34,7 +34,7 @@
import org.jbpm.pvm.internal.model.op.MoveToChildNode;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.listener.EventListener;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
/**
* @author Tom Baeyens
@@ -180,7 +180,7 @@
TransitionImpl transition = execution.getTransition();
log.trace("no current node. searching for transition from parent of "+transition);
if (transition!=null) {
- ProcessDefinition processDefinition = transition.getProcessDefinition();
+ OpenProcessDefinition processDefinition = transition.getProcessDefinition();
ObservableElementImpl transitionParent = transition.getParent();
if ( (transitionParent!=null)
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ProcessDefinitionImpl.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -28,26 +28,39 @@
import java.util.Map;
import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.client.ClientExecution;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.client.ClientProcessInstance;
import org.jbpm.pvm.internal.lob.Blob;
import org.jbpm.pvm.internal.log.Log;
import org.jbpm.pvm.internal.util.IoUtil;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
/**
* @author Tom Baeyens
*/
-public class ProcessDefinitionImpl extends CompositeElementImpl implements ProcessDefinition, ClientProcessDefinition {
+public class ProcessDefinitionImpl extends CompositeElementImpl implements OpenProcessDefinition, ClientProcessDefinition {
private static final long serialVersionUID = 1L;
private static final Log log = Log.getLog(ProcessDefinitionImpl.class.getName());
+ /** the version number of the process definitions with the same name.*/
+ protected int version;
+
+ /** the unique key (e.g. combination of name and versionnumber) for this
+ * process definition that is exposed to the users. */
+ protected String key;
+
+ /** optional package name similar to the Java package name. */
protected String packageName;
- protected int version;
+
+ /** time this process was deployed */
protected Date deploymentTime;
+
+ /** the node which is executed when the process starts */
protected NodeImpl initial;
+
+ /** the attachments
+ * TODO move the attachments to a separate DeploymentUnit type */
Map<String, Blob> attachments;
public ProcessDefinitionImpl() {
@@ -160,4 +173,10 @@
public void setPackageName(String packageName) {
this.packageName = packageName;
}
+ public String getKey() {
+ return key;
+ }
+ public void setKey(String key) {
+ this.key = key;
+ }
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ProcessElementImpl.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ProcessElementImpl.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/model/ProcessElementImpl.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -29,7 +29,7 @@
import org.jbpm.pvm.internal.log.Log;
import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
/**
* superclass for {@link NodeImpl}, {@link TransitionImpl} and {@link ProcessDefinitionImpl}.
@@ -92,7 +92,7 @@
public long getDbid() {
return dbid;
}
- public ProcessDefinition getProcessDefinition() {
+ public OpenProcessDefinition getProcessDefinition() {
return processDefinition;
}
public void setProcessDefinition(ProcessDefinitionImpl processDefinition) {
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandExecutionService.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandExecutionService.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandExecutionService.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -35,6 +35,7 @@
import org.jbpm.pvm.internal.cmd.SetVariablesCmd;
import org.jbpm.pvm.internal.cmd.SignalCmd;
import org.jbpm.pvm.internal.cmd.StartExecutionCmd;
+import org.jbpm.pvm.internal.cmd.StartExecutionInLatestCmd;
/**
@@ -44,36 +45,36 @@
protected CommandService commandService;
- public Execution startExecution(long processDefinitionDbid){
- return commandService.execute(new StartExecutionCmd(processDefinitionDbid, null, null));
+ public Execution startExecution(String processDefinitionKey){
+ return commandService.execute(new StartExecutionCmd(processDefinitionKey, null, null));
}
- public Execution startExecution(long processDefinitionDbid, String executionKey) {
- return commandService.execute(new StartExecutionCmd(processDefinitionDbid, null, executionKey));
+ public Execution startExecution(String processDefinitionKey, String executionKey) {
+ return commandService.execute(new StartExecutionCmd(processDefinitionKey, null, executionKey));
}
- public Execution startExecution(long processDefinitionDbid, Map<String, Object> variables){
- return commandService.execute(new StartExecutionCmd(processDefinitionDbid, variables, null));
+ public Execution startExecution(String processDefinitionKey, Map<String, Object> variables){
+ return commandService.execute(new StartExecutionCmd(processDefinitionKey, variables, null));
}
- public Execution startExecution(long processDefinitionDbid, Map<String, Object> variables, String executionKey){
- return commandService.execute(new StartExecutionCmd(processDefinitionDbid, variables, executionKey));
+ public Execution startExecution(String processDefinitionKey, Map<String, Object> variables, String executionKey){
+ return commandService.execute(new StartExecutionCmd(processDefinitionKey, variables, executionKey));
}
- public Execution startExecution(String processDefinitionName) {
- return commandService.execute(new StartExecutionCmd(processDefinitionName, null, null));
+ public Execution startExecutionInLatest(String processDefinitionName) {
+ return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, null, null));
}
- public Execution startExecution(String processDefinitionName, Map<String, Object> variables){
- return commandService.execute(new StartExecutionCmd(processDefinitionName, variables, null));
+ public Execution startExecutionInLatest(String processDefinitionName, Map<String, Object> variables){
+ return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, variables, null));
}
- public Execution startExecution(String processDefinitionName, String executionKey) {
- return commandService.execute(new StartExecutionCmd(processDefinitionName, null, executionKey));
+ public Execution startExecutionInLatest(String processDefinitionName, String executionKey) {
+ return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, null, executionKey));
}
- public Execution startExecution(String processDefinitionName, Map<String, Object> variables, String executionKey){
- return commandService.execute(new StartExecutionCmd(processDefinitionName, variables, executionKey));
+ public Execution startExecutionInLatest(String processDefinitionName, Map<String, Object> variables, String executionKey){
+ return commandService.execute(new StartExecutionInLatestCmd(processDefinitionName, variables, executionKey));
}
public Execution signalExecution(long executionDbid) {
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandProcessService.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandProcessService.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandProcessService.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -24,6 +24,7 @@
import java.util.List;
import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.ProcessDefinition;
import org.jbpm.pvm.ProcessService;
import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.cmd.DeployCmd;
@@ -31,7 +32,7 @@
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionCmd;
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionNamesCmd;
import org.jbpm.pvm.internal.cmd.FindProcessDefinitionsCmd;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
/** {@link ProcessService} implementation that delegates execution of the
* methods to a {@link CommandService}.
@@ -42,7 +43,7 @@
protected CommandService commandService;
- public ProcessDefinition deploy(ProcessDefinition processDefinition) {
+ public ProcessDefinition deploy(OpenProcessDefinition processDefinition) {
Deployment deployment = new Deployment(processDefinition);
return commandService.execute(new DeployCmd(deployment));
}
Added: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateKeyBinding.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateKeyBinding.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateKeyBinding.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.deploy.CreateKey;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CreateKeyBinding extends WireDescriptorBinding {
+
+ public CreateKeyBinding() {
+ super("create-key");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ObjectDescriptor(CreateKey.class);
+ }
+
+}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/CompositeElement.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/CompositeElement.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/CompositeElement.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -26,7 +26,7 @@
-/** node container base class for {@link ProcessDefinition} and {@link Node}.
+/** node container base class for {@link OpenProcessDefinition} and {@link Node}.
*
* @author Tom Baeyens
*/
Added: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -0,0 +1,34 @@
+/*
+ * 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.model;
+
+import org.jbpm.pvm.Execution;
+import org.jbpm.pvm.ProcessDefinition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ExecutionKeyGenerator {
+
+ String createKey(ProcessDefinition processDefinition, Execution execution, String executionRef);
+}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Node.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Node.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Node.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -28,7 +28,7 @@
/**
- * a node in a {@link ProcessDefinition} graph.
+ * a node in a {@link OpenProcessDefinition} graph.
*
* <p>The node supports both graph based process models as well as
* block structured (tree based) process models. First we describe
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ObservableElement.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ObservableElement.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ObservableElement.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -37,7 +37,7 @@
String getName();
/** the process definition to which this process element belongs */
- ProcessDefinition getProcessDefinition();
+ OpenProcessDefinition getProcessDefinition();
/** the property value for the given key or null if no such
* configuration key is present.
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/OpenExecution.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/OpenExecution.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/OpenExecution.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -48,7 +48,7 @@
public interface OpenExecution extends Execution, Discussable {
/** the process definition for this execution.*/
- ProcessDefinition getProcessDefinition();
+ OpenProcessDefinition getProcessDefinition();
/** the current node */
Node getNode();
Copied: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java (from rev 1992, jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ProcessDefinition.java)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -0,0 +1,59 @@
+/*
+ * 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.model;
+
+import org.jbpm.pvm.ProcessDefinition;
+
+
+
+/**
+ * a graph (or tree) structure that can be executed.
+ *
+ * <h2>Purpose</h2>
+ * <p>ProcessDefinition is a base implementation that can be leveraged to build
+ * graph based execution languages. While the ProcessDefinition class is concrete and
+ * can be used as-is (e.g. by aggregation), most likely processDefinition languages
+ * will inherit from this ProcessDefinition and create more specialized implementations.
+ * </p>
+ *
+ * <p>The specialized processDefinition language classes can extend this ProcessDefinition
+ * with new datastructures relevant for that perticular processDefinition language.
+ * </p>
+ *
+ * <h2>Structure</h2>
+ * <p>A processDefinition contains a set of nodes. Nodes can be connected with
+ * transitions or nodes can have nested nodes. But the transitions and
+ * nested nodes can be combined.
+ * </p>
+ *
+ * <h2>Execution</h2>
+ * <p>To create a new execution for a given processDefinition, see {@link #startExecution()}.
+ * </p>
+ *
+ * @author Tom Baeyens
+ */
+public interface OpenProcessDefinition extends ProcessDefinition, CompositeElement {
+
+ /** the initial node of this process definition */
+ Node getInitial();
+
+}
\ No newline at end of file
Property changes on: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ProcessDefinition.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ProcessDefinition.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/ProcessDefinition.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.model;
-
-
-
-/**
- * a graph (or tree) structure that can be executed.
- *
- * <h2>Purpose</h2>
- * <p>ProcessDefinition is a base implementation that can be leveraged to build
- * graph based execution languages. While the ProcessDefinition class is concrete and
- * can be used as-is (e.g. by aggregation), most likely processDefinition languages
- * will inherit from this ProcessDefinition and create more specialized implementations.
- * </p>
- *
- * <p>The specialized processDefinition language classes can extend this ProcessDefinition
- * with new datastructures relevant for that perticular processDefinition language.
- * </p>
- *
- * <h2>Structure</h2>
- * <p>A processDefinition contains a set of nodes. Nodes can be connected with
- * transitions or nodes can have nested nodes. But the transitions and
- * nested nodes can be combined.
- * </p>
- *
- * <h2>Execution</h2>
- * <p>To create a new execution for a given processDefinition, see {@link #startExecution()}.
- * </p>
- *
- * @author Tom Baeyens
- */
-public interface ProcessDefinition extends CompositeElement {
-
- /** the package name of this process. This is a similar way of
- * grouping and creating a structure as in Java. We recommend
- * the same conventions as with Java package names. */
- String getPackageName();
-
- /** automatically assigned during deployment of a process that
- * represents the sequence number for process definitions with
- * the same {@link ObservableElement#getName() name}. */
- int getVersion();
-
- /** the initial node of this process definition */
- Node getInitial();
-
-}
\ No newline at end of file
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Transition.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Transition.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/model/Transition.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -25,7 +25,7 @@
/**
- * a transition in a {@link ProcessDefinition} graph.
+ * a transition in a {@link OpenProcessDefinition} graph.
*
* <h3 id="guardconditions">Guard conditions</h3>
* <p>TODO</p>
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/session/PvmDbSession.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/session/PvmDbSession.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/session/PvmDbSession.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -38,16 +38,19 @@
List<String> findProcessDefinitionNames();
/** all versions of the given process. */
- List<ClientProcessDefinition> findProcessDefinitions(String name);
+ List<ClientProcessDefinition> findProcessDefinitionsByName(String name);
+ /** specific version of a named processDefinition. */
+ ClientProcessDefinition findProcessDefinitionByName(String name, int version);
+
/** latest version of the processDefinition with the given name. */
- ClientProcessDefinition findProcessDefinition(String name);
+ ClientProcessDefinition findLatestProcessDefinitionByName(String name);
- /** specific version of a named processDefinition. */
- ClientProcessDefinition findProcessDefinition(String name, int version);
+ /** the process definition uniquely identified by the given processDefinitionKey. */
+ ClientProcessDefinition findProcessDefinitionByKey(String processDefinitionKey);
- /** an execution identified by process definition and business key */
- ClientExecution findExecution(String processDefinitionName, String key);
+ /** the execution uniquely identified by the given executionKey. */
+ ClientExecution findExecutionByKey(String executionKey);
/** timers */
List<Timer> findTimers();
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/test/base/EnvironmentDbTestCase.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -30,7 +30,7 @@
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.session.DbSession;
import org.jbpm.pvm.session.PvmDbSession;
@@ -123,7 +123,7 @@
}
}
- public ProcessDefinitionImpl reload(ProcessDefinition processDefinition) {
+ public ProcessDefinitionImpl reload(OpenProcessDefinition processDefinition) {
environment.get(PvmDbSession.class).save(processDefinition);
newTransaction();
return environment.get(PvmDbSession.class).get(ProcessDefinitionImpl.class, processDefinition.getDbid());
Modified: jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.definition.hbm.xml 2008-08-25 14:11:51 UTC (rev 1997)
@@ -60,6 +60,8 @@
</set>
<!-- ProcessDefinitionImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <property name="key" column="KEY_" unique="true" />
+
<property name="packageName" column="PACKAGE_" />
<property name="version" column="VERSION_" />
<property name="deploymentTime" column="DEPLOYED_" />
@@ -406,4 +408,14 @@
]]>
</query>
+ <query name="findProcessDefinitionsByKey">
+ <![CDATA[
+ select process
+ from org.jbpm.pvm.internal.model.ProcessDefinitionImpl as process
+ where process.key = :key
+ ]]>
+ </query>
+
+
+
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.execution.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.execution.hbm.xml 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.execution.hbm.xml 2008-08-25 14:11:51 UTC (rev 1997)
@@ -114,12 +114,11 @@
<!-- ### QUERIES ######################################################## -->
- <query name="findExecutionByProcessDefinitionNameAndKey">
+ <query name="findExecutionByKey">
<![CDATA[
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
- where execution.processDefinition.name = :name
- and execution.key = :key
+ where execution.key = :key
]]>
</query>
Modified: jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/pvm.wire.bindings.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/pvm.wire.bindings.xml 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/pvm.wire.bindings.xml 2008-08-25 14:11:51 UTC (rev 1997)
@@ -60,6 +60,7 @@
<binding class="org.jbpm.pvm.internal.wire.binding.CreateProcessBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.VerifyVersionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.SaveProcessBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.CreateKeyBinding" />
<!-- ############################ -->
<!-- ### Interceptor bindings ### -->
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -16,19 +16,19 @@
import java.util.HashMap;
import java.util.Map;
+import org.jbpm.pvm.Deployment;
import org.jbpm.pvm.Execution;
import org.jbpm.pvm.activity.Activity;
import org.jbpm.pvm.activity.ActivityExecution;
import org.jbpm.pvm.activity.ExternalActivity;
import org.jbpm.pvm.client.ClientProcessDefinition;
-import org.jbpm.pvm.model.ProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.test.base.DbTestCase;
/**
+ * @author Tom Baeyens
* @author Guillaume Porcher
- *
*/
public class AutomaticDecisionDbTest extends DbTestCase {
@@ -72,35 +72,38 @@
}
public void testGoodRating() {
- ProcessDefinition processDefinition = processService.deploy(createCreditProcess());
+ Deployment deployment = new Deployment(createCreditProcess());
+ processService.deploy(deployment);
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("creditRate", 7);
- Execution execution = executionService.startExecution(processDefinition.getDbid(), variables);
+ Execution execution = executionService.startExecutionInLatest("creditProcess", variables);
assertEquals("priority delivery", execution.getNodeName());
}
public void testAverageRating() {
- ProcessDefinition processDefinition = processService.deploy(createCreditProcess());
+ Deployment deployment = new Deployment(createCreditProcess());
+ processService.deploy(deployment);
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("creditRate", 2);
- Execution execution = executionService.startExecution(processDefinition.getDbid(), variables);
+ Execution execution = executionService.startExecutionInLatest("creditProcess", variables);
assertEquals("bulk delivery", execution.getNodeName());
}
public void testBadRating() {
- ProcessDefinition processDefinition = processService.deploy(createCreditProcess());
+ Deployment deployment = new Deployment(createCreditProcess());
+ processService.deploy(deployment);
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("creditRate", -7);
- Execution execution = executionService.startExecution(processDefinition.getDbid(), variables);
+ Execution execution = executionService.startExecutionInLatest("creditProcess", variables);
assertEquals("payment upfront", execution.getNodeName());
}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/basicfeatures/BasicExecutionFlowDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/basicfeatures/BasicExecutionFlowDbTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/basicfeatures/BasicExecutionFlowDbTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -17,6 +17,7 @@
import java.util.List;
import java.util.Map;
+import org.jbpm.pvm.Deployment;
import org.jbpm.pvm.Execution;
import org.jbpm.pvm.activity.Activity;
import org.jbpm.pvm.activity.ActivityExecution;
@@ -74,9 +75,10 @@
.node("f").behaviour(AutomaticActivity.class)
.done();
- processService.deploy(processDefinition);
+ Deployment deployment = new Deployment(processDefinition);
+ processService.deploy(deployment);
- Execution processInstance = executionService.startExecution(processDefinition.getDbid());
+ Execution processInstance = executionService.startExecution("myProcess");
List<String> expectedEvents = new ArrayList<String>();
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -37,7 +37,7 @@
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
import org.jbpm.pvm.internal.log.Log;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.session.DbSession;
import org.jbpm.pvm.session.PvmDbSession;
@@ -88,7 +88,7 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) throws Exception {
log.debug("building process 'continuations'");
- ProcessDefinition processDefinition = ProcessFactory.build("continuations")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("continuations")
.node("start").initial().behaviour(AutomaticActivity.class)
.asyncExecute()
.transition().to("a")
@@ -116,7 +116,7 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) throws Exception {
PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- ClientProcessDefinition processDefinition = pvmDbSession.findProcessDefinition("continuations");
+ ClientProcessDefinition processDefinition = pvmDbSession.findLatestProcessDefinitionByName("continuations");
ClientProcessInstance execution = processDefinition.beginProcessInstance();
pvmDbSession.save(execution);
return null;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -29,9 +29,9 @@
import org.jbpm.pvm.Deployment;
import org.jbpm.pvm.Execution;
import org.jbpm.pvm.ExecutionService;
+import org.jbpm.pvm.ProcessDefinition;
import org.jbpm.pvm.ProcessService;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.model.ProcessDefinition;
import org.jbpm.pvm.test.base.DbTestCase;
@@ -70,7 +70,7 @@
ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
- Execution execution = executionService.startExecution("nuclear fusion");
+ Execution execution = executionService.startExecutionInLatest("nuclear fusion");
assertNotNull(execution);
// TODO fix after refactoring
@@ -78,19 +78,22 @@
// assertEquals(3, execution.getProcessDefinition().getVersion());
}
- public void testStartExecutionByDbid() {
+ public void testStartExecutionByKey() {
ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
processDefinition.setName("nuclear fusion");
processDefinition.setVersion(1);
- processService.deploy(new Deployment(processDefinition));
+ Deployment deployment = new Deployment(processDefinition);
+ deployment.setProcessDefinitionRef("NCLFU");
+ processService.deploy(deployment);
ProcessDefinition deployed = processService.findProcessDefinition("nuclear fusion", 1);
-
+ String processDefinitionKey = deployed.getKey();
+
ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
- Execution execution = executionService.startExecution(deployed.getDbid());
+ Execution execution = executionService.startExecution(processDefinitionKey);
assertNotNull(execution);
// TODO fix after refactoring
@@ -112,7 +115,7 @@
ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
- Execution execution = executionService.startExecution("nuclear fusion", variables);
+ Execution execution = executionService.startExecutionInLatest("nuclear fusion", variables);
long executionDbid = execution.getDbid();
assertEquals(new Integer(1), executionService.getVariable(executionDbid, "a"));
@@ -128,7 +131,7 @@
processService.deploy(new Deployment(processDefinition));
ProcessDefinition deployed = processService.findProcessDefinition("nuclear fusion", 1);
- long processDefinitionDbid = deployed.getDbid();
+ String processDefinitionKey = deployed.getKey();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("a", new Integer(1));
@@ -136,7 +139,7 @@
ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
- Execution execution = executionService.startExecution(processDefinitionDbid, variables);
+ Execution execution = executionService.startExecution(processDefinitionKey, variables);
long executionDbid = execution.getDbid();
assertEquals(new Integer(1), executionService.getVariable(executionDbid, "a"));
@@ -153,7 +156,7 @@
ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
- executionService.startExecution("nuclear fusion", null, "the first time");
+ executionService.startExecutionInLatest("nuclear fusion", null, "the first time");
assertNotNull(executionService.findExecution("nuclear fusion", "the first time"));
}
@@ -164,14 +167,15 @@
ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
processDefinition.setName("nuclear fusion");
processDefinition.setVersion(1);
- processService.deploy(new Deployment(processDefinition));
+ Deployment deployment = new Deployment(processDefinition);
+ processService.deploy(deployment);
ProcessDefinition deployed = processService.findProcessDefinition("nuclear fusion", 1);
- long processDefinitionDbid = deployed.getDbid();
+ String processDefinitionKey = deployed.getKey();
ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
- executionService.startExecution(processDefinitionDbid, null, "the first time");
+ executionService.startExecution(processDefinitionKey, null, "the first time");
assertNotNull(executionService.findExecution("nuclear fusion", "the first time"));
}
@@ -186,7 +190,7 @@
ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
- Execution execution = executionService.startExecution("nuclear fusion");
+ Execution execution = executionService.startExecutionInLatest("nuclear fusion");
execution = executionService.findExecution(execution.getDbid());
@@ -203,7 +207,7 @@
ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
- Execution execution = executionService.startExecution("nuclear fusion");
+ Execution execution = executionService.startExecutionInLatest("nuclear fusion");
executionService.setVariable(execution.getDbid(), "a", "text");
assertEquals("text", executionService.getVariable(execution.getDbid(), "a") );
@@ -219,7 +223,7 @@
ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
- Execution execution = executionService.startExecution("nuclear fusion");
+ Execution execution = executionService.startExecutionInLatest("nuclear fusion");
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("a", new Integer(1));
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -25,10 +25,10 @@
import java.util.List;
import org.jbpm.pvm.Deployment;
+import org.jbpm.pvm.ProcessDefinition;
import org.jbpm.pvm.ProcessService;
import org.jbpm.pvm.PvmException;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.model.ProcessDefinition;
import org.jbpm.pvm.test.base.DbTestCase;
/**
@@ -221,6 +221,4 @@
assertEquals("nuclear fusion", retrieved.getName());
assertEquals(3, retrieved.getVersion());
}
-
-
}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -18,6 +18,7 @@
import java.util.Map;
import java.util.Set;
+import org.jbpm.pvm.Deployment;
import org.jbpm.pvm.Execution;
import org.jbpm.pvm.ExecutionService;
import org.jbpm.pvm.ProcessService;
@@ -30,7 +31,7 @@
import org.jbpm.pvm.job.JobTestHelper;
import org.jbpm.pvm.job.Timer;
import org.jbpm.pvm.model.OpenExecution;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.samples.activities.AutomaticActivity;
import org.jbpm.pvm.session.DbSession;
@@ -68,17 +69,18 @@
return Environment.getCurrent().get(ExecutionService.class);
}
- private static ExecutionImpl deployAndInstanciateProcess(ProcessDefinition definition) {
+ private static ExecutionImpl deployAndInstanciateProcess(OpenProcessDefinition definition) {
ProcessService processService = Environment.getCurrent().get(ProcessService.class);
- processService.deploy(definition);
+ Deployment deployment = new Deployment(definition);
+ processService.deploy(deployment);
- Execution processInstance = getExecutionService().startExecution(definition.getName());
+ Execution processInstance = getExecutionService().startExecutionInLatest(definition.getName());
return (ExecutionImpl) processInstance;
}
public void testTimerDefinition() {
- ProcessDefinition processDefinition = ProcessFactory.build("timerDefinition")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("timerDefinition")
.node("request").initial().behaviour(WaitState.class)
.transition().to("decide")
.node("decide").behaviour(WaitState.class)
@@ -122,7 +124,7 @@
}
public void testTimerExecution() {
- ProcessDefinition processDefinition = ProcessFactory.build("timerExecution")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("timerExecution")
.node("decide").initial().behaviour(WaitState.class)
.timer(getDueDate(twoDaysDuration), "timeout")
.transition("decision made").to("response") // first defined transition is the default one
@@ -159,7 +161,7 @@
}
public void testCanceledTimer() {
- ProcessDefinition processDefinition = ProcessFactory.build("timerCanceled")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("timerCanceled")
.node("decide").initial().behaviour(WaitState.class)
.timer(getDueDate(twoDaysDuration), "timeout")
.transition("decision made").to("response") // first defined transition is the default one
@@ -196,7 +198,7 @@
Date now = new Date();
long twoDaysFromNow = now.getTime() + twoDaysDuration;
- ProcessDefinition processDefinition = ProcessFactory.build("fixedDateTimer")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("fixedDateTimer")
.node("decide").initial().behaviour(WaitState.class)
.timer(getDueDate(twoDaysDuration), "timeout")
.transition("decision made").to("response") // first defined transition is the default one
@@ -222,7 +224,7 @@
Date now = new Date();
long twoDaysFromNow = now.getTime() + twoDaysDuration;
- ProcessDefinition processDefinition = ProcessFactory.build("dueDateDescriptionTimer")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("dueDateDescriptionTimer")
.node("decide").initial().behaviour(WaitState.class)
.timer("2 days", "timeout")
.transition("decision made").to("response") // first defined transition is the default one
@@ -248,7 +250,7 @@
Date now = Clock.getCurrentTime();
long twoDaysFromNow = now.getTime() + twoDaysDuration;
- ProcessDefinition processDefinition = ProcessFactory.build("reschedulingTimer")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("reschedulingTimer")
.node("decide").initial().behaviour(IncrementCounterWaitState.class)
.variable(IncrementCounterWaitState.COUNTER, "0")
.timer("2 days", "increment", "2 days")
@@ -302,7 +304,7 @@
}
public void testTimerEndingProcessExecution() {
- ProcessDefinition processDefinition = ProcessFactory.build("timerEndingProcess")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("timerEndingProcess")
.node("decide").initial().behaviour(WaitState.class)
.timer("2 business days", "timeout")
.transition("decision made").to("response") // first defined transition is the default one
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/EnterpriseTimerSessionTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -40,7 +40,7 @@
import org.jbpm.pvm.internal.ejb.LocalCommandExecutorHome;
import org.jbpm.pvm.internal.job.TimerImpl;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.session.DbSession;
import org.jbpm.pvm.session.TimerSession;
@@ -72,7 +72,7 @@
// create local bean
commandExecutor = commandExecutorHome.create();
// deploy process
- ProcessDefinition processDefinition = ProcessFactory.build(getName())
+ OpenProcessDefinition processDefinition = ProcessFactory.build(getName())
.timer(TIMEOUT + " milliseconds", null)
.event("timeout")
.listener(new ObjectDescriptor(HappyActivity.class))
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/TimerTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/TimerTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/enterprise/TimerTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -45,7 +45,7 @@
import org.jbpm.pvm.internal.log.Log;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.session.DbSession;
@@ -57,7 +57,7 @@
*/
public class TimerTest extends ServletTestCase {
- private ProcessDefinition processDefinition;
+ private OpenProcessDefinition processDefinition;
private ObjectDescriptor activityDescriptor = new ObjectDescriptor();
private LocalCommandExecutor commandExecutor;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/langext/LanguageExtensionsDbTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -26,7 +26,7 @@
import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.session.DbSession;
import org.jbpm.pvm.session.PvmDbSession;
@@ -51,7 +51,7 @@
DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
assertNotNull(persistenceSession);
- ProcessDefinition processDefinition = ProcessFactory.build("addresses")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("addresses")
.node().initial().behaviour(new AddressActivity("Sesamestreet", 15))
.transition().to("a")
.node("a").behaviour(new AddressActivity("Broadway", 151))
@@ -66,7 +66,7 @@
newTransaction();
PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- Execution execution = pvmDbSession.findProcessDefinition("addresses").beginProcessInstance();
+ Execution execution = pvmDbSession.findLatestProcessDefinitionByName("addresses").beginProcessInstance();
assertTrue(execution.isEnded());
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessCacheDbTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -21,7 +21,7 @@
import org.jbpm.pvm.internal.model.NodeImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.model.Node;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.model.Transition;
import org.jbpm.pvm.session.DbSession;
@@ -39,7 +39,7 @@
* persists it.
*/
public void testCacheProcessDefinitionNodes(){
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.node("a").initial()
.node("b")
.node("c")
@@ -107,7 +107,7 @@
* persists it.
*/
public void testCacheProcessDefinitionNodeOrder(){
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.node("a").initial()
.node("b")
.node("c")
@@ -258,7 +258,7 @@
DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
assertNotNull(persistenceSession);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.compositeNode().initial()
.node("a")
.node("b")
@@ -273,7 +273,7 @@
persistenceSession = (DbSession) environment.get(DbSession.class);
- ProcessDefinition p = (ProcessDefinition) persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ OpenProcessDefinition p = (OpenProcessDefinition) persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -288,7 +288,7 @@
persistenceSession = (DbSession) environment.get(DbSession.class);
- p = (ProcessDefinition) persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ p = (OpenProcessDefinition) persistenceSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -309,7 +309,7 @@
DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
assertNotNull(persistenceSession);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.compositeNode().initial()
.compositeNode("a")
.node("aa")
@@ -412,7 +412,7 @@
public void testCacheDefaultTransition() {
DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
assertNotNull(persistenceSession);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.node().initial()
.transition().to("a")
.node("a")
@@ -428,7 +428,7 @@
DbSession testSession = (DbSession) environment.get(DbSession.class);
- ProcessDefinition p = (ProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ OpenProcessDefinition p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -458,7 +458,7 @@
testSession = (DbSession) environment.get(DbSession.class);
- p = (ProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -493,7 +493,7 @@
public void testCacheTwoTransitions() {
DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
assertNotNull(persistenceSession);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.node().initial()
.transition().to("a")
.transition().to("b")
@@ -507,7 +507,7 @@
DbSession testSession = (DbSession) environment.get(DbSession.class);
- ProcessDefinition p = (ProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ OpenProcessDefinition p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -544,7 +544,7 @@
testSession = (DbSession) environment.get(DbSession.class);
beginCacheTest(); /////////
- p = (ProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ p = (OpenProcessDefinition) testSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessDefinitionDbTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -23,7 +23,7 @@
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.model.Event;
import org.jbpm.pvm.model.Node;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.model.Transition;
import org.jbpm.pvm.session.DbSession;
@@ -54,7 +54,7 @@
}
public void testProcessDefinitionNodes(){
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.node("a").initial()
.node("b")
.node("c")
@@ -82,7 +82,7 @@
}
public void testInitialNode(){
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.node("a").initial()
.node("b")
.node("c")
@@ -103,7 +103,7 @@
DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
assertNotNull(persistenceSession);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.compositeNode("top").initial()
.node("a")
.compositeNode("b")
@@ -155,7 +155,7 @@
public void testDefaultTransition() {
DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
assertNotNull(persistenceSession);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.node("a").initial()
.transition().to("a")
.transition("tob").to("b")
@@ -180,7 +180,7 @@
public void testTwoTransitionsWithoutAName() {
DbSession persistenceSession = (DbSession) environment.get(DbSession.class);
assertNotNull(persistenceSession);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.node().initial()
.transition().to("a")
.transition().to("b")
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/ProcessExecutionDbTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -16,7 +16,7 @@
import org.jbpm.pvm.test.base.EnvironmentDbTestCase;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
/**
* @author Guillaume Porcher
@@ -25,7 +25,7 @@
public class ProcessExecutionDbTest extends EnvironmentDbTestCase {
public void testExecutionProperties() {
- ProcessDefinition processDefinition = new ProcessDefinitionImpl();
+ OpenProcessDefinition processDefinition = new ProcessDefinitionImpl();
processDefinition = reload(processDefinition); // new transaction /////////
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/WireDbTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -49,7 +49,7 @@
import org.jbpm.pvm.internal.wire.descriptor.TrueDescriptor;
import org.jbpm.pvm.internal.wire.operation.FieldOperation;
import org.jbpm.pvm.internal.wire.operation.PropertyOperation;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.session.DbSession;
@@ -306,7 +306,7 @@
listD.setValueDescriptors(listValues);
listD.setClassName(LinkedList.class.getName());
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.property(listD)
.node().initial()
.done();
@@ -317,7 +317,7 @@
dbSession = (DbSession) environment.get(DbSession.class);
- ProcessDefinition p = (ProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -353,7 +353,7 @@
setD.setValueDescriptors(listValues);
setD.setClassName(TreeSet.class.getName());
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.property(setD)
.node().initial()
.done();
@@ -364,7 +364,7 @@
dbSession = (DbSession) environment.get(DbSession.class);
- ProcessDefinition p = (ProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -411,7 +411,7 @@
mapD.setKeyDescriptors(mapKeys);
mapD.setClassName(TreeMap.class.getName());
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.property(mapD)
.node().initial()
.done();
@@ -422,7 +422,7 @@
dbSession = (DbSession) environment.get(DbSession.class);
- ProcessDefinition p = (ProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -472,7 +472,7 @@
objStaticMethod.addArgDescriptor(argStaticMethod);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.property(objDefault)
.property(objConstr)
.property(objStaticMethod)
@@ -485,7 +485,7 @@
dbSession = (DbSession) environment.get(DbSession.class);
- ProcessDefinition p = (ProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -518,7 +518,7 @@
objDescr.addOperation(fieldOp);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.property(objDescr)
.node().initial()
.done();
@@ -529,7 +529,7 @@
dbSession = (DbSession) environment.get(DbSession.class);
- ProcessDefinition p = (ProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
@@ -561,7 +561,7 @@
objDescr.addOperation(propertyOp);
- ProcessDefinition processDefinition = ProcessFactory.build()
+ OpenProcessDefinition processDefinition = ProcessFactory.build()
.property(objDescr)
.node().initial()
.done();
@@ -572,7 +572,7 @@
dbSession = (DbSession) environment.get(DbSession.class);
- ProcessDefinition p = (ProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
+ OpenProcessDefinition p = (OpenProcessDefinition) dbSession.get(ProcessDefinitionImpl.class, processDefinition.getDbid());
assertNotNull(p);
assertNotSame(processDefinition, p);
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex02/BasicProcessPersistenceTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -23,6 +23,7 @@
import junit.framework.TestCase;
+import org.jbpm.pvm.Deployment;
import org.jbpm.pvm.Execution;
import org.jbpm.pvm.ExecutionService;
import org.jbpm.pvm.ProcessService;
@@ -53,12 +54,13 @@
ProcessService processService = ExamplesConfiguration.getProcessService();
- processService.deploy(processDefinition);
+ Deployment deployment = new Deployment(processDefinition);
+ processService.deploy(deployment);
ExecutionService executionService = ExamplesConfiguration.getExecutionService();
- Execution execution = executionService.startExecution("basic", "one");
+ Execution execution = executionService.startExecutionInLatest("basic", "one");
assertEquals("a", execution.getNodeName());
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex04/ExternalDecisionTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex04/ExternalDecisionTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex04/ExternalDecisionTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -28,7 +28,7 @@
import org.jbpm.pvm.samples.activities.WaitState;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.client.ClientProcessInstance;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex05/InternalDecisionTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex05/InternalDecisionTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex05/InternalDecisionTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -27,7 +27,7 @@
import org.jbpm.pvm.samples.activities.WaitState;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.client.ClientProcessInstance;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex07/EventListenerTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex07/EventListenerTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex07/EventListenerTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -29,7 +29,7 @@
import org.jbpm.pvm.samples.activities.WaitState;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.model.Event;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex11/AsynchronousContinuationsTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex11/AsynchronousContinuationsTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex11/AsynchronousContinuationsTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -23,6 +23,7 @@
import junit.framework.TestCase;
+import org.jbpm.pvm.Deployment;
import org.jbpm.pvm.Execution;
import org.jbpm.pvm.ExecutionService;
import org.jbpm.pvm.ProcessService;
@@ -53,11 +54,11 @@
ProcessService processService = ExamplesConfiguration.getProcessService();
- processService.deploy(processDefinition);
+ processService.deploy(new Deployment(processDefinition));
ExecutionService executionService = ExamplesConfiguration.getExecutionService();
- Execution execution = executionService.startExecution("async");
+ Execution execution = executionService.startExecutionInLatest("async");
assertTrue(execution.isLocked());
assertEquals("b", execution.getNodeName());
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex12/TimerTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex12/TimerTest.java 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/samples/ex12/TimerTest.java 2008-08-25 14:11:51 UTC (rev 1997)
@@ -25,10 +25,11 @@
import junit.framework.TestCase;
+import org.jbpm.pvm.Deployment;
import org.jbpm.pvm.Execution;
import org.jbpm.pvm.ExecutionService;
import org.jbpm.pvm.ProcessService;
-import org.jbpm.pvm.model.ProcessDefinition;
+import org.jbpm.pvm.model.OpenProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.samples.ExamplesConfiguration;
import org.jbpm.pvm.samples.activities.WaitState;
@@ -41,7 +42,7 @@
public void testTimer() {
- ProcessDefinition processDefinition = ProcessFactory.build("timed")
+ OpenProcessDefinition processDefinition = ProcessFactory.build("timed")
.node("get input").initial().behaviour(WaitState.class)
.timer("2 business days", "escalate")
.transition("escalate").to("manager decision")
@@ -52,14 +53,15 @@
ProcessService processService = ExamplesConfiguration.getProcessService();
- processService.deploy(processDefinition);
+ Deployment deployment = new Deployment(processDefinition);
+ processService.deploy(deployment);
Date now = new Date();
long fourtyEightHoursFromNow = now.getTime() + 48*60*60*1000;
ExecutionService executionService = ExamplesConfiguration.getExecutionService();
- Execution execution = executionService.startExecution("timed");
+ Execution execution = executionService.startExecutionInLatest("timed");
/* TODO Fix after refactoring
Node node = execution.getNode();
Modified: jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml 2008-08-25 13:05:01 UTC (rev 1996)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/environment.cfg.xml 2008-08-25 14:11:51 UTC (rev 1997)
@@ -7,6 +7,7 @@
<deployer-manager resource="pvm.language.deployers.xml">
<language name="api">
<verify-version />
+ <create-key />
<save-process />
</language>
</deployer-manager>
More information about the jbpm-commits
mailing list