Search in sources :

Example 1 with ExecutionErrorInstanceList

use of org.kie.server.api.model.admin.ExecutionErrorInstanceList in project droolsjbpm-integration by kiegroup.

the class ProcessAdminResource method getExecutionErrorsByProcessInstance.

@ApiOperation(value = "Returns all process execution errors for a specified process instance.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Container Id not found"), @ApiResponse(code = 200, response = ExecutionErrorInstanceList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_EXEC_ERRORS_RESPONSE_JSON) })) })
@GET
@Path(ERRORS_BY_PROCESS_INST_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getExecutionErrorsByProcessInstance(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "container id that process instance belongs to", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "identifier of process instance that errors should be collected for", required = true, example = "123") @PathParam(PROCESS_INST_ID) Long processInstanceId, @ApiParam(value = "optional flag that indicates if acknowledged errors should also be collected, defaults to false", required = false) @QueryParam("includeAck") @DefaultValue("false") boolean includeAcknowledged, @ApiParam(value = "optional name of the node in the process instance to filter by", required = false) @QueryParam("node") String nodeName, @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);
    Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
    try {
        ExecutionErrorInstanceList executionErrorInstanceList = processAdminServiceBase.getExecutionErrorsByProcessInstance(containerId, processInstanceId, nodeName, includeAcknowledged, page, pageSize, sort, sortOrder);
        return createCorrectVariant(executionErrorInstanceList, headers, Response.Status.OK, conversationIdHeader);
    } catch (ExecutionErrorNotFoundException e) {
        return notFound(e.getMessage(), v, conversationIdHeader);
    } catch (DeploymentNotFoundException e) {
        return notFound(MessageFormat.format(CONTAINER_NOT_FOUND, containerId), v, conversationIdHeader);
    } catch (Exception e) {
        logger.error("Unexpected error during processing {}", e.getMessage(), e);
        return internalServerError(errorMessage(e), v, conversationIdHeader);
    }
}
Also used : RestUtils.getVariant(org.kie.server.remote.rest.common.util.RestUtils.getVariant) RestUtils.createCorrectVariant(org.kie.server.remote.rest.common.util.RestUtils.createCorrectVariant) Variant(javax.ws.rs.core.Variant) DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) Header(org.kie.server.remote.rest.common.Header) RestUtils.buildConversationIdHeader(org.kie.server.remote.rest.common.util.RestUtils.buildConversationIdHeader) ExecutionErrorInstanceList(org.kie.server.api.model.admin.ExecutionErrorInstanceList) ExecutionErrorNotFoundException(org.jbpm.services.api.admin.ExecutionErrorNotFoundException) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) NodeInstanceNotFoundException(org.jbpm.services.api.NodeInstanceNotFoundException) DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) ExecutionErrorNotFoundException(org.jbpm.services.api.admin.ExecutionErrorNotFoundException) NodeNotFoundException(org.jbpm.services.api.NodeNotFoundException) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 2 with ExecutionErrorInstanceList

use of org.kie.server.api.model.admin.ExecutionErrorInstanceList in project droolsjbpm-integration by kiegroup.

the class ProcessAdminResource method getExecutionErrors.

@ApiOperation(value = "Returns all process execution errors for a specified KIE container.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Process instance or Container Id not found"), @ApiResponse(code = 200, response = ExecutionErrorInstanceList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_EXEC_ERRORS_RESPONSE_JSON) })) })
@GET
@Path(ERRORS_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getExecutionErrors(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "container id that errors belong to", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "optional flag that indicates if acknowledged errors should also be collected, defaults to false", required = false) @QueryParam("includeAck") @DefaultValue("false") boolean includeAcknowledged, @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);
    Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
    try {
        ExecutionErrorInstanceList executionErrorInstanceList = processAdminServiceBase.getExecutionErrors(containerId, includeAcknowledged, page, pageSize, sort, sortOrder);
        return createCorrectVariant(executionErrorInstanceList, headers, Response.Status.OK, conversationIdHeader);
    } catch (ExecutionErrorNotFoundException e) {
        return notFound(e.getMessage(), v, conversationIdHeader);
    } catch (DeploymentNotFoundException e) {
        return notFound(MessageFormat.format(CONTAINER_NOT_FOUND, containerId), v, conversationIdHeader);
    } catch (Exception e) {
        logger.error("Unexpected error during processing {}", e.getMessage(), e);
        return internalServerError(errorMessage(e), v, conversationIdHeader);
    }
}
Also used : RestUtils.getVariant(org.kie.server.remote.rest.common.util.RestUtils.getVariant) RestUtils.createCorrectVariant(org.kie.server.remote.rest.common.util.RestUtils.createCorrectVariant) Variant(javax.ws.rs.core.Variant) DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) Header(org.kie.server.remote.rest.common.Header) RestUtils.buildConversationIdHeader(org.kie.server.remote.rest.common.util.RestUtils.buildConversationIdHeader) ExecutionErrorInstanceList(org.kie.server.api.model.admin.ExecutionErrorInstanceList) ExecutionErrorNotFoundException(org.jbpm.services.api.admin.ExecutionErrorNotFoundException) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) NodeInstanceNotFoundException(org.jbpm.services.api.NodeInstanceNotFoundException) DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) ExecutionErrorNotFoundException(org.jbpm.services.api.admin.ExecutionErrorNotFoundException) NodeNotFoundException(org.jbpm.services.api.NodeNotFoundException) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 3 with ExecutionErrorInstanceList

use of org.kie.server.api.model.admin.ExecutionErrorInstanceList in project droolsjbpm-integration by kiegroup.

the class UserTaskAdminResource method getExecutionErrors.

@ApiOperation(value = "Returns all task execution errors for a specified KIE container.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Container Id not found"), @ApiResponse(code = 200, response = ExecutionErrorInstanceList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_EXEC_ERRORS_RESPONSE_JSON) })) })
@GET
@Path(ERRORS_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getExecutionErrors(@javax.ws.rs.core.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 = "optional flag that indicates if acknowledged errors should also be collected, defaults to false", required = false) @QueryParam("includeAck") @DefaultValue("false") boolean includeAcknowledged, @ApiParam(value = "optional name of the task to filter by", required = false) @QueryParam("name") String taskName, @ApiParam(value = "optional process id that the task belongs to to filter by", required = false) @QueryParam("process") String processId, @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);
    Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
    try {
        ExecutionErrorInstanceList executionErrorInstanceList = userTaskAdminServiceBase.getExecutionErrorsByTaskName(containerId, processId, taskName, includeAcknowledged, page, pageSize, sort, sortOrder);
        return createCorrectVariant(executionErrorInstanceList, headers, Response.Status.OK, conversationIdHeader);
    } catch (ExecutionErrorNotFoundException e) {
        return notFound(e.getMessage(), v, conversationIdHeader);
    } catch (DeploymentNotFoundException e) {
        return notFound(MessageFormat.format(CONTAINER_NOT_FOUND, containerId), v, conversationIdHeader);
    } catch (Exception e) {
        logger.error("Unexpected error during processing {}", e.getMessage(), e);
        return internalServerError(errorMessage(e), v, conversationIdHeader);
    }
}
Also used : RestUtils.getVariant(org.kie.server.remote.rest.common.util.RestUtils.getVariant) RestUtils.createCorrectVariant(org.kie.server.remote.rest.common.util.RestUtils.createCorrectVariant) Variant(javax.ws.rs.core.Variant) DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) Header(org.kie.server.remote.rest.common.Header) RestUtils.buildConversationIdHeader(org.kie.server.remote.rest.common.util.RestUtils.buildConversationIdHeader) ExecutionErrorInstanceList(org.kie.server.api.model.admin.ExecutionErrorInstanceList) ExecutionErrorNotFoundException(org.jbpm.services.api.admin.ExecutionErrorNotFoundException) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) ExecutionErrorNotFoundException(org.jbpm.services.api.admin.ExecutionErrorNotFoundException) TaskNotFoundException(org.jbpm.services.api.TaskNotFoundException) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 4 with ExecutionErrorInstanceList

use of org.kie.server.api.model.admin.ExecutionErrorInstanceList in project droolsjbpm-integration by kiegroup.

the class UserTaskAdminResource method getExecutionErrorsByTask.

@ApiOperation(value = "Returns task execution errors for a specified task instance.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Container Id not found"), @ApiResponse(code = 200, response = ExecutionErrorInstanceList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = GET_EXEC_ERRORS_RESPONSE_JSON) })) })
@GET
@Path(ERRORS_BY_TASK_ID_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getExecutionErrorsByTask(@javax.ws.rs.core.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 errors should be collected for", required = true, example = "123") @PathParam(TASK_INSTANCE_ID) Long taskId, @ApiParam(value = "optional flag that indicates if acknowledged errors should also be collected, defaults to false", required = false) @QueryParam("includeAck") @DefaultValue("false") boolean includeAcknowledged, @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);
    Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers);
    try {
        ExecutionErrorInstanceList executionErrorInstanceList = userTaskAdminServiceBase.getExecutionErrorsByTaskId(containerId, taskId, includeAcknowledged, page, pageSize, sort, sortOrder);
        return createCorrectVariant(executionErrorInstanceList, headers, Response.Status.OK, conversationIdHeader);
    } catch (ExecutionErrorNotFoundException e) {
        return notFound(e.getMessage(), v, conversationIdHeader);
    } catch (DeploymentNotFoundException e) {
        return notFound(MessageFormat.format(CONTAINER_NOT_FOUND, containerId), v, conversationIdHeader);
    } catch (Exception e) {
        logger.error("Unexpected error during processing {}", e.getMessage(), e);
        return internalServerError(errorMessage(e), v, conversationIdHeader);
    }
}
Also used : RestUtils.getVariant(org.kie.server.remote.rest.common.util.RestUtils.getVariant) RestUtils.createCorrectVariant(org.kie.server.remote.rest.common.util.RestUtils.createCorrectVariant) Variant(javax.ws.rs.core.Variant) DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) Header(org.kie.server.remote.rest.common.Header) RestUtils.buildConversationIdHeader(org.kie.server.remote.rest.common.util.RestUtils.buildConversationIdHeader) ExecutionErrorInstanceList(org.kie.server.api.model.admin.ExecutionErrorInstanceList) ExecutionErrorNotFoundException(org.jbpm.services.api.admin.ExecutionErrorNotFoundException) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) ExecutionErrorNotFoundException(org.jbpm.services.api.admin.ExecutionErrorNotFoundException) TaskNotFoundException(org.jbpm.services.api.TaskNotFoundException) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 5 with ExecutionErrorInstanceList

use of org.kie.server.api.model.admin.ExecutionErrorInstanceList in project droolsjbpm-integration by kiegroup.

the class ProcessAdminServicesClientImpl method getErrorsByProcessInstanceAndNode.

@Override
public List<ExecutionErrorInstance> getErrorsByProcessInstanceAndNode(String containerId, Long processInstanceId, String nodeName, boolean includeAcknowledged, Integer page, Integer pageSize) {
    ExecutionErrorInstanceList result = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        valuesMap.put(CONTAINER_ID, containerId);
        valuesMap.put(PROCESS_INST_ID, processInstanceId);
        String queryString = "?includeAck=" + includeAcknowledged + "&node=" + nodeName;
        queryString = getPagingQueryString(queryString, page, pageSize);
        result = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), ADMIN_PROCESS_URI + "/" + ERRORS_BY_PROCESS_INST_GET_URI + queryString, valuesMap), ExecutionErrorInstanceList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("ProcessAdminService", "getExecutionErrorsByProcessInstance", new Object[] { containerId, processInstanceId, nodeName, includeAcknowledged, page, pageSize, "", true })));
        ServiceResponse<ExecutionErrorInstanceList> response = (ServiceResponse<ExecutionErrorInstanceList>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM").getResponses().get(0);
        throwExceptionOnFailure(response);
        if (shouldReturnWithNullResponse(response)) {
            return null;
        }
        result = response.getResult();
    }
    if (result != null && result.getItems() != null) {
        return result.getItems();
    }
    return Collections.emptyList();
}
Also used : DescriptorCommand(org.kie.server.api.commands.DescriptorCommand) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) ExecutionErrorInstanceList(org.kie.server.api.model.admin.ExecutionErrorInstanceList) HashMap(java.util.HashMap) CommandScript(org.kie.server.api.commands.CommandScript)

Aggregations

ExecutionErrorInstanceList (org.kie.server.api.model.admin.ExecutionErrorInstanceList)14 HashMap (java.util.HashMap)5 ExecutionError (org.kie.internal.runtime.error.ExecutionError)5 CommandScript (org.kie.server.api.commands.CommandScript)5 DescriptorCommand (org.kie.server.api.commands.DescriptorCommand)5 KieServerCommand (org.kie.server.api.model.KieServerCommand)5 ServiceResponse (org.kie.server.api.model.ServiceResponse)5 ApiOperation (io.swagger.annotations.ApiOperation)4 ApiResponses (io.swagger.annotations.ApiResponses)4 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 Variant (javax.ws.rs.core.Variant)4 DeploymentNotFoundException (org.jbpm.services.api.DeploymentNotFoundException)4 ProcessInstanceNotFoundException (org.jbpm.services.api.ProcessInstanceNotFoundException)4 ExecutionErrorNotFoundException (org.jbpm.services.api.admin.ExecutionErrorNotFoundException)4 Header (org.kie.server.remote.rest.common.Header)4 RestUtils.buildConversationIdHeader (org.kie.server.remote.rest.common.util.RestUtils.buildConversationIdHeader)4 RestUtils.createCorrectVariant (org.kie.server.remote.rest.common.util.RestUtils.createCorrectVariant)4 RestUtils.getVariant (org.kie.server.remote.rest.common.util.RestUtils.getVariant)4