1 /**
2 * $Id: BaseComponentRefFlowNodeDefImpl.java 58 2006-11-08 14:52:38Z maldito_orco $
3 *
4 * =========================================================================
5 *
6 * Copyright 2005 Tubo
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 package org.tubo.configuration.def.baseimpl;
21
22
23 import org.apache.commons.logging.Log;
24 import org.apache.commons.logging.LogFactory;
25
26 import org.tubo.configuration.def.ComponentRefFlowNodeDef;
27 import org.tubo.configuration.def.ComponentRefListenEventDef;
28
29 import java.util.Map;
30 import java.util.HashMap;
31
32 /**
33 * <p></p>
34 * <p>
35 * Created: Jul 8, 2005 5:39:17 PM <br>
36 * Last Modification Date: $Date: 2006-11-08 11:52:38 -0300 (Wed, 08 Nov 2006) $
37 * </p>
38 *
39 * @author maldito_orco (maldito_orco@users.sourceforge.net)
40 * @version $Revision: 58 $
41 */
42 public class BaseComponentRefFlowNodeDefImpl extends BaseReferenceFlowNodeDefImpl implements ComponentRefFlowNodeDef {
43 public static final String RCS_ID = "$Id: BaseComponentRefFlowNodeDefImpl.java 58 2006-11-08 14:52:38Z maldito_orco $";
44 private static Log log = LogFactory.getLog(BaseComponentRefFlowNodeDefImpl.class);
45
46 private Map listenEvents = new HashMap();
47
48
49 /**
50 * Check if this ComponentRefFlowNodeDef is listen a determinated event
51 *
52 * @param eventName Name of event
53 * @return true if this node is listen the event identified by eventName, otherwise false
54 */
55 public boolean isListenEvent(String eventName) {
56 return listenEvents.get(eventName)!=null;
57 }
58
59 /**
60 * Get the ListenEvent identified by eventName
61 *
62 * @param eventName Name of event
63 * @return ListenEventDef identified by eventName, or null if not found
64 */
65 public ComponentRefListenEventDef getListenEventDef(String eventName) {
66 return (ComponentRefListenEventDef)listenEvents.get(eventName);
67 }
68
69
70 public Map getListenEvents() {
71 return listenEvents;
72 }
73
74 /**
75 * Add a new ListenEvent to this FlowNode
76 *
77 * @param listenEventDef a new ListenEvent for this FlowNode
78 */
79 public void add(ComponentRefListenEventDef listenEventDef) {
80 listenEvents.put(listenEventDef.getAction(),listenEventDef);
81 }
82
83 public void add(String action, String execute) {
84 BaseComponentRefListenEventDefImpl listenEventDef = new BaseComponentRefListenEventDefImpl();
85 listenEventDef.setAction(action);
86 listenEventDef.setExecute(execute);
87 listenEvents.put(listenEventDef.getAction(),listenEventDef);
88 }
89 }