Hello

I am trying to create a Task instances list with the pendings tasks for an 
actor. I am not doing it from a JSF, so I think that I can't use 
TaskIntanceList or TaskInstaceListFoType components.

Following DVD Store example, I think that I must use ManagedJbpmContext.

This is the process definition:


  | ...
  | <start-state name="Inicio">
  |       <transition name="peticion" to="Peticion"></transition>
  |    </start-state>
  |    
  |    <task-node name="Peticion">
  |       <task name="evaluarPeticion">
  |          <assignment actor-id="#{asignarTarea.getBibliotecario}"/>
  |       </task>
  |       
  |       <transition name="aceptar" to="Pedido"></transition>
  |       <transition name="cancelar" to="Eliminado"></transition>
  |    </task-node>
  | ...
  | 

I would like to get a tasks list for type "evaluarPeticion" from a bean method.


At this momments, it is working with this code:


  | @SuppressWarnings("unchecked")
  | public void test() {
  |     AsignarTarea bibliotecario = new AsignarTarea();
  | 
  |     // JBPM Context
  |     JbpmContext context = ManagedJbpmContext.instance();
  | 
  |     // Taks for an actor
  |     TaskMgmtSession tms = context.getTaskMgmtSession();
  | 
  |     List<TaskInstance> taskInstances = (List<TaskInstance>) tms
  |                     .findTaskInstances(bibliotecario.getBibliotecario());
  | 
  |     // Task filter
  |     for (Iterator<TaskInstance> itr=taskInstances.iterator(); 
itr.hasNext();) {
  |             TaskInstance taskInstance = itr.next();
  |             
  |             if (taskInstance.getName().equals("evaluarPeticion"))
  |                     
System.out.println(taskInstance.getVariable("idPeticion"));
  |     }
  |             
  | }
  | 

With this method I get all the information I am looking for and it is working 
fine, but I think that this is not the best way to do it.

Looking at the DVD Store demo, it uses the context.getSession to create a query 
and access to the information. Can I do somethig like that to get a task 
instances list for an actor and for a type without manually iterate all the 
task instances?

If I use context.getSession, I dont know how to implement a query to retrieve a 
task list.

Thanks.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993298#3993298

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993298
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to