0

I am using the Bonitasoft tool to develop a BPM project, I have a PostgreSQL database that through a JDBC connection I was able to insert and change records by Bonitasoft, however I can not select the database data and display them in my UI Designer, because A tool not yet widely used I did not find much information about it, if they have any material soon, or any idea how I can display the data in a worksheet in my UI Designer, would be very useful.

I tested the return that my Select brings me and the information matched correctly with what I need, so I added the information in an arrayList, my problem now is to display the information from that array in UI Designer

R.Santos
  • 57
  • 9

1 Answers1

2

Displaying data in Bonita BPM UI Designer forms relies on forms variables that you bind to forms widgets.
Forms variables value can be set using different options:

  • JSON (i.e. constant)
  • JavaScript expression (the returned value of script execution)
  • External API call (REST API)...

The solution to get the data from the PostgreSQL database and put them into a form variable is actually to use a REST API call. That's the only solution to bind a form with a third party system without duplicating data in Bonita BPM.

Problem is (AFAIK) that PostgreSQL doesn't provide REST API to run SQL queries.

The solution here is to deploy in Bonita BPM a REST API extension that will act as a proxy: it will offers a REST API to initialize form variables and will execute Java code and use JDBC to run queries on the PostgreSQL database.

A REST API extension to do so is available as a Bonita BPM community project. Note that this extension does not actually handle directly the connection to the database but rather goes through a Java application server connection pool using data source.

Here is a sum up of the architecture:
Form -> Widgets -> Forms variables -> REST API extension -> Data source -> Database

Such architecture can seems quite complex. A good alternative would be to use Bonita BPM business data model (BDM). BDM basically let you define your database schema in Bonita BPM Studio and will create for you the database tables and Java classes to manipulate your data in processes.
Benefits of this solution is that you have out of the box REST API to get business data values and you can use "operations" on processes tasks to update them.

Antoine Mottier
  • 1,185
  • 1
  • 8
  • 13
  • If I put the information in a variable of type List, would I be able to display it in UI Designer? Well I made it in the forms and the information was displayed correctly, but I need it done in the UI Designer really and this API REST is difficult to understand – R.Santos Jan 30 '17 at 12:15
  • Both business variables (BDM) and process variables (with Java type such as List) can be retrieve using Bonita BPM standard REST APIs. Just remember that doing so will duplicate the data in BDM or Bonita BPM database. Here is the link to the documentation about REST API to retrieve process variable: http://documentation.bonitasoft.com/?page=bpm-api#toc15 You can also take a look at this example how to retrieve process data: http://community.bonitasoft.com/project/process-variable-example – Antoine Mottier Jan 30 '17 at 12:48
  • In the example process variable example, it shows how to show what is in the process variable in an input field, you could give me an example of how to display the data from my process variable in table for example? – R.Santos Jan 30 '17 at 16:09
  • Another thing, how do I save the contents of a process variable in the postgreSQL database for example? Can I do that in the case? – R.Santos Jan 30 '17 at 18:26
  • You can configure a connector on a task (select the task and go to "Execution" tab -> "Connectors in" or "Connector out"). In the definition of the SQL query to run you can use the ${your_variable_name} syntax to inject the content of a process variable. You can use PostgreSQL connector or data source connector (for better performance thanks to connections pooling). – Antoine Mottier Jan 30 '17 at 19:22
  • @AntonieMottier Thanks for all the help so far, I'm going to take advantage and ask you one more thing, I created a Business Data Model (DBM) with the same attributes as my PostgreSQL table, is there any way to assign the value that my select returns me in that Attributes of BDM? – R.Santos Jan 31 '17 at 15:58
  • Could I please send you my Bonitasoft work to see if it's correct what I've done so far? And then show me how to display the information without a table in the UI Designer correctly – R.Santos Jan 31 '17 at 16:17
  • Feel free to share your work export as a .bos file from Bonita BPM Studio. I can take a look at it. Also for exchange like that I would recommend to use Bonitasoft community forum. – Antoine Mottier Jan 31 '17 at 19:04
  • Thanks for all the help so far, could you tell me how I can post my work .bos in Bonita BPM Studio? – R.Santos Jan 31 '17 at 19:57
  • Would you have any emails that I could send you my .BOS file so I can clear my doubts with you? I am Brazilian and it is very difficult to find some content that helps me to find the answers to my doubts – R.Santos Feb 01 '17 at 18:11
  • I would recommend to go to our community forum and post a link to your .bos file hosted on Dropbox or Google Drive. – Antoine Mottier Feb 02 '17 at 08:40
  • Link to my question in the Bonitasoft forum with the link to my file on the drive. Link: http://community.bonitasoft.com/questions-and-answers/pass-information-process-variable-attributes-my-bdm – R.Santos Feb 02 '17 at 12:15