Problem accessing Mapped Input Parameter in domain specific work item handler.
krujos Jan 12, 2012 12:35 PMHello,
I'm having an isue accessing a mapped input parameter from my work item handler. I'm using jbpm 5.2. Reading the documentation & examples this seems like it should be straight forward, but I must have missed a step somewhere. Could someone please provide a pointer as to where I've gone wrong?
My .wid looks like this:
{code}
import org.drools.process.core.datatype.impl.type.StringDataType;
[
[
"name" : "MyWorkItem",
"parameters" : [
"Text" : new StringDataType(),
"OptionXML" : new StringDataType(),
],
"displayName" : "MyWorkItem",
]
]
{code}
The relevant bpmn looks like this:
{code:xml}
...
...
<property id="boolResult" itemSubjectRef="_boolResultItem"/>
...
<startEvent id="StartEvent_1" name="Start" />
<task id="_3" name="This is a single select." tns:taskName="MyWorkItem" >
<ioSpecification>
<dataInput id="_3_boolResultInput" name="boolResult" />
<dataInput id="_3_OptionXMLInput" name="OptionXML" />
<dataInput id="_3_TextInput" name="Text" />
<dataOutput id="_3_singleResultOutput" name="singleResult" />
<inputSet>
<dataInputRefs>_3_boolResultInput</dataInputRefs>
<dataInputRefs>_3_OptionXMLInput</dataInputRefs>
<dataInputRefs>_3_TextInput</dataInputRefs>
</inputSet>
<outputSet>
<dataOutputRefs>_3_singleResultOutput</dataOutputRefs>
</outputSet>
</ioSpecification>
<dataInputAssociation>
<sourceRef>boolResult</sourceRef>
<targetRef>_3_boolResultInput</targetRef>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>_3_OptionXMLInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression"><xml>foo</questions></from>
<to xsi:type="tFormalExpression">_3_OptionXMLInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>_3_TextInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression">This is my text</from>
<to xsi:type="tFormalExpression">_3_TextInput</to>
</assignment>
</dataInputAssociation>
<dataOutputAssociation>
<sourceRef>_3_singleResultOutput</sourceRef>
<targetRef>singleResult</targetRef>
</dataOutputAssociation>
</task>
{code}
When I try to access the mapped parameter boolResult from my workitem handler I do the following:
{code}
public final void executeWorkItem(WorkItem wi, WorkItemManager wim) {
logger.info("Loading workitem: " + wi.getId());
for (String key : wi.getParameters().keySet()) {
logger.info("Parameter: " + key);
}
logger.info("boolResult = " + wi.getParameter("boolResult"));
{code}
In my log I see the values of OptionXML and Text in the parameters hash, but boolResult is not in the hash. Is my expectation that mapped parameters should show up in the work item's parametrs correct? Does anyone see an error?
Thanks!
Josh