use of org.kie.server.api.model.definition.TaskOutputsDefinition in project droolsjbpm-integration by kiegroup.
the class UserTaskServicesClientImpl method releaseTask.
@Override
public void releaseTask(String containerId, Long taskId, String userId) {
if (config.isRest()) {
sendTaskOperation(containerId, taskId, TASK_URI + "/" + TASK_INSTANCE_RELEASE_PUT_URI, getUserQueryStr(userId));
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskService", "release", new Object[] { containerId, taskId, userId })));
ServiceResponse<TaskOutputsDefinition> response = (ServiceResponse<TaskOutputsDefinition>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
throwExceptionOnFailure(response);
}
}
use of org.kie.server.api.model.definition.TaskOutputsDefinition in project droolsjbpm-integration by kiegroup.
the class ProcessDefinitionIntegrationTest method testTaskOutputsDefinition.
@Test
public void testTaskOutputsDefinition() {
TaskOutputsDefinition result = processClient.getUserTaskOutputDefinitions(CONTAINER_ID, PROCESS_ID_EVALUATION, "Evaluate items?");
assertNotNull(result);
// assert task inputs and outputs
Map<String, String> outputs = result.getTaskOutputs();
assertNotNull(outputs);
assertEquals(1, outputs.size());
assertTrue(outputs.containsKey("outcome"));
assertEquals("Boolean", outputs.get("outcome"));
}
use of org.kie.server.api.model.definition.TaskOutputsDefinition in project droolsjbpm-integration by kiegroup.
the class DefinitionResource method getTaskOutputMappings.
@ApiOperation(value = "Retrieves output variables defined on a given user task")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Process or Container Id not found"), @ApiResponse(code = 200, response = TaskOutputsDefinition.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_TASK_OUTPUTS_RESPONSE_JSON) })) })
@GET
@Path(PROCESS_DEF_USER_TASK_OUTPUT_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getTaskOutputMappings(@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 given task belongs to", required = true, example = "evaluation") @PathParam(PROCESS_ID) String processId, @ApiParam(value = "task name that output variable definitions should be retrieved for", required = true, example = "Review") @PathParam("taskName") String taskName) {
Variant v = getVariant(headers);
Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
try {
TaskOutputsDefinition taskOutputsDefinition = definitionServiceBase.getTaskOutputMappings(containerId, processId, URLDecoder.decode(taskName, "UTF-8"));
return createCorrectVariant(taskOutputsDefinition, 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.TaskOutputsDefinition in project droolsjbpm-integration by kiegroup.
the class ProcessServicesClientImpl method getUserTaskOutputDefinitions.
@Override
public TaskOutputsDefinition getUserTaskOutputDefinitions(String containerId, String processId, String taskName) {
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(PROCESS_ID, processId);
valuesMap.put(TASK_NAME, encode(taskName));
return makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), PROCESS_DEF_URI + "/" + PROCESS_DEF_USER_TASK_OUTPUT_GET_URI, valuesMap), TaskOutputsDefinition.class);
} else {
CommandScript script = new CommandScript(singletonList((KieServerCommand) new DescriptorCommand("DefinitionService", "getTaskOutputMappings", new Object[] { containerId, processId, taskName })));
ServiceResponse<TaskOutputsDefinition> response = (ServiceResponse<TaskOutputsDefinition>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
return response.getResult();
}
}
Aggregations