Search in sources :

Example 6 with ExecutionErrorInstanceList

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

the class UserTaskAdminServicesClientImpl method getErrorsByTaskId.

@Override
public List<ExecutionErrorInstance> getErrorsByTaskId(String containerId, Long taskId, 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(TASK_INSTANCE_ID, taskId);
        String queryString = "?includeAck=" + includeAcknowledged;
        queryString = getPagingQueryString(queryString, page, pageSize);
        result = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), ADMIN_TASK_URI + "/" + ERRORS_BY_TASK_ID_GET_URI, valuesMap) + queryString, ExecutionErrorInstanceList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskAdminService", "getExecutionErrorsByTaskId", new Object[] { containerId, taskId, 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)

Example 7 with ExecutionErrorInstanceList

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

the class UserTaskAdminServicesClientImpl method getErrorsByTaskInfo.

@Override
public List<ExecutionErrorInstance> getErrorsByTaskInfo(String containerId, Long processId, String taskName, 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);
        String queryString = "?includeAck=" + includeAcknowledged + "&name=" + taskName + "&process=" + processId;
        queryString = getPagingQueryString(queryString, page, pageSize);
        result = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), ADMIN_TASK_URI + "/" + ERRORS_GET_URI, valuesMap) + queryString, ExecutionErrorInstanceList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskAdminService", "getExecutionErrorsByTaskName", new Object[] { containerId, processId, taskName, 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)

Example 8 with ExecutionErrorInstanceList

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

the class ConvertUtils method convertToErrorInstanceList.

public static ExecutionErrorInstanceList convertToErrorInstanceList(List<ExecutionError> executionErrors) {
    if (executionErrors == null) {
        return new ExecutionErrorInstanceList(new ExecutionErrorInstance[0]);
    }
    List<ExecutionErrorInstance> executionErrorInstances = new ArrayList<ExecutionErrorInstance>(executionErrors.size());
    for (ExecutionError error : executionErrors) {
        ExecutionErrorInstance errorInstance = convertToErrorInstance(error);
        executionErrorInstances.add(errorInstance);
    }
    return new ExecutionErrorInstanceList(executionErrorInstances);
}
Also used : ExecutionError(org.kie.internal.runtime.error.ExecutionError) ExecutionErrorInstanceList(org.kie.server.api.model.admin.ExecutionErrorInstanceList) ArrayList(java.util.ArrayList) ExecutionErrorInstance(org.kie.server.api.model.admin.ExecutionErrorInstance)

Example 9 with ExecutionErrorInstanceList

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

the class ProcessAdminServiceBase method getExecutionErrorsByProcessInstance.

public ExecutionErrorInstanceList getExecutionErrorsByProcessInstance(String containerId, Number processInstanceId, String nodeName, boolean includeAcknowledged, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    logger.debug("About to get execution errors for process instance id {} and node {}", processInstanceId, nodeName);
    List<ExecutionError> errors = null;
    if (nodeName == null || nodeName.isEmpty()) {
        errors = processInstanceAdminService.getErrorsByProcessInstanceId(processInstanceId.longValue(), includeAcknowledged, buildQueryContext(page, pageSize, sort, sortOrder));
        ;
    } else {
        errors = processInstanceAdminService.getErrorsByProcessInstanceId(processInstanceId.longValue(), nodeName, includeAcknowledged, buildQueryContext(page, pageSize, sort, sortOrder));
    }
    logger.debug("Found errors {}", errors);
    ExecutionErrorInstanceList errorInstanceList = convertToErrorInstanceList(errors);
    return errorInstanceList;
}
Also used : ExecutionError(org.kie.internal.runtime.error.ExecutionError) ExecutionErrorInstanceList(org.kie.server.api.model.admin.ExecutionErrorInstanceList)

Example 10 with ExecutionErrorInstanceList

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

the class ProcessAdminServiceBase method getExecutionErrors.

public ExecutionErrorInstanceList getExecutionErrors(String containerId, boolean includeAcknowledged, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    logger.debug("About to get execution errors");
    List<ExecutionError> errors = processInstanceAdminService.getErrorsByDeploymentId(containerId, includeAcknowledged, buildQueryContext(page, pageSize, sort, sortOrder));
    logger.debug("Found errors {}", errors);
    ExecutionErrorInstanceList errorInstanceList = convertToErrorInstanceList(errors);
    return errorInstanceList;
}
Also used : ExecutionError(org.kie.internal.runtime.error.ExecutionError) ExecutionErrorInstanceList(org.kie.server.api.model.admin.ExecutionErrorInstanceList)

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