I guess first you have to get hold of the “workitemid”
from the task data i.e. task.getTaskData().getWorkItemId().
a) Create a “Command” class which implements
GenericCommand<WorkItem>
b) Implement the method “public WorkItem execute(Context
context)”
c) Based on the workitem id ( set this value in your command object –
constructor/setter) – get hold of the WorkItemInfo object through the
entity manager and then its workItem ----- something like this
StatefulKnowledgeSession ksession = ((KnowledgeCommandContext)
context).getStatefulKnowledgesession();
if
(workItemId==null) {
return
null;
}
EntityManager
em = (EntityManager)
ksession.getEnvironment().get(EnvironmentName.ENTITY_MANAGER);
WorkItemInfo
workItemInfo = em.find(WorkItemInfo.class, workItemId);
if(workItemInfo==null){
return
null;
}else{
return workItemInfo.getWorkItem();
}
d) Then
call the execute method on the StatefulKnowledgeSession – which should
execute the above Command object and that returns you the WorkItem object.
Vijay
From:
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Todd Pagni
Sent: Tuesday, December 08, 2009
11:16 AM
To: Rules Users List
Subject: [rules-users] Human Task
Work Item
From
the Mina client, how do you get a work item associated with a human task?
I
see the Task.getTaskData(), but I don’t see any easy way to get the work
item as I need the work item inparameters from the mina client side.
Thanks,
Todd