I’m interested about BPM and I’ve installed bonita 5 and 7 in my computer.
I’ve created my process business into bpm modeling, and now i’m in phase of developing my business process into application ( UI Designer ).
In my modeling process, i’ve created a process variable ( Java Object - java.util.List [No Coding, Just Created] ) to stored my MySQL - query ( Created using Graphical Connector In ).
I’ve tried on bonita 5 and i stored the connector into a suggestbox and it’s work but not on bonita 7, it’s pretty hard to show the process variable into UI, i did the same thing as bonita 5. I read in bonita documentation it’s needed REST API, so i tried REST API.
Thanks for your reply and the examples, you’re so kind, but it’s still not answer my question.
I’ve concern about MySQL that i stored into the process variable, then i can call those variable back into user interface for the examples ( select, check list, radio button or etc ).
Lemme give you an explanation about what i mean and include pictures :
Table that i will show in ui ( Suggest, list box, selected box )
Create a variable ( list.util )
Create Connection
Query
Graphic Select
output store to variable
create page flow
add variable into suggest box
result
It worked on bonita 6, but i don’t know how to implement on bonita 7.
You’ve said that in the example
Note: it is generally recommended to use business variables instead of process variables.
so do you have any examples to show me the way how to get the database ( MySQL ) result data into BDM until it called into user interface and it implement on select, check list, or etc.
Apologies that you didn’t think I answered your question however, now that I’ve seen what you are doing I definitely did…it’s an interpretive thing.
And it’s not mySQL you are storing in the variable, it is the mySQL Returned Data you are storing in the variable. I understand that english may not be your first language so apologies for assuming it was, it’s easy to misunderstand sometimes.
Anyway - you are close.
In Step 1 Create a variable ( list.util ) , do not create a list but create a String
In Step 3 Query change the select to something like
SELECT
CONCAT(“[”,
GROUP_CONCAT(
CONCAT(“{username:'”,username,“'”),
CONCAT(“,email:'”,email),“'}”)
)
,“]”)
AS json FROM users;
In Step 4 Graphic Select select Single Value as String
Now you can use this variable as your process data into your Select Dropdown List.
The important thing here is that nearly everything in 7 UI should be represented to the UI in JSON format.
You can see this in the process example I gave.
regards
Sean
PS if you really want to get sophisticated you can use code similar to this to do the mySQL resultset to Json
public String getJSONFromResultSet(ResultSet rs,String keyName) {
Map json = new HashMap();
List list = new ArrayList();
if(rs!=null)
{
try {
ResultSetMetaData metaData = rs.getMetaData();
while(rs.next())
{
Map columnMap = new HashMap();
for(int columnIndex=1;columnIndex<=metaData.getColumnCount();columnIndex++)
{
if(rs.getString(metaData.getColumnName(columnIndex))!=null)
columnMap.put(metaData.getColumnLabel(columnIndex), rs.getString(metaData.getColumnName(columnIndex)));
else
columnMap.put(metaData.getColumnLabel(columnIndex), "");
}
list.add(columnMap);
}
} catch (SQLException e) {
e.printStackTrace();
}
json.put(keyName, list);
}
return JSONValue.toJSONString(json);
}
i’ve tried your suggestion and short tutorial about how to store in variable.
This below is what i did :
Here is my sql result in mysql.
i created the variable
select query as json
this is what i got, it isn’t as same as your suggestion. I can’t choose single result because bonita read “,” as separator. i tried to give command separator as “,” and “;”, and it still doesn’t work too…
then i tried another code that you suggest.
here my sql query:
SELECT * FROM mst_deployment_type
groovy can’t read function “try and catch”.
so i delete “try and catch”, it’s ok, no error.
but when i tried the connection, there’s an error.
java.lang.reflect.InvocationTargetException
org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: USERNAME=install | org.bonitasoft.engine.core.connector.exception.SConnectorException: org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: org.bonitasoft.engine.connector.exception.SConnectorException: org.bonitasoft.engine.connector.ConnectorException: org.bonitasoft.engine.connector.ConnectorException: java.sql.BatchUpdateException: Can not issue SELECT via executeUpdate().
so do you have any idea how to fix it ? thanks anyway.
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.