use of org.flowable.engine.form.FormProperty in project syncope by apache.
the class FlowableUserWorkflowAdapter method getFormTO.
@SuppressWarnings("unchecked")
protected WorkflowFormTO getFormTO(final String processInstanceId, final String taskId, final String formKey, final List<FormProperty> properties) {
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));
properties.stream().map(fProp -> {
WorkflowFormPropertyTO propertyTO = new WorkflowFormPropertyTO();
BeanUtils.copyProperties(fProp, propertyTO, PROPERTY_IGNORE_PROPS);
propertyTO.setType(fromFlowableFormType(fProp.getType()));
if (propertyTO.getType() == WorkflowFormPropertyType.Date) {
propertyTO.setDatePattern((String) fProp.getType().getInformation("datePattern"));
}
if (propertyTO.getType() == WorkflowFormPropertyType.Enum) {
propertyTO.getEnumValues().putAll((Map<String, String>) fProp.getType().getInformation("values"));
}
return propertyTO;
}).forEachOrdered(propertyTO -> {
formTO.getProperties().add(propertyTO);
});
return formTO;
}
Aggregations