I don't think you can get hold of workItem directly from Task ---- the only 
reference Task has the workItemId.  May be you can serialize the workItem and 
set to the content of the Task( I don't like it) - and then retrieve it later  
--- else I guess you have to get hold of WorkItemInfo and then workItem..

Also creation of knowledgesession is not process/time consuming so I don't see 
any harm in there
________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of Todd Pagni
Sent: Tuesday, December 08, 2009 11:57 AM
To: Rules Users List
Subject: Re: [rules-users] Human Task Work Item

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: [email protected] 
[mailto:[email protected]] 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: [email protected] 
[mailto:[email protected]] 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
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to