Discussion:
[jboss-user] [jBPM] - How to get content of task with Reserved and Completed state in JBPM5.4
neeraj sharma
2013-01-07 11:35:10 UTC
Permalink
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]
neeraj sharma
2013-01-10 05:55:07 UTC
Permalink
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/789990#789990

--------------------------------------------------------------
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/789990#789990]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-01-10 10:37:35 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/790052#790052

--------------------------------------------------------------
you should use the second approach with ConetentMarshallerHelper as retrieving content does not depend on the task status.

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/790052#790052]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...