[jbpm-dev] [Design of JBoss jBPM] - Reassignment does not reflect in task history.
shekharv
do-not-reply at jboss.com
Sat Jul 4 21:54:01 EDT 2009
Summary:
1.) Task is assigned to 'Person1' at the point of creation.
2.) Task is reassigned to 'Person2'.
3.) 'Person2' completes the task.
4.) We query history for the task, it says that 'Person1' was the assignee, whereas it was 'person2' at the point of completion.
Process:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <process key="ReassignTest"
| name="ReassignTest"
| xmlns="http://jbpm.org/4.0/jpdl">
|
| <start g="20,20,48,48">
| <transition to="test1"/>
| </start>
|
| <task name="test1" g="96,16,127,52">
| <assignment-handler
| class= "org.jbpm.examples.task.assignmenthandler.AssignTask">
| <field name="assignee">
| <string value="person1"/>
| </field>
| </assignment-handler>
| <transition name="end1" to="end1"/>
| </task>
|
| <end name="end1" g="255,16,88,52"/>
| </process>
|
Test:
| public void test_whether_reassign_history_works() {
| ProcessInstance pi =
| executionService.startProcessInstanceByKey("ReassignTest");
|
| List<Task> tasks = taskService.findPersonalTasks("person1");
| assertTrue(tasks.size() == 1);
|
| long taskDbId = tasks.get(0).getDbid();
|
| taskService.assignTask(taskDbId, "person2");
| List<Task> tasksAfterReassignment = taskService.findPersonalTasks("person1");
| assertTrue("Person1 should not have any tasks.",tasksAfterReassignment.size() == 0);
|
| List<Task> tasksForNewAssignee = taskService.findPersonalTasks("person2");
| assertTrue("Person2 should have 1 task.", tasksForNewAssignee.size() == 1);
|
| assertEquals("person2", taskService.getTask(taskDbId).getAssignee());
|
| taskService.completeTask(taskDbId, "end1");
| List<HistoryActivityInstance> aiHistory = historyService
| .createHistoryActivityInstanceQuery()
| .executionId(pi.getId()).list();
| assertEquals("My assumption of there being only one entry in the history is wrong." , 1,aiHistory.size());
| HistoryTaskInstanceImpl hai = (HistoryTaskInstanceImpl) aiHistory.get(0);
|
| assertEquals("Person2 completed the Task, but someone else got the credit","person2", hai.getAssignee());
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4241816#4241816
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4241816
More information about the jbpm-dev
mailing list