/** * Determines the subject of the form email. */ protected String determineSubject (final WorkItem wi) { String subject = wi.getAttributes().sget("mf_subject"); if (subject != null) return subject; return "OpenWFE form"; }
private boolean shouldBounceDirectly (final InFlowWorkItem wi) { final String sBounce = wi.getAttributes().sget(CORRELATION_BOUNCE); if (sBounce == null) return false; return (sBounce.equalsIgnoreCase("true")); }
public void consume (WorkItem wi) throws Exception { System.out.println("~~~ b"); System.out.println(" value : "+wi.getAttributes().sget("value")); replyToEngine((InFlowWorkItem)wi); }
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 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()+"'"); }
/** * This method returns the item id that should be used for the log. */ protected String determineItemId (final WorkItem item) { StringBuffer id = new StringBuffer(); if (this.idFieldName != null) id.append(item.getAttributes().sget(this.idFieldName)); if (item instanceof InFlowWorkItem) { final InFlowWorkItem ifwi = (InFlowWorkItem)item; if (id.length() > 0) { id .insert(0, this.separator) .insert(0, ifwi.getId().getWorkflowInstanceId()); } else { id = new StringBuffer(ifwi.getId().toString()); } } if (id.length() < 1) return "_new_"; return id.toString(); }
public java.util.List listWorkItems (final Subject s, final int limit) throws StoreException { //final String userName = BasicPrincipal.getBasicPrincipal(s).getName(); final String userName = BasicPrincipal.getBasicPrincipal(s) .getOwfePrincipalName(); if (log.isDebugEnabled()) log.debug("listWorkItems() for '"+userName+"'"); final java.util.List items = super.listWorkItems(s, limit); if (isAdmin(userName)) return items; final java.util.List results = new java.util.ArrayList(items.size()); final java.util.Iterator it = items.iterator(); while (it.hasNext()) { final InFlowWorkItem item = (InFlowWorkItem)it.next(); final String wiUserName = item.getAttributes().sget(this.usernameField); //if (userName.equals(wiUserName) if (this.equals(userName, wiUserName)) results.add(item); } return results; }
private static Object smap2bean (final StringMapAttribute sma) final String beanClassName = sma.sget(A_BEAN_CLASSNAME);
public void consume (WorkItem wi) throws Exception { //System.out.print(this.getRegex()+" "); System.out.print (((InFlowWorkItem)wi).getParticipantName()+" "); if (wi.getAttributes().hasKey(F_INPUT)) { System.out.print (wi.getAttributes().sget(F_INPUT)+" "); } //System.out.flush(); replyToEngine((InFlowWorkItem)wi); } });
String s = wi.getAttributes().sget(ValueUtils.F_RESULT);
/** * This method extracts the author name from the workitem and if it doesn't * find it, it will take the subject username. */ protected String determineAuthorName (final Subject s, final WorkItem item) { String authorName = null; if (this.authorFieldName != null) authorName = item.getAttributes().sget(this.authorFieldName); if (authorName == null) { final BasicPrincipal bp = BasicPrincipal.getBasicPrincipal(s); if (bp != null) authorName = bp.getName(); } if (authorName == null) authorName = "_unknown_"; return authorName; }
/** * Checks wether the incoming workitem is correlated (slave or master) or * not correlated at all, then takes the appropriate action. */ public void put (final InFlowWorkItem wi) throws StoreException { final String cId = wi.getAttributes().sget(CORRELATION_ID); if (cId != null) { //log.debug("put() wi with correlationId (set to >"+cId+"<)"); final String cField = wi.getAttributes().sget(CORRELATION_FIELD); synchronized (this) { if (cField != null) receiveSlave(cId, cField, wi); else receiveMaster(cId, wi); } return; } // // no correlation, behaving like a regular put strategy... getStorage().storeWorkItem(getStoreName(), wi); }
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")); }
if (this.recipientField != null) final String s = wi.getAttributes().sget(this.recipientField);
String sCommand = wi.getAttributes().sget(this.cursorCommandField);
public void apply (final InFlowWorkItem wi) throws ApplyException { // // gather params final String fieldName = this.lookupAttribute(A_FIELD_NAME, wi); String separator = this.lookupAttribute(A_SEPARATOR, wi); if (separator == null) separator = DEFAULT_SEPARATOR; // // do the job final String s = wi.getAttributes().sget(fieldName); if (s == null) flatten(wi, fieldName, separator); else expand(wi, fieldName, s, separator); // // done applyToParent(wi); }