protected void storeWorkItem (InFlowWorkItem wi) throws StoreException { this.store.put(wi.getLastExpressionId(), wi); }
public void run () { try { bounce(wi); } catch (final StoreException se) { log.warn ("Failed to bounce wi back "+wi.getLastExpressionId(), se); } } }).start();
public void store (final InFlowWorkItem wi) { synchronized (this) { this.map.put(wi.getLastExpressionId(), wi); this.list.add(wi); } }
private void printSep (final StringBuffer sb, final InFlowWorkItem wi) { sb .append("\n") .append(ID_PREFIX) .append(wi.getLastExpressionId().toParseableString()) .append("\n\n"); }
/** * When a participant has finished working with a workitem, it uses this * method to give it back to the engine. */ public void reply (final InFlowWorkItem wi) throws ReplyException { if (log.isDebugEnabled()) log.debug("reply() to "+wi.getLastExpressionId()); getExpressionPool().reply(wi.getLastExpressionId(), wi); }
private int determineAltitude (final InFlowWorkItem wi) { final String wfiid = wi.getLastExpressionId().getWorkflowInstanceId(); return getChildrenAltitudes().indexOf(wfiid); }
/** * Returns the workitem belonging to a certain workflow instance */ public java.util.List findFlowInstance (final Subject s, final String workflowInstanceId) throws StoreException { log.debug("findFlowInstance()"); final int limit = 1500; final java.util.List result = new java.util.ArrayList(10); final java.util.Iterator it = listWorkItems(s, limit).iterator(); while (it.hasNext()) { final InFlowWorkItem item = (InFlowWorkItem)it.next(); final FlowExpressionId fei = item.getLastExpressionId(); if (fei.getWorkflowInstanceId().equals(workflowInstanceId)) result.add(item.getLastExpressionId()); } return result; }
/** * Returns the flowExpressionId instances of the workitems belonging * to the given workflow instance. */ public java.util.List findFlowInstance (final Subject s, final String workflowInstanceId) throws StoreException { log.debug("findFlowInstance()"); final int limit = 1500; final java.util.List result = new java.util.ArrayList(10); final java.util.Iterator it = this.getStrategy.listWorkItems(s, limit).iterator(); while (it.hasNext()) { final InFlowWorkItem item = (InFlowWorkItem)it.next(); final FlowExpressionId fei = item.getLastExpressionId(); if (fei.getWorkflowInstanceId().equals(workflowInstanceId)) result.add(item.getLastExpressionId()); } return result; }
private java.util.Map determineAnswerMap () { final java.util.Map result = new java.util.HashMap(getIncomingWorkitems().size()); final java.util.Iterator it = getIncomingWorkitems().iterator(); while (it.hasNext()) { final InFlowWorkItem wi = (InFlowWorkItem)it.next(); //log.debug // ("determineAnswerMap() found answer for "+ // wi.getLastExpressionId().getWorkflowInstanceId()); result.put(wi.getLastExpressionId().getWorkflowInstanceId(), wi); } return result; }
/** * Determines the mail subject out of the workitem */ protected String determineSubject (final WorkItem wi) { String subject = SUBJECT_PREFIX + wi.getClass().getName(); if (wi instanceof InFlowWorkItem) { final InFlowWorkItem ifwi = (InFlowWorkItem)wi; final FlowExpressionId id = ifwi.getLastExpressionId(); final StringBuffer sb = new StringBuffer(); sb .append(SUBJECT_PREFIX) .append(id.getEngineId()) .append(":") .append(id.getWorkflowInstanceId()) .append(":") .append(id.getExpressionId()); subject = sb.toString(); } return subject; }
public void apply (final InFlowWorkItem wi) throws ApplyException { if (this.appliedItem != null) { throw new ApplyException ("An expression should not get applied twice."); } this.appliedItem = (InFlowWorkItem)wi.clone(); if (log.isDebugEnabled()) { log.debug ("apply() applied item lastExpressionId : "+ this.appliedItem.getLastExpressionId()); } this.expression.storeItself(); }
public void reply (final InFlowWorkItem wi) throws ReplyException { final FlowExpressionId replyingId = wi.getLastExpressionId(); if (log.isDebugEnabled()) log.debug("reply() from "+replyingId); getChildren().remove(replyingId); this.storeItself(); try { apply(wi); } catch (final ApplyException e) { throw new ReplyException ("failed to apply next (random) child", e); } }
private void bounce (final InFlowWorkItem wi) throws StoreException { log.debug("bounce() boucing back "+wi.getLastExpressionId()); final String engineId = wi.getLastExpressionId().getEngineId(); final Participant pEngine = openwfe.org.engine.Definitions .getParticipantMap (((openwfe.org.Service)getStore()).getContext()) .get(engineId); try { pEngine.dispatch(getContext(), wi); } catch (final Exception e) { throw new StoreException ("Failed bounce slave correlated workitem", e); } log.debug("bounce() bounced "+wi.getLastExpressionId()); }
/** * Delegate works to this workitem store */ public void delegate (InFlowWorkItem wi) throws StoreException { java.security.AccessController.checkPermission (StorePermission.newStorePermission(getName(), "delegate")); if (log.isDebugEnabled()) { log.debug ("'"+getName()+"' Received delegated WI "+ wi.getLastExpressionId()); } store(wi); }
/** * Delegate works to this workitem store */ public void delegate (final InFlowWorkItem wi) throws StoreException { java.security.AccessController.checkPermission (StorePermission.newStorePermission(getName(), "delegate")); if (log.isDebugEnabled()) { log.debug ("delegate() store '"+getName()+"' received delegated wi "+ wi.getLastExpressionId()); } this.putStrategy.put(wi); }
/** * Returns the name of the principal that locked this workitem (or * null if it's not locked). */ protected String getLockerName (final InFlowWorkItem wi) { final Lock lock = getLock(wi.getLastExpressionId()); if (lock == null) return null; return BasicPrincipal.getBasicPrincipal(lock.getLocker()).getName(); }
protected void storeWorkItem (final InFlowWorkItem wi) throws StoreException { log.debug("storeWorkItem() "+wi.getLastExpressionId()); try { getCoder().encode (wi, getContext(), getParams()); } catch (CodingException ce) { throw new StoreException ("Failed to store workitem", ce); } }
/** * 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); }
/** * Forwards a workitem (make it proceed in its flow). */ public void forward (final InFlowWorkItem wi) throws WorkListException { getStorage().removeWorkItem(this.listName, wi.getLastExpressionId()); try { replyToEngine(wi); } catch (final ReplyException e) { throw new WorkListException ("Forward (proceed) failure", e); } }
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"); }