<!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;">&#160;</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;">&#160;</p><blockquote class="jive-quote"><p>public class MyDialog extends EditBeanDialog implements WorkEditor{</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; Text myText;</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; public MyDialog(Shell parentShell) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; super (parentShell, "title");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; setBlockOnOpen(true);</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; protected Control createDialogArea(Composite parent) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Composite composite = (Composite) super.createDialogArea(parent);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Work work = (Work) getValue();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Label label = new Label(composite, SWT.NONE);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; label.setText("labelOne:");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; GridDataFactory.fillDefaults().applyTo(label);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; myText = new Text(composite, SWT.NONE);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; //get current value from node</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; MyDomainClass mdc = (MyDomainClass) work.getParameter("myParameter");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(mdc != null){</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Value value = mdc.getValue();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; myText.setText(value == null ? "" : value.toString());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; myText.setText("");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; GridDataFactory.fillDefaults().applyTo(myText);</p><p>&#160;&#160;&#160; }</p><p>&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160; protected Object updateValue(Object value) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Work work = new WorkImpl();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; work.setName(((Work) value).getName());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; MyDomainClass mdc = new MyDomainClass();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; mdc.setValue(myText.getText());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; work.setParameter("myParameter", mdc);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; work.setParameterDefinitions(((Work) value).getParameterDefinitions());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return work;</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public Work getWork() {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return (Work) getValue();</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public void setWork(Work work) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; setValue(work);</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public void setWorkDefinition(WorkDefinition workDefinition) {</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public boolean show() {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; int result = open();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return result == OK;</p><p>&#160;&#160;&#160; }</p><p>}</p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>WorkItemDefinition (reduced to one parameter for this code example):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><p>[</p><p>&#160; [</p><p>&#160;&#160;&#160; "name" : "MyServiceTask",</p><p>&#160;&#160;&#160; "parameters" : [</p><p>&#160;&#160;&#160;&#160;&#160; "myParameter" : new ObjectDataType("my.package.MyDomainClass"),</p><p>&#160;&#160;&#160; ],</p><p>&#160;&#160;&#160; "displayName" : "do fancy stuff",</p><p>&#160;&#160;&#160; "customEditor" : "my.package.MyDialog"</p><p>&#160; ],</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>