@Override protected void checkQueryOk() { super.checkQueryOk(); // In case historic query variables are included, an additional order-by // clause should be added // to ensure the last value of a variable is used if (includeProcessVariables || includeTaskLocalVariables) { this.orderBy(HistoricTaskInstanceQueryProperty.INCLUDED_VARIABLE_TIME).asc(); } }
@Override protected void checkQueryOk() { super.checkQueryOk(); // In case historic query variables are included, an additional order-by // clause should be added // to ensure the last value of a variable is used if (includeProcessVariables || includeTaskLocalVariables) { this.orderBy(HistoricTaskInstanceQueryProperty.INCLUDED_VARIABLE_TIME).asc(); } }
@Override protected void checkQueryOk() { super.checkQueryOk(); // In case historic query variables are included, an additional order-by clause should be added // to ensure the last value of a variable is used if (includeProcessVariables || includeTaskLocalVariables) { this.orderBy(HistoricTaskInstanceQueryProperty.INCLUDED_VARIABLE_TIME).asc(); } }
private BpmTask getMostRecentProcessHistoryTask(final ProcessInstance pi, final UserData user, final Calendar minDate, ProcessToolContext ctx) { HistoryService hs = getProcessEngine().getHistoryService(); HistoricTaskInstanceQuery q = hs.createHistoricTaskInstanceQuery() .taskAssignee(user.getLogin()) .processInstanceId(pi.getInternalId()); q = q.orderByHistoricTaskInstanceEndTime().asc(); List<HistoricTaskInstance> tasks = q.list(); List<HistoricTaskInstance> pastTasks = new ArrayList<HistoricTaskInstance>(); for (HistoricTaskInstance task : tasks) { if (task.getEndTime() != null && task.getEndTime().compareTo(minDate.getTime()) > 0) { pastTasks.add(task); } } if (pastTasks.isEmpty()) return null; MutableBpmTask task = collectHistoryActivity(pastTasks.get(0), pi, user); String endTaskName = findEndActivityName(pi, ctx); if (Strings.hasText(endTaskName)) { task.setTaskName(endTaskName); } return task; }
q = q.taskName(taskNames.iterator().next()); q = q.orderByHistoricTaskInstanceEndTime().asc();