Import in JBPM Script Task

1,540 views
Skip to first unread message

Saad Meraj

unread,
Apr 27, 2015, 8:04:35 AM4/27/15
to jbpm-...@googlegroups.com, tasmiya...@techlogix.com
I have created a new jBPM process and calling a rest service which consumes json intput.

The data is present in the process variables of the process i just need to transform it into Json string.  In my view the best approach would be to use the script task to do the transformation but i am unable to import the java classes in it  (want to do something like below)  Help!!

import org.json.simple.JSONObject;
      JSONObject obj = new JSONObject();
      obj.put("name", "foo");
      obj.put("num", new Integer(100));
      obj.put("balance", new Double(1000.21));
      obj.put("is_vip", new Boolean(true));
      System.out.print(obj);

Maciej Swiderski

unread,
Apr 27, 2015, 8:28:17 AM4/27/15
to Saad Meraj, jbpm-...@googlegroups.com, tasmiya...@techlogix.com
on process level in web designer when you open properties panel (right hand side) you will find imports section where you can add any java like imports that will be propagated into script tasks.

Maciej
--
You received this message because you are subscribed to the Google Groups "jBPM Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-usage+...@googlegroups.com.
To post to this group, send email to jbpm-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-usage/6843f2b4-24ab-44c1-af40-214a6b10f4c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tasmiyah Iqbal

unread,
Apr 28, 2015, 1:28:11 AM4/28/15
to jbpm-...@googlegroups.com, saad...@gmail.com

Maciej,

 

You probably mean this section below. I need to add org.json class in here so that it can be propagated in my scripts on Task level. Can you pin point where I might add this class? org.json is contained in my WAR file on the following path jbpm-console.war\WEB-INF\lib\json-20090211.jar



Maciej Swiderski

unread,
Apr 28, 2015, 5:17:39 AM4/28/15
to Tasmiyah Iqbal, jbpm-...@googlegroups.com, saad...@gmail.com
Just type it into ‘Custom Class Name’ and you should be fine

Maciej

Tasmiyah Iqbal

unread,
Apr 28, 2015, 8:27:08 AM4/28/15
to jbpm-...@googlegroups.com, tasmiy...@gmail.com, saad...@gmail.com
Great, thanks. We were able to make it work by writing org.json.JSONObject in the 'custom class name' box.

Daniel Bastidas

unread,
Jun 7, 2016, 9:52:30 AM6/7/16
to jBPM Usage, tasmiy...@gmail.com, saad...@gmail.com
Hello,

On jbpm version 5.5 there are import but when I try to execute the same code my error is 

Process Compilation error JSONParser cannot be resolved to a type JSONParser cannot be resolved to a type JSONObject cannot be resolved to a type JSONObject cannot be resolved to a type


Can you help me please?


Reply all
Reply to author
Forward
0 new messages