use of org.flowable.task.api.history.HistoricTaskInstance in project syncope by apache.
the class FlowableUserWorkflowAdapter method getForms.
protected <T extends Query<?, ?>, U extends Object> List<WorkflowFormTO> getForms(final Query<T, U> query) {
List<WorkflowFormTO> forms = new ArrayList<>();
query.list().forEach(obj -> {
try {
if (obj instanceof HistoricTaskInstance) {
forms.add(getFormTO((HistoricTaskInstance) obj));
} else if (obj instanceof Task) {
forms.add(getFormTO((Task) obj));
} else {
throw new FlowableException("Failure retrieving form", new IllegalArgumentException("Invalid task type"));
}
} catch (FlowableException e) {
LOG.debug("No form found for task {}", obj, e);
}
});
return forms;
}
use of org.flowable.task.api.history.HistoricTaskInstance in project syncope by apache.
the class FlowableUserWorkflowAdapter method getFormTO.
protected WorkflowFormTO getFormTO(final HistoricTaskInstance task) {
final List<HistoricFormPropertyEntity> props = new ArrayList<>();
engine.getHistoryService().createHistoricDetailQuery().taskId(task.getId()).list().stream().filter(historicDetail -> (historicDetail instanceof HistoricFormPropertyEntity)).forEachOrdered(historicDetail -> {
props.add((HistoricFormPropertyEntity) historicDetail);
});
WorkflowFormTO formTO = getHistoricFormTO(task.getProcessInstanceId(), task.getId(), task.getFormKey(), props);
BeanUtils.copyProperties(task, formTO);
HistoricActivityInstance historicActivityInstance = engine.getHistoryService().createHistoricActivityInstanceQuery().executionId(task.getExecutionId()).activityType("userTask").activityName(task.getName()).singleResult();
if (historicActivityInstance != null) {
formTO.setCreateTime(historicActivityInstance.getStartTime());
formTO.setDueDate(historicActivityInstance.getEndTime());
}
return formTO;
}
Aggregations