JBoss JBPM SVN: r4394 - in jbpm4/trunk/modules/examples/src/test: java/org/jbpm/examples/task/swimlane and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-02 15:34:49 -0400 (Thu, 02 Apr 2009)
New Revision: 4394
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/swimlane/TaskSwimlaneTest.java
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/swimlane/process.jpdl.xml
Log:
Make sure test identities are created only a single time
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-04-02 17:54:53 UTC (rev 4393)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-04-02 19:34:49 UTC (rev 4394)
@@ -36,7 +36,20 @@
protected void setUp() throws Exception
{
super.setUp();
+
deploy("jbpm-TaskCandidatesTest.jar");
+
+ if(identityService.findGroupById("sales-test-group")==null)
+ {
+ // create johndoe and joesmoe as members of the sales group
+ identityService.createGroup("sales-test-group");
+
+ identityService.createUser("johndoe", "johndoe", "John", "Doe");
+ identityService.createMembership("johndoe", "sales-test-group");
+
+ identityService.createUser("joesmoe", "joesmoe", "Joe", "Smoe");
+ identityService.createMembership("joesmoe", "sales-test-group");
+ }
}
protected void tearDown() throws Exception
@@ -46,21 +59,12 @@
}
public void testGroupCandidateAssignment() {
- // create johndoe and joesmoe as members of the sales group
- identityService.createGroup("sales");
-
- identityService.createUser("johndoe", "johndoe", "John", "Doe");
- identityService.createMembership("johndoe", "sales");
-
- identityService.createUser("joesmoe", "joesmoe", "Joe", "Smoe");
- identityService.createMembership("joesmoe", "sales");
-
Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
String executionId = execution.getId();
// both johndoe and joesmoe will see the task in their *takable* task list
List<Task> taskList = taskService.findTakableTasks("johndoe");
- assertEquals("Expected a single task in johndoe's takable task list", 1, taskList.size());
+ assertEquals("Expected a single task in johndoe's task list", 1, taskList.size());
Task task = taskList.get(0);
assertEquals("review", task.getName());
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-04-02 17:54:53 UTC (rev 4393)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-04-02 19:34:49 UTC (rev 4394)
@@ -36,6 +36,15 @@
{
super.setUp();
deploy("jbpm-TaskSwimlaneTest.jar");
+
+ if(identityService.findGroupById("sales-test-group")==null)
+ {
+ // create johndoe and joesmoe as members of the sales group
+ identityService.createGroup("sales-test-group");
+
+ identityService.createUser("johndoe", "johndoe", "John", "Doe");
+ identityService.createMembership("johndoe", "sales-test-group");
+ }
}
protected void tearDown() throws Exception
@@ -44,15 +53,11 @@
super.tearDown();
}
- public void testTaskSwimlane() {
- identityService.createGroup("sales");
- identityService.createUser("johndoe", "johndoe", "John", "Doe");
- identityService.createMembership("johndoe", "sales");
-
+ public void testTaskSwimlane() {
executionService.startProcessInstanceByKey("TaskSwimlane");
List<Task> taskList = taskService.findTakableTasks("johndoe");
- assertEquals(1, taskList.size());
+ assertEquals("Expected a single task in johndoe's task list", 1, taskList.size());
Task task = taskList.get(0);
long taskDbid = task.getDbid();
assertEquals("enter order data", task.getName());
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-04-02 17:54:53 UTC (rev 4393)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml 2009-04-02 19:34:49 UTC (rev 4394)
@@ -7,7 +7,7 @@
</start>
<task name="review"
- candidate-groups="sales"
+ candidate-groups="sales-test-group"
g="96,16,127,52">
<transition to="wait" />
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml 2009-04-02 17:54:53 UTC (rev 4393)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml 2009-04-02 19:34:49 UTC (rev 4394)
@@ -3,7 +3,7 @@
<process name="TaskSwimlane" xmlns="http://jbpm.org/4/jpdl">
<swimlane name="sales representative"
- candidate-groups="sales" />
+ candidate-groups="sales-test-group" />
<start g="20,20,48,48">
<transition to="enter order data" />
15 years, 1 month
JBoss JBPM SVN: r4393 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/process and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-02 13:54:53 -0400 (Thu, 02 Apr 2009)
New Revision: 4393
Modified:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ServicesTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
Log:
More excludes from integration test suite
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ServicesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ServicesTest.java 2009-04-02 14:51:06 UTC (rev 4392)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/services/ServicesTest.java 2009-04-02 17:54:53 UTC (rev 4393)
@@ -9,6 +9,7 @@
import org.jbpm.ProcessEngine;
import org.jbpm.RepositoryService;
import org.jbpm.TaskService;
+import org.jbpm.test.JbpmTestCase;
/** shows explicitely the part of the API that is
* provided by JbpmTestCase as a convenience.
@@ -18,7 +19,13 @@
public class ServicesTest extends TestCase {
public void testObtainServicesAndDeployProcess() {
-
+
+ if(JbpmTestCase.isIntegrationTest())
+ {
+ // Not part of the integration test suite
+ return;
+ }
+
// create a configuration
Configuration configuration = new Configuration();
// build a process engine from a configuration
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java 2009-04-02 14:51:06 UTC (rev 4392)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java 2009-04-02 17:54:53 UTC (rev 4393)
@@ -39,6 +39,13 @@
public class DeploymentResourcesTest extends JbpmTestCase {
public void testProcessWithNameOnly() {
+
+ if(isIntegrationTest())
+ {
+ // Not part of the integration test suite
+ return;
+ }
+
byte[] lotOfBytes = generateString("a lot of bytes ", 5000).getBytes();
byte[] otherBytes = generateString("other bytes ", 5000).getBytes();
15 years, 1 month
JBoss JBPM SVN: r4392 - in jbpm4/trunk/modules: userguide/src/main/docbook/en/modules and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-02 10:51:06 -0400 (Thu, 02 Apr 2009)
New Revision: 4392
Removed:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/handler/
Modified:
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
Log:
task assignment docs updates
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-02 12:34:28 UTC (rev 4391)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-02 14:51:06 UTC (rev 4392)
@@ -526,14 +526,6 @@
</process></programlisting>
</section>
-
-
-
-
-
-
-
-
<section id="end">
<title><literal>end</literal></title>
<para>Ends the execution.
@@ -823,58 +815,113 @@
<section id="task">
<title><literal>task</literal></title>
- <para>Creates a task for a person in the task component. The configuration capabilities
- of the task activity will be expanded in the next releases.
+
+ <para>Creates a task for a person in the task component.
</para>
- <table><title><literal>task</literal> attributes:</title>
- <tgroup cols="5" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Attribute</entry>
- <entry>Type</entry>
- <entry>Default</entry>
- <entry>Required?</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>assignee</literal></entry>
- <entry>text</entry>
- <entry></entry>
- <entry><emphasis role="bold">required</emphasis></entry>
- <entry>id of the person to which this task must be assigned</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>For example:</para>
- <figure id="process.task">
- <title>The task example process</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
- </figure>
- <programlisting><process name="Task" xmlns="http://jbpm.org/4/jpdl">
+ <section id="taskassignee">
+ <title><literal>task</literal> assignee</title>
+ <para>A simple task that will be assigned to a specific user
+ </para>
+ <table><title><literal>task</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>assignee</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>userId referring to the person that is responsible for
+ completing this task.</entry>
+ </row>
+ <row>
+ <entry><literal>assignee-lang</literal></entry>
+ <entry>expression language</entry>
+ <entry>juel</entry>
+ <entry>optional</entry>
+ <entry>expression language used in the assignee attribute</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <figure id="process.task">
+ <title>The task example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="TaskAssignee">
+
<start>
<transition to="review" />
</start>
- <emphasis role="bold"><task name="review"
- assignee="johndoe"></emphasis>
-
- <transition to="wait" />
- <emphasis role="bold"></task></emphasis>
+ <task name="review"
+ assignee="#{order.owner}">
+
+ <transition to="wait" />
+ </task>
<state name="wait" />
</process></programlisting>
- <para>After starting a process like this
- </para>
- <programlisting>executionService.startProcessInstanceByKey("Task");</programlisting>
- <para>The task list for user johndoe can be obtained from the <literal>TaskService</literal>
- like this</para>
- <programlisting>taskService.getPersonalTaskList("johndoe", 0, 10);</programlisting>
- <para>The task list for user 'johndoe' will contain a task named 'review'.</para>
+ <para>This process shows 2 aspects of task assignment. First, that the
+ attribute <literal>assignee</literal> is used to indicate the user that is
+ responsible for completing the task. The assignee is a String property
+ of a task and refers to a user.
+ </para>
+ <para>Secondly, this attribute is by default evaluated as an expression.
+ In this case the task is assigned to <literal>#{order.owner}</literal>.
+ Which means that first an object is searched for with name order. One of
+ the places where this object is looked up is the process variables
+ associated to the task. Then the <literal>getOwner()</literal> getter
+ will be used to get the userId that references the user that is
+ responsible for completing this task.
+ </para>
+ <para>Here's the Order class used in our example:</para>
+ <programlisting>public class Order implements Serializable {
+
+ String owner;
+
+ public Order(String owner) {
+ this.owner = owner;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+}</programlisting>
+ <para>Next a new process instance is created with an order as a process
+ variable.</para>
+ <programlisting>Map<String, Object> variables = new HashMap<String, Object>();
+variables.put("order", new Order("johndoe"));
+Execution execution = executionService.startProcessInstanceByKey("TaskAssignee", variables);</programlisting>
+ <para>Then the task list for <literal>johndoe</literal> can be obtained like this.</para>
+ <programlisting>List<Task> taskList = taskService.findAssignedTasks("johndoe");</programlisting>
+ <para>Note that it is also possible to put plain text like
+ <literal>assignee="johndoe"</literal>. In that case
+ the task will be assigned to johndoe.
+ </para>
+ </section>
+
+ <section id="taskcandidates">
+ <title><literal>task</literal> candidates</title>
+ <para>A task that will be offered to a group of users. One of the users should then
+ take the task in order to complete it.
+ </para>
+ <para>TODO</para>
+ </section>
</section>
<section id="script">
15 years, 1 month
JBoss JBPM SVN: r4391 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/task/candidates and 8 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-02 08:34:28 -0400 (Thu, 02 Apr 2009)
New Revision: 4391
Removed:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/mgmt/
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
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/swimlane/TaskSwimlaneTest.java
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AssignTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml
Log:
introduce separate task take method
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-04-02 12:01:33 UTC (rev 4390)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/TaskService.java 2009-04-02 12:34:28 UTC (rev 4391)
@@ -62,6 +62,11 @@
/** assigns this task to the given assignee. */
void assignTask(long taskDbid, String userId);
+ /** taking this task will prevent all other candidates from
+ * taking and working on this task.
+ * @throws JbpmException if this task already has been taken. */
+ void takeTask(long taskDbid, String userId);
+
/** Deletes this task, marks the related history task as completed.
* If the task was created in the context
* of a process execution, this operation may result in a process instance
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-04-02 12:01:33 UTC (rev 4390)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-04-02 12:34:28 UTC (rev 4391)
@@ -78,7 +78,7 @@
assertEquals(0, taskList.size());
// lets assume that johndoe takes the task
- taskService.assignTask(task.getDbid(), "johndoe");
+ taskService.takeTask(task.getDbid(), "johndoe");
// johndoe's and joesmoe's takable task list is now empty
taskList = taskService.findTakableTasks("johndoe");
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-04-02 12:01:33 UTC (rev 4390)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-04-02 12:34:28 UTC (rev 4391)
@@ -61,7 +61,7 @@
assertEquals(0, taskService.findAssignedTasks("johndoe").size());
// lets assume that johndoe takes the task
- taskService.assignTask(taskDbid, "johndoe");
+ taskService.takeTask(taskDbid, "johndoe");
// the next task will be created and assigned directly to johndoe
// this is because johndoe was the person that took the previous task
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java 2009-04-02 12:01:33 UTC (rev 4390)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java 2009-04-02 12:34:28 UTC (rev 4391)
@@ -21,16 +21,17 @@
*/
package org.jbpm.integration.console;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.server.integration.TaskManagement;
-import org.jboss.bpm.console.client.model.TaskRef;
+import org.jbpm.IdentityService;
import org.jbpm.TaskService;
-import org.jbpm.IdentityService;
-import org.jbpm.identity.Group;
-import org.jbpm.task.*;
+import org.jbpm.task.GroupRef;
+import org.jbpm.task.Participation;
+import org.jbpm.task.Task;
-import java.util.List;
-import java.util.ArrayList;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -98,6 +99,12 @@
return ModelAdaptor.adoptTask(t0);
}
+ public void takeTask(long taskId, String idRef)
+ {
+ TaskService taskService = this.processEngine.get(TaskService.class);
+ taskService.takeTask(taskId, idRef);
+ }
+
public void assignTask(long taskId, String idRef)
{
TaskService taskService = this.processEngine.get(TaskService.class);
@@ -122,5 +129,4 @@
TaskService taskService = this.processEngine.get(TaskService.class);
taskService.completeTask(taskId);
}
-
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AssignTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AssignTaskCmd.java 2009-04-02 12:01:33 UTC (rev 4390)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AssignTaskCmd.java 2009-04-02 12:34:28 UTC (rev 4391)
@@ -36,19 +36,30 @@
protected long taskDbid;
protected String userId;
+ protected boolean take;
public AssignTaskCmd(long taskDbid, String userId) {
this.taskDbid = taskDbid;
this.userId = userId;
}
+ public AssignTaskCmd(long taskDbid, String userId, boolean take) {
+ this.taskDbid = taskDbid;
+ this.userId = userId;
+ this.take = take;
+ }
+
public Void execute(Environment environment) {
TaskDbSession taskDbession = environment.get(TaskDbSession.class);
TaskImpl task = (TaskImpl) taskDbession.findTaskByDbid(taskDbid);
if (task==null) {
throw new JbpmException("task "+taskDbid+" does not exist");
}
- task.setAssignee(userId, true);
+ if (take) {
+ task.take(userId);
+ } else {
+ task.setAssignee(userId, true);
+ }
return null;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-04-02 12:01:33 UTC (rev 4390)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-04-02 12:34:28 UTC (rev 4391)
@@ -41,29 +41,23 @@
public class TaskServiceImpl extends AbstractServiceImpl implements TaskService {
public Task newTask() {
- NewTaskCmd cmd = new NewTaskCmd(null);
- addTxWireObjects(cmd);
- return commandService.execute(cmd);
+ return commandService.execute(new NewTaskCmd(null));
}
public Task getTask(long taskDbid) {
- GetTaskCmd cmd = new GetTaskCmd(taskDbid);
- return commandService.execute(cmd);
+ return commandService.execute(new GetTaskCmd(taskDbid));
}
public long saveTask(Task task) {
- SaveTaskCmd cmd = new SaveTaskCmd((TaskImpl) task);
- return commandService.execute(cmd);
+ return commandService.execute(new SaveTaskCmd((TaskImpl) task));
}
public void cancelTask(long taskDbid) {
- CancelTaskCmd cmd = new CancelTaskCmd(taskDbid);
- commandService.execute(cmd);
+ commandService.execute(new CancelTaskCmd(taskDbid));
}
public void cancelTask(long taskDbid, String reason) {
- CancelTaskCmd cmd = new CancelTaskCmd(taskDbid, reason);
- commandService.execute(cmd);
+ commandService.execute(new CancelTaskCmd(taskDbid, reason));
}
public void completeTask(long taskDbid) {
@@ -71,8 +65,7 @@
}
public void completeTask(long taskDbid, String outcome) {
- CompleteTaskCmd cmd = new CompleteTaskCmd(taskDbid, outcome);
- commandService.execute(cmd);
+ commandService.execute(new CompleteTaskCmd(taskDbid, outcome));
}
public void addTaskParticipatingUser(long taskDbid, String userId, String participation) {
@@ -116,41 +109,37 @@
}
public List<Task> getSubTasks(long taskDbid) {
- GetSubTasksCmd cmd = new GetSubTasksCmd(taskDbid);
- return commandService.execute(cmd);
+ return commandService.execute(new GetSubTasksCmd(taskDbid));
}
public Task newTask(long parentTaskDbid) {
- NewTaskCmd cmd = new NewTaskCmd(parentTaskDbid);
- return commandService.execute(cmd);
+ return commandService.execute(new NewTaskCmd(parentTaskDbid));
}
public Comment addTaskComment(long taskDbid, String message) {
- AddTaskCommentCmd cmd = new AddTaskCommentCmd(taskDbid, message);
- return commandService.execute(cmd);
+ return commandService.execute(new AddTaskCommentCmd(taskDbid, message));
}
public List<Comment> getTaskComments(long taskDbid) {
- GetTaskCommentsCmd cmd = new GetTaskCommentsCmd(taskDbid);
- return commandService.execute(cmd);
+ return commandService.execute(new GetTaskCommentsCmd(taskDbid));
}
public void deleteComment(long commentDbid) {
- DeleteCommentCmd cmd = new DeleteCommentCmd(commentDbid);
- commandService.execute(cmd);
+ commandService.execute(new DeleteCommentCmd(commentDbid));
}
public Comment addReplyComment(long commentDbid, String message) {
- AddReplyCommentCmd cmd = new AddReplyCommentCmd(commentDbid, message);
- return commandService.execute(cmd);
+ return commandService.execute(new AddReplyCommentCmd(commentDbid, message));
}
public void assignTask(long taskDbid, String userId) {
- AssignTaskCmd cmd = new AssignTaskCmd(taskDbid, userId);
- addTxWireObjects(cmd);
- commandService.execute(cmd);
+ commandService.execute(new AssignTaskCmd(taskDbid, userId));
}
+ public void takeTask(long taskDbid, String userId) {
+ commandService.execute(new AssignTaskCmd(taskDbid, userId, true));
+ }
+
public Object getVariable(long taskDbid, String variableName) {
Set<String> variableNames = new HashSet<String>();
variableNames.add(variableName);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-04-02 12:01:33 UTC (rev 4390)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-04-02 12:34:28 UTC (rev 4391)
@@ -109,12 +109,19 @@
// assignment ///////////////////////////////////////////////////////////////
- public void setAssignee(String assignee) {
- this.assignee = assignee;
+ public void take(String userId) {
+ if (assignee!=null) {
+ throw new JbpmException("task already taken by "+this.assignee);
+ }
+ setAssignee(userId, true);
}
+
+ public void setAssignee(String userId) {
+ this.assignee = userId;
+ }
- public void setAssignee(String assignee, boolean propagateToSwimlane) {
- this.assignee = assignee;
+ public void setAssignee(String userId, boolean propagateToSwimlane) {
+ this.assignee = userId;
if (propagateToSwimlane) {
propagateAssigneeToSwimlane();
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java 2009-04-02 12:01:33 UTC (rev 4390)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCandidatesTest.java 2009-04-02 12:34:28 UTC (rev 4391)
@@ -26,6 +26,7 @@
import java.util.Map;
import org.jbpm.Execution;
+import org.jbpm.JbpmException;
import org.jbpm.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -72,7 +73,7 @@
assertEquals(0, taskList.size());
// lets assume that johndoe takes the task
- taskService.assignTask(task.getDbid(), "johndoe");
+ taskService.takeTask(task.getDbid(), "johndoe");
// johndoe's and joesmoe's takable task list is now empty
taskList = taskService.findTakableTasks("johndoe");
@@ -144,7 +145,7 @@
assertEquals(0, taskList.size());
// lets assume that johndoe takes the task
- taskService.assignTask(task.getDbid(), "johndoe");
+ taskService.takeTask(task.getDbid(), "johndoe");
// johndoe's and joesmoe's takable task list is now empty
taskList = taskService.findTakableTasks("johndoe");
@@ -175,4 +176,33 @@
execution = executionService.findExecution(executionId);
assertEquals("wait", execution.getActivityName());
}
+
+ public void testDoubleTake() {
+ deployJpdlXmlString(
+ "<process name='DoubleTake'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " candidate-users='johndoe, joesmoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("DoubleTake");
+ String executionId = execution.getId();
+
+ // both johndoe and joesmoe will see the task in their *takable* task list
+ long taskDbid = taskService.findTakableTasks("johndoe").get(0).getDbid();
+
+ taskService.takeTask(taskDbid, "johndoe");
+
+ try {
+ taskService.takeTask(taskDbid, "joesmoe");
+ } catch (JbpmException e) {
+ assertTextPresent("task already taken by johndoe", e.getMessage());
+ }
+ }
}
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml 2009-04-02 12:01:33 UTC (rev 4390)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml 2009-04-02 12:34:28 UTC (rev 4391)
@@ -305,12 +305,50 @@
<section id="taskservice">
<title>TaskService</title>
- <para></para>
+ <para>The primary purpose of the TaskService is to provide access to
+ task lists. The code sample will show how to get the task list for
+ the user with id <literal>johndoe</literal>.
+ </para>
+ <programlisting>List<Task> taskList = taskService.findAssignedTasks("johndoe");</programlisting>
+ <para>Typically tasks are associated with a form and displayed in some user
+ interface. The form needs to be able to read and write data related to the task.
+ </para>
+ <programlisting>long taskDbid = task.getDbid();
+
+Set<String> variableNames = taskService.getVariableNames(taskDbid);
+variables = taskService.getVariables(taskDbid, variableNames);
+
+variables = new HashMap<String, Object>();
+variables.put("category", "small");
+variables.put("lires", 923874893);
+taskService.setVariables(taskDbid, variables);</programlisting>
+ <para>and complete tasks</para>
+ <programlisting>taskService.completeTask(taskDbid);</programlisting>
+ <para>Tasks can also be offered to a set of candidates. Candidates can be
+ users or groups. Users can take tasks for which they are a candidate. Taking
+ a task means that this user will be set as the assignee. After that, other users
+ will be blocked from taking the task.
+ </para>
+ <programlisting></programlisting>
+ <para>
+ People should not work on
+ a task unless they are assigned to that task. The user interface should display
+ forms and allow users to complete tasks if they are assigned to it.
+ For unassigned tasks for which the user is a candidate, the only action that
+ should be exposed is 'take'. Since taking a task boiles down to setting the
+ assignee to the current user, we didn't introduce a separate method for that.
+ </para>
+ <para>More on tasks in <xref linkend="tasks" /> </para>
</section>
+ <section id="historyservice">
+ <title>HistoryService</title>
+ <para>TODO</para>
+ </section>
+
<section id="managementservice">
<title>ManagementService</title>
- <para></para>
+ <para>TODO</para>
</section>
</chapter>
\ No newline at end of file
15 years, 1 month
JBoss JBPM SVN: r4390 - jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-02 08:01:33 -0400 (Thu, 02 Apr 2009)
New Revision: 4390
Modified:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
Log:
Exclude ServicesTest from integration test suite
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-02 11:57:02 UTC (rev 4389)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-04-02 12:01:33 UTC (rev 4390)
@@ -184,7 +184,7 @@
return testHelper;
}
- protected boolean isIntegrationTest()
+ public static boolean isIntegrationTest()
{
return System.getProperty("jboss.bind.address")!=null;
}
15 years, 1 month
JBoss JBPM SVN: r4389 - in jbpm4/trunk/modules/examples/src/test: resources/org/jbpm/examples/java and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-02 07:57:02 -0400 (Thu, 02 Apr 2009)
New Revision: 4389
Modified:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml
Log:
Fix JavaInstantiateTest
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java 2009-04-02 11:50:43 UTC (rev 4388)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/java/JohnDoe.java 2009-04-02 11:57:02 UTC (rev 4389)
@@ -30,11 +30,9 @@
public class JohnDoe {
String state;
- Session session;
public String hello(String msg) {
if ( (msg.indexOf("how are you?")!=-1)
- && (session.isOpen())
) {
return "I'm "+state+", thank you.";
}
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml 2009-04-02 11:50:43 UTC (rev 4388)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/java/process.jpdl.xml 2009-04-02 11:57:02 UTC (rev 4389)
@@ -13,7 +13,6 @@
g="96,16,127,52">
<field name="state"><string value="fine"/></field>
- <field name="session"><env type="org.hibernate.Session"/></field>
<arg><string value="Hi, how are you?"/></arg>
15 years, 1 month
JBoss JBPM SVN: r4388 - jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/esb.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-02 07:50:43 -0400 (Thu, 02 Apr 2009)
New Revision: 4388
Modified:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/esb/EsbTest.java
Log:
Exclude EsbTest from integration runs
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/esb/EsbTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/esb/EsbTest.java 2009-04-02 10:34:41 UTC (rev 4387)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/esb/EsbTest.java 2009-04-02 11:50:43 UTC (rev 4388)
@@ -60,7 +60,13 @@
}
public void testEsb() {
-
+
+ if(isIntegrationTest())
+ {
+ System.out.println("FIXME JBPM-2137: Implement and execute esb integration tests");
+ return;
+ }
+
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("title", "Internetworking with TCP/IP");
15 years, 1 month
JBoss JBPM SVN: r4387 - in jbpm4/trunk/modules/test-db/src/test: resources and 4 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-02 06:34:41 -0400 (Thu, 02 Apr 2009)
New Revision: 4387
Added:
jbpm4/trunk/modules/test-db/src/test/resources/org/
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml
Removed:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml
Log:
moved process in test-db to resources directory
Deleted: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml 2009-04-02 10:26:07 UTC (rev 4386)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml 2009-04-02 10:34:41 UTC (rev 4387)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process name="Resource" xmlns="http://jbpm.org/4/jpdl">
-
- <start>
- <transition to="get return code" />
- </start>
-
- <state name="get return code">
- <transition to="ok"/>
- </state>
-
- <end name="ok" state="completed"/>
-
-</process>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml (from rev 4384, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml 2009-04-02 10:34:41 UTC (rev 4387)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Resource" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="get return code" />
+ </start>
+
+ <state name="get return code">
+ <transition to="ok"/>
+ </state>
+
+ <end name="ok" state="completed"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 1 month
JBoss JBPM SVN: r4386 - jbpm4/trunk/modules/distro/src/main/resources/installer.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-02 06:26:07 -0400 (Thu, 02 Apr 2009)
New Revision: 4386
Modified:
jbpm4/trunk/modules/distro/src/main/resources/installer/install-definition.xml
Log:
Install *-ds.xml to docs/examples/jbpm
Modified: jbpm4/trunk/modules/distro/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/installer/install-definition.xml 2009-04-02 10:11:45 UTC (rev 4385)
+++ jbpm4/trunk/modules/distro/src/main/resources/installer/install-definition.xml 2009-04-02 10:26:07 UTC (rev 4386)
@@ -120,10 +120,10 @@
<file src="@{deploy.artifacts.dir}/license.txt" targetdir="$INSTALL_PATH" override="true" />
<file src="@{deploy.artifacts.dir}/readme.html" targetdir="$INSTALL_PATH" override="true" />
- <!-- jbpm4/doc -->
+ <!-- jbpm4/doc -->
<fileset dir="@{deploy.artifacts.dir}/doc" targetdir="$INSTALL_PATH/doc" />
<fileset dir="@{deploy.artifacts.dir}/db.scripts" targetdir="$INSTALL_PATH/db" />
-
+
<!-- jbpm4/examples -->
<fileset dir="@{deploy.artifacts.dir}/examples" targetdir="$INSTALL_PATH/examples" />
@@ -149,14 +149,14 @@
<description>The Install jBPM in JBoss</description>
- <!-- jbpm/jbpm-service.sar , console config-->
+ <!-- jbpm/jbpm-service.sar , console config-->
<fileset dir="@{deploy.artifacts.dir}/resources/jbpm-console-config" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar/META-INF" override="true">
<include name="jboss-service.xml"/>
</fileset>
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" override="true">
<include name="jbpm-pvm.jar" />
- <include name="jbpm-jpdl.jar" />
+ <include name="jbpm-jpdl.jar" />
<include name="jbpm-console-integration.jar" />
<include name="idm*.jar" />
<include name="livetribe-jsr223.jar" />
@@ -187,7 +187,7 @@
<include name="jbpm-log.jar" />
</fileset>
- <!-- deployer -->
+ <!-- deployer -->
<fileset dir="@{deploy.artifacts.dir}/lib/"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm.deployer"
override="true"
@@ -224,12 +224,12 @@
<include name="jbpm-log.jar" />
</fileset>
- <!-- deployer -->
+ <!-- deployer -->
<fileset dir="@{deploy.artifacts.dir}/lib/"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm.deployer"
override="true"
condition="isJBoss423">
- <include name="jbpm-jboss4.jar"/>
+ <include name="jbpm-jboss4.jar"/>
</fileset>
<fileset dir="@{deploy.artifacts.dir}/resources/jbpm-jboss4-config/jbpm.deployer/META-INF"
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm.deployer/META-INF"
@@ -243,7 +243,7 @@
targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar/jbpm.beans/META-INF"
override="true"
condition="isJBoss423">
- <include name="jboss-beans.xml"/>
+ <include name="jboss-beans.xml"/>
</fileset>
<!--
==============================
@@ -280,43 +280,59 @@
==============================
-->
- <!-- Database Hypsersonic -->
- <file src="@{deploy.artifacts.dir}/resources/datasources/jbpm-hsqldb-ds.xml"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm"
+ <!-- Database Hypersonic -->
+ <file src="@{deploy.artifacts.dir}/resources/datasources/jbpm-hsqldb-ds.xml"
+ targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm"
condition="isHypersonic"/>
- <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-hsqldb-config"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
+ <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-hsqldb-config"
+ targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
condition="isHypersonic" />
- <fileset dir="@{deploy.artifacts.dir}/resources/hsqldb"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/data/hypersonic"
+ <fileset dir="@{deploy.artifacts.dir}/resources/hsqldb"
+ targetdir="${jbossInstallPath}/server/${jbossTargetServer}/data/hypersonic"
condition="isHypersonic">
<include name="jbpm4DB.*" />
</fileset>
<!-- Database MySQL -->
- <file src="@{deploy.artifacts.dir}/resources/datasources/jbpm-mysql-ds.xml"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm"
- condition="isMySQL"/>
- <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-mysql-config"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
+ <file src="@{deploy.artifacts.dir}/resources/datasources/jbpm-mysql-ds.xml"
+ targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm"
+ condition="isMySQL"/>
+ <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-mysql-config"
+ targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
condition="isMySQL" />
- <fileset dir="@{deploy.artifacts.dir}/lib"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
- override="true"
+ <fileset dir="@{deploy.artifacts.dir}/lib"
+ targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
+ override="true"
condition="isMySQL">
<include name="mysql-connector-java.jar" />
</fileset>
- <!-- Database Oracle -->
- <file src="@{deploy.artifacts.dir}/resources/datasources/jbpm-oracle-ds.xml"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm"
+ <!-- Database Oracle -->
+ <file src="@{deploy.artifacts.dir}/resources/datasources/jbpm-oracle-ds.xml"
+ targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm"
condition="isOracle"/>
- <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-oracle-config"
- targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
+ <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-oracle-config"
+ targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
condition="isOracle" />
<!-- NOTE: oracle driver needs to be provided manually -->
<!--
+
+ Database configs to docs/examples/jbpm
+ @see also hudson/hudson-home/command.sh
+ -->
+ <fileset dir="@{deploy.artifacts.dir}/resources/datasources"
+ targetdir="${jbossInstallPath}/docs/examples/jbpm" override="true">
+ <!--include name="hibernate.cfg.hsqldb.xml"/>
+ <include name="hibernate.cfg.mysql.xml"/>
+ <include name="hibernate.cfg.oracle.xml"/-->
+ <include name="jbpm-hsqldb-ds.xml"/>
+ <include name="jbpm-mysql-ds.xml"/>
+ <include name="jbpm-oracle-ds.xml"/>
+ </fileset>
+
+
+ <!--
==============================
GWT Console
==============================
15 years, 1 month