0 Replies Latest reply on Feb 19, 2014 2:29 PM by omar aguayo

    Variables doesnt reach script after complete human task

    omar aguayo Newbie

      Hey guys,

      I'm facing a problem, when I complete a human task through API, it continues to script node and the variables I attached to complete method are null when I use them in the script, I think is something wrong in the process diagram, the weird thing here is that all works pretty well with Rest API.

       

      EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );
      Environment env = KnowledgeBaseFactory.newEnvironment();
      env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
      env.set( EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager() );
      
      
      KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
      kbuilder.add(ResourceFactory.newClassPathResource("/changeset/nivelUno.xml"),ResourceType.CHANGE_SET);
      kbase = kbuilder.newKnowledgeBase();
      
      
      
      
      Properties propJbpm = new Properties();
      propJbpm.put("drools.processInstanceManagerFactory", "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");
      propJbpm.put("drools.processSignalManagerFactory", "org.jbpm.persistence.processinstance.JPASignalManagerFactory");
      KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(propJbpm);
      ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);
      ksessionProcess = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);
      
      
      
      
      AsyncHornetQTaskClient clientHornet = new AsyncHornetQTaskClient("cliente");
      AsyncHornetQHTWorkItemHandler HWItemHandler = new AsyncHornetQHTWorkItemHandler(ksession);
      HWItemHandler.setClient(clientHornet);
      clientHornet.connect("192.168.0.140", 5153);
      ksession.getWorkItemManager().registerWorkItemHandler("Human Task", HWItemHandler);
      

       

      With this code I can get all tasks and start new process, but the next code is the problem. (the map variable is <String, Object> with "fechaContacto" and "modoContactoId" as key with their values)

      TaskService  client = new SyncTaskServiceWrapper(sesion.getClientHornet());
        client.completeWithResults(tarea.getId(), sesion.getUsuario(), map);
      

       

      Process

      img_1.pngimg2.pngimg3.png

       

      Any Idea?

      thanks in advance.