<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: How to properly use ContentMarshallerHelper for Human Task Output in JBPM5.3?
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/jiang_hoo">星兰 蒋</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/779860#779860">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi Thomas, I'm sorry i thought you were in Beijing.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In my case,in fact i want to get the vars's value when i get a task by userid. And these values are passed when i start a processinstance.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>i set &amp; get values all in myself application. no using the jbpm console.&#160; Also no using marshall and unmarshall.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Set values when start process:</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Map&lt;String,Object&gt; params = new HashMap&lt;String,Object&gt;();<br/>&#160;&#160; params.put("sales", c.getCreateby());<br/>&#160;&#160; params.put("contractno", c.getContractno());<br/>&#160;&#160; params.put("details", c.getDetails());<br/>&#160;&#160; params.put("amount", c.getAmount());<br/>&#160;&#160; params.put(role.getRole(), leader.getName());<br/>&#160;&#160; params.put("accoptor", list.get(0).getName());<br/>&#160;&#160; </p><p>getSession().startProcess(definitionId, processVars);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Get values when get a task by userid:</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>List&lt;TaskSummary&gt; t = sTaskService.getTasksAssignedAsTaskInitiator(idRef, "en-UK");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160; if(null != t &amp;&amp; t.size() &gt; 0){<br/>&#160;&#160;&#160; <br/>&#160;&#160;&#160; for(TaskSummary ts : t){<br/>&#160;&#160;&#160;&#160; Object obj = getTaskContentInput(ts);<br/>&#160;&#160;&#160;&#160; Map&lt;?, ?&gt; map = (Map&lt;?, ?&gt;) obj;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160; for (Map.Entry&lt;?, ?&gt; entry : map.entrySet()) {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160;&#160; System.out.println(entry.getKey() + " = " + entry.getValue());&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160; tasks.add(new TaskRef(ts.getId(), ts.getProcessInstanceId() + "", ts.getProcessId(), <br/>&#160;&#160;&#160;&#160;&#160;&#160; ts.getName(), ts.getCreatedBy().getId(), ts.getStatus() == Status.Suspended, ts.getStatus() != Status.Suspended));<br/>&#160;&#160;&#160; }<br/>&#160;&#160;&#160; <br/>&#160;&#160; }</p><div class="mcePaste" id="_mcePaste" style="position: absolute; top: 0px; left: 0px;"></div><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>And the getTaskContentInput method as blow:</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public Object getTaskContentInput(TaskSummary taskSum) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BlockingGetTaskResponseHandler handlerT = new BlockingGetTaskResponseHandler();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; client.getTask(taskSum.getId(), handlerT);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Task task2 = handlerT.getTask();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TaskData taskData = task2.getTaskData();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BlockingGetContentResponseHandler handlerC = new BlockingGetContentResponseHandler();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; client.getContent(taskData.getDocumentContentId(), handlerC);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Content content = handlerC.getContent();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ByteArrayInputStream bais = new ByteArrayInputStream(</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; content.getContent());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ObjectInputStream is = new ObjectInputStream(bais);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Object obj = null;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; while ((obj = is.readObject()) != null) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("OBJECT: " + obj);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return obj;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (Exception e) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.err.print("There was an error reading task input...");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return null;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return null;</p><p> }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Is My way right or wrong? Would you pls give some advice?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks and Best Regards!</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/779860#779860">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>