3 Replies Latest reply on Feb 29, 2012 1:23 AM by devilkazuya99

    How to use Content of Human Task

    devilkazuya99

      In Human Task,

      Content: The data associated with this task.

       

      So, how to use it? Any example? API? Documentation?

      Could it be readable from TaskSummary?

       

      Thanks.

        • 1. Re: How to use Content of Human Task
          eaa

          In the process definition you have to map the "Content" input from a process variable or a hardcoded value.

          The content is not present in the TaskSummary object. In your client application, you have to explicitly ask for the content:

           

                  public Object getTaskContentInput(TaskSummary taskSum) {

                          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());

                          try {

                                  ObjectInputStream is = new ObjectInputStream(bais);

                                  Object obj = null;

           

           

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

                                          System.out.println("OBJECT: " + obj);

                                          return obj;

                                  }

                          } catch (Exception e) {

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

                                  e.printStackTrace();             

                                  return null;

                          }

                          return null;

                  }

           

           

          Best Regards,

          • 2. Re: How to use Content of Human Task
            calca

            Adding to Esteban's response.

             

            If you need more than one variable in your task, you can avoid using Content variable, and use the variables mappings of the task node.

             

            When you execute the code Esteban posted, you will receive a map with these variables.

             

            Regards,

             

            Demian

            1 of 1 people found this helpful
            • 3. Re: How to use Content of Human Task
              devilkazuya99

              Thank you guys for your reply. I know about variables mappings, just that I don't want to leave the Content there without knowing what it can do.