org.opencms.main
Class CmsEvent

java.lang.Object
  extended by org.opencms.main.CmsEvent

public class CmsEvent
extends Object

Event class for OpenCms for system wide events that are thrown by various operations (e.g. publishing) and can be caught and processed by classes that implement the I_CmsEventListener interface.

Since:
6.0.0
See Also:
I_CmsEventListener

Constructor Summary
CmsEvent(int type, Map<String,Object> data)
          Construct a new CmsEvent with the specified parameters.
 
Method Summary
 boolean equals(Object obj)
           
 Map<String,Object> getData()
          Provides access to the event data that was passed with this event.
 int getType()
          Provides access to the event type that was passed with this event.
 Integer getTypeInteger()
          Provides access to the event type as Integer.
 int hashCode()
           
 String toString()
          Return a String representation of this CmsEvent.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsEvent

public CmsEvent(int type,
                Map<String,Object> data)
Construct a new CmsEvent with the specified parameters.

The event data Map provides a facility to pass objects with the event that contain information about the event environment. For example, if the event is of type I_CmsEventListener.EVENT_LOGIN_USER the Map contains a single object with the key "data" and a value that is the OpenCms user object that represents the user that just logged in.

Parameters:
type - event type
data - event data
See Also:
I_CmsEventListener
Method Detail

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

getData

public Map<String,Object> getData()
Provides access to the event data that was passed with this event.

Returns:
the event data of this event

getType

public int getType()
Provides access to the event type that was passed with this event.

Event types of the core OpenCms classes are defined in I_CmsEventListener. For your extensions, you should define them in a central class or interface as public member variables. Make sure the integer values do not conflict with the values from the core classes.

Returns:
the event type of this event
See Also:
I_CmsEventListener

getTypeInteger

public Integer getTypeInteger()
Provides access to the event type as Integer.

Returns:
the event type of this event as Integer

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Return a String representation of this CmsEvent.

Overrides:
toString in class Object
Returns:
a String representation of this event