public Attribute getAttribute (String attributeName) { return this.attributes.aget(attributeName); }
/** * Like get() but returns the attribute value as a String. */ public String sget (final String key) { final Attribute a = this.aget(key); if (a == null) return null; return a.toString(); }
/** * Returns the result held in the field '__result__'. */ public static Attribute getResult (final InFlowWorkItem wi) { return wi.getAttributes().aget(F_RESULT); }
/** * This is a particular iterator : it iterates on the value of a field * given by its name. * For instance, if in this StringMapAttribute you have a field named * 'toto' that points to a StringAttribute containing "foo, bar", * this method will return an iterator on [ "foo", "bar" ].<br> * Similarly, if 'toto' would point to a ListAttribute containing * [ new StringAttribute("foo2"), new StringAttribute("bar2") ], it * would return an iterator on [ "foo2", "bar2" ].<br> * If the fieldName points to nothing, null is returned. */ public java.util.Iterator fieldIterator (final String fieldName) { final Attribute a = this.aget(fieldName); if (a == null) return null; if (a instanceof ListAttribute) { final java.util.List l = AttributeUtils.list2java((ListAttribute)a); return l.iterator(); } final String[] ss = a.toString().trim().split(", *"); return java.util.Arrays.asList(ss).iterator(); }
public void consume (WorkItem wi) throws Exception { System.out.println("~~~ b"); System.out.println(" value : "+wi.getAttributes().sget("value")); Object bean = AttributeUtils .owfe2java(wi.getAttributes().aget("bean")); System.out.println (" bean ("+bean.getClass().getName()+ ") : "+bean.toString()); replyToEngine((InFlowWorkItem)wi); } });
private org.jdom.Content extractXmlFromField (final InFlowWorkItem wi, final String fieldName) throws Exception { final Attribute a = wi.getAttributes().aget(fieldName); if (a != null) { if (a instanceof StringAttribute) return XmlUtils.extractXmlElement(a.toString()); else if (a instanceof XmlAttribute) return ((XmlAttribute)a).getContent(); } return null; }
/** * Looks for a boolean result field in the workitem. * Used by the 'if' and the 'when' expression. */ public static boolean lookupBooleanResult (final InFlowWorkItem wi) throws ReplyException { final Attribute a = wi.getAttributes().aget(F_RESULT); if (a == null) { throw new ReplyException ("lookupBooleanVariable() no boolean result found"); } //log.debug("o.class is "+o.getClass().getName()); if (a instanceof BooleanAttribute) return ((BooleanAttribute)a).booleanValue(); return (a.toString().toLowerCase().equals("true")); /* throw new ReplyException ("lookupBooleanVariable() boolean value expected, "+ "found "+a.getClass()); */ }
(wi.getAttributes().aget(new StringAttribute(this.recipientField)), ", *");
final Attribute a = masterWi.getAttributes().aget(correlationField);
/** * Turns an OpenWFE attribute into a java instance */ public static Object owfe2java (final Attribute a) { if (a instanceof AtomicAttribute) return ((AtomicAttribute)a).getValue(); if (a instanceof StringMapAttribute) { final StringMapAttribute sma = (StringMapAttribute)a; final Attribute va = sma.aget(A_BEAN_CLASSNAME); if ((va != null) && (va instanceof StringAttribute)) return smap2bean(sma); } if (a instanceof MapAttribute) return map2java((MapAttribute)a); if (a instanceof ListAttribute) return list2java((ListAttribute)a); if (a instanceof FlowExpressionId) return FEI_PREFIX + ((FlowExpressionId)a).toParseableString(); return "null"; }
(Attribute)source.getAttributes().aget(key).clone();
if (fieldName != null) Attribute aRef = wi.getAttributes().aget(fieldName); String ref = null; if (aRef != null) ref = aRef.toString();