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; }
public VariableInstanceList getVariableHistory(long processInstanceId, String variableName, Integer page, Integer pageSize) { logger.debug("About to search for variable '{}; history within process instance '{}' with page {} and page size {}", variableName, processInstanceId, page, pageSize); Collection<VariableDesc> variableDescs = runtimeDataService.getVariableHistory(processInstanceId, variableName, buildQueryContext(page, pageSize)); logger.debug("Found {} variable {} history entries within process instance '{}'", variableDescs.size(), variableName, processInstanceId); VariableInstanceList variableInstanceList = convertToVariablesList(variableDescs); logger.debug("Returning result of variable '{}; history search: {}", variableName, variableInstanceList); return variableInstanceList; }
public ExecutionErrorInstanceList getExecutionErrorsByTaskId(String containerId, Number taskId, boolean includeAcknowledged, Integer page, Integer pageSize, String sort, boolean sortOrder) { logger.debug("About to get execution errors for task id {}", taskId); List<ExecutionError> errors = userTaskAdminService.getErrorsByTaskId(taskId.longValue(), includeAcknowledged, buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found errors {}", errors); ExecutionErrorInstanceList errorInstanceList = convertToErrorInstanceList(errors); return errorInstanceList; }
public ProcessInstanceList getProcessInstancesByParent(long parentProcessInstanceId, List<Integer> status, Integer page, Integer pageSize, String sort, boolean sortOrder) { if (sort == null || sort.isEmpty()) { sort = "ProcessInstanceId"; } if (status == null || status.isEmpty()) { status = new ArrayList<Integer>(); status.add(ProcessInstance.STATE_ACTIVE); } Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstancesByParent(parentProcessInstanceId, status, buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process instances , statuses '{}'", instances.size(), status); ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances); logger.debug("Returning result of process instance search: {}", processInstanceList); return processInstanceList; }
public ExecutionErrorInstanceList getExecutionErrorsByTaskName(String containerId, String processId, String taskName, boolean includeAcknowledged, Integer page, Integer pageSize, String sort, boolean sortOrder) { logger.debug("About to get execution errors for task name {} in process {} and container {}", taskName, processId, containerId); List<ExecutionError> errors = null; if (containerId != null && !containerId.isEmpty()) { errors = userTaskAdminService.getErrorsByTaskName(containerId, processId, taskName, includeAcknowledged, buildQueryContext(page, pageSize, sort, sortOrder)); } else if (processId != null && !processId.isEmpty()) { errors = userTaskAdminService.getErrorsByTaskName(processId, taskName, includeAcknowledged, buildQueryContext(page, pageSize, sort, sortOrder)); } else if (taskName != null && !taskName.isEmpty()) { errors = userTaskAdminService.getErrorsByTaskName(taskName, includeAcknowledged, buildQueryContext(page, pageSize, sort, sortOrder)); } else { errors = userTaskAdminService.getErrors(includeAcknowledged, buildQueryContext(page, pageSize, sort, sortOrder)); } logger.debug("Found errors {}", errors); ExecutionErrorInstanceList errorInstanceList = convertToErrorInstanceList(errors); return errorInstanceList; }
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; }
public ProcessInstanceList getProcessInstancesByDeploymentId(String containerId, List<Integer> status, Integer page, Integer pageSize, String sort, boolean sortOrder) { if (sort == null || sort.isEmpty()) { sort = "ProcessInstanceId"; } if (status == null || status.isEmpty()) { status = new ArrayList<Integer>(); status.add(ProcessInstance.STATE_ACTIVE); } logger.debug("About to search for process instance belonging to container '{}' with page {} and page size {}", containerId, page, pageSize); Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstancesByDeploymentId(containerId, status, buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process instance for container '{}', statuses '{}'", instances.size(), containerId, status); ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances); logger.debug("Returning result of process instance search: {}", processInstanceList); return processInstanceList; }
public NodeInstanceList getProcessInstanceHistory(long processInstanceId, Boolean active, Boolean completed, Integer page, Integer pageSize) { logger.debug("About to search for node instances with page {} and page size {}", page, pageSize); Collection<NodeInstanceDesc> result = null; if ((Boolean.TRUE.equals(active) && Boolean.TRUE.equals(completed)) || (active == null && completed == null)) { logger.debug("Searching for active and completed node instances for process instance with id {}", processInstanceId); result = runtimeDataService.getProcessInstanceFullHistory(processInstanceId, buildQueryContext(page, pageSize)); } else if (Boolean.TRUE.equals(active)) { logger.debug("Searching for active node instances for process instance with id {}", processInstanceId); result = runtimeDataService.getProcessInstanceHistoryActive(processInstanceId, buildQueryContext(page, pageSize)); } else if (Boolean.TRUE.equals(completed)) { logger.debug("Searching for completed node instances for process instance with id {}", processInstanceId); result = runtimeDataService.getProcessInstanceHistoryCompleted(processInstanceId, buildQueryContext(page, pageSize)); } NodeInstanceList nodeInstanceList = convertToNodeInstanceList(result); logger.debug("Returning result of node instances search: {}", nodeInstanceList); return nodeInstanceList; }
public ProcessDefinitionList getProcessesByFilter(String filter, Integer page, Integer pageSize, String sort, boolean sortOrder) { Collection<ProcessDefinition> definitions; if (sort == null || sort.isEmpty()) { sort = "ProcessName"; } if (filter != null && !filter.isEmpty()) { logger.debug("About to search for process definitions with filter '{}' with page {} and page size {}", filter, page, pageSize); definitions = runtimeDataService.getProcessesByFilter(filter, buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process definitions with filter '{}'", definitions.size(), filter); } else { logger.debug("About to search for process definitions with page {} and page size {}", page, pageSize); definitions = runtimeDataService.getProcesses(buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process definitions", definitions.size(), filter); } ProcessDefinitionList processDefinitionList = convertToProcessList(definitions); logger.debug("Returning result of process definition search: {}", processDefinitionList); return processDefinitionList; }
public ProcessInstanceList getProcessInstanceByVariables(String variableName, String variableValue, List<Integer> status, Integer page, Integer pageSize, String sort, boolean sortOrder) { if (sort == null || sort.isEmpty()) { sort = "ProcessInstanceId"; } Collection<ProcessInstanceDesc> instances = null; if (variableValue != null && !variableValue.isEmpty()) { logger.debug("About to search for process instance that has variable '{}' with value '{}' with page {} and page size {}", variableName, variableValue, page, pageSize); instances = runtimeDataService.getProcessInstancesByVariableAndValue(variableName, variableValue, status, buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process instance with variable {} and variable value {}", instances.size(), variableName, variableValue); } else { logger.debug("About to search for process instance that has variable '{}' with page {} and page size {}", variableName, page, pageSize); instances = runtimeDataService.getProcessInstancesByVariable(variableName, status, buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process instance with variable {} ", instances.size(), variableName); } ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances); logger.debug("Returning result of process instance search: {}", processInstanceList); return processInstanceList; }
public ProcessInstanceList getProcessInstancesByProcessId(String processId, List<Integer> status, String initiator, Integer page, Integer pageSize, String sort, boolean sortOrder) { if (sort == null || sort.isEmpty()) { sort = "ProcessInstanceId"; } if (status == null || status.isEmpty()) { status = new ArrayList<Integer>(); status.add(ProcessInstance.STATE_ACTIVE); } logger.debug("About to search for process instances with process id '{}' with page {} and page size {}", processId, page, pageSize); Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstancesByProcessId(status, processId, nullEmpty(initiator), buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process instance for process id '{}', statuses '{}'", instances.size(), processId, status); ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances); logger.debug("Returning result of process instance search: {}", processInstanceList); return processInstanceList; }
public ProcessInstanceList getProcessInstancesByCorrelationKey(String correlationKey, Integer page, Integer pageSize, String sort, boolean sortOrder) { if (sort == null || sort.isEmpty()) { sort = "ProcessInstanceId"; } String[] correlationProperties = correlationKey.split(":"); CorrelationKey actualCorrelationKey = correlationKeyFactory.newCorrelationKey(Arrays.asList(correlationProperties)); Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstancesByCorrelationKey(actualCorrelationKey, buildQueryContext(page, pageSize, sort, sortOrder)); ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances); logger.debug("Returning result of process instance search: {}", processInstanceList); return processInstanceList; }
public ProcessInstanceList getProcessInstances(List<Integer> status, String initiator, String processName, Integer page, Integer pageSize, String sort, boolean sortOrder) { if (sort == null || sort.isEmpty()) { sort = "ProcessInstanceId"; } if (status == null || status.isEmpty()) { status = new ArrayList<Integer>(); status.add(ProcessInstance.STATE_ACTIVE); } Collection<ProcessInstanceDesc> instances = null; if (processName != null && !processName.isEmpty()) { logger.debug("About to search for process instances with process name '{}' with page {} and page size {}", processName, page, pageSize); instances = runtimeDataService.getProcessInstancesByProcessName(status, processName, nullEmpty(initiator), buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process instances for process name '{}', statuses '{}'", instances.size(), processName, status); } else { logger.debug("About to search for process instances with page {} and page size {}", page, pageSize); instances = runtimeDataService.getProcessInstances(status, nullEmpty(initiator), buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process instances , statuses '{}'", instances.size(), status); } ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances); logger.debug("Returning result of process instance search: {}", processInstanceList); return processInstanceList; }
public QueryDefinitionList getQueries(Integer page, Integer pageSize) throws QueryNotFoundException { List<org.jbpm.services.api.query.model.QueryDefinition> queries = queryService.getQueries(buildQueryContext(page, pageSize)); return convertToQueryDefinitionList(queries); }
public TaskSummaryList getTasksByVariables(String userId, String variableName, String variableValue, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder) { userId = getUser(userId); List<Status> taskStatuses = buildTaskStatuses(status); if (taskStatuses == null) { taskStatuses = new ArrayList<Status>(); taskStatuses.add(Status.Ready); taskStatuses.add(Status.Reserved); taskStatuses.add(Status.InProgress); } List<TaskSummary> instances = null; if (variableValue != null && !variableValue.isEmpty()) { logger.debug("About to search for tasks that has variable '{}' with value '{}' with page {} and page size {}", variableName, variableValue, page, pageSize); instances = runtimeDataService.getTasksByVariableAndValue(userId, variableName, variableValue, taskStatuses, buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} tasks with variable {} and variable value {}", instances.size(), variableName, variableValue); } else { logger.debug("About to search for tasks that has variable '{}' with page {} and page size {}", variableName, page, pageSize); instances = runtimeDataService.getTasksByVariable(userId, variableName, taskStatuses, buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} tasks with variable {} ", instances.size(), variableName); } TaskSummaryList taskSummaryList = convertToTaskSummaryList(instances); logger.debug("Returning result of task by variable search: {}", taskSummaryList); return taskSummaryList; }
public ProcessDefinitionList getProcessesByDeploymentId(String containerId, Integer page, Integer pageSize, String sort, boolean sortOrder) { try { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); logger.debug("About to search for process definitions within container '{}' with page {} and page size {}", containerId, page, pageSize); if (sort == null || sort.isEmpty()) { sort = "ProcessName"; } Collection<ProcessDefinition> definitions = runtimeDataService.getProcessesByDeploymentId(containerId, buildQueryContext(page, pageSize, sort, sortOrder)); logger.debug("Found {} process definitions within container '{}'", definitions.size(), containerId); ProcessDefinitionList processDefinitionList = convertToProcessList(definitions); logger.debug("Returning result of process definition search: {}", processDefinitionList); return processDefinitionList; } catch (IllegalArgumentException e) { // container was not found by locator return new ProcessDefinitionList(); } }
public Object query(String queryName, String mapper, String orderBy, Integer page, Integer pageSize) { QueryResultMapper<?> resultMapper = QueryMapperRegistry.get().mapperFor(mapper, null); QueryContext queryContext = buildQueryContext(page, pageSize); if (orderBy != null && !orderBy.isEmpty()) { String[] orderBySortOrderItems = orderBy.split(","); if (orderBySortOrderItems.length > 1) { logger.debug("-- query() > orderBy clause = {} ", orderBy); queryContext = new AdvancedQueryContext(queryContext, orderBy); } else { logger.debug("-- query() > sortBy = {}", orderBy); queryContext.setOrderBy(orderBy); queryContext.setAscending(true); } } logger.debug("About to perform query '{}' with sorting criteria '{}' and page {} and page size {}", queryName, orderBy, page, pageSize); Object result = queryService.query(queryName, resultMapper, queryContext); logger.debug("Result returned from the query {} mapped with {}", result, resultMapper); return transform(result, resultMapper); }
@SuppressWarnings("unchecked") public Object queryFilteredWithBuilder(String containerId, String queryName, String mapper, String builder, Integer page, Integer pageSize, String payload, String marshallingType) { Map<String, String> columnMapping = null; QueryContext queryContext = buildQueryContext(page, pageSize); Map<String, Object> queryParameters = new HashMap<String, Object>(); String orderBy = null;
Map<String, String> columnMapping = null; QueryContext queryContext = buildQueryContext(page, pageSize); QueryFilterSpec filterSpec = new QueryFilterSpec();
public <T> T getWithFilters(Integer page, Integer pageSize, QueryCallback queryCallback, RequestCallback reqCallback) { QueryParam[] params = new QueryParam[0]; Map<String, String> columnMapping = null; QueryContext queryContext = buildQueryContext(page, pageSize); BaseQueryFilterSpec filterSpec = reqCallback.getQueryFilterSpec(); if (filterSpec != null) { queryContext.setOrderBy(filterSpec.getOrderBy()); queryContext.setAscending(filterSpec.isAscending()); // build parameters for filtering the query if (filterSpec.getParameters() != null) { params = new QueryParam[filterSpec.getParameters().length]; int index = 0; for (org.kie.server.api.model.definition.QueryParam param : filterSpec.getParameters()) { params[index] = new QueryParam(param.getColumn(), param.getOperator(), param.getValue()); index++; } } } QueryResultMapper<?> resultMapper = QueryMapperRegistry.get().mapperFor(queryCallback.getMapperName(), columnMapping); logger.debug("About to perform query '{}' with page {} and page size {}", queryCallback.getQueryName(), page, pageSize); Object result = queryService.query(queryCallback.getQueryName(), resultMapper, queryContext, params); logger.debug("Result returned from the query {} mapped with {}", result, resultMapper); return (T) transform(result, resultMapper); }