use of org.kie.server.remote.rest.common.Header in project droolsjbpm-integration by kiegroup.
the class RuntimeDataResource method queryUserTasksByVariables.
@ApiOperation(value = "Queries process tasks by variables", response = ProcessInstanceUserTaskWithVariablesList.class)
@POST
@Path(RestURI.VARIABLES_TASKS_PROCESSES_URI)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@KieServerEndpoint(categories = { EndpointType.DEFAULT, EndpointType.HISTORY })
public Response queryUserTasksByVariables(@Context HttpHeaders headers, String payload, @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", required = false) @QueryParam("orderBy") String orderBy, @ApiParam(value = "optional sort direction - true ascending, false descending", required = false) @QueryParam("asc") @DefaultValue("true") boolean asc) {
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
Variant v = getVariant(headers);
try {
String type = getContentType(headers);
ProcessInstanceUserTaskWithVariablesList taskVariableSummaryList = runtimeDataServiceBase.queryUserTasksByVariables(payload, type, new QueryContext(page * pageSize, pageSize, orderBy, asc));
logger.debug("Returning result of process tasks search: {}", taskVariableSummaryList);
return createCorrectVariant(taskVariableSummaryList, headers, Response.Status.OK, 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 RuntimeDataResource method queryProcessesByVariables.
@ApiOperation(value = "Queries processes by variables and tasks", response = ProcessInstanceCustomVarsList.class)
@POST
@Path(RestURI.VARIABLES_PROCESSES_URI)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@KieServerEndpoint(categories = { EndpointType.DEFAULT, EndpointType.HISTORY })
public Response queryProcessesByVariables(@Context HttpHeaders headers, String payload, @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", required = false) @QueryParam("orderBy") String orderBy, @ApiParam(value = "optional sort direction - true ascending, false descending", required = false) @QueryParam("asc") @DefaultValue("true") boolean asc) {
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
Variant v = getVariant(headers);
try {
String type = getContentType(headers);
ProcessInstanceCustomVarsList processVariableSummaryList = runtimeDataServiceBase.queryProcessesByVariables(payload, type, new QueryContext(page * pageSize, pageSize, orderBy, asc));
logger.debug("Returning result of process instance search: {}", processVariableSummaryList);
return createCorrectVariant(processVariableSummaryList, headers, Response.Status.OK, 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 RuntimeDataResource method getProcessInstanceHistory.
@ApiOperation(value = "Returns node instances for a specified process instance.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 200, response = NodeInstanceList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_PROCESS_INSTANCE_NODES_RESPONSE_JSON) })) })
@GET
@Path(NODE_INSTANCES_BY_INSTANCE_ID_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getProcessInstanceHistory(@Context HttpHeaders headers, @ApiParam(value = "process instance id to to retrive history for", required = true) @PathParam(PROCESS_INST_ID) long processInstanceId, @ApiParam(value = "include active nodes only", required = false) @QueryParam("activeOnly") Boolean active, @ApiParam(value = "include completed nodes only", required = false) @QueryParam("completedOnly") Boolean completed, @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) {
// no container id available so only used to transfer conversation id if given by client
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
NodeInstanceList nodeInstanceList = runtimeDataServiceBase.getProcessInstanceHistory(processInstanceId, active, completed, page, pageSize);
logger.debug("Returning result of node instances search: {}", nodeInstanceList);
return createCorrectVariant(nodeInstanceList, headers, Response.Status.OK, conversationIdHeader);
}
use of org.kie.server.remote.rest.common.Header in project droolsjbpm-integration by kiegroup.
the class RuntimeDataResource method getVariableHistory.
@ApiOperation(value = "Returns the history of a specified variable in a specified process instance.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 200, response = VariableInstanceList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_PROCESS_INSTANCE_VARS_LOG_RESPONSE_JSON) })) })
@GET
@Path(VAR_INSTANCES_BY_VAR_INSTANCE_ID_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getVariableHistory(@Context HttpHeaders headers, @ApiParam(value = "process instance id to load variable history for", required = true) @PathParam(PROCESS_INST_ID) long processInstanceId, @ApiParam(value = "variable name that history should be loaded for", required = true) @PathParam("varName") String variableName, @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) {
// no container id available so only used to transfer conversation id if given by client
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
VariableInstanceList variableInstanceList = runtimeDataServiceBase.getVariableHistory(processInstanceId, variableName, page, pageSize);
logger.debug("Returning result of variable '{}; history search: {}", variableName, variableInstanceList);
return createCorrectVariant(variableInstanceList, headers, Response.Status.OK, conversationIdHeader);
}
use of org.kie.server.remote.rest.common.Header in project droolsjbpm-integration by kiegroup.
the class RuntimeDataResource method getProcessesByDeploymentIdProcessId.
@ApiOperation(value = "Returns information about a specified process definition in a specified KIE container.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 200, response = ProcessDefinition.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_PROCESS_DEF_RESPONSE_JSON) })) })
@GET
@Path(PROCESS_DEFINITIONS_BY_CONTAINER_ID_DEF_ID_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getProcessesByDeploymentIdProcessId(@Context HttpHeaders headers, @ApiParam(value = "container id that process definition belongs to", required = true) @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "process id to load process definition", required = true) @PathParam(PROCESS_ID) String processId) {
Variant v = getVariant(headers);
// no container id available so only used to transfer conversation id if given by client
Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
ProcessDefinition processDesc = null;
try {
processDesc = runtimeDataServiceBase.getProcessesByDeploymentIdProcessId(containerId, processId);
return createCorrectVariant(processDesc, headers, Response.Status.OK, conversationIdHeader);
} catch (IllegalArgumentException e) {
return notFound(MessageFormat.format(PROCESS_DEFINITION_NOT_FOUND, processId, containerId), v, conversationIdHeader);
}
}
Aggregations