private Date getValidForDate(WidgetElement element) throws Exception { Date validForDate = processInstance.getCreateDate(); if (Strings.hasText(element.getValidFor())) { String[] splits = element.getValidFor().split(":"); if (splits.length != 2) { throw new IllegalArgumentException("Error while loading values for " + (nvl(element.getGlobal(), false) ? "global" : "process") + " dictionary[" + element.getDict() + "], provider[" + element.getProvider() + "]: " + "Illegal argument: " + element.getValidFor() + " for element: " + element.getClass().getName()); } String controlChar = splits[0]; String validFor = splits[1]; DateFormat dateFormat = VaadinUtility.simpleDateFormat(); if ("d".equalsIgnoreCase(controlChar) && !"current".equalsIgnoreCase(validFor)) { validForDate = dateFormat.parse(validFor); } else if ("a".equalsIgnoreCase(controlChar)) { Object attributeValue = PropertyUtils.getProperty(processAttributes, validFor); if (attributeValue instanceof String) { validForDate = dateFormat.parse(validFor); } else if (attributeValue instanceof Date) { validForDate = (Date) attributeValue; } else { throw new IllegalArgumentException("Unable to date from property: " + validFor + "for element: " + element.getClass().getName()); } } } return validForDate; }
{"instance_keyword", processInstance.getKeyword()}, {"instance_state", processInstance.getState()},//TODO remember about multiple states (when BpmTask is merged) {"instance_create_date", formatShortDate(processInstance.getCreateDate())}, }); ProcessDefinitionConfig def = processInstance.getDefinition();