/** * 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"; }
/** * Use work item if request scope. */ @Override public void setAttribute(String name, Object value, int scope) { if (scope == Context.LOCAL_SCOPE) { Attribute attr = AttributeUtils.java2owfe(value); try { if (this.workItem.containsAttribute(name)) { log.debug("Attribute {} already set in WorkItem, will overwrite it with value {}", name, attr.toString()); this.workItem.setAttribute(name, attr); } else { this.workItem.addAttribute(name, attr); } } catch (AttributeException e) { log.error("can't set value {}", name, e); } } else { super.setAttribute(name, value, scope); } }
protected org.jdom.Element encodeSuper (WorkItem wi) throws CodingException { final org.jdom.Element elt = new org.jdom.Element(WORKITEM, XMLNS); if (wi.getLastModified() != null) WicUtils.setAttribute(elt, LAST_MODIFIED, wi.getLastModified()); // // attributes org.jdom.Element as = new org.jdom.Element(ATTRIBUTES, XMLNS); org.jdom.Element smap = encodeAttribute(wi.getAttributes()); if (smap != null) as.addContent(smap); elt.addContent(as); // // the end return elt; }
/** * Use work item if request scope. */ @Override public void removeAttribute(String name, int scope) { if (scope == Context.LOCAL_SCOPE) { this.workItem.removeAttribute(name); } else { super.removeAttribute(name, scope); } }
/** * Use work item if request scope. */ @Override public Object getAttribute(String name, int scope) { if (scope == Context.LOCAL_SCOPE) { Attribute attr = this.workItem.getAttribute(name); if (attr != null) { Object obj = AttributeUtils.owfe2java(attr); if (obj != null) { return obj; } } } return super.getAttribute(name, scope); }
final WorkItem cwi = (WorkItem)wi.clone();
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); } });
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("~~~ a"); wi.getAttributes().puts("value", "CHF 10.-"); replyToEngine((InFlowWorkItem)wi); } });
public void consume (WorkItem wi) throws Exception { System.out.println("~~~ a"); wi.getAttributes().puts("value", "CHF 10.-"); replyToEngine((InFlowWorkItem)wi); }
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); } });
/** * Use work item if request scope. */ @Override public Map<String, Object> getAttributes(int scope) { if (scope == Context.LOCAL_SCOPE) { return AttributeUtils.map2java(this.workItem.getAttributes()); } return super.getAttributes(scope); }
/** * 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(); }
final String sHeader = wi.getAttributes().sget("mf_header"); final String sFields = wi.getAttributes().sget("mf_fields"); String value = wi.getAttributes().sget(fieldName); if (value == null) value = ""; final String sFooter = wi.getAttributes().sget("mf_footer");
/** * 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; }
if (this.recipientField != null) final String s = wi.getAttributes().sget(this.recipientField);