Page 1 of 1

Task assignment to pooled actor not working

PostPosted:Thu Dec 23, 2010 2:32 am
by surajaya
Hello All,

I'm currently trying workflow in openkm 5.0. I successfully assign task to single actor (user) but failed to assign task to group of user (pooled actor). In this sample, i'm trying to assign task to user1, user2, user3, and group of UserRole. Here is my sample process definition (processdefinition.xml) :
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>

<process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="AssignmentTest">


	<start-state name="start-state1">
		<task name="testing" blocking="true">
			<description>
				testing
			</description>
			<assignment pooled-actors="group(UserRole)"></assignment>
			<controller></controller>
		</task>
		<transition to="task-node1" name="to_task1"></transition>
	</start-state>


	<task-node name="task-node1">
		<task name="task1" blocking="true">
			<description>
				Testing task1
			</description>
			<assignment actor-id="user1"></assignment>
			<controller></controller>
		</task>
		<transition to="task-node2" name="to_task2"></transition>
	</task-node>

	<task-node name="task-node2">
		<task name="task2" blocking="true">
			<description>
				Testing task2
			</description>
			<assignment actor-id="user2"></assignment>
			<controller></controller>
		</task>
		<transition to="task-node3" name="to_task3"></transition>
	</task-node>

	<task-node name="task-node3">
		<task name="task3" blocking="true">
			<description>
				Testing task3
			</description>
			<assignment actor-id="user3"></assignment>
			<controller></controller>
		</task>
		<transition to="task-node4" name="to_task4"></transition>
	</task-node>

	<task-node name="task-node4">
		<task name="task4" blocking="true">
			<description>
				Testing task4
			</description>
			<assignment pooled-actors="group(UserRole)"></assignment>
			<controller></controller>
		</task>
		<transition to="end-state1" name="to_end"></transition>
	</task-node>


	<end-state name="end-state1"></end-state>


</process-definition>
and here is my form definition (forms.xml) :
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 1.0//EN"
                                "http://www.openkm.com/dtd/workflow-forms-1.0.dtd">
<workflow-forms>
  <workflow-form task="testing">
    <input label="variable1" name="variable1" />
    <button label="Submit" />
  </workflow-form>
  <workflow-form task="task1">
    <input label="variable1" name="variable1" />
    <button label="Submit" />
  </workflow-form>
  <workflow-form task="task2">
    <input label="variable2" name="variable2" />
    <button label="Submit" />
  </workflow-form>
  <workflow-form task="task3">
    <input label="variable3" name="variable3" />
    <button label="Submit" />
  </workflow-form>
  <workflow-form task="task4">
    <input label="variable4" name="variable4" />
    <button label="Submit" />
  </workflow-form>
</workflow-forms>
What is probably wrong with my workflow ?. Does openkm 5.0 support pooled actor in the task assignment ?

Thanks in advance for your reply

Re: Task assignment to pooled actor not working

PostPosted:Thu Dec 23, 2010 2:38 am
by surajaya
I successfully deploy that workflow to openkm5.0, but only user1,user2,user3 have task in their "pending task".
Only task1,task2,task3 is assigned. Testing and task4 is not assigned, even if I logged in as user4 (which belong to group UserRole)

Re: Task assignment to pooled actor not working

PostPosted:Thu Dec 23, 2010 3:06 am
by surajaya
I've tried to change the assigment from :
Code: Select all
			<assignment pooled-actors="group(UserRole)"></assignment>
to
Code: Select all
			<assignment pooled-actors="UserRole"></assignment>
but still not working. No assigned task for tasks : testing & task4

Re: Task assignment to pooled actor not working

PostPosted:Thu Dec 23, 2010 7:53 am
by surajaya
Here I attach the *.par file

Re: Task assignment to pooled actor not working

PostPosted:Fri Dec 24, 2010 2:38 am
by surajaya
Change the assignment to this, and still not solved :(
Code: Select all
<assignment pooled-actors="user1,user2,user3,user4"></assignment>

Re: Task assignment to pooled actor not working

PostPosted:Sat Dec 25, 2010 1:36 am
by surajaya
When I change this :
Code: Select all
<assignment pooled-actors="group(UserRole)"></assignment>
into this :
Code: Select all
<assignment expression="group(UserRole)"></assignment>
I got this error message :
Code: Select all
OKM-015026(callbackRunProcessDefinition): OKM-015026
org.jbpm.identity.assignment.ExpressionAssignmentHandler cannot be cast to org.jbpm.taskmgmt.def.AssignmentHandler
Any idea ?

Re: Task assignment to pooled actor not working

PostPosted:Mon Dec 27, 2010 9:40 am
by surajaya
Finally solved using AssignmentHandler Class :D
Here is my class sample :
Code: Select all
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.taskmgmt.def.AssignmentHandler;
import org.jbpm.taskmgmt.exe.Assignable;


public class Assignment1 implements AssignmentHandler {

	@Override
	public void assign(Assignable assignable, ExecutionContext executionContext)
			throws Exception {

		String[] aktor = {"user1","user2","user3","user4"}; 
		assignable.setPooledActors(aktor);
	}

}

Re: Task assignment to pooled actor not working

PostPosted:Mon Jan 24, 2011 6:25 pm
by pavila
Sorry surajaya, I didn't saw your post until yesterday and was testing the pooled actors feature. I don't know why is not working for you. With this task node description works without problems:
Code: Select all
<task-node name="task-node">
		<task name="sample">
			<assignment pooled-actors="paco,pepe"></assignment>
			<controller></controller>
			<event type="task-create">
				<script>
					taskInstance.start();
				</script>
			</event>
		</task>
		<transition to="end" name="to_end">
			<action></action>
		</transition>
	</task-node>
Pooled Actor: is defined by an actorID sequence separated by comma (','). When this task is created, is not assigned to any user. An actor should retrieve the list of pending tasks from actor pool and be assigned by himself to be included in his pending task list.

Re: Task assignment to pooled actor not working

PostPosted:Thu Jan 27, 2011 8:11 am
by surajaya
pavila wrote:Sorry surajaya, I didn't saw your post until yesterday and was testing the pooled actors feature. I don't know why is not working for you. With this task node description works without problems:
Code: Select all
<task-node name="task-node">
		<task name="sample">
			<assignment pooled-actors="paco,pepe"></assignment>
			<controller></controller>
			<event type="task-create">
				<script>
					taskInstance.start();
				</script>
			</event>
		</task>
		<transition to="end" name="to_end">
			<action></action>
		</transition>
	</task-node>
Pooled Actor: is defined by an actorID sequence separated by comma (','). When this task is created, is not assigned to any user. An actor should retrieve the list of pending tasks from actor pool and be assigned by himself to be included in his pending task list.
I'll test it again. The first time I test my code, nothing is blinking in the status bar (notifying that there are some pending task for the user). I must admit that I forgot to check the dashboard and look in the "Unassigned pending task". I'll test this assignment soon :
Code: Select all
<assignment pooled-actors="user1,user2,user3,user4"></assignment>

Re: Task assignment to pooled actor not working

PostPosted:Thu Jan 27, 2011 8:22 am
by pavila
The blinking icon status take some time to refresh it does not update its status immediately. So is working for you isn't it?