@Override public String getSimpleAttributeValue(String key,ProcessInstance processInstance){ long start = System.currentTimeMillis(); ProcessInstanceSimpleAttribute pisa = getSimpleAttribute(key,processInstance); long duration = System.currentTimeMillis() - start; logger.severe("getSimpleAttributeValue: " + duration); return pisa.getValue(); }
public ProcessInstanceSimpleAttribute(String key, String value) { setKey(key); setValue(value); setBpmVariableName(key); }
public void setSimpleAttribute(String key, String value) { ProcessInstanceSimpleAttribute attr = (ProcessInstanceSimpleAttribute)findAttributeByKey(key); if (attr != null) { attr.setValue(value); } else { addAttribute(new ProcessInstanceSimpleAttribute(key, value)); } }
@Override public Collection<ProcessInstanceSearchAttribute> getAttributes() { return Arrays.asList( new ProcessInstanceSearchAttribute(getKey(), value, false), new ProcessInstanceSearchAttribute(getBpmVariableName(), value, false) ); } }
@Override public ProcessInstanceSimpleAttribute setSimpleAttribute(String key, String newValue, ProcessInstance processInstance){ ProcessInstanceSimpleAttribute pisa = getSimpleAttribute(key,processInstance); if(pisa==null){ return null; } pisa.setValue(newValue); session.update(pisa); return pisa; }
@Override public String getBpmVariableName() { return bpmVariableName != null ? bpmVariableName : getKey(); }
attribute = hasText(element.getInheritedAttributeClass()) ? (ProcessInstanceAttribute) getClass().getClassLoader().loadClass(element.getInheritedAttributeClass()).newInstance() : new ProcessInstanceSimpleAttribute(); attribute.setProcessInstance(processInstance); attribute.setKey(attributeName);
@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()); } } } };
private void checkExistenceOfKey(final String internalId,String key) throws AperteWsWrongArgumentException{ List<ProcessInstanceSimpleAttribute> simpleAttributesList = getSimpleAttributesList(internalId); for (ProcessInstanceSimpleAttribute processInstanceSimpleAttribute : simpleAttributesList) { if (processInstanceSimpleAttribute.getKey().equals(key)){ return; } } AperteWrongArgumentCodes.SIMPLE_ATTRIBUTE.throwAperteWebServiceException(); }
public String getSimpleAttributeValue(String key) { ProcessInstanceAttribute attr = findAttributeByKey(key); return attr != null ? ((ProcessInstanceSimpleAttribute)attr).getValue() : null; }
public String getSimpleAttributeValue(String key, String default_) { ProcessInstanceAttribute attr = findAttributeByKey(key); return attr != null ? ((ProcessInstanceSimpleAttribute)attr).getValue() : default_; }
public String getInheritedSimpleAttributeValue(String key, String default_) { for (ProcessInstance pi = this; pi != null; pi = pi.getParent()) { ProcessInstanceAttribute attr = findAttributeByKey(key); if (attr instanceof ProcessInstanceSimpleAttribute) { return ((ProcessInstanceSimpleAttribute)attr).getValue(); } } return default_; }
private Link createLink(LinkWidgetElement we) { Link link = new Link(); link.setTargetName("_blank"); String url = we.getUrl(); if(url.matches("#\\{.*\\}")){ String urlKey = url.replaceAll("#\\{(.*)\\}", "$1"); if(processAttributes.containsKey(urlKey)) url = ((ProcessInstanceSimpleAttribute)processAttributes.get(urlKey)).getValue(); } link.setResource(new ExternalResource(url)); return link; }
@Override protected void showValidationErrorsOrSave(final WidgetContextSupport support, final Map<ProcessToolDataWidget, Collection<String>> validationErrors) { if(url.matches("#\\{.*\\}")){ String urlKey = url.replaceAll("#\\{(.*)\\}", "$1"); ProcessInstanceAttribute attr = task.getProcessInstance().findAttributeByKey(urlKey); if(attr != null) url = ((ProcessInstanceSimpleAttribute)attr).getValue(); } getApplication().getMainWindow().open(new ExternalResource(url), "_new"); }
((ProcessInstanceSimpleAttribute) value).getValue() : value; if (value != null) { boolean readonly = component.isReadOnly();