[jboss-user] [JBoss jBPM] - Re: how to retrieve task instance/process instances in a spe
yxyang
do-not-reply at jboss.com
Sun Aug 13 06:22:08 EDT 2006
Is the following code the correct way to retrieve the taskinstances for the specific tasknode name and task name?
| private java.util.List getTaskInstance(String tasknodename, String taskname) throws Exception {
| log.debug("getTaskInstance() is called");
| log.debug("" + ctx.getCallerPrincipal().getName());
| JbpmConfiguration config = null;
| JbpmContext jbpmContext = null;
| java.util.List list = null;
| java.util.List list2 = new ArrayList();
| try {
| InitialContext ic = new InitialContext();
| config = (JbpmConfiguration) ic
| .lookup("java:/jbpm/JbpmConfiguration");
| jbpmContext = config.createJbpmContext();
| list = jbpmContext.getTaskMgmtSession().findPooledTaskInstances(ctx.getCallerPrincipal().getName());
| for(Iterator iter=list.iterator();iter.hasNext();){
| TaskInstance taskinstance =(TaskInstance) iter.next();
| Task task = taskinstance.getTask();
| if(task.getName()!=null &&task.getName().equals(taskname) && task.getTaskNode().getName().equals(tasknodename)){
| list2.add(taskinstance);
| }
| }
| log.debug("return task instance set size ="+list2.size());
| } finally {
| if (jbpmContext != null)
| jbpmContext.close();
| }
| return list2;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964829#3964829
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964829
More information about the jboss-user
mailing list