use of org.apache.camel.component.bonita.api.model.ProcessDefinitionResponse in project camel by apache.
the class BonitaStartProducer method process.
public void process(Exchange exchange) throws Exception {
// Setup access type (HTTP on local host)
String hostname = this.configuration.getHostname();
String port = this.configuration.getPort();
String processName = this.configuration.getProcessName();
String username = this.configuration.getUsername();
String password = this.configuration.getPassword();
BonitaAPIConfig bonitaAPIConfig = new BonitaAPIConfig(hostname, port, username, password);
BonitaAPI bonitaApi = BonitaAPIBuilder.build(bonitaAPIConfig);
ProcessDefinitionResponse processDefinition = bonitaApi.getProcessDefinition(processName);
bonitaApi.startCase(processDefinition, exchange.getIn().getBody(Map.class));
}
use of org.apache.camel.component.bonita.api.model.ProcessDefinitionResponse in project camel by apache.
the class BonitaAPI method getProcessDefinition.
public ProcessDefinitionResponse getProcessDefinition(String processName) {
if (ObjectHelper.isEmpty(processName)) {
throw new IllegalArgumentException("processName is empty.");
}
WebTarget resource = getBaseResource().path("process").queryParam("s", processName);
List<ProcessDefinitionResponse> listProcess = resource.request().accept(MediaType.APPLICATION_JSON).get(new GenericType<List<ProcessDefinitionResponse>>() {
});
if (listProcess.size() > 0) {
return listProcess.get(0);
} else {
throw new RuntimeException("The process with name " + processName + " has not been retrieved");
}
}
use of org.apache.camel.component.bonita.api.model.ProcessDefinitionResponse in project camel by apache.
the class BonitaAPITest method testStartCaseNUllContractInput.
@Test(expected = IllegalArgumentException.class)
public void testStartCaseNUllContractInput() throws Exception {
BonitaAPI bonitaApi = BonitaAPIBuilder.build(new BonitaAPIConfig("hostname", "port", "username", "password"));
ProcessDefinitionResponse processDefinition = new ProcessDefinitionResponse();
bonitaApi.startCase(processDefinition, null);
}
Aggregations