neeraj sharma
2013-01-07 11:35:10 UTC
neeraj sharma [https://community.jboss.org/people/nsharm28] created the discussion
"How to get content of task with Reserved and Completed state in JBPM5.4"
To view the discussion, visit: https://community.jboss.org/message/788725#788725
--------------------------------------------------------------
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
[https://community.jboss.org/message/788725#788725]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
"How to get content of task with Reserved and Completed state in JBPM5.4"
To view the discussion, visit: https://community.jboss.org/message/788725#788725
--------------------------------------------------------------
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
[https://community.jboss.org/message/788725#788725]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]