In my customized Workflow web application, I get the Tasks I want in my action
class. Here are two methods that may help or give you ideas.
I simply add the retrieved list as a request attribute, and then code my JSP
page displays whatever I want it to.
/**
| * Gets all task instances that a user with the given actor id could
claim.
| * @return List of jbpm task instances.
| */
| public static List getUnClaimedTaskInstancesForActorId (JbpmContext
jbpmContext, String actorId) {
| Session session = jbpmContext.getSession();
|
| //create list of possible id's (this includes groups) that
| //belong to the current user.
| List actorsList = new ArrayList();
| actorsList.add(actorId);
| IdentitySession identitySession = new IdentitySession(session);
| org.jbpm.identity.User jbpmUser =
identitySession.getUserByName(actorId);
| Iterator i = jbpmUser.getMemberships().iterator();
| while(i.hasNext()){
| Membership m = (Membership) i.next();
| actorsList.add(m.getGroup().getName());
| }
| List pooledTaskInstances =
jbpmContext.getTaskMgmtSession().findPooledTaskInstances(actorsList);
| List jbpmTaskInstanceList = session.createQuery("from
org.jbpm.taskmgmt.exe.TaskInstance ti where ti.start is null and ti.end is null
and actorId = '"+actorId+"'").list();
| //add pooledTaskInstances to taskList
| jbpmTaskInstanceList.addAll(pooledTaskInstances);
|
| //TODO sort jbpmTaskInstanceList by task instance id
|
| return jbpmTaskInstanceList;
| }
/**
| * Retrieves a list of TaskInstance objects for a given user, that he
has claimed/started.
| * @param actorId
| * @return
| */
| private List getClaimedTasks(String actorId) {
| Session session = jbpmContext.getSession();
| List jbpmTaskInstanceList = session.createQuery("from
org.jbpm.taskmgmt.exe.TaskInstance ti where ti.start is not null and ti.end is
null and actorId = '"+actorId+"'").list();
| return jbpmTaskInstanceList;
| }
I also have some more complex method which are relevant to my web app, like
retrieving tasks for everyone in your team etc. But that's all dependant on
your identity component.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150387#4150387
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150387
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user