[rules-users] Human Task Work Item
Vijay K Pandey
VPandey at mdes.ms.gov
Tue Dec 8 12:46:30 EST 2009
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 at lists.jboss.org [mailto:rules-users-bounces at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091208/de290446/attachment.html
More information about the rules-users
mailing list