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