JBoss Community

Re: How to use Content of Human Task

created by Esteban Aliverti in jBPM - View the full discussion

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,

Reply to this message by going to Community

Start a new discussion in jBPM at Community