JBoss Community

Re: jbpm5 RULEFLOW VARIABLE CHANGED null

created by Luis Tamayo in jBPM - View the full discussion

Thanks, I change to ksession.getWorkItemManager().registerWorkItemHandler("Notification", new EmailWorkItemHandler()); and then works.

 

Now I am facing another problem, I need to get information of Person in HumanTask 2, I am using this code:

 

public Object getTaskContentInput(TaskSummary taskSum) {

                    System.out.println( "======>Entra a ver getTaskContentInput" );

                    try {

                              BlockingGetTaskResponseHandler handlerT = new BlockingGetTaskResponseHandler();

                              client.getTask(taskSum.getId(), handlerT);

                              Task task2 = handlerT.getTask();

                              TaskData taskData = task2.getTaskData();

                              BlockingGetContentResponseHandler handlerC = new BlockingGetContentResponseHandler();

                              client.getContent(taskData.getDocumentContentId(), handlerC);

                              Content content = handlerC.getContent();

                                    

                              ByteArrayInputStream bais = new ByteArrayInputStream(

                                        content.getContent());

 

                              ObjectInputStream is = new ObjectInputStream(bais);

                              Object obj = null;

 

                              while ( (obj = is.readObject()) != null ) {

                                        return obj;

                              }

 

                    } catch (Exception e) {

                              System.err.print("There was an error reading task input...");

                              e.printStackTrace();

 

                    }

                    return null;

          }

 

 

          public String imprimirTareasConsola( ){

                    HumanTaskClientMina htk = new HumanTaskClientMina();

                    User u= new User("operator");

                    System.out.println( "======>Operador" );

                    List<TaskSummary> t = htk.getAssignedTasks( u );

                    if( t!= null && t.size() >0  ){

                              Object xx= htk.getTaskContentInput(t.get( 0 ));

 

                              if(  xx != null ){

                                        System.out.println( "===> Class name en content:   " + xx.getClass().getName());

                                        if( xx instanceof Persona ){

                                                  System.out.println( "==00> Id en content type " + ((Persona)xx).getId() );

                                        } else if( xx instanceof String ){

                                                  System.out.println( "==00> name type " + (String)xx);

                                        }

                                        System.out.println( "===> cerrando Class name en content:   "  );

                              } else {

                                        System.out.println( "==> El content es null "  );

                              }

          }

 

                    return null;

          }

 

Always the object returned is String, do you have any ideas how can I get the object modified in previus task.

Reply to this message by going to Community

Start a new discussion in jBPM at Community