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 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 TaskSummaryList getTasksByStatusByProcessInstanceId(Number processInstanceId, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder) { List<Status> taskStatuses = buildTaskStatuses(status); if (taskStatuses == null) { taskStatuses = new ArrayList<Status>(); taskStatuses.add(Status.Ready); taskStatuses.add(Status.Reserved); taskStatuses.add(Status.InProgress); } logger.debug("About to search for tasks attached to process instance with id '{}'", processInstanceId); List<TaskSummary> tasks = runtimeDataService.getTasksByStatusByProcessInstanceId(processInstanceId.longValue(), taskStatuses, buildQueryFilter(page, pageSize, sort, sortOrder)); logger.debug("Found {} tasks attached to process instance with id '{}'", tasks.size(), processInstanceId); TaskSummaryList result = convertToTaskSummaryList(tasks); return result; }
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 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; }
actualResult = convertToProcessInstanceCustomVarsList((Collection<ProcessInstanceCustomDesc>) result); } else if (ProcessInstanceWithVarsDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToProcessInstanceWithVarsList((Collection<ProcessInstanceWithVarsDesc>) result); } else if (ProcessInstanceDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToProcessInstanceList((Collection<ProcessInstanceDesc>) result); } else if (UserTaskInstanceWithVarsDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskInstanceWithVarsList((Collection<UserTaskInstanceWithVarsDesc>) result); } else if (UserTaskInstanceWithPotOwnerDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskInstanceListPO((Collection<UserTaskInstanceWithPotOwnerDesc>) result); } else if (UserTaskInstanceDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskInstanceList((Collection<UserTaskInstanceDesc>) result); } else if (TaskSummary.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskSummaryList((Collection<TaskSummary>) result); } else if (ExecutionError.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToErrorInstanceList((List<ExecutionError>) result); } else if (List.class.isAssignableFrom(resultMapper.getType())) {
actualResult = convertToProcessInstanceWithVarsList((Collection<ProcessInstanceWithVarsDesc>) result); } else if (ProcessInstanceDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToProcessInstanceList((Collection<ProcessInstanceDesc>) result); } else if (UserTaskInstanceWithVarsDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskInstanceWithVarsList((Collection<UserTaskInstanceWithVarsDesc>) result); } else if (UserTaskInstanceDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskInstanceList((Collection<UserTaskInstanceDesc>) result); } else if (TaskSummary.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskSummaryList((Collection<TaskSummary>) result); } else if (List.class.isAssignableFrom(resultMapper.getType())) {
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 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 TaskSummaryList getTasksAssignedAsPotentialOwner(List<String> status, List<String> groupIds, String userId, Integer page, Integer pageSize, String sort, boolean sortOrder, String filter) { List<Status> taskStatuses = buildTaskStatuses(status); userId = getUser(userId); logger.debug("About to search for task assigned as potential owner for user '{}'", userId); List<TaskSummary> tasks; QueryFilter queryFilter = buildTaskByNameQueryFilter(page, pageSize, sort, sortOrder, filter); if (groupIds != null && !groupIds.isEmpty()) { if (taskStatuses == null) { tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(userId, groupIds, queryFilter); } else { tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(userId, groupIds, taskStatuses, queryFilter); } } else if (taskStatuses != null) { tasks = runtimeDataService.getTasksAssignedAsPotentialOwnerByStatus(userId, taskStatuses, queryFilter); } else { tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(userId, queryFilter); } logger.debug("Found {} tasks for user '{}' assigned as potential owner", tasks.size(), userId); TaskSummaryList result = convertToTaskSummaryList(tasks); return result; }
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 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); }
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; }
List<TaskEvent> tasks = runtimeDataService.getTaskEvents(taskId, buildQueryFilter(page, pageSize, sort, sortOrder));
actualResult = convertToProcessInstanceWithVarsList((Collection<ProcessInstanceWithVarsDesc>) result); } else if (ProcessInstanceDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToProcessInstanceList((Collection<ProcessInstanceDesc>) result); } else if (UserTaskInstanceWithVarsDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskInstanceWithVarsList((Collection<UserTaskInstanceWithVarsDesc>) result); } else if (UserTaskInstanceDesc.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskInstanceList((Collection<UserTaskInstanceDesc>) result); } else if (TaskSummary.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToTaskSummaryList((Collection<TaskSummary>) result); } else if (ExecutionError.class.isAssignableFrom(resultMapper.getType())) { actualResult = convertToErrorInstanceList((List<ExecutionError>) result); } else if (List.class.isAssignableFrom(resultMapper.getType())) {
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 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(); } }
@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;
List<AuditTask> tasks = runtimeDataService.getAllAuditTask(userId, buildQueryFilter(page, pageSize, sort, sortOrder));
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; }