@Override public void loadData(final BpmTask task) { boundProperties.clear(); dictContainers.clear(); if (Strings.hasText(widgetsDefinition)) { widgetsDefinitionElement = (WidgetsDefinitionElement) definitionLoader.unmarshall(widgetsDefinition); } this.processInstance = task.getProcessInstance(); processAttributes.clear(); for (ProcessInstanceAttribute attribute : processInstance.getProcessAttributes()) { processAttributes.put(attribute.getKey(), attribute); } }
processAttributes.clear(); for (ProcessInstanceAttribute attribute : pi.getProcessAttributes()) { processAttributes.put(attribute.getKey(), attribute);
@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()); } } } };