public void setAttribute (String attributeName, Attribute attributeValue) { this.attributes.put(attributeName, attributeValue); }
attributes.put (Header.SUBJECT, subject);
/** * This method is used by setField() internally. */ protected void putField (final String fieldName, final Attribute aValue) { //if (log.isDebugEnabled()) // log.debug("putField() '"+fieldName+"' -> '"+aValue+"'"); if (aValue == null) this.remove(fieldName); else this.put(fieldName, aValue); }
private static void resolveGet (final StringMapAttribute sma, final Object bean, final Method[] getAndSet) { try { final Object value = getAndSet[0].invoke(bean, new Object[] {}); final String attributeName = getAndSet[0].getName().substring(3); final Attribute aValue = java2owfe(value); if (aValue != null) sma.put(attributeName, aValue); } catch (final Throwable t) { log.warn ("resolveGet() failed to get value from "+ getAndSet[0].getName()+"()", t); } }
private void addFieldWithValue (final String assignation, //final InFlowWorkItem parentWi, final InFlowWorkItem newWi) { final String[] ss = assignation.split(" *= *"); final String fieldName = ss[0].trim(); final String value = ss[1].trim(); if (log.isDebugEnabled()) { log.debug ("addFieldWithValue() newWi['"+fieldName+"'] = '"+value+"'"); } newWi.getAttributes().put (new StringAttribute(fieldName), new StringAttribute(value)); }
/** * Sets the field '__boolean_result__' in the workitem. */ public static void setBooleanResult (final InFlowWorkItem wi, final boolean result) { //log.debug // ("setBooleanResult() '"+result+"' for "+wi.getLastExpressionId()); wi.getAttributes().put(F_RESULT, new BooleanAttribute(result)); }
private void addFieldAlias (final String aliasing, final InFlowWorkItem parentWi, final InFlowWorkItem newWi) { final String[] ss = aliasing.split(" *as *"); final String newFieldName = ss[0].trim(); final String parentFieldName = ss[1].trim(); final Attribute parentValue = parentWi.getAttribute(parentFieldName); if (parentValue != null) { newWi.getAttributes() .put(new StringAttribute(newFieldName), parentValue); } }
/** * Sets the field '__result__' in the workitem. */ public static void setResult (final InFlowWorkItem wi, final Object result) { wi.getAttributes().put(F_RESULT, AttributeUtils.java2owfe(result)); // the method java2owfe leaves the result untouched if // it's already an Attribute }
private void addFieldsFromRegex (final String regex, final InFlowWorkItem parentWi, final InFlowWorkItem newWi) { final java.util.Iterator it = parentWi.getAttributes().keyNamesMatching(regex).iterator(); while (it.hasNext()) { final String fieldName = ((String)it.next()).trim(); if (log.isDebugEnabled()) log.debug("prepareFields() adding field '"+fieldName+"'"); final Attribute a = parentWi.getAttribute(fieldName); newWi.getAttributes().put(new StringAttribute(fieldName), a); } }
private void expand (final InFlowWorkItem wi, final String fieldName, final String toFieldName, final Attribute a, String separator, final boolean trim) { if (separator.equals("|")) separator = "\\|"; // // there may be other special cases, but for now, it's sufficient // // do the job final String value = a.toString(); final String[] ss = value.split(separator); final ListAttribute la = new ListAttribute(ss.length); for (int i=0; i<ss.length; i++) { String s = ss[i]; if (trim) s = s.trim(); la.add(new StringAttribute(s)); if (log.isDebugEnabled()) log.debug("expand() "+i+" -> '"+s+"'"); } String fn = fieldName; if (toFieldName != null) fn = toFieldName; wi.getAttributes().put(fn, la); }
.put(Definitions.V_TIMED_OUT, new BooleanAttribute(true));
/** * 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(); }
private InFlowWorkItem doInsert (final InFlowWorkItem wi, final Object workitemSource, final String fieldName) { // // fetch workitem to restore final InFlowWorkItem restoredWorkitem = fetchWorkitemToRestore(workitemSource); if (restoredWorkitem == null) return wi; // // do insert wi.getAttributes().put (new StringAttribute(fieldName), restoredWorkitem.getAttributes()); return wi; }
(Attribute)source.getAttributes().aget(key).clone(); target.getAttributes().put(key, value);
.getLauncher(iteratingExpression.context()); wi.getAttributes().put (F_ITERATION_POSITION, new IntegerAttribute(this.iterationPosition));
.put(DESCRIPTION_FIELD_NAME, this.oldDescriptionValue);
workItem.getAttributes().put(fieldName, (Attribute)value);