/** * Turns a map into a StringMapAttribute (may easily be used in * conjunction with workitem.SetAttributes(x)) */ public static StringMapAttribute java2attributes (final java.util.Map m) { final StringMapAttribute result = new StringMapAttribute(); fillMap(result, m); return result; }
public Attribute decode (final Object o, final java.util.Map args) throws CodingException { final org.jdom.Element elt = enforceElement(o); final StringMapAttribute ma = new StringMapAttribute(); fillMap(ma, elt); return ma; }
/** * Turns a java bean into a StringMapAttribute. */ public static StringMapAttribute bean2owfe (final Object o) { final StringMapAttribute sma = new StringMapAttribute(); // // class name sma.puts(A_BEAN_CLASSNAME, o.getClass().getName()); // // fields final java.util.Iterator it = ReflectionUtils.listReadWriteFields(o).iterator(); while (it.hasNext()) resolveGet(sma, o, (Method[])it.next()); return sma; }
private InFlowWorkItem prepareSubWorkitem (final InFlowWorkItem parentWi) { final String sFields = lookupAttribute(A_FIELDS, parentWi); final InFlowWorkItem newWi = (InFlowWorkItem)parentWi.clone(); if (sFields == null) return newWi; newWi.setAttributes(new StringMapAttribute()); String[] fields = sFields.split(", *"); for (int i=0; i<fields.length; i++) { if (log.isDebugEnabled()) log.debug("prepareFields() considering '"+fields[i]+"'..."); if (fields[i].indexOf("=") > -1) addFieldWithValue(fields[i], newWi); else if (fields[i].indexOf(" as ") > -1) addFieldAlias(fields[i], parentWi, newWi); else addFieldsFromRegex(fields[i], parentWi, newWi); } return newWi; }
/** * Adds a brand new attribute, if the attribute with the same * name already exists, an instance of AttributeException will be * thrown. */ public void addAttribute (final String attributeName, final Attribute attributeValue) throws AttributeException { if (this.attributes == null) this.attributes = new StringMapAttribute(1); if (this.attributes.stringKeySet().contains(attributeName)) { throw new AttributeException ("WorkItem already contains an attribute named '"+ attributeName+"'"); } this.attributes.put(attributeName, attributeValue); touch(); }
/** * A shortcut method for * getAttributes().put(new StringAttribute(attributeName, attributeValue)); * It will throw an AttributeException if there is not already * an attribute named as attributeName. See AddAttribute() if * you really want to add a new attribute... */ public void setAttribute (final String attributeName, final Attribute attributeValue) throws AttributeException { if (this.attributes == null) this.attributes = new StringMapAttribute(1); if ( ! this.attributes.stringKeySet().contains(attributeName)) { throw new AttributeException ("WorkItem doesn't contain any attribute named '"+ attributeName+"'"); } this.attributes.put(attributeName, attributeValue); touch(); }
result = (StringMapAttribute)a; else result = new StringMapAttribute();
(new StringMapAttribute(workItem.getAttributes().size()));
li.setAttributes(new StringMapAttribute()); li.setLastModified(Time.toIsoDate());
final StringMapAttribute attributes = new StringMapAttribute();
StringMapAttribute attributes = new StringMapAttribute();