use of org.flowable.engine.impl.persistence.entity.HistoricFormPropertyEntity in project syncope by apache.
the class FlowableUserWorkflowAdapter method getHistoricFormTO.
protected WorkflowFormTO getHistoricFormTO(final String processInstanceId, final String taskId, final String formKey, final List<HistoricFormPropertyEntity> props) {
WorkflowFormTO formTO = new WorkflowFormTO();
User user = userDAO.findByWorkflowId(processInstanceId);
if (user == null) {
throw new NotFoundException("User with workflow id " + processInstanceId);
}
formTO.setUsername(user.getUsername());
formTO.setTaskId(taskId);
formTO.setKey(formKey);
formTO.setUserTO(engine.getRuntimeService().getVariable(processInstanceId, USER_TO, UserTO.class));
formTO.setUserPatch(engine.getRuntimeService().getVariable(processInstanceId, USER_PATCH, UserPatch.class));
props.stream().map(prop -> {
WorkflowFormPropertyTO propertyTO = new WorkflowFormPropertyTO();
propertyTO.setId(prop.getPropertyId());
propertyTO.setName(prop.getPropertyId());
propertyTO.setValue(prop.getPropertyValue());
return propertyTO;
}).forEachOrdered(propertyTO -> {
formTO.getProperties().add(propertyTO);
});
return formTO;
}
use of org.flowable.engine.impl.persistence.entity.HistoricFormPropertyEntity 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