[jboss-user] [JBoss jBPM] - Re: How to retrieve the Task list of a user ?
dleerob
do-not-reply at jboss.com
Fri Jan 18 08:32:29 EST 2008
In your process definition, you have:
| <swimlane name="user">
| </swimlane>
|
You've defined a swimlane called "user", but you haven't assigned any users to that swimlane.
Also, to get a list of tasks that can potentially be assigned to a user, I use a method like this:
/**
| * 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;
| }
Hope this helps a bit. Good luck!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121272#4121272
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121272
More information about the jboss-user
mailing list