use of org.kie.server.remote.rest.common.Header in project droolsjbpm-integration by kiegroup.
the class RuntimeDataResource method getProcessInstances.
@ApiOperation(value = "Returns all process instances filtered by optional parameters.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 200, message = "Successful response", response = ProcessInstanceList.class, examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_PROCESS_INSTANCES_RESPONSE_JSON) })) })
@GET
@Path(PROCESS_INSTANCES_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getProcessInstances(@Context HttpHeaders headers, @ApiParam(value = "optional process instance status (active, completed, aborted) - defaults ot active (1) only", required = false, allowableValues = "1,2,3") @QueryParam("status") List<Integer> status, @ApiParam(value = "optional process instance initiator - user who started process instance to filter process instances", required = false) @QueryParam("initiator") String initiator, @ApiParam(value = "optional process name to filter process instances", required = false) @QueryParam("processName") String processName, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize, @ApiParam(value = "optional sort column, no default", required = false) @QueryParam("sort") String sort, @ApiParam(value = "optional sort direction (asc, desc) - defaults to asc", required = false) @QueryParam("sortOrder") @DefaultValue("true") boolean sortOrder) {
// no container id available so only used to transfer conversation id if given by client
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
ProcessInstanceList processInstanceList = runtimeDataServiceBase.getProcessInstances(status, initiator, processName, page, pageSize, sort, sortOrder);
logger.debug("Returning result of process instance search: {}", processInstanceList);
return createCorrectVariant(processInstanceList, headers, Response.Status.OK, conversationIdHeader);
}
use of org.kie.server.remote.rest.common.Header in project droolsjbpm-integration by kiegroup.
the class RuntimeDataResource method getProcessInstancesByProcessId.
@ApiOperation(value = "Returns all process instances for a specified process.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 200, response = ProcessInstanceList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_PROCESS_INSTANCES_RESPONSE_JSON) })) })
@GET
@Path(PROCESS_INSTANCES_BY_PROCESS_ID_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getProcessInstancesByProcessId(@Context HttpHeaders headers, @ApiParam(value = "process id to filter process instance", required = true) @PathParam(PROCESS_ID) String processId, @ApiParam(value = "optional process instance status (active, completed, aborted) - defaults ot active (1) only", required = false, allowableValues = "1,2,3") @QueryParam("status") List<Integer> status, @ApiParam(value = "optinal process instance initiator - user who started process instance to filtr process instances", required = false) @QueryParam("initiator") String initiator, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize, @ApiParam(value = "optional sort column, no default", required = false) @QueryParam("sort") String sort, @ApiParam(value = "optional sort direction (asc, desc) - defaults to asc", required = false) @QueryParam("sortOrder") @DefaultValue("true") boolean sortOrder) {
// no container id available so only used to transfer conversation id if given by client
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
ProcessInstanceList processInstanceList = runtimeDataServiceBase.getProcessInstancesByProcessId(processId, status, initiator, page, pageSize, sort, sortOrder);
logger.debug("Returning result of process instance search: {}", processInstanceList);
return createCorrectVariant(processInstanceList, headers, Response.Status.OK, conversationIdHeader);
}
use of org.kie.server.remote.rest.common.Header in project droolsjbpm-integration by kiegroup.
the class RuntimeDataResource method getTaskEvents.
@ApiOperation(value = "Returns events for a specified task instance.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 200, response = TaskEventInstanceList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_TASK_EVENTS_RESPONSE_JSON) })) })
@GET
@Path(TASKS_EVENTS_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getTaskEvents(@Context HttpHeaders headers, @ApiParam(value = "task id to load task events for", required = true) @PathParam(TASK_INSTANCE_ID) Long taskId, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize, @ApiParam(value = "optional sort column, no default", required = false) @QueryParam("sort") String sort, @ApiParam(value = "optional sort direction (asc, desc) - defaults to asc", required = false) @QueryParam("sortOrder") @DefaultValue("true") boolean sortOrder) {
Variant v = getVariant(headers);
// no container id available so only used to transfer conversation id if given by client
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
try {
TaskEventInstanceList result = runtimeDataServiceBase.getTaskEvents(taskId, page, pageSize, sort, sortOrder);
return createCorrectVariant(result, headers, Response.Status.OK, conversationIdHeader);
} catch (TaskNotFoundException e) {
return notFound(MessageFormat.format(TASK_INSTANCE_NOT_FOUND, taskId), v, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
use of org.kie.server.remote.rest.common.Header in project droolsjbpm-integration by kiegroup.
the class UserTaskResource method getTaskInputContentByTaskId.
@ApiOperation(value = "Returns input data for a specified task instance.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Task with given id not found"), @ApiResponse(code = 200, response = Map.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_PROCESS_INSTANCE_VARS_RESPONSE_JSON) })) })
@GET
@Path(TASK_INSTANCE_INPUT_DATA_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getTaskInputContentByTaskId(@Context HttpHeaders headers, @ApiParam(value = "container id that task instance belongs to", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "identifier of the task instance that input data should be loaded from", required = true, example = "123") @PathParam(TASK_INSTANCE_ID) Long taskId) {
Variant v = getVariant(headers);
String type = getContentType(headers);
Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
try {
String response = userTaskServiceBase.getTaskInputContentByTaskId(containerId, taskId, type);
logger.debug("Returning OK response with content '{}'", response);
return createResponse(response, v, Response.Status.OK, conversationIdHeader);
} catch (TaskNotFoundException e) {
return notFound(errorMessage(e, MessageFormat.format(TASK_INSTANCE_NOT_FOUND, taskId)), v, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
use of org.kie.server.remote.rest.common.Header in project droolsjbpm-integration by kiegroup.
the class UserTaskResource method nominate.
@ApiOperation(value = "Nominates one or more potential owners to whom the task instance should be assigned.", response = Void.class, code = 201)
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Task with given id not found"), @ApiResponse(code = 403, message = "User was unable to execute current operation on task with given id due to a no 'current status' match or insufficient permissions") })
@PUT
@Path(TASK_INSTANCE_NOMINATE_PUT_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response nominate(@Context HttpHeaders headers, @ApiParam(value = "container id that task instance belongs to", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "identifier of the task instance that should be nominated", required = true, example = "123") @PathParam(TASK_INSTANCE_ID) Long taskId, @ApiParam(value = "optional user id to be used instead of authenticated user - only when bypass authenticated user is enabled", required = false) @QueryParam("user") String userId, @ApiParam(value = "list of users that the task should be nominated to", required = true) @QueryParam("potOwner") List<String> potentialOwners) {
Variant v = getVariant(headers);
Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
try {
userTaskServiceBase.nominate(containerId, taskId, userId, potentialOwners);
return createResponse("", v, Response.Status.CREATED, conversationIdHeader);
} catch (TaskNotFoundException e) {
return notFound(errorMessage(e, MessageFormat.format(TASK_INSTANCE_NOT_FOUND, taskId)), v, conversationIdHeader);
} catch (PermissionDeniedException e) {
return forbidden(errorMessage(e, e.getMessage()), v, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
Aggregations