protected void assertHistoricTasksDeleteReason(ProcessInstance processInstance, String expectedDeleteReason, String ... taskNames) { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { for (String taskName : taskNames) { List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery() .processInstanceId(processInstance.getId()).taskName(taskName).list(); assertTrue(historicTaskInstances.size() > 0); for (HistoricTaskInstance historicTaskInstance : historicTaskInstances) { assertNotNull(historicTaskInstance.getEndTime()); if (expectedDeleteReason == null) { assertNull(historicTaskInstance.getDeleteReason()); } else { assertTrue(historicTaskInstance.getDeleteReason().startsWith(expectedDeleteReason)); } } } } }
assertEquals(processInstanceId, historicTaskInstance.getProcessInstanceId()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no start time", historicTaskInstance.getStartTime()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no end time", historicTaskInstance.getEndTime());
assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no create time", historicTaskInstance.getCreateTime()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no start time", historicTaskInstance.getStartTime()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no end time", historicTaskInstance.getEndTime());
properties.put(WorkflowModel.PROP_COMPLETION_DATE, historicTask.getEndTime());
properties.put(WorkflowModel.PROP_COMPLETION_DATE, historicTask.getEndTime());
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; }
List<HistoricTaskInstance> pastTasks = new ArrayList<HistoricTaskInstance>(); for (HistoricTaskInstance task : tasks) { if (task.getEndTime() != null && task.getEndTime().compareTo(minDate.getTime()) > 0) { pastTasks.add(task);
private MutableBpmTask collectHistoryActivity(HistoricTaskInstance task, ProcessInstance pi, UserData user) { MutableBpmTask t = new MutableBpmTask(); t.setProcessInstance(pi); t.setAssignee(user.getLogin()); t.setOwner(user); t.setTaskName(task.getName()); t.setInternalTaskId(null); t.setExecutionId(task.getExecutionId()); t.setCreateDate(task.getStartTime()); t.setFinishDate(task.getEndTime()); t.setFinished(task.getEndTime() != null); return t; }
protected void assertHistoricTasksDeleteReason(ProcessInstance processInstance, String expectedDeleteReason, String ... taskNames) { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { for (String taskName : taskNames) { List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery() .processInstanceId(processInstance.getId()).taskName(taskName).list(); assertTrue(historicTaskInstances.size() > 0); for (HistoricTaskInstance historicTaskInstance : historicTaskInstances) { assertNotNull(historicTaskInstance.getEndTime()); if (expectedDeleteReason == null) { assertNull(historicTaskInstance.getDeleteReason()); } else { assertTrue(historicTaskInstance.getDeleteReason().startsWith(expectedDeleteReason)); } } } } }
protected void addTaskItem(HistoricTaskInstance task, Table taskTable) { Item item = taskTable.addItem(task.getId()); if(task.getEndTime() != null) { item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22)); } else { item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22)); } item.getItemProperty("name").setValue(task.getName()); item.getItemProperty("priority").setValue(task.getPriority()); item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime(), true)); item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime(), true)); if(task.getDueDate() != null) { Label dueDateLabel = new PrettyTimeLabel(task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET), true); item.getItemProperty("dueDate").setValue(dueDateLabel); } if(task.getAssignee() != null) { Component taskAssigneeComponent = getTaskAssigneeComponent(task.getAssignee()); if(taskAssigneeComponent != null) { item.getItemProperty("assignee").setValue(taskAssigneeComponent); } } }
protected void addTaskItem(HistoricTaskInstance task, Table taskTable) { Item item = taskTable.addItem(task.getId()); if(task.getEndTime() != null) { item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22)); } else { item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22)); } item.getItemProperty("name").setValue(task.getName()); item.getItemProperty("priority").setValue(task.getPriority()); item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime(), true)); item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime(), true)); if(task.getDueDate() != null) { Label dueDateLabel = new PrettyTimeLabel(task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET), true); item.getItemProperty("dueDate").setValue(dueDateLabel); } if(task.getAssignee() != null) { Component taskAssigneeComponent = getTaskAssigneeComponent(task.getAssignee()); if(taskAssigneeComponent != null) { item.getItemProperty("assignee").setValue(taskAssigneeComponent); } } }
protected void addTaskItem(HistoricTaskInstance task, Table taskTable) { Item item = taskTable.addItem(task.getId()); if(task.getEndTime() != null) { item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22)); } else { item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22)); } item.getItemProperty("name").setValue(task.getName()); item.getItemProperty("priority").setValue(task.getPriority()); item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime(), true)); item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime(), true)); if(task.getDueDate() != null) { Label dueDateLabel = new PrettyTimeLabel(task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET), true); item.getItemProperty("dueDate").setValue(dueDateLabel); } if(task.getAssignee() != null) { Component taskAssigneeComponent = getTaskAssigneeComponent(task.getAssignee()); if(taskAssigneeComponent != null) { item.getItemProperty("assignee").setValue(taskAssigneeComponent); } } }
if(subTask.getEndTime() != null) { icon = new Embedded(null, Images.TASK_FINISHED_22); } else { subTaskLayout.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT); if(subTask.getEndTime() == null) {
assertEquals(processInstanceId, historicTaskInstance.getProcessInstanceId()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no start time", historicTaskInstance.getStartTime()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no end time", historicTaskInstance.getEndTime());
private TaskInfoBean transToTaskInfoBean(HistoricTaskInstance task) { TaskInfoBean taskInfoBean = new TaskInfoBean(); taskInfoBean.setTaskDefinitionKey(task.getTaskDefinitionKey()); taskInfoBean.setFormKey(task.getFormKey()); taskInfoBean.setProcessDefinitionId(task.getProcessDefinitionId()); taskInfoBean.setProcessInstanceId(task.getProcessInstanceId()); taskInfoBean.setTaskName(task.getName()); taskInfoBean.setTaskId(task.getId()); taskInfoBean.setAssigneeId(task.getAssignee()); taskInfoBean.setTaskCreateTime(task.getCreateTime()); taskInfoBean.setTaskEndTime(task.getEndTime()); taskInfoBean.setTaskOwner(task.getOwner()); HistoricProcessInstance historicInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).includeProcessVariables().singleResult(); taskInfoBean.setItemsName(historicInstance.getProcessDefinitionName()); taskInfoBean.setVariables(historicInstance.getProcessVariables()); return taskInfoBean; }
result.setDueDate(taskInstance.getDueDate()); result.setDurationInMillis(taskInstance.getDurationInMillis()); result.setEndTime(taskInstance.getEndTime()); result.setExecutionId(taskInstance.getExecutionId()); result.setFormKey(taskInstance.getFormKey());
assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no create time", historicTaskInstance.getCreateTime()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no start time", historicTaskInstance.getStartTime()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no end time", historicTaskInstance.getEndTime());