/** * Lookup the listener criteria holder for the listener provided. * @param listener the listener * @return the holder, or null if not found */ private ConditionalFlowExecutionListenerHolder getHolder(FlowExecutionListener listener) { for (ConditionalFlowExecutionListenerHolder holder : listeners) { if (holder.getListener().equals(listener)) { return holder; } } return null; } }
/** * Returns the array of flow execution listeners for specified flow. * @param flowDefinition the flow definition associated with the execution to be listened to * @return the flow execution listeners that apply */ public FlowExecutionListener[] getListeners(FlowDefinition flowDefinition) { Assert.notNull(flowDefinition, "The Flow to load listeners for cannot be null"); List<FlowExecutionListener> listenersToAttach = new LinkedList<>(); for (ConditionalFlowExecutionListenerHolder listenerHolder : listeners) { if (listenerHolder.listenerAppliesTo(flowDefinition)) { listenersToAttach.add(listenerHolder.getListener()); } } if (logger.isDebugEnabled()) { logger.debug("Loaded [" + listenersToAttach.size() + "] of possible " + listeners.size() + " listeners for this execution request for flow '" + flowDefinition.getId() + "', the listeners to attach are " + StylerUtils.style(listenersToAttach)); } return listenersToAttach.toArray(new FlowExecutionListener[listenersToAttach.size()]); }
/** * Lookup the listener criteria holder for the listener provided. * @param listener the listener * @return the holder, or null if not found */ private ConditionalFlowExecutionListenerHolder getHolder(FlowExecutionListener listener) { for (ConditionalFlowExecutionListenerHolder holder : listeners) { if (holder.getListener().equals(listener)) { return holder; } } return null; } }
/** * Remove the flow execution listener from the listener list. * @param listener the listener */ public void removeListener(FlowExecutionListener listener) { Iterator it = listeners.iterator(); while (it.hasNext()) { ConditionalFlowExecutionListenerHolder h = (ConditionalFlowExecutionListenerHolder) it.next(); if (h.getListener().equals(listener)) { it.remove(); } } }
/** * Is the given listener contained by this Flow execution manager? * @param listener the listener * @return true if yes, false otherwise */ public boolean containsListener(FlowExecutionListener listener) { Iterator it = listeners.iterator(); while (it.hasNext()) { ConditionalFlowExecutionListenerHolder h = (ConditionalFlowExecutionListenerHolder) it.next(); if (h.getListener().equals(listener)) { return true; } } return false; }
/** * Lookup the listener criteria holder for the listener provided. * @param listener the listener * @return the holder, or null if not found */ private ConditionalFlowExecutionListenerHolder getHolder(FlowExecutionListener listener) { Iterator it = listeners.iterator(); while (it.hasNext()) { ConditionalFlowExecutionListenerHolder next = (ConditionalFlowExecutionListenerHolder) it.next(); if (next.getListener().equals(listener)) { return next; } } return null; }
/** * Lookup the listener criteria holder for the listener provided. * @param listener the listener * @return the holder, or null if not found */ private ConditionalFlowExecutionListenerHolder getHolder(FlowExecutionListener listener) { Iterator it = listeners.iterator(); while (it.hasNext()) { ConditionalFlowExecutionListenerHolder next = (ConditionalFlowExecutionListenerHolder) it.next(); if (next.getListener().equals(listener)) { return next; } } return null; } }
/** * Returns the array of flow execution listeners for specified flow. * @param flowDefinition the flow definition associated with the execution to be listened to * @return the flow execution listeners that apply */ public FlowExecutionListener[] getListeners(FlowDefinition flowDefinition) { Assert.notNull(flowDefinition, "The Flow to load listeners for cannot be null"); List listenersToAttach = new LinkedList(); for (Iterator it = listeners.iterator(); it.hasNext();) { ConditionalFlowExecutionListenerHolder listenerHolder = (ConditionalFlowExecutionListenerHolder) it.next(); if (listenerHolder.listenerAppliesTo(flowDefinition)) { listenersToAttach.add(listenerHolder.getListener()); } } if (logger.isDebugEnabled()) { logger.debug("Loaded [" + listenersToAttach.size() + "] of possible " + listeners.size() + " listeners for this execution request for flow '" + flowDefinition.getId() + "', the listeners to attach are " + StylerUtils.style(listenersToAttach)); } return (FlowExecutionListener[]) listenersToAttach.toArray(new FlowExecutionListener[listenersToAttach.size()]); }
/** * Returns the array of flow execution listeners for specified flow. * @param flowDefinition the flow definition associated with the execution to be listened to * @return the flow execution listeners that apply */ public FlowExecutionListener[] getListeners(FlowDefinition flowDefinition) { Assert.notNull(flowDefinition, "The Flow to load listeners for cannot be null"); List listenersToAttach = new LinkedList(); for (Iterator it = listeners.iterator(); it.hasNext();) { ConditionalFlowExecutionListenerHolder listenerHolder = (ConditionalFlowExecutionListenerHolder) it.next(); if (listenerHolder.listenerAppliesTo(flowDefinition)) { listenersToAttach.add(listenerHolder.getListener()); } } if (logger.isDebugEnabled()) { logger.debug("Loaded [" + listenersToAttach.size() + "] of possible " + listeners.size() + " listeners for this execution request for flow '" + flowDefinition.getId() + "', the listeners to attach are " + StylerUtils.style(listenersToAttach)); } return (FlowExecutionListener[]) listenersToAttach.toArray(new FlowExecutionListener[listenersToAttach.size()]); }
/** * Returns the array of flow execution listeners for specified flow. * @param flowDefinition the flow definition associated with the execution to be listened to * @return the flow execution listeners that apply */ public FlowExecutionListener[] getListeners(FlowDefinition flowDefinition) { Assert.notNull(flowDefinition, "The Flow to load listeners for cannot be null"); List<FlowExecutionListener> listenersToAttach = new LinkedList<>(); for (ConditionalFlowExecutionListenerHolder listenerHolder : listeners) { if (listenerHolder.listenerAppliesTo(flowDefinition)) { listenersToAttach.add(listenerHolder.getListener()); } } if (logger.isDebugEnabled()) { logger.debug("Loaded [" + listenersToAttach.size() + "] of possible " + listeners.size() + " listeners for this execution request for flow '" + flowDefinition.getId() + "', the listeners to attach are " + StylerUtils.style(listenersToAttach)); } return listenersToAttach.toArray(new FlowExecutionListener[listenersToAttach.size()]); }