@Override
public void evaluate(Property component, WidgetElement element) throws Exception {
if (!component.isReadOnly()) {
ProcessInstanceAttribute attribute = fetchOrCreateAttribute(element);
if (component instanceof FileUploadComponent) {
ProcessInstanceAttachmentAttribute attachment = (ProcessInstanceAttachmentAttribute) component.getValue();
if (attachment==null) return;
attachment.setProcessState(task.getTaskName());
attachment.setProcessInstance(task.getProcessInstance());
attachment.setKey(attribute.getKey());
PropertyUtils.setProperty(processAttributes, element.getBind(), component.getValue());
} else if (attribute instanceof ProcessInstanceSimpleAttribute) {
if (element instanceof DateWidgetElement) {
String dateString = null;
if (component.getValue() != null)
dateString = new SimpleDateFormat(((DateWidgetElement) element).getFormat()).format(component.getValue());
((ProcessInstanceSimpleAttribute) attribute).setValue(dateString);
} else if (component.getValue() != null) {
((ProcessInstanceSimpleAttribute) attribute).setValue(component.getValue().toString());
}
} else {
PropertyUtils.setProperty(processAttributes, element.getBind(), component.getValue());
}
}
}
};