[jboss-user] [JBoss Seam] - My filtered pooledTaskInstanceList
harpritt
do-not-reply at jboss.com
Tue Jul 24 17:49:27 EDT 2007
I needed a filtered version of the pooledTaskInstanceList so that i could select tasks assigned to a given actor pool.
the two actor pools tasks that i needed were CRS_Releaser and CRS_Processor.
i can use following to get my filtered lists
#{cRSReleaserPooledTaskInstanceList}
#c{RSProcessorrPooledTaskInstanceList}
i dont know how "good" my solution is.... any comments would be nice.
anyway i hope this helps someone else out there.
package main.java.com.sms.crs.customComponents;
|
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.annotations.Factory;
| import org.jbpm.taskmgmt.exe.TaskInstance;
|
|
| import java.util.List;
| import java.util.Iterator;
| import java.util.ArrayList;
|
| @Name("customSeamComponents")
| public class CustomSeamComponent {
|
| @In(required = true)
| private List pooledTaskInstanceList;
|
| //could make this filter on more than a single actor..really this is a group
|
| @Factory("cRSReleaserPooledTaskInstanceList")
| public List cRSReleaserPooledTaskInstanceList() {
| return filteredPooledTaskInstanceList("CRS_Releaser");
| }
|
| @Factory("cRSProcessorPooledTaskInstanceList")
| public List cRSProcessorPooledTaskInstanceList() {
| return filteredPooledTaskInstanceList("CRS_Processor");
| }
|
|
| //pooled actor is a Role
| private List filteredPooledTaskInstanceList(String pooledActor) {
| List taskInstanceList = new ArrayList();
| Iterator pooledTaskItr = pooledTaskInstanceList.iterator();
| while (pooledTaskItr.hasNext()) {
| TaskInstance taskInstance = (TaskInstance) pooledTaskItr.next();
| if (taskInstance.getTask().getPooledActorsExpression().equals(pooledActor)) {
| taskInstanceList.add(taskInstance);
| }
| }
| return taskInstanceList;
| }
|
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067192#4067192
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067192
More information about the jboss-user
mailing list