[jbpm-commits] JBoss JBPM SVN: r4301 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/env and 16 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Mar 20 12:51:42 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-03-20 12:51:42 -0400 (Fri, 20 Mar 2009)
New Revision: 4301
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java
Removed:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidate/
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentFactory.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.identity.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddParticipantCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CompositeCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/EndProcessInstance.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionByKeyCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionByIdCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionKeysCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsByKeyCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetParticipantsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetSubTasksCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/RemoveParticipantCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SendMessageCmd.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/SubmitTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ProvidedObjectDescriptor.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
Log:
JBPM-2080 task candidates
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/IdentityService.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -49,6 +49,14 @@
/** create a group new group
* @return the generated id for this group. */
+ String createGroup(String string);
+
+ /** create a group new group
+ * @return the generated id for this group. */
+ String createGroup(String string, String groupType);
+
+ /** create a group new group
+ * @return the generated id for this group. */
String createGroup(String groupName, String groupType, String parentGroupId);
/** lookup a group.
@@ -69,10 +77,15 @@
/** makes the given user a member of the given group with the given role.
* Role can be null. */
+ void createMembership(String string, String groupId);
+
+ /** makes the given user a member of the given group with the given role.
+ * Role can be null. */
void createMembership(String userId, String groupId, String role);
/** makes the given user a member of the given group with the given role.
* Role can be null. If no such membership exists, this method will
* not throw an exception and have no effect. */
void deleteMembership(String userId, String groupId, String role);
+
}
\ No newline at end of file
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/ProcessEngine.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,7 +21,6 @@
*/
package org.jbpm;
-import java.util.Map;
/** central starting point for all process engine API
* interactions.
@@ -34,51 +33,33 @@
* to the process repository. */
ProcessService getProcessService();
- /** the {@link ProcessService process service} and supply some
- * transactional resources. The given transactional resources will only
- * be associated to the returned process service. */
- ProcessService getProcessService(Map<String, Object> envObjects);
-
/** the {@link ExecutionService execution service} that provides access
* to the runtime executions repository. */
ExecutionService getExecutionService();
- /** the {@link ExecutionService execution service} and supply some
- * transactional resources. The given transactional resources will only
- * be associated to the returned execution service. */
- ExecutionService getExecutionService(Map<String, Object> envObjects);
-
/** the {@link HistoryService history service} that provides access
* to the history executions repository. */
HistoryService getHistoryService();
- /** the {@link HistoryService history service} that provides access
- * to the history executions repository. The given transactional resources will only
- * be associated to the returned history service. */
- HistoryService getHistoryService(Map<String, Object> envObjects);
-
/** the {@link TaskService task service} that exposes the
* runtime human task lists. */
TaskService getTaskService();
- /** the {@link TaskService task service} and supply some
- * transactional resources. The given transactional resources will only
- * be associated to the returned task service. */
- TaskService getTaskService(Map<String, Object> envObjects);
+ /** the {@link IdentityService identity service} that exposes the
+ * user and group operations management operations. */
+ IdentityService getIdentityService();
/** the {@link ManagementService management service} that exposes the
* management operations to operators that have to keep the jBPM system
* up and running. */
ManagementService getManagementService();
- /** the {@link ManagementService management service} and supply some
- * transactional resources. The given transactional resources will only
- * be associated to the returned management service. */
- ManagementService getManagementService(Map<String, Object> envObjects);
-
/** retrieve and object defined in the process engine by type */
<T> T get(Class<T> type);
/** retrieve and object defined in the process engine by name */
Object get(String name);
+
+ /** programmatically provide a hibernate session factory */
+ void setSessionFactory(Object sessionFactory);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskQuery.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -40,6 +40,10 @@
/** only find tasks for which the given user is the assignee */
TaskQuery assignee(String userId);
+
+ /** only find tasks that are unassigned. These tasks can still
+ * potentially have candidates. */
+ TaskQuery unassigned();
/** only find tasks for which the given user is a candidate */
TaskQuery candidate(String userId);
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,6 +21,7 @@
*/
package org.jbpm;
+import java.sql.Connection;
import java.util.List;
import org.jbpm.model.Comment;
@@ -131,4 +132,12 @@
/** delete a comment.
* this will recursively delete all replies to this comment. */
void deleteComment(long commentDbid);
+
+ /** provide a userId that will be used in the next method invocation
+ * on this service by this thread. */
+ void setUserId(String userId);
+
+ /** provide a JDBC connection that will be used in the next method
+ * invocation on this service by this thread. */
+ void setConnection(Connection connection);
}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentFactory.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentFactory.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentFactory.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -58,11 +58,11 @@
/**
* open a new Environment and pass in a list of objects
- * that must be placed/exposed in the environment context.
+ * that must be placed/exposed in the transaction context.
* The client is responsible for
* closing the environment with {@link Environment#close()}.
*/
- // Environment openEnvironment(List<EnvironmentObject> environmentObjects);
+ Environment openEnvironment(List<WireObject> txWireObjects);
/**
* closes this environment factory and cleans any allocated
@@ -70,4 +70,5 @@
*/
void close();
+
}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -1,59 +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.env;
-
-
-/**
- * @author Tom Baeyens
- */
-public class EnvironmentObject {
-
- protected String name;
- protected Object object;
- protected boolean exposeType;
-
- public EnvironmentObject(Object object) {
- this.object = object;
- this.exposeType = true;
- }
-
- public EnvironmentObject(Object object, String name) {
- this.object = object;
- this.name = name;
- }
-
- public EnvironmentObject(Object object, String name, boolean exposeType) {
- this.object = object;
- this.exposeType = exposeType;
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
- public Object getObject() {
- return object;
- }
- public boolean isExposeType() {
- return exposeType;
- }
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java (from rev 4298, jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/EnvironmentObject.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -0,0 +1,62 @@
+/*
+ * 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.env;
+
+import org.jbpm.JbpmException;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class WireObject {
+
+ protected String name;
+ protected Object object;
+ protected boolean isTypeExposed;
+
+ public WireObject(Object object) {
+ this(object, null, true);
+ }
+
+ public WireObject(Object object, String name) {
+ this(object, null, true);
+ }
+
+ public WireObject(Object object, String name, boolean isTypeExposed) {
+ if (object==null) {
+ throw new JbpmException("object is null");
+ }
+ this.object = object;
+ this.isTypeExposed = isTypeExposed;
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public Object getObject() {
+ return object;
+ }
+ public boolean isTypeExposed() {
+ return isTypeExposed;
+ }
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/env/WireObject.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -36,29 +36,29 @@
public class TaskAssigneeTest extends JbpmTestCase {
public void testTaskAssignee() {
-// deployJpdlResource("org/jbpm/examples/task/assignee/process.jpdl.xml");
-//
-// Map<String, Object> variables = new HashMap<String, Object>();
-// variables.put("order", new Order("johndoe"));
-// Execution execution = executionService.startProcessInstanceByKey("TaskAssignee", variables);
-// String executionId = execution.getId();
-//
-// List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
-// assertEquals(1, taskList.size());
-// Task task = taskList.get(0);
-// assertEquals("review", task.getName());
-// assertEquals("johndoe", task.getAssignee());
-//
-// // submit the task
-// taskService.submitTask(task.getDbid());
-//
-// // verify that the task list is now empty
-// taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
-// assertEquals(0, taskList.size());
-//
-// // verify that process moved to the next state
-// execution = executionService.findExecution(executionId);
-// assertEquals("wait", execution.getActivityName());
+ deployJpdlResource("org/jbpm/examples/task/assignee/process.jpdl.xml");
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("order", new Order("johndoe"));
+ Execution execution = executionService.startProcessInstanceByKey("TaskAssignee", variables);
+ String executionId = execution.getId();
+
+ List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+ assertEquals("johndoe", task.getAssignee());
+
+ // submit the task
+ taskService.submitTask(task.getDbid());
+
+ // verify that the task list is now empty
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that process moved to the next state
+ execution = executionService.findExecution(executionId);
+ assertEquals("wait", execution.getActivityName());
}
}
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,12 +21,9 @@
*/
package org.jbpm.examples.task.candidates;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jbpm.Execution;
-import org.jbpm.examples.task.assignee.Order;
import org.jbpm.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -36,12 +33,20 @@
*/
public class TaskCandidatesTest extends JbpmTestCase {
- public void testTaskAssignee() {
+ public void testGroupCandidateAssignment() {
+ // create johndoe and joesmoe as members of the sales group
+ String salesGroupId = identityService.createGroup("sales");
+
+ identityService.createUser("johndoe", "John", "Doe");
+ identityService.createMembership("johndoe", salesGroupId);
+
+ identityService.createUser("joesmoe", "Joe", "Smoe");
+ identityService.createMembership("joesmoe", salesGroupId);
+
+ // deploy the process
deployJpdlResource("org/jbpm/examples/task/candidates/process.jpdl.xml");
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("order", new Order("johndoe"));
- Execution execution = executionService.startProcessInstanceByKey("TaskCandidates", variables);
+ Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
String executionId = execution.getId();
List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
@@ -54,8 +59,8 @@
task = taskList.get(0);
assertEquals("review", task.getName());
- /*
- // submit the task
+ // lets assume that johndoe takes the task
+ taskService.setUserId("johndoe");
taskService.takeTask(task.getDbid());
// verify that the group task lists are now empty
@@ -81,6 +86,5 @@
// verify that process moved to the next state
execution = executionService.findExecution(executionId);
assertEquals("wait", execution.getActivityName());
- */
}
}
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml 2009-03-20 16:51:42 UTC (rev 4301)
@@ -6,11 +6,11 @@
<transition to="review" />
</start>
- <task name="review"
- candidate-users="johndoe, joesmoe"
+ <task name="review"
+ candidate-groups="sales"
g="96,16,127,52">
-
- <transition to="wait" />
+
+ <transition to="wait" />
</task>
<state name="wait" g="255,16,88,52"/>
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-03-20 16:51:42 UTC (rev 4301)
@@ -33,13 +33,15 @@
<check-problems />
<save />
</deployer-manager>
-
+
<script-manager default-expression-language="juel"
default-script-language="juel"
read-contexts="execution, environment, process-engine"
write-context="">
<script-language name="juel" factory="com.sun.script.juel.JuelScriptEngineFactory" />
</script-manager>
+
+ <authentication />
<job-executor auto-start="false" />
@@ -58,7 +60,6 @@
</process-engine-context>
<transaction-context>
- <hibernate-session />
<transaction />
<pvm-db-session />
<job-db-session />
@@ -66,6 +67,7 @@
<message-session />
<timer-session />
<history-session />
+ <hibernate-session />
<identity-session />
</transaction-context>
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.identity.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.identity.hbm.xml 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.identity.hbm.xml 2009-03-20 16:51:42 UTC (rev 4301)
@@ -10,7 +10,7 @@
</id>
<version name="dbversion" column="DBVERSION_" />
- <property name="name" column="NAME_" />
+ <property name="id" column="ID_" />
<property name="givenName" column="GIVENNAME_" />
<property name="familyName" column="FAMILYNAME_" />
</class>
@@ -44,6 +44,7 @@
</id>
<version name="dbversion" column="DBVERSION_" />
+ <property name="id" column="ID_" />
<property name="name" column="NAME_" />
<property name="type" column="TYPE_" />
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.task.hbm.xml 2009-03-20 16:51:42 UTC (rev 4301)
@@ -19,8 +19,12 @@
<property name="dueDateDuration" column="DUEDATE_"/>
<property name="isBlocking" column="BLOCK_"/>
<property name="isSignalling" column="SIGNAL_"/>
- <property name="assigneeExpression" column="ASSIGNEE_EXPR_"/>
- <property name="candidatesExpression" column="CANDIDATES_EXPR_"/>
+ <property name="assigneeExpression" column="ASS_EXPR_"/>
+ <property name="assigneeExpressionLanguage" column="ASS_EXPR_LANG_"/>
+ <property name="candidateUsersExpression" column="CNDUSR_EXPR_"/>
+ <property name="candidateUsersExpressionLanguage" column="CNDUSR_EXPRLANG_"/>
+ <property name="candidateGroupsExpression" column="CNDGRP_EXPR_"/>
+ <property name="candidateGroupsExpressionLanguage" column="CNDGRP_EXPRLANG_"/>
<many-to-one name="assignerDescriptor"
column="ASSIGNER_DESCR_"
@@ -111,8 +115,8 @@
</id>
<version name="dbversion" column="DBVERSION_" />
- <property name="identityType" column="IDENTITYTYPE_"/>
- <property name="identityId" column="IDENTITYID_"/>
+ <property name="groupId" column="GROUPID_"/>
+ <property name="userId" column="USERID_"/>
<property name="participation" column="PARTICIPATION_" />
<many-to-one name="task"
@@ -154,6 +158,11 @@
column="SWIMLANEDEF_"
foreign-key="FK_SWIMLANE_DEF" />
+ <many-to-one name="execution"
+ class="org.jbpm.pvm.internal.model.ExecutionImpl"
+ column="EXECUTION_"
+ foreign-key="FK_SWIMLANE_EXEC" />
+
<set name="participants" cascade="all-delete-orphan">
<key column="SWIMLANE_" />
<one-to-many class="ParticipantImpl" />
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -24,12 +24,14 @@
import java.io.File;
import java.io.InputStream;
import java.net.URL;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jbpm.Configuration;
import org.jbpm.ExecutionService;
import org.jbpm.HistoryService;
+import org.jbpm.IdentityService;
import org.jbpm.ManagementService;
import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
@@ -37,6 +39,7 @@
import org.jbpm.env.Context;
import org.jbpm.env.Environment;
import org.jbpm.env.EnvironmentFactory;
+import org.jbpm.env.WireObject;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.PvmEnvironment;
import org.jbpm.pvm.internal.env.PvmEnvironmentFactoryParser;
@@ -48,6 +51,7 @@
import org.jbpm.pvm.internal.stream.UrlStreamInput;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
/**
* an environment factory that also is the process-engine context.
@@ -87,7 +91,7 @@
protected boolean isConfigured = false;
protected WireContext environmentFactoryCtxWireContext = null;
- protected WireDefinition environmentCtxWireDefinition = null;
+ protected WireDefinition transactionCtxWireDefinition = null;
public JbpmConfiguration() {
super((Configuration)null);
@@ -100,6 +104,12 @@
return this;
}
+ public void setSessionFactory(Object sessionFactory) {
+ environmentFactoryCtxWireContext
+ .getWireDefinition()
+ .addDescriptor(new ProvidedObjectDescriptor(sessionFactory));
+ }
+
public Configuration setInputStream(InputStream inputStream) {
parse(new InputStreamInput(inputStream));
return this;
@@ -150,24 +160,10 @@
public TaskService getTaskService() {
return environmentFactoryCtxWireContext.get(TaskService.class);
}
-
- public TaskService getTaskService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
+ public IdentityService getIdentityService() {
+ return environmentFactoryCtxWireContext.get(IdentityService.class);
}
- public HistoryService getHistoryService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
- }
- public ExecutionService getExecutionService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
- }
- public ProcessService getProcessService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
- }
- public ManagementService getManagementService(Map<String, Object> txResources) {
- throw new UnsupportedOperationException("please implement me");
- }
-
public static EnvironmentFactory parseXmlString(String xmlString) {
JbpmConfiguration jbpmConfiguration = new JbpmConfiguration();
jbpmConfiguration.setXmlString(xmlString);
@@ -175,7 +171,12 @@
return jbpmConfiguration;
}
+
public Environment openEnvironment() {
+ return openEnvironment(null);
+ }
+
+ public Environment openEnvironment(List<WireObject> txWireObjects) {
PvmEnvironment environment = new PvmEnvironment(this);
if (log.isTraceEnabled()) log.trace("opening " + environment);
@@ -189,15 +190,20 @@
// add the process-engine context
environment.addContext(environmentFactoryCtxWireContext);
- // add the environment block context
- WireContext environmentContext = new WireContext(environmentCtxWireDefinition, Context.CONTEXTNAME_TRANSACTION, environment, true);
+ // add the transaction context
+ WireDefinition usedWireDefinition = transactionCtxWireDefinition;
+ if (txWireObjects!=null) {
+ usedWireDefinition = new WireDefinition(transactionCtxWireDefinition, txWireObjects);
+ }
+
+ WireContext transactionContext = new WireContext(usedWireDefinition, Context.CONTEXTNAME_TRANSACTION, environment, true);
// add the environment block context to the environment
- environment.addContext(environmentContext);
+ environment.addContext(transactionContext);
Environment.pushEnvironment(environment);
try {
// finish the creation of the environment wire context
- environmentContext.create();
+ transactionContext.create();
} catch (RuntimeException e) {
Environment.popEnvironment();
@@ -241,8 +247,8 @@
// getters and setters //////////////////////////////////////////////////////
- public void setEnvironmentCtxWireDefinition(WireDefinition blockWireDefinition) {
- this.environmentCtxWireDefinition = blockWireDefinition;
+ public void setTransactionCtxWireDefinition(WireDefinition blockWireDefinition) {
+ this.transactionCtxWireDefinition = blockWireDefinition;
}
public WireContext getEnvironmentFactoryCtxWireContext() {
return environmentFactoryCtxWireContext;
@@ -250,7 +256,7 @@
public void setEnvironmentFactoryCtxWireContext(WireContext applicationWireContext) {
this.environmentFactoryCtxWireContext = applicationWireContext;
}
- public WireDefinition getEnvironmentCtxWireDefinition() {
- return environmentCtxWireDefinition;
+ public WireDefinition getTransactionCtxWireDefinition() {
+ return transactionCtxWireDefinition;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -22,9 +22,12 @@
package org.jbpm.pvm.internal.cfg;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
+import org.jbpm.env.Environment;
import org.jbpm.env.EnvironmentFactory;
+import org.jbpm.env.WireObject;
import org.jbpm.pvm.internal.spring.SpringEnvironment;
import org.jbpm.pvm.internal.util.ReflectUtil;
import org.springframework.context.ApplicationContext;
@@ -95,4 +98,8 @@
public Object set(String key, Object value) {
return null;
}
+
+ public Environment openEnvironment(List<WireObject> txWireObjects) {
+ return null;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,34 +21,25 @@
*/
package org.jbpm.pvm.internal.cmd;
-import org.jbpm.client.ClientExecution;
+import java.util.List;
+
import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.session.DbSession;
-import org.jbpm.session.PvmDbSession;
+import org.jbpm.env.WireObject;
/**
* @author Tom Baeyens
*/
public abstract class AbstractCommand<T> implements Command<T> {
+
+ private static final long serialVersionUID = 1L;
- // TODO: REMOVE
- protected ClientExecution getExecution(Environment environment, long executionDbid) {
- DbSession dbSession = environment.get(DbSession.class);
- ClientExecution execution = dbSession.get(ExecutionImpl.class, executionDbid);
- if (execution==null) {
- throw new CommandException("execution "+executionDbid+" doesn't exist");
- }
- return execution;
- }
+ protected List<WireObject> txWireObjects;
- protected ClientExecution getExecution(Environment environment, String executionId) {
- PvmDbSession dbSession = environment.get(PvmDbSession.class);
- ClientExecution execution = dbSession.findExecutionById(executionId);
- if (execution==null) {
- throw new CommandException("execution "+executionId+" doesn't exist");
- }
- return execution;
+ public List<WireObject> getTxWireObjects() {
+ return txWireObjects;
}
+
+ public void setTxWireObjects(List<WireObject> txWireObjects) {
+ this.txWireObjects = txWireObjects;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddParticipantCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddParticipantCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddParticipantCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -23,7 +23,6 @@
import org.hibernate.Session;
import org.jbpm.JbpmException;
-import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.task.IdentityRef;
@@ -31,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class AddParticipantCmd implements Command<Object> {
+public class AddParticipantCmd extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -32,7 +32,7 @@
/**
* @author Tom Baeyens
*/
-public class AddReplyCommentCmd implements Command<Comment> {
+public class AddReplyCommentCmd extends AbstractCommand<Comment> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddTaskCommentCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class AddTaskCommentCmd implements Command<Comment> {
+public class AddTaskCommentCmd extends AbstractCommand<Comment> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CompositeCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CompositeCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CompositeCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -32,7 +32,7 @@
*
* @author Tom Baeyens
*/
-public class CompositeCmd implements Command<Void> {
+public class CompositeCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -32,7 +32,7 @@
/**
* @author Tom Baeyens
*/
-public class DeleteCommentCmd implements Command<Object> {
+public class DeleteCommentCmd extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessDefinitionCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class DeleteProcessDefinitionCmd implements Command<Void> {
+public class DeleteProcessDefinitionCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteProcessInstance.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,7 +29,7 @@
/**
* @author Tom Baeyens
*/
-public class DeleteProcessInstance implements Command<Void> {
+public class DeleteProcessInstance extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Alejandro Guizar
*/
-public class DeleteTaskCmd implements Command<Void> {
+public class DeleteTaskCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeployCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -33,7 +33,7 @@
/**
* @author Tom Baeyens
*/
-public class DeployCmd implements Command<List<ProcessDefinition>> {
+public class DeployCmd extends AbstractCommand<List<ProcessDefinition>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/EndProcessInstance.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/EndProcessInstance.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/EndProcessInstance.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class EndProcessInstance implements Command<Object> {
+public class EndProcessInstance extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -39,7 +39,7 @@
/**
* @author Tom Baeyens
*/
-public class ExecuteJobCmd implements Command<Job> {
+public class ExecuteJobCmd extends AbstractCommand<Job> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class FindExecutionCmd implements Command<Execution> {
+public class FindExecutionCmd extends AbstractCommand<Execution> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindExecutionsCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -38,7 +38,7 @@
/**
* @author Tom Baeyens
*/
-public class FindExecutionsCmd implements Command<List<Execution>> {
+public class FindExecutionsCmd extends AbstractCommand<List<Execution>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionByKeyCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionByKeyCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindLatestProcessDefinitionByKeyCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class FindLatestProcessDefinitionByKeyCmd implements Command<ProcessDefinition> {
+public class FindLatestProcessDefinitionByKeyCmd extends AbstractCommand<ProcessDefinition> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionByIdCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionByIdCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionByIdCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class FindProcessDefinitionByIdCmd implements Command<OpenProcessDefinition> {
+public class FindProcessDefinitionByIdCmd extends AbstractCommand<OpenProcessDefinition> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionKeysCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionKeysCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionKeysCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class FindProcessDefinitionKeysCmd implements Command<List<String>> {
+public class FindProcessDefinitionKeysCmd extends AbstractCommand<List<String>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsByKeyCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsByKeyCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/FindProcessDefinitionsByKeyCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -32,7 +32,7 @@
/**
* @author Tom Baeyens
*/
-public class FindProcessDefinitionsByKeyCmd implements Command<List<ClientProcessDefinition>> {
+public class FindProcessDefinitionsByKeyCmd extends AbstractCommand<List<ClientProcessDefinition>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetAttachment.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class GetAttachment implements Command<byte[]> {
+public class GetAttachment extends AbstractCommand<byte[]> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetParticipantsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetParticipantsCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetParticipantsCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -35,7 +35,7 @@
/**
* @author Tom Baeyens
*/
-public class GetParticipantsCmd implements Command<List<Participant>> {
+public class GetParticipantsCmd extends AbstractCommand<List<Participant>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetSubTasksCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetSubTasksCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetSubTasksCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -34,7 +34,7 @@
/**
* @author Tom Baeyens
*/
-public class GetSubTasksCmd implements Command<List<Task>> {
+public class GetSubTasksCmd extends AbstractCommand<List<Task>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,7 +29,7 @@
/**
* @author Alejandro Guizar
*/
-public class GetTaskCmd implements Command<Task> {
+public class GetTaskCmd extends AbstractCommand<Task> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCommentsCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -34,7 +34,7 @@
/**
* @author Tom Baeyens
*/
-public class GetTaskCommentsCmd implements Command<List<Comment>> {
+public class GetTaskCommentsCmd extends AbstractCommand<List<Comment>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariableNamesCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -33,7 +33,7 @@
/**
* @author Tom Baeyens
*/
-public class GetVariableNamesCmd implements Command<Set<String>> {
+public class GetVariableNamesCmd extends AbstractCommand<Set<String>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetVariablesCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -34,7 +34,7 @@
/**
* @author Tom Baeyens
*/
-public class GetVariablesCmd implements Command<Map<String, Object>> {
+public class GetVariablesCmd extends AbstractCommand<Map<String, Object>> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,7 +29,7 @@
/**
* @author Tom Baeyens
*/
-public class NewTaskCmd implements Command<Task> {
+public class NewTaskCmd extends AbstractCommand<Task> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/QueryCommand.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -27,7 +27,7 @@
*
* @author Tom Baeyens
*/
-public abstract class QueryCommand<T> implements Command<T>{
+public abstract class QueryCommand<T> extends AbstractCommand<T>{
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/RemoveParticipantCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/RemoveParticipantCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/RemoveParticipantCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -36,7 +36,7 @@
/**
* @author Tom Baeyens
*/
-public class RemoveParticipantCmd implements Command<Object> {
+public class RemoveParticipantCmd extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,7 +29,7 @@
/**
* @author Alejandro Guizar
*/
-public class SaveTaskCmd implements Command<Long> {
+public class SaveTaskCmd extends AbstractCommand<Long> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SendMessageCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SendMessageCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SendMessageCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
*
* @author Tom Baeyens
*/
-public class SendMessageCmd implements Command<Object> {
+public class SendMessageCmd extends AbstractCommand<Object> {
private static final long serialVersionUID = 1L;
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-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SignalCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -33,7 +33,7 @@
/**
* @author Tom Baeyens
*/
-public class SignalCmd implements Command<Execution> {
+public class SignalCmd extends AbstractCommand<Execution> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -30,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class SubmitTaskCmd implements Command<Void> {
+public class SubmitTaskCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -31,7 +31,7 @@
/**
* @author Tom Baeyens
*/
-public class TakeTaskCmd implements Command<Void> {
+public class TakeTaskCmd extends AbstractCommand<Void> {
private static final long serialVersionUID = 1L;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/VariablesCmd.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -24,6 +24,11 @@
import java.util.HashMap;
import java.util.Map;
+import org.jbpm.JbpmException;
+import org.jbpm.client.ClientExecution;
+import org.jbpm.env.Environment;
+import org.jbpm.session.PvmDbSession;
+
/**
* @author Tom Baeyens
*/
@@ -47,4 +52,14 @@
public void setVariables(Map<String, Object> variables) {
this.variables = variables;
}
+
+ protected ClientExecution getExecution(Environment environment, String executionId) {
+ PvmDbSession dbSession = environment.get(PvmDbSession.class);
+ ClientExecution execution = dbSession.findExecutionById(executionId);
+ if (execution==null) {
+ throw new JbpmException("execution "+executionId+" doesn't exist");
+ }
+ return execution;
+ }
+
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -0,0 +1,40 @@
+/*
+ * 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.env;
+
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProvidedAuthentication extends Authentication {
+
+ protected String userId;
+
+ public ProvidedAuthentication(String userId) {
+ this.userId = userId;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironmentFactoryParser.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -86,7 +86,7 @@
// configure the default environment factory
jbpmConfiguration.setEnvironmentFactoryCtxWireContext(environmentFactoryWireContext);
- jbpmConfiguration.setEnvironmentCtxWireDefinition(environmentWireDefinition);
+ jbpmConfiguration.setTransactionCtxWireDefinition(environmentWireDefinition);
parse.setDocumentObject(jbpmConfiguration);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentityServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -62,6 +62,14 @@
commandService.execute(new DeleteUser(userId));
}
+ public String createGroup(String groupName) {
+ return commandService.execute(new CreateGroup(groupName, null, null));
+ }
+
+ public String createGroup(String groupName, String groupType) {
+ return commandService.execute(new CreateGroup(groupName, groupType, null));
+ }
+
public String createGroup(String groupName, String groupType, String parentGroupId) {
return commandService.execute(new CreateGroup(groupName, groupType, parentGroupId));
}
@@ -82,12 +90,16 @@
commandService.execute(new DeleteGroup(groupId));
}
+ public void createMembership(String userId, String groupId) {
+ commandService.execute(new CreateMembership(userId, groupId, null));
+ }
+
public void createMembership(String userId, String groupId, String role) {
commandService.execute(new CreateMembership(userId, groupId, role));
}
+
public void deleteMembership(String userId, String groupId, String role) {
commandService.execute(new DeleteMembership(userId, groupId, role));
}
-
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -42,7 +42,6 @@
user.setId(userName);
user.setGivenName(givenName);
user.setFamilyName(familyName);
-
session.save(user);
}
@@ -68,7 +67,8 @@
public String createGroup(String groupName, String groupType, String parentGroupId) {
GroupImpl group = new GroupImpl();
- group.setId("group://"+groupType+"/"+groupName);
+ String groupId = (groupType!=null ? groupType+"."+groupName : groupName);
+ group.setId(groupId);
group.setName(groupName);
group.setType(groupType);
@@ -134,6 +134,7 @@
}
public void deleteMembership(String userId, String groupId, String role) {
+ throw new UnsupportedOperationException("please implement me");
}
public void setSession(Session session) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,9 +21,13 @@
*/
package org.jbpm.pvm.internal.svc;
+import java.util.List;
+
import org.jbpm.cmd.Command;
import org.jbpm.env.Environment;
import org.jbpm.env.EnvironmentFactory;
+import org.jbpm.env.WireObject;
+import org.jbpm.pvm.internal.cmd.AbstractCommand;
/** sets up an environment around the execution of the command.
@@ -35,8 +39,17 @@
protected EnvironmentFactory environmentFactory;
public <T> T execute(Command<T> command) {
- Environment environment = environmentFactory.openEnvironment();
+ Environment environment;
+ if (command instanceof AbstractCommand) {
+ AbstractCommand abstractCommand = (AbstractCommand) command;
+ List<WireObject> txWireObjects = abstractCommand.getTxWireObjects();
+ environment = environmentFactory.openEnvironment(txWireObjects);
+
+ } else {
+ environment = environmentFactory.openEnvironment();
+ }
+
try {
return next.execute(command);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -21,12 +21,16 @@
*/
package org.jbpm.pvm.internal.task;
+import java.sql.Connection;
+import java.util.ArrayList;
import java.util.List;
import org.jbpm.TaskQuery;
import org.jbpm.TaskService;
import org.jbpm.cmd.CommandService;
+import org.jbpm.env.WireObject;
import org.jbpm.model.Comment;
+import org.jbpm.pvm.internal.cmd.AbstractCommand;
import org.jbpm.pvm.internal.cmd.AddParticipantCmd;
import org.jbpm.pvm.internal.cmd.AddReplyCommentCmd;
import org.jbpm.pvm.internal.cmd.AddTaskCommentCmd;
@@ -41,6 +45,7 @@
import org.jbpm.pvm.internal.cmd.SaveTaskCmd;
import org.jbpm.pvm.internal.cmd.SubmitTaskCmd;
import org.jbpm.pvm.internal.cmd.TakeTaskCmd;
+import org.jbpm.pvm.internal.env.ProvidedAuthentication;
import org.jbpm.task.IdentityRef;
import org.jbpm.task.Participant;
import org.jbpm.task.Task;
@@ -51,6 +56,8 @@
public class TaskServiceImpl implements TaskService {
protected CommandService commandService;
+
+ protected ThreadLocal<List<WireObject>> contextThreadLocal;
public TaskServiceImpl() {
}
@@ -68,47 +75,59 @@
}
public Task newTask() {
- return commandService.execute(new NewTaskCmd(null));
+ NewTaskCmd cmd = new NewTaskCmd(null);
+ addTxWireObjects(cmd);
+ return commandService.execute(cmd);
}
public Task getTask(long taskDbid) {
- return commandService.execute(new GetTaskCmd(taskDbid));
+ GetTaskCmd cmd = new GetTaskCmd(taskDbid);
+ return commandService.execute(cmd);
}
public long saveTask(Task task) {
- return commandService.execute(new SaveTaskCmd((TaskImpl) task));
+ SaveTaskCmd cmd = new SaveTaskCmd((TaskImpl) task);
+ return commandService.execute(cmd);
}
public void deleteTask(long taskDbid) {
- commandService.execute(new DeleteTaskCmd(taskDbid));
+ DeleteTaskCmd cmd = new DeleteTaskCmd(taskDbid);
+ commandService.execute(cmd);
}
public void submitTask(long taskDbid) {
- commandService.execute(new SubmitTaskCmd(taskDbid));
+ SubmitTaskCmd cmd = new SubmitTaskCmd(taskDbid);
+ commandService.execute(cmd);
}
public void addTaskParticipant(long taskDbid, IdentityRef identityRef, String participation) {
- commandService.execute(new AddParticipantCmd(taskDbid, null, identityRef, participation));
+ AddParticipantCmd cmd = new AddParticipantCmd(taskDbid, null, identityRef, participation);
+ commandService.execute(cmd);
}
public List<Participant> getTaskParticipants(long taskDbid) {
- return commandService.execute(new GetParticipantsCmd(taskDbid, null));
+ GetParticipantsCmd cmd = new GetParticipantsCmd(taskDbid, null);
+ return commandService.execute(cmd);
}
public void removeTaskParticipant(long taskDbid, IdentityRef identityRef, String participation) {
- commandService.execute(new RemoveParticipantCmd(taskDbid, null, identityRef, participation));
+ RemoveParticipantCmd cmd = new RemoveParticipantCmd(taskDbid, null, identityRef, participation);
+ commandService.execute(cmd);
}
public void addSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
- commandService.execute(new AddParticipantCmd(null, szimlaneDbid, identityRef, participation));
+ AddParticipantCmd cmd = new AddParticipantCmd(null, szimlaneDbid, identityRef, participation);
+ commandService.execute(cmd);
}
public List<Participant> getSwimlaneParticipants(long szimlaneDbid) {
- return commandService.execute(new GetParticipantsCmd(null, szimlaneDbid));
+ GetParticipantsCmd cmd = new GetParticipantsCmd(null, szimlaneDbid);
+ return commandService.execute(cmd);
}
public void removeSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation) {
- commandService.execute(new RemoveParticipantCmd(null, szimlaneDbid, identityRef, participation));
+ RemoveParticipantCmd cmd = new RemoveParticipantCmd(null, szimlaneDbid, identityRef, participation);
+ commandService.execute(cmd);
}
public List<Task> getPersonalTaskList(String userId, int firstResult, int maxResults) {
@@ -121,6 +140,7 @@
public List<Task> getGroupTaskList(String userId, int firstResult, int maxResults) {
return createTaskQuery()
+ .unassigned()
.candidate(userId)
.orderDesc(TaskQuery.PROPERTY_PRIORITY)
.page(firstResult, maxResults)
@@ -132,30 +152,65 @@
}
public List<Task> getSubTasks(long taskDbid) {
- return commandService.execute(new GetSubTasksCmd(taskDbid));
+ GetSubTasksCmd cmd = new GetSubTasksCmd(taskDbid);
+ return commandService.execute(cmd);
}
public Task newTask(long parentTaskDbid) {
- return commandService.execute(new NewTaskCmd(parentTaskDbid));
+ NewTaskCmd cmd = new NewTaskCmd(parentTaskDbid);
+ return commandService.execute(cmd);
}
public Comment addTaskComment(long taskDbid, String message) {
- return commandService.execute(new AddTaskCommentCmd(taskDbid, message));
+ AddTaskCommentCmd cmd = new AddTaskCommentCmd(taskDbid, message);
+ return commandService.execute(cmd);
}
public List<Comment> getTaskComments(long taskDbid) {
- return commandService.execute(new GetTaskCommentsCmd(taskDbid));
+ GetTaskCommentsCmd cmd = new GetTaskCommentsCmd(taskDbid);
+ return commandService.execute(cmd);
}
public void deleteComment(long commentDbid) {
- commandService.execute(new DeleteCommentCmd(commentDbid));
+ DeleteCommentCmd cmd = new DeleteCommentCmd(commentDbid);
+ commandService.execute(cmd);
}
public Comment addReplyComment(long commentDbid, String message) {
- return commandService.execute(new AddReplyCommentCmd(commentDbid, message));
+ AddReplyCommentCmd cmd = new AddReplyCommentCmd(commentDbid, message);
+ return commandService.execute(cmd);
}
public void takeTask(long taskDbid) {
- commandService.execute(new TakeTaskCmd(taskDbid));
+ TakeTaskCmd cmd = new TakeTaskCmd(taskDbid);
+ addTxWireObjects(cmd);
+ commandService.execute(cmd);
}
+
+ public void setUserId(String userId) {
+ addTxWireObject(new WireObject(new ProvidedAuthentication(userId)));
+ }
+
+ public void setConnection(Connection connection) {
+ addTxWireObject(new WireObject(connection));
+ }
+
+ protected synchronized void addTxWireObject(WireObject wireObject) {
+ if (contextThreadLocal==null) {
+ contextThreadLocal = new ThreadLocal<List<WireObject>>();
+ }
+ List<WireObject> txWireObjects = contextThreadLocal.get();
+ if (txWireObjects==null) {
+ txWireObjects = new ArrayList<WireObject>();
+ contextThreadLocal.set(txWireObjects);
+ }
+ txWireObjects.add(wireObject);
+ }
+
+ protected void addTxWireObjects(AbstractCommand cmd) {
+ if (contextThreadLocal!=null) {
+ cmd.setTxWireObjects(contextThreadLocal.get());
+ contextThreadLocal.set(null);
+ }
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -27,8 +27,10 @@
import java.util.List;
import java.util.Map;
+import org.jbpm.env.WireObject;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
/**
@@ -56,11 +58,26 @@
public WireDefinition() {
}
- public WireDefinition(WireDefinition other) {
- this.descriptors = new HashMap<String, Descriptor>(other.descriptors);
- this.descriptorNames = new HashMap<Class<?>, String>(other.descriptorNames);
+ public WireDefinition(WireDefinition other, List<WireObject> txWireObjects) {
+ if (other.descriptors!=null) {
+ this.descriptors = new HashMap<String, Descriptor>(other.descriptors);
+ }
+ if (other.descriptorNames!=null) {
+ this.descriptorNames = new HashMap<Class<?>, String>(other.descriptorNames);
+ }
+ if (other.eagerInitNames!=null) {
+ this.eagerInitNames = new ArrayList<String>(other.eagerInitNames);
+ }
this.useTypes = other.useTypes;
- this.eagerInitNames = new ArrayList<String>(other.eagerInitNames);
+
+ for (WireObject wireObject: txWireObjects) {
+ ProvidedObjectDescriptor descriptor = new ProvidedObjectDescriptor(
+ wireObject.getObject(),
+ wireObject.isTypeExposed(),
+ wireObject.getName()
+ );
+ addDescriptor(descriptor);
+ }
}
public void addDescriptor(Descriptor descriptor) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ProvidedObjectDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ProvidedObjectDescriptor.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ProvidedObjectDescriptor.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -47,6 +47,12 @@
this.exposeType = exposeType;
}
+ public ProvidedObjectDescriptor(Object providedObject, boolean exposeType, String name) {
+ this.exposeType = exposeType;
+ this.providedObject = providedObject;
+ this.name = name;
+ }
+
public Object construct(WireContext wireContext) {
return providedObject;
}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java 2009-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/identity/IdentityTest.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -73,6 +73,6 @@
assertEquals(1, groups.size());
Group group = groups.get(0);
- assertEquals("group://unit/jboss", group.getId());
+ assertEquals("unit.jboss", group.getId());
}
}
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-03-19 21:35:58 UTC (rev 4300)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -29,6 +29,7 @@
import org.jbpm.Execution;
import org.jbpm.ExecutionService;
import org.jbpm.HistoryService;
+import org.jbpm.IdentityService;
import org.jbpm.ManagementService;
import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessEngine;
@@ -72,6 +73,7 @@
protected static ManagementService managementService;
protected static TaskService taskService;
protected static HistoryService historyService;
+ protected static IdentityService identityService;
protected static CommandService commandService;
@@ -105,6 +107,7 @@
historyService = processEngine.getHistoryService();
managementService = processEngine.getManagementService();
taskService = processEngine.getTaskService();
+ identityService = processEngine.getIdentityService();
commandService = processEngine.get(CommandService.class);
}
}
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java (from rev 4298, jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java 2009-03-20 16:51:42 UTC (rev 4301)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.task;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.Execution;
+import org.jbpm.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskCandidatesTest extends JbpmTestCase {
+
+ public void testCommaSeparatedTaskCandidates() {
+ deployJpdlXmlString(
+ "<process name='TaskCandidates'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " candidate-users='johndoe, joesmoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
+ String executionId = execution.getId();
+
+ List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ // lets assume that johndoe takes the task
+ taskService.setUserId("johndoe");
+ taskService.takeTask(task.getDbid());
+
+ // verify that the group task lists are now empty
+ taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+ taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that the task now shows up in the personal task list for johndoe
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+ assertEquals("johndoe", task.getAssignee());
+
+ // submit the task
+ taskService.submitTask(task.getDbid());
+
+ // verify that the task list is now empty
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that process moved to the next state
+ execution = executionService.findExecution(executionId);
+ assertEquals("wait", execution.getActivityName());
+ }
+
+ public void testTaskCandidatesExpression() {
+ deployJpdlXmlString(
+ "<process name='TaskCandidates'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " candidate-users='#{userone}, #{usertwo}'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("userone", "johndoe");
+ variables.put("usertwo", "joesmoe");
+ Execution execution = executionService.startProcessInstanceByKey("TaskCandidates", variables);
+ String executionId = execution.getId();
+
+ List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+
+ // submit the task
+ taskService.setUserId("johndoe");
+ taskService.takeTask(task.getDbid());
+
+ // verify that the group task lists are now empty
+ taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+ taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that the task now shows up in the personal task list for johndoe
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ assertEquals("review", task.getName());
+ assertEquals("johndoe", task.getAssignee());
+
+ // submit the task
+ taskService.submitTask(task.getDbid());
+
+ // verify that the task list is now empty
+ taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertEquals(0, taskList.size());
+
+ // verify that process moved to the next state
+ execution = executionService.findExecution(executionId);
+ assertEquals("wait", execution.getActivityName());
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
More information about the jbpm-commits
mailing list