-
1. Re: Adding new workitems programmatically, without repacking the application ?
salaboy21 Feb 16, 2012 7:50 AM (in response to arunvg)If you are not planning to use eclipse or the web designer, you can write your WorkItem definitions in the language that you want. Your tool will need to understand that language.
And yes you can register the workitems doing:
ksession.getWorkItemManager().registerWorkItem("name", implementation);
Cheers
-
2. Re: Adding new workitems programmatically, without repacking the application ?
arunvg Feb 16, 2012 8:11 AM (in response to arunvg)Thanks for the very quick reply.
Hope you are pointing to the registerWorkItemHandler(String workItemName, WorkItemHandler handler); I am using this to register the handler.
Does it mean that the workdefinitions like below has no meaning in the core engine part and is used only by the editor.
import org.drools.process.core.datatype.impl.type.StringDataType;
[
// the Notification work item
[
"name" : "Notification",
"parameters" : [
"Message" : new StringDataType(),
"From" : new StringDataType(),
"To" : new StringDataType(),
"Priority" : new StringDataType(),
],
"displayName" : "Notification",
"icon" : "icons/notification.gif"
]
]
Cheers
-
3. Re: Adding new workitems programmatically, without repacking the application ?
salaboy21 Feb 16, 2012 8:14 AM (in response to arunvg)1 of 1 people found this helpfulExactly!
You are right with the method name.. I didn't have the code infront of me.. but you find it
-
4. Re: Adding new workitems programmatically, without repacking the application ?
arunvg Feb 16, 2012 10:52 PM (in response to salaboy21)Thank you for the reply ..
I could register the workitemhandler and the confusion was about the work item definition.
So Let me confirm what I understood about the work definition.
A work definition for example ,
import org.drools.process.core.datatype.impl.type.StringDataType;
[
// the Notification work item
[
"name" : "Notification",
"parameters" : [
"Message" : new StringDataType(),
"From" : new StringDataType(),
"To" : new StringDataType(),
"Priority" : new StringDataType(),
],
"displayName" : "Notification",
"icon" : "icons/notification.gif"
]
]
Is just a template used by the editor to show the properties of a domain specific task. Internally workdefintion is used to map the parameters, results to the BPMN format. As BPMN format is used by the processing engine, It doesn't want a reference to the work definition .
Am I right ?
Cheers
-
5. Re: Adding new workitems programmatically, without repacking the application ?
salaboy21 Feb 17, 2012 7:58 AM (in response to arunvg)Once again yes.. you are right!
If you take a look at my examples in my github account you will see that none of them defines those templates, because the engine doesn't care. Those definitions are right now only used by Eclipse and the Web Designer.
Cheers
-
6. Re: Adding new workitems programmatically, without repacking the application ?
arunvg Feb 19, 2012 10:56 PM (in response to salaboy21)Thank you Mauricio.
Cheers
-
7. Re: Adding new workitems programmatically, without repacking the application ?
hoang_to Jun 17, 2013 5:56 AM (in response to arunvg)import org.drools.process.core.datatype.impl.type.StringDataType;
[
// the Notification work item
[
"name" : "Notification",
"parameters" : [
"Message" : new StringDataType(),
"From" : new StringDataType(),
"To" : new StringDataType(),
"Priority" : new StringDataType(),
],
"displayName" : "Notification",
"icon" : "icons/notification.gif"
]
]
The engine has no interests on item definitions, but the info that you passed to item definitions is available in BPMN (generated by web-based/ide-based editors). As far as i see, the key used to register WorkItemHandler must identical to the value in "name" field. In other words, to link ServiceTask named "Notification" with a NotificationWorkItemHandler via programatical registration, we have to use the code
WorkItemHandler notificationHandler = ....
ksession.getWorkItemManager().registerWorkItemHandler("Notification", notificationHandler);