I am new to Bonita. I am using Engine API with spring mvc. How to I initiate new case if I am using .bar file. I can start the process and process instance, but If I want to start another process using the same bar file, is not working. Thank you for help!.
Can you give more information about the problem and the code you are using?
Thanks Carlos, I resolved that issue. Right now I am having taskinstance not found problem. It occur sometimes, other times it works. It seems to occur when I initiate executeTask method. After I execute, I can not get the next availabletask id so i can assign to a user. my app i am trying to auto assign the task after one task is completed.
The following code is what I am using to get TaskID.
public static long getFormReviewTaskPendingId(boolean action, long pID, String step) throws BonitaException, InterruptedException {
Thread.sleep(4000); //add this, but it is inconsistent. works most of the time, but fails sometime. return task is 0
long tID = 0;
ProcessAPI processAPI = TenantAPIAccessor.getProcessAPI(BonitaHelper.getSession());
SearchOptionsBuilder optionsBuilder = new SearchOptionsBuilder(STARINDEX, PAGE_SIZE);
//optionsBuilder.sort(ArchivedProcessInstancesSearchDescriptor.SOURCE_OBJECT_ID, Order.ASC);
SearchResult tasks = processAPI.searchMyAvailableHumanTasks(BonitaHelper.getSession().getUserId(), optionsBuilder.done());;
for(HumanTaskInstance t : tasks.getResult())
{
if((t.getName().matches(“(?i)”+step+“-.*”)) && (t.getParentContainerId() == pID) )
{
final long activityInstanceId = t.getId();
//processAPI.executeFlowNode(taskToExecute.getId());
tID = activityInstanceId;
break;
}
}
return tID;
}
public static void executeTask(long taskId) throws BonitaException{
ProcessAPI processAPI = TenantAPIAccessor.getProcessAPI(BonitaHelper.getSession());
HumanTaskInstance taskToExecute = processAPI.getHumanTaskInstance(taskId);
processAPI.executeFlowNode(taskToExecute.getId());
}
Thanks!