Paul Borlin [
https://community.jboss.org/people/borlinp] created the discussion
"WorkItemHandler not honoring data type"
To view the discussion, visit:
https://community.jboss.org/message/736307#736307
--------------------------------------------------------------
Hi,
I am in the process of upgrading from Drools 5.0 rule flows to jBPM 5.3 BPMN processes.
All is going well for the most part, but I ran into an odd snag. I have 25+
WorkItemHandler's defined. Several of them use IntegerDataType's for input
parameters. Now, in jBPM 5.3, all parameters seem to be passed to the hander as String,
regardless if it's defined as a type other than StringDataType().
For example, let me share one definition that is causing me fits:
[
"name" : "SFTPget",
"parameters" : [
"Host Name" : new StringDataType(),
"User Name" : new StringDataType(),
"Password" : new StringDataType(),
"File Location" : new StringDataType(),
"File Name" : new StringDataType(),
"Target Directory" : new StringDataType(),
"Delete Original" : new StringDataType(),
"Log Level" : new StringDataType(),
"Date Format" : new StringDataType(),
"Date Format to lowercase" : new StringDataType(),
"Date Format Offset" : new IntegerDataType(),
"Reply Timeout": new IntegerDataType()
],
"displayName" : "sFTP Get",
"icon" : "icons/computer_world.gif"
]
In the WorkItemHandler, I have the following code that worked prior to upgrading, but now
throws ClassCastException:
Integer dateOffset = (Integer) ((workItem.getParameter("Date Format Offset") ==
null)? 0: workItem.getParameter("Date Format Offset"));
The object returned by workItem.getParameter("Date Format Offset") is a String.
My questions would be as follows:
1. Is this just the way jBPM 5.3 works, and am I to manually cast all parameters from
String to the desired type?
2. If #1 is no, then is this a bug or something I need to change in my code?
Thanks for the help/tips!
-Paul
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/736307#736307]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]