protected void storeWorkItem (InFlowWorkItem wi) throws StoreException { this.store.put(wi.getLastExpressionId(), wi); }
/** * Produces an exact replica of this InFlowWorkItem */ public Object clone () { InFlowWorkItem clone = new InFlowWorkItem (); clone.setAttributes((StringMapAttribute)getAttributes().clone()); if (getId() != null) clone.setId(getId().copy()); clone.setParticipantName(Utils.copyString(getParticipantName())); clone.setDispatchTime(Utils.copyString(getDispatchTime())); clone.setLastModified(Time.toIsoDate()); clone.setFilter(getFilter()); clone.setHistory(HistoryItem.copyHistoryList(this.history)); return clone; }
public static void proceed(String id, String action, String comment) { InFlowWorkItem wi = getWorkItem(id); if (wi == null) { log.error("can't proceed workitem [{}]", id); return; } wi.touch(); // remove old exception if(wi.containsAttribute(Context.ATTRIBUTE_EXCEPTION)){ wi.removeAttribute(Context.ATTRIBUTE_EXCEPTION); } if(wi.containsAttribute(Context.ATTRIBUTE_MESSAGE)){ wi.removeAttribute(Context.ATTRIBUTE_MESSAGE); } wi.getAttributes().puts(WorkflowConstants.ATTRIBUTE_ACTION, action); wi.getAttributes().puts(WorkflowConstants.ATTRIBUTE_USERNAME, MgnlContext.getUser().getName()); if (StringUtils.isNotEmpty(comment)) { wi.getAttributes().puts(Context.ATTRIBUTE_COMMENT, comment); } proceed(wi); }
protected String buildWorkItemSql (final Long workitemId, final InFlowWorkItem wi) { // // generate batch statements for inserting core workitem data final java.util.List values = new java.util.ArrayList(WORKITEM_COLS.length); values.add(workitemId.toString()); values.add(wi.getParticipantName()); values.add(wi.getDispatchTime()); values.add(wi.getLastModified()); final String sInsert = SqlUtils.buildInsertString (WORKITEM_TABLE, WORKITEM_COLS, values); log.debug("buildWorkItemSql() "+sInsert ); return sInsert; }
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); } }
log.debug("constrain() filter '"+this.name+"'"); InFlowWorkItem result = new InFlowWorkItem(); result.setId(workItem.getId()); result.setParticipantName(workItem.getParticipantName()); result.setLastModified(workItem.getLastModified()); result.setAttributes (new StringMapAttribute(workItem.getAttributes().size())); result.setHistory(workItem.getHistory()); java.util.Iterator it = workItem.getAttributes().keySet().iterator(); while (it.hasNext()) result.getAttributes().put (attributeName, (Attribute)workItem.getAttribute(attributeName).clone()); if (log.isDebugEnabled()) result.getAttributes().put (attributeName, (Attribute)workItem.getAttribute(attributeName).clone()); if (log.isDebugEnabled()) result.setFilter(this); return result;
header.setExpressionId(wi.getLastExpressionId()); header.setLastModified(wi.getLastModified()); wi.getLastExpressionId().getWorkflowInstanceId()); wi.getLastExpressionId().getWorkflowDefinitionName()); wi.getLastExpressionId().getWorkflowDefinitionRevision()); wi.getLastExpressionId().getWorkflowDefinitionUrl()); wi.getDispatchTime()); wi.getParticipantName());
FlowExpressionId feId = wi.getLastExpressionId(); System.out.println("Last modified: " + wi.getLastModified()); System.out.println("Dispatch time: " + wi.getDispatchTime()); System.out.println("Participant: " + wi.getParticipantName()); System.out.println("Engine: " + feId.getEngineId()); System.out.println("WF def name: " + feId.getWorkflowDefinitionName()); System.out.println("Expression id: " + feId.getExpressionId()); displayAttributes(wi.getAttributes()); if(wi.getHistory() != null) for(Iterator i = wi.getHistory().iterator(); i.hasNext();)
(elt, PARTICIPANT_NAME, wi.getParticipantName()); WicUtils.setAttribute (elt, DISPATCH_TIME, wi.getDispatchTime()); if (wi.getLastExpressionId() != null) lei.addContent(encode(wi.getLastExpressionId())); elt.addContent(lei); if (wi.getFilter() != null) elt.addContent(encode(wi.getFilter())); if (wi.getHistory() != null) java.util.Iterator it = wi.getHistory().iterator(); while (it.hasNext()) his.addContent(encodeAsXml((HistoryItem)it.next()));
ifwi.getLastExpressionId()); log.debug ("use() received workitem for participant '"+ ifwi.getParticipantName()+"'"); ifwi.getAttributes().getField(this.processDefinitionField); ifwi.getId(), Launcher.URL_FIELD_PREFIX+this.processDefinitionField, true); // async is true
HierarchyManager hm = getHierarchyManager(); if (hasWorkItem(wi.getId())) { hm.delete(createPathFromId(wi.getId())); String path = createPathFromId(wi.getId()); if (log.isDebugEnabled()) { log.debug("storing workitem with path = " + path); String sId = wi.getLastExpressionId().toParseableString(); newc.createNodeData(WorkflowConstants.NODEDATA_PARTICIPANT, vf.createValue(wi.getParticipantName())); StringAttribute assignTo = (StringAttribute) wi.getAttribute(WorkflowConstants.ATTRIBUTE_ASSIGN_TO); if (assignTo != null) { String s = assignTo.toString();
protected InFlowWorkItem decodeInFlowWorkItem (final org.jdom.Element elt) throws CodingException { InFlowWorkItem wi = new InFlowWorkItem(); org.jdom.Element leiElt = elt.getChild(LAST_EXPRESSION_ID, elt.getNamespace()); if (leiElt != null) { leiElt = leiElt.getChild(FLOW_EXPRESSION_ID, elt.getNamespace()); wi.setId(decodeFlowExpressionId(leiElt)); } wi.setParticipantName(elt.getAttributeValue(PARTICIPANT_NAME)); wi.setDispatchTime(elt.getAttributeValue(DISPATCH_TIME)); //log.debug // ("decodeInFlowWorkItem() wi.dispatchTime >"+ // wi.getDispatchTime()+"<"); // // decode filter wi.setFilter(decodeFilter(elt)); // // decode history wi.setHistory(decodeHistory(elt)); return wi; }
/** * Returns the result held in the field '__result__'. */ public static Attribute getResult (final InFlowWorkItem wi) { return wi.getAttributes().aget(F_RESULT); }
store.get(getSubject(), item.getLastExpressionId()); item.getAttributes().stringKeySet().iterator(); while (it.hasNext()) ! originalItem.containsAttribute(fieldName); final Attribute currentAttribute = item.getAttribute(fieldName); originalItem.getAttribute(fieldName); it = originalItem.getAttributes().stringKeySet().iterator(); while (it.hasNext()) if ( ! item.containsAttribute(fieldName))
modifiedWorkItem.getAttributes().keySet().iterator(); while (it.hasNext()) ! initialWorkItem.containsAttribute(attributeName); initialWorkItem.getAttributes().put (attributeName, modifiedWorkItem.getAttribute(attributeName)); if (modifiedWorkItem.getAttribute(attributeName) .equals(initialWorkItem.getAttribute(attributeName))) initialWorkItem.getAttributes().put (attributeName, modifiedWorkItem.getAttribute(attributeName)); new java.util.ArrayList(initialWorkItem.getAttributes().size()); it = initialWorkItem.getAttributes().keySet().iterator(); while (it.hasNext()) if ( ! modifiedWorkItem.containsAttribute(fieldName)) initialWorkItem.removeAttribute((String)it.next());
protected void encode (final java.sql.Statement st, final InFlowWorkItem wi) throws java.sql.SQLException, CodingException { // // generate id for the workitem final Long workitemId = (Long)uidGenerator.generateUniqueId(); log.debug("Building SWIS insert batch"); st.addBatch(buildWorkItemSql(workitemId, wi)); // // generate batch statements for payload and routing info // of workitem encode(st, workitemId, -1, wi.getLastExpressionId()); // stackIndex is set to -1 for the 'last expression id' // when >= 0, it means it's a flow stack entry //encode(st, workitemId, wi.getFlowStack(), wi); encode(st, workitemId, wi.getAttributes()); if (wi.getFilter() != null) encode(st, workitemId, wi.getFilter()); encode(st, workitemId, wi.getHistory(), wi); log.debug("Finished SWIS insert batch"); }
(WORKITEM_TABLE, WORKITEM_COLS, sWhere); final InFlowWorkItem wi = new InFlowWorkItem(); wi.setId(lastExpressionId); wi.setParticipantName(rs.getString(2)); wi.setDispatchTime(rs.getString(3)); wi.setLastModified(rs.getString(4));
/** * Takes care of handling the workitem (reply) to the expression pool. */ protected void reply (final InFlowWorkItem wi) throws ReplyException { //if (log.isDebugEnabled()) // log.debug("reply() to "+wi.getLastExpressionId()); final History h = Definitions.getHistory(getContext()); if (h != null) { h.log (wi.getLastExpressionId(), wi, History.EVT_INCOMING, wi.getParticipantName(), ""); } Definitions.getExpressionPool(getContext()) .reply(wi.getLastExpressionId(), wi); }
this.remove(s, wi.getLastExpressionId()); wi.addHistoryItem ("subject::"+BasicPrincipal.getBasicPrincipal(s).getName(), "Delegated to participant::"+participantName); wi.setParticipantName(participantName);
this.appliedWorkitem = (InFlowWorkItem)wi.clone(); .getAttribute(DESCRIPTION_FIELD_NAME); wi.getAttributes().puts(DESCRIPTION_FIELD_NAME, this.description); itemToDispatch.getAttributes().puts(F_FORGOTTEN_FIELD, "true"); wi.getAttributes().remove(F_FORGOTTEN_FIELD);