public UserAttribute findAttributeRecursive(final String key) { UserAttribute found = findAttribute(key); if (found == null) { for (UserAttribute a : getAttributes()) { found = a.findAttributeRecursive(key); if (found != null) { break; } } } return found; }
public String findAttributeValueRecursive(String key) { UserAttribute a = findAttributeRecursive(key); return a != null ? a.getValue() : null; }
public void setSimpleAttribute(String key, String value) { ProcessInstanceSimpleAttribute attr = (ProcessInstanceSimpleAttribute)findAttributeByKey(key); if (attr != null) { attr.setValue(value); } else { addAttribute(new ProcessInstanceSimpleAttribute(key, value)); } }
public String getCreator() { return processInstance != null ? processInstance.getCreator().getLogin() : null; }
@Override public void saveData(BpmTask task) { task.getProcessInstance().getRootProcessInstance().setSimpleAttribute("markedImportant", String.valueOf(markProcessImportant)); // override }
UserAttribute addInternal(UserAttribute a) { if (a.getParent() != null) { a.getParent().getAttributes().remove(a); } getAttributes().add(a); if (getUser() != null) { getUser().addChild(a); } a.setUser(getUser()); a.setParent(getChildParent()); return a; }
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_; }
/** Method checks if the process is in running or new state */ public boolean isProcessRunning() { if(getStatus() == null) return false; if(getRunning() != null && !getRunning()) return false; return getStatus().equals(ProcessStatus.NEW) || getStatus().equals(ProcessStatus.RUNNING); }
public void addDictionaryAttributeItem(String dictionary, String key, String value){ ProcessInstanceDictionaryAttribute attr = (ProcessInstanceDictionaryAttribute)findAttributeByKey(dictionary); if (attr == null) { addAttribute(attr = new ProcessInstanceDictionaryAttribute(dictionary)); } attr.put(key, value); }
public String getSimpleAttributeValue(String key, String default_) { ProcessInstanceAttribute attr = findAttributeByKey(key); return attr != null ? ((ProcessInstanceSimpleAttribute)attr).getValue() : default_; }
void clearAttribute(UserData user, UserAttribute a) { a.removeAllAttributes(); a.setParent(null); a.setUser(null); user.addOrphan(a); }
public UserAttribute setAttribute(UserAttribute attribute, String oldValue) { return modifyOrAddAttribute(findAttribute(attribute.getKey(), oldValue), attribute); }
@Override public UserAttribute findAttribute(final String key) { return findAttribute(getMainAttributes(), UserAttributePredicates.matchKey(key)); }
@Override public UserAttribute findAttribute(final String key, final String value) { return findAttribute(getMainAttributes(), UserAttributePredicates.matchKeyValue(key, value)); }
protected UserAttribute modifyOrAddAttribute(UserAttribute attribute, String key, String value) { if (attribute == null) { return addInternal(new UserAttribute(key, value)); } attribute.setValue(value); return attribute; }
public String findAttributeValue(String key) { UserAttribute a = findAttribute(key); return a != null ? a.getValue() : null; }
public boolean containsAttributes(final String... keys) { return containsAttributes(new HashSet<String>() {{ for (String key : keys) { add(key); } }}); }
private void removeMatched(final UserAttribute a) { removeMatched(new HashSet<UserAttribute>() {{ add(a); }}); }
public void removeAttribute(final UserAttribute a) { removeAttribute(UserAttributePredicates.matchEntity(a)); }
public UserAttribute findAttributeRecursive(final String key, final String value) { UserAttribute found = findAttribute(key, value); if (found == null) { for (UserAttribute a : getAttributes()) { found = a.findAttributeRecursive(key, value); if (found != null) { break; } } } return found; }