/** * Set the list of flow execution listeners with corresponding criteria. Allows for bean style configuration. The * given map should have {@link FlowExecutionListener} objects as keys and Strings ("*", "flowId", * "flowId1,flowId2") or {@link FlowExecutionListenerCriteria} objects as values. This will clear any listeners * registered with this object using the <tt>addListener</tt> methods. * @param listenersWithCriteria the map of listeners and their corresponding criteria */ public void setListeners(Map listenersWithCriteria) { removeAllListeners(); for (Iterator it = listenersWithCriteria.entrySet().iterator(); it.hasNext();) { Entry entry = (Entry) it.next(); Assert.isInstanceOf(FlowExecutionListener.class, entry.getKey(), "The key in the listenersWithCriteria map needs to be a FlowExecutionListener object"); FlowExecutionListener listener = (FlowExecutionListener) entry.getKey(); FlowExecutionListenerCriteria criteria = null; if (entry.getValue() instanceof String) { criteria = getCriteria((String) entry.getValue()); } else if (entry.getValue() instanceof FlowExecutionListenerCriteria) { criteria = (FlowExecutionListenerCriteria) entry.getValue(); } else if (entry.getValue() != null) { throw new IllegalArgumentException("The value in the listenersWithCriteria map needs to be a " + "String or a FlowExecutionListenerCriteria object"); } addListener(listener, criteria); } }