/** * Puts an entry composed of two strings (a StringAttribute will also * be created for the value). */ public void puts (final String key, final String value) { getMap().put(new StringAttribute(key), new StringAttribute(value)); }
/** * Removes a given entry. */ public void remove (final String key) { log.debug("remove() key '"+key+"'"); getMap().remove(new StringAttribute(key)); }
/** * Returns the attribute corresponding to the given String key. */ public Attribute aget (final String key) { return (Attribute)getMap().get(new StringAttribute(key)); }
/** * Puts in the map a new entry. A previous entry with the same key name * will get overriden. */ public void aput (final String key, final Attribute value) { getMap().put(new StringAttribute(key), value); }
/** * The implementation of cget() as defined in the parent * class CollectionAttribute. */ public Attribute cget (final String key) { if (key.equals(K_KEYSET)) return new ListAttribute(this.map.keySet()); return (Attribute)this.map.get(new StringAttribute(key)); }
/** * The equivalent of put(new StringAttribute(key), value). But this * is mainly a method required by CollectionAttribute, the parent class. * This method is used by setField in CollectionAttribute, * it has thus an internal value rather than an API value. */ public void cput (final String key, final Attribute value) { this.put(new StringAttribute(key), value); }
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)); }
public Attribute decode (final Object o, final java.util.Map args) throws CodingException { final org.jdom.Element elt = enforceElement(o); return new StringAttribute(XmlUtils.fetchTextContent(elt)); }
/** * Returns a copy of this StringAttribute. */ public Object clone () { try { return new StringAttribute (new String (toString().getBytes(Utils.getEncoding()), Utils.getEncoding())); } catch (final java.io.UnsupportedEncodingException e) { throw new IllegalArgumentException ("clone() failure "+e); } }
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); } }
private static void fillMap (final MapAttribute ma, final java.util.Map m) { java.util.Iterator it = m.keySet().iterator(); while (it.hasNext()) { Object k = it.next(); Object v = m.get(k); if (ma instanceof StringMapAttribute) ma.put(new StringAttribute(k.toString()), java2owfe(v)); else ma.put(java2owfe(k), java2owfe(v)); } }
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); } }
/** * assign work item to a user, if userName = "", then assignment for the workItem will be deleted. */ public static void assignWorkItemToUser(InFlowWorkItem wi, String userName) { if (userName == null) { log.info("User name was null"); return; } try { wi.addAttribute(WorkflowConstants.ATTRIBUTE_ASSIGN_TO, new StringAttribute(userName)); getWorkItemStore().storeWorkItem(StringUtils.EMPTY, wi); } catch (Exception e) { log.error("assign work item to user " + userName + " failed.)", e); } }
/** * Simply launch a flow for the specified node. */ public static void launchFlow(String repository, String path, String flowName) throws Exception { try { // Get the references LaunchItem li = new LaunchItem(); // start activation if (repository != null) { li.addAttribute(Context.ATTRIBUTE_REPOSITORY, new StringAttribute(repository)); } if (path != null) { li.addAttribute(Context.ATTRIBUTE_PATH, new StringAttribute(path)); } launchFlow(li, flowName); // Launch the item } catch (Exception e) { log.error("Launching flow " + flowName + " failed", e); } }
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); }
private static Attribute toAttribute (final org.jdom.Content c) { if (c == null) return null; if (c instanceof org.jdom.Text) return new StringAttribute(((org.jdom.Text)c).getText()); return new XmlAttribute((org.jdom.Content)c.clone()); }
private static Object increment (Object val, Object inc) { Object originalVal = val; val = refineValue(val); inc = refineValue(inc); Object result = refinedIncrement(val, inc); if (originalVal instanceof Attribute) { if (result instanceof Long) return new LongAttribute((Long)result); if (result instanceof Double) return new DoubleAttribute((Double)result); return new StringAttribute(result.toString()); } //log.debug("increment() new value = "+result); return result; }
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; }
private void applyNextChild (final InFlowWorkItem wi) throws ApplyException { //log.debug("applyNextChild() childIndex : "+this.childIndex); final Object child = this.getChildren().get(this.childIndex); this.childIndex++; this.storeItself(); if (child instanceof String) { final String s = substituteText((String)child, wi); //log.debug("applyNextChild() s is >"+s+"<"); this.tag(wi); ValueUtils.setResult(wi, new StringAttribute(s)); try { this.reply(wi); } catch (final ReplyException e) { throw new ApplyException("failed to go beyond next child", e); } return; } getExpressionPool().apply((FlowExpressionId)child, wi); }
public void apply (final InFlowWorkItem wi) throws ApplyException { if (getChildExpressionId() == null) // // no child { log.debug("apply() no child."); final String s = lookupAttribute(A_VALUE, wi); if (s != null) { ValueUtils.setResult(wi, new StringAttribute(s)); try { reply(wi); } catch (final ReplyException e) { throw new ApplyException ("failure", e); } return; } applyToParent(wi); return; } // // one child getExpressionPool().apply(getChildExpressionId(), wi); }