2 Replies Latest reply on Apr 24, 2008 8:29 AM by Angel Scull

    proccess not execute  HactionHandler

    Angel Scull Newbie

      Hi

      I'm have a procces like this:

      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="Flujo">


      <start-state name="start-state1">

      </start-state>


      <task-node name="crear_tarea" signal="first-wait" create-tasks="false" >





      </task-node>






      <task-node name="tomar_fotos" signal="first-wait" create-tasks="false" >





      </task-node>

      <task-node name="redactar_tarea" signal="first-wait" create-tasks="false" >






      </task-node>

      continue *******

      I create N task in taskNode(crear_tarea) and work fine, after that when I finish one of my task the proccess make one task in (crear_tarea) and (tomar_fotos), this work fine , but when I finish another of my task in (crear_tarea) node, the proccess the process not create the taskInstance of (crear_tarea) and (tomar_fotos), and not make a new taskInstance.

      I call that method for do that:

      public String asignar() {

      WorkflowUtil util = new WorkflowUtil();
      JbpmContext context = util.getContexto();
      guardar();
      try{

      System.out.println("Id de la tarea a terminar: " + this.tareaId);

      TaskInstance t_instance = context.getTaskInstance(this.tareaId);

      System.out.println("instance :"+t_instance.getCreate());

      t_instance.getContextInstance().setTransientVariable("ids_periodistas", new String[]{"10117", "10308"});
      t_instance.getContextInstance().setTransientVariable("id_fotografo", "2");
      // seleccionar el id del texto en la tabla tb_texto y ponerlo en las variables temporales

      Long id_texto = new Long(this.getTexto().getId_texto());
      System.out.println("id texto a enviar :");
      //para el fotografo..
      t_instance.getContextInstance().setTransientVariable(WorkflowUtil.T_ID_TEXTO, id_texto);
      t_instance.getContextInstance().setTransientVariable(WorkflowUtil.T_FECHA_LIM, t_instance.getDueDate());
      //para el periodista...
      t_instance.getContextInstance().setTransientVariable(WorkflowUtil.T_ID_TEXTOP, id_texto);
      t_instance.getContextInstance().setTransientVariable(WorkflowUtil.T_FECHA_LIMP, t_instance.getDueDate());

      t_instance.end();
      context.save(t_instance.getToken().getProcessInstance());

      } catch (Exception e) {
      e.getCause();
      } finally {
      context.close();
      }
      return "to_view";
      }

      and the one of my action handlers ActionHandler execute method ist that:
      public void execute(ExecutionContext executionContext) throws Exception {

      TaskMgmtInstance tskMgtInstance = executionContext.getTaskMgmtInstance();
      TaskMgmtDefinition tmd = (TaskMgmtDefinition)executionContext.getDefinition(TaskMgmtDefinition.class);

      Task task = tmd.getTask("toma_fotos");
      TaskInstance t_intance = tskMgtInstance.createTaskInstance(task,executionContext.getToken());
      t_intance.setVariableLocally(WorkflowUtil.T_ID_TEXTO,executionContext.getContextInstance().getTransientVariable(WorkflowUtil.T_ID_TEXTO));

      String fecha = executionContext.getContextInstance().getTransientVariable(WorkflowUtil.T_FECHA_LIM).toString();
      DateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd");

      t_intance.setDueDate(dFormat.parse(fecha.substring(0,fecha.indexOf(" "))));
      t_intance.setActorId(String.valueOf(executionContext.getContextInstance().getTransientVariable("id_fotografo")));

      t_intance.start();

      executionContext.getContextInstance().deleteTransientVariable(WorkflowUtil.T_ID_TEXTO);
      executionContext.getContextInstance().deleteTransientVariable("id_fotografo");
      executionContext.getJbpmContext().save(t_intance);


      }

      I see already 9 post abaut this problem , but never found the solution.

      What can I do for resolve that problem.

      Tnks for any help…