|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.enhydra.barracuda.core.event.DefaultBaseEvent
This is the default implementation for the BaseEvent interface. It acts as the base class in the event heirarchy.
While events are capable of carrying state information, generally you want to keep them as lite as possible, storying any state either in the dispatch queue or the user's session.
NOTE: As general good practice, you should try and provide a no-args public constructor for all event classes. Anything that implements Polymorphic or Exceptional MUST have a noargs constructor, or the system will not be able to instantiate it.
Field Summary | |
protected String |
ext
|
protected boolean |
handled
|
protected List |
idList
|
protected Map |
params
|
protected Object |
source
|
protected EventObject |
sourceEvent
|
protected StateMap |
statemap
|
protected long |
timestamp
|
static boolean |
USE_ID_ALIASES
|
protected boolean |
useIDAliases
|
Fields inherited from interface org.enhydra.barracuda.core.event.BaseEvent |
EVENT_ID |
Constructor Summary | |
DefaultBaseEvent()
Default noargs constructor |
|
DefaultBaseEvent(Object source)
Public constructor. |
|
DefaultBaseEvent(String urlParamStr)
Public constructor. |
Method Summary | |
void |
addListenerID(String id)
Add a specific listener id this event should be delivered to. |
void |
clearState()
clear all state information |
Object |
clone()
clone the event |
boolean |
equals(Object o)
Events are generally considered equal if they are of the same class. |
static String |
getClassID(Class cl)
Get a class ID for a given class. |
String |
getEventExtension()
get the event extension |
String |
getEventID()
Get the ID that identifies this event. |
String |
getEventIDWithExtension()
Deprecated. csc010404_1; replaced by getEventURL() |
String |
getEventURL()
Get the URL version of the event. |
List |
getListenerIDs()
Get the list of id's this event is specifically targeted for. |
static BaseEvent |
getOriginalEvent(BaseEvent e)
Find the original event in target event's event chain (if it exists) |
Map |
getParams()
Get any associated params |
BaseEvent |
getRootEvent()
get the root event source (may be null) |
static BaseEvent |
getRootEvent(BaseEvent be)
get the RootEvent that caused this event (if any). |
Object |
getSource()
get the event source (may be null) |
Object |
getState(Object key)
get a property in this StateMap |
List |
getStateKeys()
get a list of the keys for this StateMap |
Map |
getStateValues()
get a copy of the underlying Map |
long |
getTimestamp()
Get the timestamp |
boolean |
isHandled()
get the handled status for the event |
void |
putState(Object key,
Object val)
set a property in this StateMap |
Object |
removeState(Object key)
remove a property in this StateMap |
void |
reset()
Reset the event to it's default state |
void |
setEventExtension(String iext)
set the event extension |
void |
setHandled(boolean val)
mark the event as handled/unhandled |
void |
setParam(String key,
String val)
Set any associated params |
void |
setParam(String key,
String[] val)
Set any associated params |
void |
setSource(Object isource)
set the source for an event |
void |
setUseIDAliases(boolean val)
determine whether or not we are using ID aliasing. |
void |
touch()
Update the timestamp on the event |
boolean |
useIDAliases()
see whether or not we are using ID aliasing |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean USE_ID_ALIASES
protected Object source
protected EventObject sourceEvent
protected String ext
protected boolean handled
protected List idList
protected long timestamp
protected boolean useIDAliases
protected StateMap statemap
protected Map params
Constructor Detail |
public DefaultBaseEvent()
public DefaultBaseEvent(String urlParamStr)
public DefaultBaseEvent(Object source)
Method Detail |
public void setSource(Object isource)
setSource
in interface BaseEvent
isource
- the source for this eventpublic Object getSource()
getSource
in interface BaseEvent
public BaseEvent getRootEvent()
getRootEvent
in interface BaseEvent
public void setEventExtension(String iext)
setEventExtension
in interface BaseEvent
iext
- the target event extensionpublic String getEventExtension()
getEventExtension
in interface BaseEvent
public void setUseIDAliases(boolean val)
val
- true if we want to use ID aliasingpublic boolean useIDAliases()
public void setHandled(boolean val)
setHandled
in interface BaseEvent
val
- true if the event is handledpublic boolean isHandled()
isHandled
in interface BaseEvent
public void addListenerID(String id)
addListenerID
in interface BaseEvent
id
- the Listener ID the event should targetpublic List getListenerIDs()
getListenerIDs
in interface BaseEvent
public String getEventID()
getEventID
in interface BaseEvent
public String getEventIDWithExtension()
getEventURL()
getEventIDWithExtension
in interface BaseEvent
public String getEventURL()
getEventURL
in interface BaseEvent
public long getTimestamp()
getTimestamp
in interface BaseEvent
public void touch()
touch
in interface BaseEvent
public void reset()
reset
in interface BaseEvent
public static BaseEvent getOriginalEvent(BaseEvent e)
e
- the target event
public boolean equals(Object o)
o
- the object we are checking against for equality
public Object clone() throws CloneNotSupportedException
CloneNotSupportedException
public static String getClassID(Class cl)
cl
- the target class
public static BaseEvent getRootEvent(BaseEvent be)
be
- a BaseEvent for which we wish to find the root event
public void putState(Object key, Object val)
putState
in interface StateMap
key
- the state key objectval
- the state value objectpublic Object getState(Object key)
getState
in interface StateMap
key
- the state key object
public Object removeState(Object key)
removeState
in interface StateMap
key
- the key object
public List getStateKeys()
getStateKeys
in interface StateMap
public Map getStateValues()
getStateValues
in interface StateMap
public void clearState()
clearState
in interface StateMap
public void setParam(String key, String val)
setParam
in interface BaseEvent
public void setParam(String key, String[] val)
setParam
in interface BaseEvent
public Map getParams()
getParams
in interface BaseEvent
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |