How to access initialized BDM variables in Bonita BPM from java code using Bonita Engine API.

Need to access initialized BDM variables in Bonita 7.3.0 BPM from my java code using Engine API.

Following is the code that I have implemented:

loginAPI = TenantAPIAccessor.getLoginAPI(); session = loginAPI.login("walter.bates", "bpm"); processAPI = TenantAPIAccessor.getProcessAPI(session); List processes = processAPI.getProcessInstances(0, 20, ProcessInstanceCriterion.STATE_ASC); for(ProcessInstance p : processes) { if(p.getName().equalsIgnoreCase("My Task")) { processId = p.getId(); } } Map context = processAPI.getProcessInstanceExecutionContext(processId); SimpleBusinessDataReferenceImpl procOrderStorageId = (SimpleBusinessDataReferenceImpl) context.get("procedureOrderMaster_ref"); //procedureOrderMaster is a BDM variable created in bonita BusinessObjectDAOFactory daoFactory = new BusinessObjectDAOFactory(); MasterProcedureOrderDAO procedureOrderDao = daoFactory.createDAO(session, MasterProcedureOrderDAO.class); MasterProcedureOrder procedureOrder = procedureOrderDao.findByPersistenceId(procOrderStorageId.getStorageId()); System.out.println("Procedure Order Id: "+procedureOrder.getProcId()+" Status: "+procedureOrder.getStatus());

Also added bonita-client-pojo.jar file.

Encountering ClassNotFoundException :

org.bonitasoft.engine.bdm.BusinessObjectDaoCreationException: java.lang.ClassNotFoundException: com.company.clinivantage.MasterProcedureOrderDAOImpl
at org.bonitasoft.engine.bdm.BusinessObjectDAOFactory.createDAO(BusinessObjectDAOFactory.java:55)

at spark.template.handlebars.HandlebarsTest.main(HandlebarsTest.java:79)
Caused by: java.lang.ClassNotFoundException: com.company.clinivantage.MasterProcedureOrderDAOImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.bonitasoft.engine.bdm.BusinessObjectDAOFactory.loadClass(BusinessObjectDAOFactory.java:89)
at org.bonitasoft.engine.bdm.BusinessObjectDAOFactory.createDAO(BusinessObjectDAOFactory.java:53)
… 1 more

As this is an external program rather than an internal Connector I suspect you have to include the necessary class file into your programs build directory.

regards
Seán

PS: If this reply answers your question, please mark as resolved.

A Tip on displaying CODE/LOGS correctly in Posts:

Do not use the Supplied Buttons above, for some reason they refuse to work correctly, and despite bringing it to Bonitasofts attention, it’s low priority.

To Show Code/Logs correctly use

< code >
your code/log
< /code >

removing the spaces to allow the showing of code/logs correctly as here:

your code/log

You should still be able to edit your post to ensure the correct formatting of the code to help us understand it easier.

Thanks and regards
Seán