/** * Removes an attribute from the workitem. */ public void removeAttribute (final String attributeName) { this.attributes.remove(attributeName); touch(); }
/** * 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(); }