/** * An alias for puts(). */ public void sput (final String key, final String value) { this.puts(key, value); }
final Attribute a = masterWi.getAttributes().aget(correlationField); result = new StringMapAttribute(); "correlationField contained "+result.size()+" sub-fields"); slaveWi.getAttributes().keySet().iterator(); while (it.hasNext()) result.put(key, (Attribute)slaveWi.getAttributes().get(key)); "correlationField now contains "+result.size()+" sub-fields"); masterWi.getAttributes().put(correlationField, result);
private void flatten (final InFlowWorkItem wi, final String fieldName, final String separator) { StringBuffer sb = new StringBuffer(); int i = 0; while (true) { final String fn = fieldName + UU + i; final String s = wi.getAttributes().sget(fn); if (i == 0 && s == null) { log.info("flatten() nothing to do (no field '"+fn+"')"); return; } if (s == null) break; if (sb.length() > 0) sb.append(separator); sb.append(s); wi.getAttributes().remove(fn); i++; } wi.getAttributes().puts(fieldName, sb.toString()); if (log.isDebugEnabled()) log.debug("flatten() '"+fieldName+"' -> '"+sb.toString()+"'"); }
public static void displayAttributes(StringMapAttribute sma) { for(Iterator i = sma.stringKeySet().iterator(); i.hasNext();) { String key = (String)i.next(); Attribute attr = (Attribute)sma.get(key); String attrType = attr.getClass().getName(); attrType = attrType.substring(attrType.lastIndexOf(".")+1); System.out.print("\n" + key + " [" + attr + "] (" + attrType + ")"); } }
/** * 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(); }
StringMapAttribute attributes = new StringMapAttribute(); attributes.puts (Header.WF_INSTANCE_ID, wi.getLastExpressionId().getWorkflowInstanceId()); attributes.puts (Header.WF_DEFINITION_NAME, wi.getLastExpressionId().getWorkflowDefinitionName()); attributes.puts (Header.WF_DEFINITION_REVISION, wi.getLastExpressionId().getWorkflowDefinitionRevision()); attributes.puts (Header.WF_DEFINITION_URL, wi.getLastExpressionId().getWorkflowDefinitionUrl()); attributes.puts (Header.DISPATCH_TIME, wi.getDispatchTime()); attributes.puts (Header.PARTICIPANT_NAME, wi.getParticipantName()); attributes.put (Header.SUBJECT, subject);
private boolean shouldBounceDirectly (final InFlowWorkItem wi) { final String sBounce = wi.getAttributes().sget(CORRELATION_BOUNCE); if (sBounce == null) return false; return (sBounce.equalsIgnoreCase("true")); }
(new StringMapAttribute(workItem.getAttributes().size())); java.util.Iterator it = workItem.getAttributes().keySet().iterator(); while (it.hasNext()) ( ! "".equals(getPermissions(attributeName)))) result.getAttributes().put (attributeName, (Attribute)workItem.getAttribute(attributeName).clone()); result.getAttributes().put (attributeName, (Attribute)workItem.getAttribute(attributeName).clone());
public static void main (String[] args) throws Exception { // // encoding InFlowWorkItem wi = new InFlowWorkItem(); wi.setId(new FlowExpressionId()); wi.getAttributes().puts("mf_fields", "color, size, quantity"); wi.getAttributes().puts("mf_header", "This is our offer"); wi.getAttributes().puts("mf_footer", "Best regards,\n\nJohn"); wi.getAttributes().puts("color", "blue"); wi.getAttributes().puts("size", "XL"); WorkItemCoder coder = new MailFormCoder(); String s = new String ((byte[])coder.encode(wi, null, null), Utils.getEncoding()); System.out.println(s); // // decoding wi = (InFlowWorkItem)coder .decode(new java.io.StringReader(s), null, null); System.out.println(); System.out.println("color : "+wi.getAttributes().sget("color")); System.out.println("size : "+wi.getAttributes().sget("size")); System.out.println("quantity : "+wi.getAttributes().sget("quantity")); }
public void setAttribute (String attributeName, Attribute attributeValue) { this.attributes.put(attributeName, attributeValue); }
public Attribute getAttribute (String attributeName) { return this.attributes.aget(attributeName); }
/** * 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; }
java.util.Iterator it = wi.getAttributes().stringKeySet().iterator(); while (it.hasNext()) context.put(k, wi.getAttributes().get(k).toString()); (wi.getAttributes().aget(new StringAttribute(this.recipientField)), ", *");
modifiedWorkItem.getAttributes().keySet().iterator(); while (it.hasNext()) initialWorkItem.getAttributes().put (attributeName, modifiedWorkItem.getAttribute(attributeName)); initialWorkItem.getAttributes().put (attributeName, modifiedWorkItem.getAttribute(attributeName)); new java.util.ArrayList(initialWorkItem.getAttributes().size()); it = initialWorkItem.getAttributes().keySet().iterator(); while (it.hasNext())
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 void expand (final InFlowWorkItem wi, final String fieldName, final String value, String separator) { if (separator.equals("|")) separator = "\\|"; // // there may be other special cases, but for now, it's sufficient // // do the job wi.getAttributes().remove(fieldName); final String[] ss = value.split(separator); for (int i=0; i<ss.length; i++) { final String fn = fieldName + UU + i; wi.getAttributes().puts(fn, ss[i]); if (log.isDebugEnabled()) log.debug("expand() '"+fn+"' -> '"+ss[i]+"'"); } final String fn = fieldName + UU + "count"; wi.getAttributes().puts(fn, ""+ss.length); if (log.isDebugEnabled()) log.debug("expand() '"+fn+"' -> '"+ss.length+"'."); }