use of org.kie.server.api.model.definition.ServiceTasksDefinition in project droolsjbpm-integration by kiegroup.
the class DefinitionResource method getServiceTasks.
@ApiOperation(value = "Retrieves service tasks definitions that are present in given process and container")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Process or Container Id not found"), @ApiResponse(code = 200, response = ServiceTasksDefinition.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_PROCESS_SERVICE_TASKS_RESPONSE_JSON) })) })
@GET
@Path(PROCESS_DEF_SERVICE_TASKS_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getServiceTasks(@Context HttpHeaders headers, @ApiParam(value = "container id where the process definition resides", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "process id that the service task definitions should be retrieved from", required = true, example = "evaluation") @PathParam(PROCESS_ID) String processId) {
Variant v = getVariant(headers);
Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
try {
ServiceTasksDefinition serviceTasksDefinition = definitionServiceBase.getServiceTasks(containerId, processId);
return createCorrectVariant(serviceTasksDefinition, headers, Response.Status.OK, conversationIdHeader);
} catch (IllegalStateException e) {
return notFound(MessageFormat.format(PROCESS_DEFINITION_NOT_FOUND, processId, containerId), v, conversationIdHeader);
} catch (Exception e) {
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
use of org.kie.server.api.model.definition.ServiceTasksDefinition in project droolsjbpm-integration by kiegroup.
the class ProcessDefinitionIntegrationTest method testServiceTasksDefinition.
@Test
public void testServiceTasksDefinition() {
ServiceTasksDefinition result = processClient.getServiceTaskDefinitions(CONTAINER_ID, PROCESS_ID_EVALUATION);
// assert services tasks
assertEquals(1, result.getServiceTasks().size());
assertTrue(result.getServiceTasks().containsKey("Email results"));
// assert type of the services task for 'Email results' name
assertEquals("Email", result.getServiceTasks().get("Email results"));
}
use of org.kie.server.api.model.definition.ServiceTasksDefinition in project droolsjbpm-integration by kiegroup.
the class ProcessServicesClientImpl method getServiceTaskDefinitions.
@Override
public ServiceTasksDefinition getServiceTaskDefinitions(String containerId, String processId) {
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(PROCESS_ID, processId);
return makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), PROCESS_DEF_URI + "/" + PROCESS_DEF_SERVICE_TASKS_GET_URI, valuesMap), ServiceTasksDefinition.class);
} else {
CommandScript script = new CommandScript(singletonList((KieServerCommand) new DescriptorCommand("DefinitionService", "getServiceTasks", new Object[] { containerId, processId })));
ServiceResponse<ServiceTasksDefinition> response = (ServiceResponse<ServiceTasksDefinition>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
return response.getResult();
}
}
Aggregations