How to complete a task in Bonita Using Bonita Java API

Hi,
How to mark a task as completed if we know the task Id using bonita java API.

I know How to get task Id.

settings.put(“server.url”, server_url);
settings.put(“application.name”, “bonita”);
APITypeManager.setAPITypeAndParams(ApiAccessType.HTTP, settings);
// get the LoginAPI using the TenantAPIAccessor
loginAPI = TenantAPIAccessor.getLoginAPI();
// log in to the tenant to create a session
System.out.println(“Logging in to BPM Engine …”);
apiSession = loginAPI.login(bpm_user_name, bpm_user_password);
System.out.println(“MarkATaskAsComplete …”);
UserAPI uapi = TenantAPIAccessor.getIdentityAPI(apiSession);
processAPI = TenantAPIAccessor.getProcessAPI(apiSession);
final SearchOptionsBuilder searchOptionsBuilder2 = new SearchOptionsBuilder( 0, 1);

	searchOptionsBuilder2.filter(HumanTaskInstanceSearchDescriptor.PROCESS_INSTANCE_ID,SearchOptionsBuilder2.filter(
			HumanTaskInstanceSearchDescriptor.NAME, taskName);
	final HumanTaskInstance userTask = processAPI
			.searchHumanTaskInstances(searchOptionsBuilder2.done())
			.getResult().get(0);

From UserTask I can get TaskID.

Then how to complete this task using java api.

Any help is greatly appreciated.

Thanks & Regards

Rajesh Kohir

Yes you can use executeFlowNode it should do the same as executUserTask with an empty input map.

Hi guys can I use

processAPI.executeFlowNode(u.getId(),userTask.getId());

To make it completed and move to next task.Please let me know your opinion.