JBoss Community

How to get content of task with Reserved and Completed state in JBPM5.4

created by neeraj sharma in jBPM Development - View the full discussion

Hi,

 

Currently I am reteriving the task content using following methods

 

 

-Following method reterives content of task which are in 'Completed' status

 

public Object getContent(long taskId)

    {

   

              Task task = taskService.getTask(taskId);

                    TaskData taskData = task.getTaskData();

                    Content content =taskService.getContent(taskData.getDocumentContentId());

              ByteArrayInputStream bais = new ByteArrayInputStream(content.getContent());

                    ObjectInputStream ois;

                    Object taskinfo = null;

                    try {

                        ois = new ObjectInputStream(bais);

                        taskinfo = ois.readObject();

                    } catch (Exception e) {

                        e.printStackTrace();

                    }

                              return taskinfo;     

              }

 

-Following method reterives content of task which are in 'Reserved' status

 

public Object getContentNew(long taskId) {

         Task task= taskService.getTask(taskId);

         Object  input=null;

              long contentId = task.getTaskData().getDocumentContentId();

        if (contentId != -1) {

                  Content content   = taskService.getContent(contentId);

                  input = ContentMarshallerHelper.unmarshall(content.getContent(), null);

        }

        System.out.println(input);

        return input;

    }

 

 

Is there any single method or way to reterive the content of task for both Completed and Reserved status??

Reply to this message by going to Community

Start a new discussion in jBPM Development at Community