public Collection<ProcessInstance> execute(Context context) { StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession(); Collection<ProcessInstance> instances = ksession.getProcessInstances(); Collection<ProcessInstance> result = new ArrayList<ProcessInstance>(); for ( ProcessInstance instance : instances ) { result.add( instance ); } return result; }
public Collection<Long> getRunningFlows() throws WorkflowException { Collection<ProcessInstance> processInstances = getSessionForCurrentContext().getProcessInstances(); Collection<Long> result = new HashSet<Long>(); for (ProcessInstance p : processInstances) { result.add(p.getId()); } return result; }
public Collection<Long> getRunningFlows() throws WorkflowException { Collection<ProcessInstance> processInstances = getSessionForCurrentContext().getProcessInstances(); Collection<Long> result = new HashSet<Long>(); for (ProcessInstance p : processInstances) { result.add(p.getId()); } return result; }
for (ProcessInstance p : session.getProcessInstances()) { p.signalEvent(event.getClass().getSimpleName(), event);
@SuppressWarnings("deprecation") // will be removed in 3.0 (OPENENGSB-2789) @Override public void processEvent(Event event) throws WorkflowException { LOGGER.info("processing Event {} of type {}", event, event.getClass()); StatefulKnowledgeSession session = getSessionForCurrentContext(); FactHandle factHandle = null; try { factHandle = session.insert(event); workflowLock.lock(); try { session.fireAllRules(); } catch (ConsequenceException e) { throw new WorkflowException("ConsequenceException occured while processing event", e.getCause()); } finally { workflowLock.unlock(); } Set<Long> processIds = retrieveRelevantProcessInstanceIds(event, session); if (processIds.isEmpty()) { for (ProcessInstance p : session.getProcessInstances()) { p.signalEvent(event.getType(), event); } } else { signalEventToProcesses(event, session, processIds); } } finally { session.retract(factHandle); } }