Hello, could you please consider changing the way how WorkItemHandler obtains parameters from process?
It looks like many WorkItemHandlers follow this schema currently:
- obtain parameter from Map<String, Object> and hope it's defined and has proper type
for instance https://github.com/droolsjbpm/jbpm/blob/master/jbpm-workitems/src/main/java/org/jbpm/process/workitem/email/EmailWorkItemHandler.java#L95
- write Javadoc to class so user is able to guess right parameters to pass to work item handler
When user wan't to use this work item handler, he must create WorkItem definition in his project to be able to drag and drop work item into process right ?
- fill proper parameters to work item definition
And then keep work item handler sources and WID in project "in sync".
I believe it would be useful to take inspiration from Apache Camel project and theirs component model.
Camel is routing framework which allows creating route from start, through some processors to end. Kind of like process, right ?
They model process in following way
In the source code they use annotations @UriParam and @UriPath to
- process tne component configuration smtp://firstname.lastname@example.org&subject=Nothing
- generate documentation http://camel.apache.org/mail.html
- generate so-caled camel catalog - jar containg all component definitions (~200 components) which is used for tooling like eclipse camel editor or hawtio to visualise routes and show help && documentation
See for instance source code of camel mail component - anotation for defining default value of mail sender - property from
And the default value is also in camel docs http://camel.apache.org/mail.html (CTRL+F camel@localhost)
So the Work item handler source might look like like this
It might allow you
- to have easier definition of WorkItemHandlers for users - just anotate your class with certain annotations...
- business central could automatically discover available work item handlers && provide correct, complete and up to date Data IO Mapping in BPM process modeler
- no need for users to maintain their own WorkItemDefinition
What do you think about this?
Is it something worth implementing in jBPM ?