Thanks for the info. I was hoping there was a way to get the work item
via mina. We have a client application that is communicating with the
TaskServer via mina and it would be nice if you could easily get a work
item that is associated with a task instead of creating a separate
knowledgesession.
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Vijay K Pandey
Sent: Tuesday, December 08, 2009 11:47 AM
To: Rules Users List
Subject: Re: [rules-users] Human Task Work Item
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(a)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