<!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: CustormWorkItemEditor + ObjectDataType("MyDomainClass"): Always getting String instead of MyDomainClass in WorkItem
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/sebb">sebb</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/649625#649625">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 Demian,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I use my ServiceTask with my CustomWorkItemEditor to pass the parameters to the node (reduced to one parameter for this code example):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"><p>public class MyDialog extends EditBeanDialog implements WorkEditor{</p><p>    </p><p>    Text myText;</p><p>    </p><p>    public MyDialog(Shell parentShell) {</p><p>        super (parentShell, "title");</p><p>        setBlockOnOpen(true);</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    protected Control createDialogArea(Composite parent) {</p><p>        Composite composite = (Composite) super.createDialogArea(parent);</p><p>        GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);</p><p>        </p><p>        Work work = (Work) getValue();</p><p>        </p><p>           Label label = new Label(composite, SWT.NONE);</p><p>        label.setText("labelOne:");</p><p>        GridDataFactory.fillDefaults().applyTo(label);</p><p>        </p><p>        myText = new Text(composite, SWT.NONE);</p><p>        </p><p>        //get current value from node</p><p>        MyDomainClass mdc = (MyDomainClass) work.getParameter("myParameter");</p><p>        if(mdc != null){</p><p>            Value value = mdc.getValue();</p><p>            myText.setText(value == null ? "" : value.toString());</p><p>        } else {</p><p>            myText.setText("");</p><p>        }</p><p>        GridDataFactory.fillDefaults().applyTo(myText);</p><p>    }</p><p>      </p><p>    protected Object updateValue(Object value) {</p><p>        Work work = new WorkImpl();</p><p>        work.setName(((Work) value).getName());</p><p>               </p><p>        MyDomainClass mdc = new MyDomainClass();</p><p>        mdc.setValue(myText.getText());</p><p>        work.setParameter("myParameter", mdc);</p><p>        work.setParameterDefinitions(((Work) value).getParameterDefinitions());</p><p>        return work;</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    public Work getWork() {</p><p>        return (Work) getValue();</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    public void setWork(Work work) {</p><p>        setValue(work);</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    public void setWorkDefinition(WorkDefinition workDefinition) {</p><p>    }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    public boolean show() {</p><p>        int result = open();</p><p>        return result == OK;</p><p>    }</p><p>}</p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>WorkItemDefinition (reduced to one parameter for this code example):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"><p>[</p><p>  [</p><p>    "name" : "MyServiceTask",</p><p>    "parameters" : [</p><p>      "myParameter" : new ObjectDataType("my.package.MyDomainClass"),</p><p>    ],</p><p>    "displayName" : "do fancy stuff",</p><p>    "customEditor" : "my.package.MyDialog"</p><p>  ],</p><p>]</p></blockquote></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/649625#649625">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>