[jboss-user] [JBoss jBPM] - Re: Task list of specified actor
dleerob
do-not-reply at jboss.com
Tue Sep 25 08:01:52 EDT 2007
Here's how I get all task instances that have not ended for all processes for the currently authenticated user. You could use this code as an example. If anyone has a better way of doing it, please post it:
| User currentUser = getUser(request);
| 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(currentUser.getUsername());
| IdentitySession identitySession = new IdentitySession(session);
| org.jbpm.identity.User jbpmUser = identitySession.getUserByName(currentUser.getUsername());
| 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 = '"+currentUser.getUsername()+"'").list();
| //add pooledTaskInstances to taskList
| jbpmTaskInstanceList.addAll(pooledTaskInstances);
|
| //TODO sort jbpmTaskInstanceList by task instance id
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088377#4088377
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088377
More information about the jboss-user
mailing list