it.eng.spagobi.events
Class EventsManager

java.lang.Object
  extended by it.eng.spagobi.events.EventsManager

public class EventsManager
extends java.lang.Object

This class menage SpagoBI Event System

Author:
Gioia TODO add logging

Field Summary
static java.lang.String DEFAULT_EVENT_PRESENTAION_HANDLER_CLASS_NAME
           
 
Method Summary
static EventsManager getInstance()
          Gets the single instance of EventsManager.
static java.lang.String getParamsStr(java.util.Map params)
          Gets the params str.
 EventLog getRegisteredEvent(java.lang.Integer id)
          Get registered event with the id specified at input.
 java.util.List getRegisteredEvents(it.eng.spago.security.IEngUserProfile profile)
          Get the list of registered events (generated by the user at input) ordered by date.
static java.util.Map parseParamsStr(java.lang.String str)
          Parses the params str.
 java.lang.Integer registerEvent(java.lang.String user, java.lang.String desc, java.lang.String params, java.util.List roles)
          Register event.
 java.lang.Integer registerEvent(java.lang.String user, java.lang.String desc, java.lang.String params, java.util.List roles, java.lang.String handler)
          Register an event given its user name, description and parameters.
 void registerHandler(long id, java.lang.Object handler)
          Associate an handler to the given event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EVENT_PRESENTAION_HANDLER_CLASS_NAME

public static final java.lang.String DEFAULT_EVENT_PRESENTAION_HANDLER_CLASS_NAME
See Also:
Constant Field Values
Method Detail

getInstance

public static EventsManager getInstance()
Gets the single instance of EventsManager.

Returns:
single instance of EventsManager

registerHandler

public void registerHandler(long id,
                            java.lang.Object handler)
Associate an handler to the given event. Every time an event is fired all the handlers associteted to it are executed by the EventManager. To be implemented ....

Parameters:
id - the event unique id to which the handler is associated
handler - the handler to execute when the event is fired TODO decide EventHandler interface TODO decide EventHandler execution order policy TODO implement some default EventHandler (i.e. NotificationHandler, HousekeepingHandler, ecc...)

registerEvent

public java.lang.Integer registerEvent(java.lang.String user,
                                       java.lang.String desc,
                                       java.lang.String params,
                                       java.util.List roles)
Register event.

Parameters:
user - the user
desc - the desc
params - the params
roles - the roles
Returns:
the integer

registerEvent

public java.lang.Integer registerEvent(java.lang.String user,
                                       java.lang.String desc,
                                       java.lang.String params,
                                       java.util.List roles,
                                       java.lang.String handler)
Register an event given its user name, description and parameters.

Parameters:
user - The user who generated the event
desc - a description provided by the agent
params - parameters provided by the agent (usefull for the handlers configuration)
handler - The presentation class (implementing it.eng.spagobi.events.handlers.IEventPresentationHandler) for the event
roles - the roles
Returns:
the integer

getRegisteredEvent

public EventLog getRegisteredEvent(java.lang.Integer id)
Get registered event with the id specified at input.

Parameters:
id - The id of the registered event
Returns:
The EventLog object with the id specified at input

getRegisteredEvents

public java.util.List getRegisteredEvents(it.eng.spago.security.IEngUserProfile profile)
Get the list of registered events (generated by the user at input) ordered by date.

Parameters:
profile - the profile
Returns:
The list of events generated by the user

getParamsStr

public static java.lang.String getParamsStr(java.util.Map params)
Gets the params str.

Parameters:
params - the params
Returns:
the params str

parseParamsStr

public static java.util.Map parseParamsStr(java.lang.String str)
Parses the params str.

Parameters:
str - the str
Returns:
the map