[jbpm-commits] JBoss JBPM SVN: r4565 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/client and 9 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Apr 16 09:09:58 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-04-16 09:09:58 -0400 (Thu, 16 Apr 2009)
New Revision: 4565
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstance.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstanceQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenProcessInstance.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java
Removed:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/client/ClientProcessInstance.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/EndProcessInstanceTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
Log:
JBPM-2171 introducing ProcessInstance
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm;
-
-import java.util.List;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface ExecutionQuery {
-
- String PROPERTY_KEY = "key";
-
- ExecutionQuery processDefinitionId(String processDefinitionId);
-
- ExecutionQuery processInstanceId(String processInstanceId);
-
- ExecutionQuery orderAsc(String property);
- ExecutionQuery orderDesc(String property);
-
- ExecutionQuery page(int firstResult, int maxResults);
-
- List<Execution> list();
- Execution uniqueResult();
-}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionService.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -21,7 +21,6 @@
*/
package org.jbpm;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -34,36 +33,36 @@
/** starts a new process instance for the ProcessDefinition with the given processDefinitionDbid.
* @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition. */
- Execution startProcessInstanceById(String processDefinitionId);
+ ProcessInstance startProcessInstanceById(String processDefinitionId);
/** starts a new process instance for the ProcessDefinition with the given processDefinitionDbid.
* @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition.
* @param processInstanceKey is a user provided reference for the new process instance that must be unique over all
* process definition versions with the same name. */
- Execution startProcessInstanceById(String processDefinitionId, String processInstanceKey);
+ ProcessInstance startProcessInstanceById(String processDefinitionId, String processInstanceKey);
/** starts a new process instance for the ProcessDefinition with the given processDefinitionDbid.
* @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition.
* @param variables are the initial values of the process variables that will be set before the execution starts. */
- Execution startProcessInstanceById(String processDefinitionId, Map<String, Object> variables);
+ ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables);
/** starts a new process instance for the ProcessDefinition with the given processDefinitionDbid.
* @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition.
* @param variables are the initial values of the process variables that will be set before the execution starts.
* @param processInstanceKey is a user provided reference for the new process instance that must be unique over all
* process versions with the same name. */
- Execution startProcessInstanceById(String processDefinitionId, Map<String, Object> variables, String processInstanceKey);
+ ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables, String processInstanceKey);
/** starts a new process instance in the latest version of the given process definition.
* @param processDefinitionKey is the key of the process definition for which the latest version will be taken. */
- Execution startProcessInstanceByKey(String processDefinitionKey);
+ ProcessInstance startProcessInstanceByKey(String processDefinitionKey);
/** starts a new process instance in the latest version of the given processDefinitionName.
* @param processDefinitionKey is the key of the process definition
* for which the latest version will be taken.
* @param processInstanceKey is a user provided reference for the new process instance
* that must be unique over all process versions with the same name. */
- Execution startProcessInstanceByKey(String processDefinitionKey, String processInstanceKey);
+ ProcessInstance startProcessInstanceByKey(String processDefinitionKey, String processInstanceKey);
/** starts a new process instance in the latest version of the given processDefinitionName.
* @param processDefinitionKey is the key of the process definition
@@ -71,39 +70,36 @@
* @param variables are the initial values of the process variables that
* will be set before the execution starts (read: before the initial
* activity is executed). */
- Execution startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables);
+ ProcessInstance startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables);
/** starts a new process instance in the latest version of the given processDefinitionName.
* @param processDefinitionKey is the key of the process definition for which the latest version will be taken.
* @param variables are the initial values of the process variables that will be set before the execution starts.
* @param processInstanceKey is a user provided reference for the new execution that must be unique over all
* process versions with the same name. */
- Execution startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables, String processInstanceKey);
+ ProcessInstance startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables, String processInstanceKey);
- /** the execution that is uniquely defined by the process execution id. */
+ /** the path of execution that is uniquely defined by the execution id. */
Execution findExecutionById(String executionId);
- /** this method returns this execution and all its child executions recursively. */
- List<Execution> findExecutionsById(String processDefinitionId);
+ /** the process instance that is uniquely defined by the process execution id. */
+ ProcessInstance findProcessInstanceById(String processInstanceId);
/** provides an external trigger to an execution. */
- Execution signalExecutionById(String executionId);
+ ProcessInstance signalExecutionById(String executionId);
/** provides a named external trigger to an execution. */
- Execution signalExecutionById(String executionId, String signalName);
+ ProcessInstance signalExecutionById(String executionId, String signalName);
/** provides a named external trigger to an execution with parameters. */
- Execution signalExecutionById(String executionId, String signalName, Map<String, Object> parameters);
+ ProcessInstance signalExecutionById(String executionId, String signalName, Map<String, Object> parameters);
/** provides a external trigger to an execution with parameters. */
- Execution signalExecutionById(String executionId, Map<String, Object> parameters);
+ ProcessInstance signalExecutionById(String executionId, Map<String, Object> parameters);
- /** search for executions with criteria */
- ExecutionQuery createExecutionQuery();
-
/** search for process instances with criteria */
- ExecutionQuery createProcessInstanceQuery();
+ ProcessInstanceQuery createProcessInstanceQuery();
/** creates or overwrites a variable value on the referenced execution */
void setVariable(String executionId, String name, Object value);
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstance.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstance.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstance.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+
+/** a process instance is one execution of a process definition.
+ * One process instance can have many concurrent executions.
+ * Executions are structured in a tree of which the ProcessInstance
+ * is the root.
+ *
+ * @author Tom Baeyens
+ */
+public interface ProcessInstance extends Execution {
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstance.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstanceQuery.java (from rev 4558, jbpm4/trunk/modules/api/src/main/java/org/jbpm/ExecutionQuery.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstanceQuery.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstanceQuery.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -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;
+
+import java.util.List;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ProcessInstanceQuery {
+
+ String PROPERTY_KEY = "key";
+
+ ProcessInstanceQuery processDefinitionId(String processDefinitionId);
+
+ ProcessInstanceQuery processInstanceId(String processInstanceId);
+
+ ProcessInstanceQuery orderAsc(String property);
+ ProcessInstanceQuery orderDesc(String property);
+
+ ProcessInstanceQuery page(int firstResult, int maxResults);
+
+ List<Execution> list();
+ Execution uniqueResult();
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessInstanceQuery.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/client/ClientProcessInstance.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/client/ClientProcessInstance.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/client/ClientProcessInstance.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -21,16 +21,17 @@
*/
package org.jbpm.client;
+import org.jbpm.model.OpenProcessInstance;
+
/**
* @author Tom Baeyens
*/
-public interface ClientProcessInstance extends ClientExecution {
+public interface ClientProcessInstance extends ClientExecution, OpenProcessInstance {
// start ////////////////////////////////////////////////////////////////////
/** starts this process instance */
void start();
-
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenExecution.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -137,7 +137,7 @@
/** the main path of execution in the <a href="package-summary.html#basicexecutionstructure">execution
* structure</a>. Null will be returned in case this execution itself is the
* main execution path. */
- OpenExecution getProcessInstance();
+ OpenProcessInstance getProcessInstance();
/** the parent execution in the <a href="package-summary.html#basicexecutionstructure">execution
* structure</a>. Null will be returned in case this execution itself is the
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenProcessInstance.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenProcessInstance.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenProcessInstance.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -0,0 +1,27 @@
+/*
+ * 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.model;
+
+import org.jbpm.ProcessInstance;
+
+public interface OpenProcessInstance extends OpenExecution, ProcessInstance {
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/model/OpenProcessInstance.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -21,10 +21,12 @@
*/
package org.jbpm.examples.concurrency.graphbased;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.jbpm.Execution;
+import org.jbpm.ProcessInstance;
import org.jbpm.test.JbpmTestCase;
@@ -50,7 +52,7 @@
public void testConcurrencyGraphBased() {
- Execution processInstance = executionService.startProcessInstanceByKey("ConcurrencyGraphBased");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ConcurrencyGraphBased");
String pid = processInstance.getId();
Set<String> expectedActivityNames = new HashSet<String>();
@@ -58,48 +60,63 @@
expectedActivityNames.add("load truck");
expectedActivityNames.add("print shipping documents");
- assertEquals(expectedActivityNames, getActivityNames(pid));
+ assertEquals(expectedActivityNames, getActiveActivityNames(processInstance));
- assertTrue(findExecution(pid, "send invoice").isActive());
- assertTrue(findExecution(pid, "load truck").isActive());
- assertTrue(findExecution(pid, "print shipping documents").isActive());
+ assertNotNull(processInstance.findActiveExecutionIn("send invoice"));
+ assertNotNull(processInstance.findActiveExecutionIn("load truck"));
+ assertNotNull(processInstance.findActiveExecutionIn("print shipping documents"));
- String sendInvoiceExecutionId = findExecution(pid, "send invoice").getId();
- executionService.signalExecutionById(sendInvoiceExecutionId);
+ String sendInvoiceExecutionId = processInstance.findActiveExecutionIn("send invoice").getId();
+ processInstance = executionService.signalExecutionById(sendInvoiceExecutionId);
expectedActivityNames.remove("send invoice");
- expectedActivityNames.add("final join");
- assertEquals(expectedActivityNames, getActivityNames(pid));
+ assertEquals(expectedActivityNames, getActiveActivityNames(processInstance));
- assertTrue(findExecution(pid, "load truck").isActive());
- assertTrue(findExecution(pid, "print shipping documents").isActive());
- assertFalse(findExecution(pid, "final join").isActive());
+ assertNotNull(processInstance.findActiveExecutionIn("load truck"));
+ assertNotNull(processInstance.findActiveExecutionIn("print shipping documents"));
- String loadTruckExecutionId = findExecution(pid, "load truck").getId();
- executionService.signalExecutionById(loadTruckExecutionId);
+ String loadTruckExecutionId = processInstance.findActiveExecutionIn("load truck").getId();
+ processInstance = executionService.signalExecutionById(loadTruckExecutionId);
expectedActivityNames.remove("load truck");
- expectedActivityNames.add("shipping join");
- assertEquals(expectedActivityNames, getActivityNames(pid));
+ assertEquals(expectedActivityNames, getActiveActivityNames(processInstance));
- assertTrue(findExecution(pid, "print shipping documents").isActive());
- assertFalse(findExecution(pid, "final join").isActive());
+ assertNotNull(processInstance.findActiveExecutionIn("print shipping documents"));
- String printShippingDocumentsId = findExecution(pid, "print shipping documents").getId();
- executionService.signalExecutionById(printShippingDocumentsId);
+ String printShippingDocumentsId = processInstance.findActiveExecutionIn("print shipping documents").getId();
+ processInstance = executionService.signalExecutionById(printShippingDocumentsId);
expectedActivityNames.remove("print shipping documents");
- expectedActivityNames.remove("shipping join");
expectedActivityNames.add("drive truck to destination");
- assertEquals(expectedActivityNames, getActivityNames(pid));
+ assertEquals(expectedActivityNames, getActiveActivityNames(processInstance));
- assertTrue(findExecution(pid, "drive truck to destination").isActive());
- assertFalse(findExecution(pid, "final join").isActive());
+ assertNotNull(processInstance.findActiveExecutionIn("drive truck to destination"));
- String driveTruckExecutionId = findExecution(pid, "drive truck to destination").getId();
- executionService.signalExecutionById(driveTruckExecutionId);
+ String driveTruckExecutionId = processInstance.findActiveExecutionIn("drive truck to destination").getId();
+ processInstance = executionService.signalExecutionById(driveTruckExecutionId);
assertNull("execution "+pid+" should not exist", executionService.findExecutionById(pid));
}
+ public Set<String> getActiveActivityNames(ProcessInstance processInstance) {
+ return getActiveActivityNames(processInstance, new HashSet<String>());
+ }
+
+ public Set<String> getActiveActivityNames(Execution execution, Set<String> activityNames) {
+ if (execution.isActive()) {
+ activityNames.add(execution.getActivityName());
+ }
+ Collection<Execution> childExecutions = execution.getExecutions();
+ if (childExecutions!=null) {
+ for (Execution childExecution: childExecutions) {
+ if (childExecution!=null) {
+
+ }
+ getActiveActivityNames(childExecution, activityNames);
+ }
+ }
+ return activityNames;
+ }
+
}
+
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -29,7 +29,7 @@
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.integration.ProcessManagement;
import org.jbpm.Execution;
-import org.jbpm.ExecutionQuery;
+import org.jbpm.ProcessInstanceQuery;
import org.jbpm.ExecutionService;
import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessDefinitionQuery;
@@ -122,7 +122,7 @@
{
ExecutionService execService = this.processEngine.getExecutionService();
- ExecutionQuery query = execService.createExecutionQuery();
+ ProcessInstanceQuery query = execService.createProcessInstanceQuery();
query.processDefinitionId(String.valueOf(procDefId));
List<Execution> executions = query.list();
@@ -175,7 +175,7 @@
{
ExecutionService execService = this.processEngine.getExecutionService();
- ExecutionQuery query = execService.createProcessInstanceQuery();
+ ProcessInstanceQuery query = execService.createProcessInstanceQuery();
query.processInstanceId(instanceId);
List<Execution> executions = query.list();
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -23,17 +23,16 @@
import java.util.Map;
-import org.jbpm.Execution;
import org.jbpm.JbpmException;
+import org.jbpm.ProcessInstance;
import org.jbpm.client.ClientExecution;
-import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.session.PvmDbSession;
/**
* @author Tom Baeyens
*/
-public class SignalCmd extends AbstractCommand<Execution> {
+public class SignalCmd extends AbstractCommand<ProcessInstance> {
private static final long serialVersionUID = 1L;
@@ -50,7 +49,7 @@
this.parameters = parameters;
}
- public Execution execute(Environment environment) throws Exception {
+ public ProcessInstance execute(Environment environment) throws Exception {
ClientExecution execution = null;
PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
@@ -61,6 +60,6 @@
execution.signal(signalName, parameters);
- return execution;
+ return execution.getProcessInstance();
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -24,18 +24,17 @@
import java.util.Map;
import org.hibernate.Session;
-import org.jbpm.Execution;
import org.jbpm.JbpmException;
+import org.jbpm.ProcessInstance;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.client.ClientProcessInstance;
import org.jbpm.env.Environment;
-import org.jbpm.session.PvmDbSession;
import org.jbpm.session.RepositorySession;
/**
* @author Tom Baeyens
*/
-public class StartProcessInstanceCmd extends VariablesCmd<Execution> {
+public class StartProcessInstanceCmd extends VariablesCmd<ProcessInstance> {
private static final long serialVersionUID = 1L;
@@ -48,7 +47,7 @@
this.executionKey = executionKey;
}
- public Execution execute(Environment environment) throws Exception {
+ public ProcessInstance execute(Environment environment) throws Exception {
RepositorySession repositorySession = environment.get(RepositorySession.class);
ClientProcessDefinition processDefinition = (ClientProcessDefinition)
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -24,9 +24,9 @@
import java.util.Map;
import org.hibernate.Session;
-import org.jbpm.Execution;
import org.jbpm.JbpmException;
import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.ProcessInstance;
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.client.ClientProcessInstance;
import org.jbpm.env.Environment;
@@ -36,7 +36,7 @@
/**
* @author Tom Baeyens
*/
-public class StartProcessInstanceInLatestCmd extends VariablesCmd<Execution> {
+public class StartProcessInstanceInLatestCmd extends VariablesCmd<ProcessInstance> {
private static final long serialVersionUID = 1L;
@@ -52,7 +52,7 @@
this.executionKey = executionKey;
}
- public Execution execute(Environment environment) throws Exception {
+ public ProcessInstance execute(Environment environment) throws Exception {
ClientProcessDefinition processDefinition = null;
RepositorySession repositorySession = environment.get(RepositorySession.class);
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -1,108 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.query;
-
-import java.util.List;
-
-import org.hibernate.Query;
-import org.jbpm.Execution;
-import org.jbpm.ExecutionQuery;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ExecutionQueryImpl extends AbstractQuery implements ExecutionQuery {
-
- private static final long serialVersionUID = 1L;
-
- protected boolean onlyProcessInstances;
- protected String processDefinitionId;
- protected String processInstanceId;
-
- public ExecutionQueryImpl(CommandService commandService, boolean onlyProcessInstances) {
- super(commandService);
- this.onlyProcessInstances = onlyProcessInstances;
- }
-
- public Execution uniqueResult() {
- return (Execution)untypedUniqueResult();
- }
-
- public List<Execution> list() {
- return (List<Execution>) untypedList();
- }
-
- public String hql() {
- StringBuffer hql = new StringBuffer();
- hql.append("select execution ");
- hql.append("from ");
- hql.append(ExecutionImpl.class.getName());
- hql.append(" as execution ");
-
- if (onlyProcessInstances) {
- appendWhereClause("execution.processInstance.dbid = execution.dbid ", hql);
- }
-
- if (processInstanceId!=null) {
- appendWhereClause("execution.processInstance.id = '"+processInstanceId+"' ", hql);
- }
-
- if (processDefinitionId!=null) {
- appendWhereClause("execution.processDefinitionId = '"+processDefinitionId+"' ", hql);
- }
-
- appendOrderByClause(hql);
-
- return hql.toString();
- }
-
- protected void applyParameters(Query query) {
- }
-
- public ExecutionQuery orderAsc(String property) {
- addOrderByClause("e."+property+" asc");
- return this;
- }
-
- public ExecutionQuery orderDesc(String property) {
- addOrderByClause("e."+property+" desc");
- return this;
- }
-
- public ExecutionQuery processDefinitionId(String processDefinitionId) {
- this.processDefinitionId = processDefinitionId;
- return this;
- }
-
- public ExecutionQuery page(int firstResult, int maxResults) {
- this.page = new Page(firstResult, maxResults);
- return this;
- }
-
- public ExecutionQuery processInstanceId(String processInstanceId) {
- this.processInstanceId = processInstanceId;
- return this;
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java (from rev 4558, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ExecutionQueryImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.query;
+
+import java.util.List;
+
+import org.hibernate.Query;
+import org.jbpm.Execution;
+import org.jbpm.ProcessInstanceQuery;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessInstanceQueryImpl extends AbstractQuery implements ProcessInstanceQuery {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String processDefinitionId;
+ protected String processInstanceId;
+
+ public ProcessInstanceQueryImpl(CommandService commandService) {
+ super(commandService);
+ }
+
+ public Execution uniqueResult() {
+ return (Execution)untypedUniqueResult();
+ }
+
+ public List<Execution> list() {
+ return (List<Execution>) untypedList();
+ }
+
+ public String hql() {
+ StringBuffer hql = new StringBuffer();
+ hql.append("select processInstance ");
+ hql.append("from ");
+ hql.append(ExecutionImpl.class.getName());
+ hql.append(" as processInstance ");
+
+ appendWhereClause("processInstance.parent is null ", hql);
+
+ if (processInstanceId!=null) {
+ appendWhereClause("processInstance.processInstance.id = '"+processInstanceId+"' ", hql);
+ }
+
+ if (processDefinitionId!=null) {
+ appendWhereClause("processInstance.processDefinitionId = '"+processDefinitionId+"' ", hql);
+ }
+
+ appendOrderByClause(hql);
+
+ return hql.toString();
+ }
+
+ protected void applyParameters(Query query) {
+ }
+
+ public ProcessInstanceQuery orderAsc(String property) {
+ addOrderByClause("processInstance."+property+" asc");
+ return this;
+ }
+
+ public ProcessInstanceQuery orderDesc(String property) {
+ addOrderByClause("processInstance."+property+" desc");
+ return this;
+ }
+
+ public ProcessInstanceQuery processDefinitionId(String processDefinitionId) {
+ this.processDefinitionId = processDefinitionId;
+ return this;
+ }
+
+ public ProcessInstanceQuery page(int firstResult, int maxResults) {
+ this.page = new Page(firstResult, maxResults);
+ return this;
+ }
+
+ public ProcessInstanceQuery processInstanceId(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ return this;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -27,8 +27,9 @@
import java.util.Set;
import org.jbpm.Execution;
-import org.jbpm.ExecutionQuery;
import org.jbpm.ExecutionService;
+import org.jbpm.ProcessInstance;
+import org.jbpm.ProcessInstanceQuery;
import org.jbpm.pvm.internal.cmd.DeleteProcessInstance;
import org.jbpm.pvm.internal.cmd.EndProcessInstance;
import org.jbpm.pvm.internal.cmd.FindExecutionCmd;
@@ -39,7 +40,7 @@
import org.jbpm.pvm.internal.cmd.SignalCmd;
import org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd;
import org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd;
-import org.jbpm.pvm.internal.query.ExecutionQueryImpl;
+import org.jbpm.pvm.internal.query.ProcessInstanceQueryImpl;
/**
@@ -47,53 +48,53 @@
*/
public class ExecutionServiceImpl extends AbstractServiceImpl implements ExecutionService {
- public Execution startProcessInstanceById(String processDefinitionId){
+ public ProcessInstance startProcessInstanceById(String processDefinitionId){
return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, null, null));
}
- public Execution startProcessInstanceById(String processDefinitionId, String executionKey) {
+ public ProcessInstance startProcessInstanceById(String processDefinitionId, String executionKey) {
return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, null, executionKey));
}
- public Execution startProcessInstanceById(String processDefinitionId, Map<String, Object> variables){
+ public ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables){
return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, variables, null));
}
- public Execution startProcessInstanceById(String processDefinitionId, Map<String, Object> variables, String executionKey){
+ public ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables, String executionKey){
return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, variables, executionKey));
}
- public Execution startProcessInstanceByKey(String processDefinitionKey) {
+ public ProcessInstance startProcessInstanceByKey(String processDefinitionKey) {
return commandService.execute(new StartProcessInstanceInLatestCmd(processDefinitionKey, null, null));
}
- public Execution startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables){
+ public ProcessInstance startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables){
return commandService.execute(new StartProcessInstanceInLatestCmd(processDefinitionKey, variables, null));
}
- public Execution startProcessInstanceByKey(String processDefinitionKey, String executionKey) {
+ public ProcessInstance startProcessInstanceByKey(String processDefinitionKey, String executionKey) {
return commandService.execute(new StartProcessInstanceInLatestCmd(processDefinitionKey, null, executionKey));
}
- public Execution startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables, String executionKey){
+ public ProcessInstance startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables, String executionKey){
return commandService.execute(new StartProcessInstanceInLatestCmd(processDefinitionKey, variables, executionKey));
}
- public Execution signalExecutionById(String executionId) {
+ public ProcessInstance signalExecutionById(String executionId) {
return commandService.execute(new SignalCmd(executionId, null, null));
}
- public Execution signalExecutionById(String executionId, String signalName) {
+ public ProcessInstance signalExecutionById(String executionId, String signalName) {
return commandService.execute(new SignalCmd(executionId, signalName, null));
}
- public Execution signalExecutionById(String executionId, String signalName, Map<String, Object> parameters) {
+ public ProcessInstance signalExecutionById(String executionId, String signalName, Map<String, Object> parameters) {
return commandService.execute(new SignalCmd(executionId, signalName, parameters));
}
- public Execution signalExecutionById(String executionId, Map<String, Object> parameters) {
+ public ProcessInstance signalExecutionById(String executionId, Map<String, Object> parameters) {
return commandService.execute(new SignalCmd(executionId, null, parameters));
}
@@ -102,18 +103,15 @@
return commandService.execute(new FindExecutionCmd(executionId));
}
- public List<Execution> findExecutionsById(String executionId) {
- return commandService.execute(new FindExecutionsCmd(executionId));
+ public ProcessInstance findProcessInstanceById(String executionId) {
+ return (ProcessInstance) commandService.execute(new FindExecutionCmd(executionId));
}
+
- public ExecutionQuery createExecutionQuery() {
- return new ExecutionQueryImpl(commandService, false);
+ public ProcessInstanceQuery createProcessInstanceQuery() {
+ return new ProcessInstanceQueryImpl(commandService);
}
- public ExecutionQuery createProcessInstanceQuery() {
- return new ExecutionQueryImpl(commandService, true);
- }
-
public void endProcessInstance(String processInstanceId, String state) {
commandService.execute(new EndProcessInstance(processInstanceId, state));
}
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -231,31 +231,6 @@
return taskDbid;
}
- public HashSet<String> getActivityNames(String processInstanceId) {
- HashSet<String> activityNames = new HashSet<String>();
-
- List<Execution> executions = executionService.findExecutionsById(processInstanceId);
- for (Execution execution: executions) {
- String activityName = execution.getActivityName();
- if (activityName!=null) {
- activityNames.add(activityName);
- }
- }
-
- return activityNames;
- }
-
- public Execution findExecution(String processInstanceId, String activityName) {
- List<Execution> executions = executionService.findExecutionsById(processInstanceId);
- for (Execution execution: executions) {
- if (activityName.equals(execution.getActivityName())) {
- return execution;
- }
- }
-
- return null;
- }
-
public static Task getTask(List<Task> taskList, String taskName) {
for (Task task : taskList) {
if (taskName.equals(task.getName())) {
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/EndProcessInstanceTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/EndProcessInstanceTest.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/EndProcessInstanceTest.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -50,7 +50,7 @@
String processInstanceId = execution.getId();
executionService.endProcessInstance(processInstanceId, Execution.STATE_CANCELLED);
- List<Execution> executions = executionService.createExecutionQuery()
+ List<Execution> executions = executionService.createProcessInstanceQuery()
.processInstanceId(processInstanceId)
.list();
assertEquals(0, executions.size());
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -66,7 +66,7 @@
// also check that the ended process instances have been removed from the
// runtime database
List<Execution> executions = executionService
- .createExecutionQuery()
+ .createProcessInstanceQuery()
.processDefinitionId("ICL-1")
.list();
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java 2009-04-16 11:50:42 UTC (rev 4564)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/RepositoryServiceTest.java 2009-04-16 13:09:58 UTC (rev 4565)
@@ -185,7 +185,7 @@
// check if the db is empty
assertEquals(0, repositoryService.createProcessDefinitionQuery().list().size());
- assertEquals(0, executionService.createExecutionQuery().list().size());
+ assertEquals(0, executionService.createProcessInstanceQuery().list().size());
}
public void testDeleteProcessDefinitionButNotInstances() {
More information about the jbpm-commits
mailing list