-
1. Re: How to use WorkItemHandler on Kie-workbench?
salaboy21 Feb 19, 2015 3:06 PM (in response to catherinesjy)Hi Catherine, can you please elaborate on what problems are you having?
-
2. Re: How to use WorkItemHandler on Kie-workbench?
catherinesjy Feb 19, 2015 4:04 PM (in response to salaboy21)Hi Mauricio,
I am fine using WorkItemHandler in eclipse plugin. But comes to kie-wb, I totally lost. I cannot find where to add a custom WorkItemHandler and how to use it. It seems to be a totally different story using WorkItemHandler in Kie-wb comparing to in eclipse.
So I just need some basic examples, instructions, or some other things can help me starting.
Thanks!
Looking forward to your further help.
Best,
Catherine
-
3. Re: How to use WorkItemHandler on Kie-workbench?
abhijithumbe Feb 19, 2015 10:05 PM (in response to catherinesjy)1 of 1 people found this helpfulHi,
There are several approaches to register workithemhander in jbpm 6.1
1.
Create a drools.session.conf with this content, and place it in jbpm-console.war/WEB-INF/classes/META-INF.
drools.workItemHandlers = CustomWorkItemHandlers.conf
Define a WorkItemHandler mapping in CustomWorkItemHandlers.conf file, and place it in the same directory jbpm-console.war/WEB-INF/classes/META-INF.
[
"Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),
"Email": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),
"MyCustomWorkItem": new com.sample.MyCustomWorkItemHandler()
]Add jar with handler class under business-central.war/WEB-INF/lib or classes.
2.
Add jar with handler class under business-central.war/WEB-INF/lib or classes.
Register WorkItem handler in kmodule.xml of your project, like this:
<workItemHandler name="Sysout" type="new com.sample.MyCustomWorkItemHandler()"/>
you can upload jar into 'Artifact Repository' and then add this artifact as a project dependency. jBPM 6.2 onwards we can use kie-wb-deployment-descriptor.xml as well to register workithemhandler.
-
4. Re: How to use WorkItemHandler on Kie-workbench?
catherinesjy Feb 26, 2015 5:52 PM (in response to abhijithumbe)Hi Abhijit,
Thank you very much for your advice! I followed your steps in approach 1. However, I cannot find any change on the business process panel on jbpm-console (Fig.1). Could you please tell me where I can find the workitemhandler items I just created? So that I am able to drag them onto the process flow.
Fig.1 Business process panel on jbpm-console.
Looking forward to your further help!
Best,
Catherine
-
5. Re: How to use WorkItemHandler on Kie-workbench?
abhijithumbe Feb 26, 2015 8:12 PM (in response to catherinesjy)Hi,
To create new workItem refer these steps:
- In the 'Project Explorer' panel, select your project.
- In the menu, click 'New Item' -> 'Work Item Definition'.
- In the dialogue box provide work item definition name.
- New tab with the work item definition template opens up in the Work Item editor , edit the source of the MVEL work item definition as per your requirement, it will look like as:
import org.drools.core.process.core.datatype.impl.type.StringDataType;
import org.drools.core.process.core.datatype.impl.type.ObjectDataType;
[
[
"name" : "MyTask",
"parameters" : [
"MyFirstParam" : new StringDataType(),
"MySecondParam" : new StringDataType(),
"MyThirdParam" : new ObjectDataType()
],
"results" : [
"Result" : new ObjectDataType("java.util.Map")
],
"displayName" : "My Task",
"icon" : ""
]
]
Rather then creating new work item definition(*.wid) you can modify existing work Item Definition(WorkDefinitions.wid) as well.To set icon for Work item go to 'New Item' -> ' Uploaded file' menu and then referencing this icon by filename in the WorkItemDefinition file.But it may not work with jbpm 6.1 release because of existing bug which may be fixed in 6.2 release, in this case we have to push icon into repository using 'git' command.
git clone ssh://username@localhost:8001/repository_name
cd repository_name/project_name/global
cp ~/path/to/icon/icon.png .
git add icon.png
git commit -m "icon"
git push