org.dbforms.event
Class AbstractEventFactory

java.lang.Object
  extended by org.dbforms.event.AbstractEventFactory
Direct Known Subclasses:
AbstractDatabaseEventFactory, AbstractNavEventFactory

public abstract class AbstractEventFactory
extends Object

The EventFactory abstract class provides the interface and the implementation of protected methods used by eventFactory subclasses (see NavEventFactory and DatabaseEventFactory).

Author:
Luca Fossato

Field Summary
protected  HashMap eventInfoMap
          map of supported event
 
Constructor Summary
protected AbstractEventFactory()
          Creates a new EventFactory object.
 
Method Summary
 void addEventInfo(EventInfo einfo)
          Add a new EventInfo object into the factory.
abstract  AbstractWebEvent createEvent(String action, HttpServletRequest request, DbFormsConfig config)
          Create and return a new event.
protected  AbstractWebEvent getEvent(EventInfo einfo, Class[] aconstructorArgsTypes, Object[] constructorArgs)
          Instance a new DatabaseEvent object.
protected  String getEventIdFromDestinationTable(HttpServletRequest request, String action)
          Get the Event identifier from the destination table related to the input action string
protected  String getEventIdFromDestinationTable(Table table, String action)
          Get the Event identifier from the destination table related to the input action string
protected  EventInfo getEventInfo(String id)
          Get the EventInfo object having the input identifier.
protected abstract  void initializeEvents()
          Initialize the default events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventInfoMap

protected HashMap eventInfoMap
map of supported event

Constructor Detail

AbstractEventFactory

protected AbstractEventFactory()
Creates a new EventFactory object.

Method Detail

createEvent

public abstract AbstractWebEvent createEvent(String action,
                                             HttpServletRequest request,
                                             DbFormsConfig config)
Create and return a new event.

Parameters:
action - the action string that identifies the web event
request - the HttpServletRequest object
config - the DbForms config object
Returns:
a new navigation event

addEventInfo

public void addEventInfo(EventInfo einfo)
Add a new EventInfo object into the factory.
The EventInfo name must be unique.

Parameters:
einfo - the EventInfo object to add to

initializeEvents

protected abstract void initializeEvents()
                                  throws Exception
Initialize the default events.

Throws:
Exception - if any error occurs

getEvent

protected AbstractWebEvent getEvent(EventInfo einfo,
                                    Class[] aconstructorArgsTypes,
                                    Object[] constructorArgs)
Instance a new DatabaseEvent object.

Parameters:
einfo - the EventInfo object
constructorArgsTypes - array of constructor argument classes
constructorArgs - array of constructor argument objects
Returns:
the event object, or null if any problem occurs

getEventIdFromDestinationTable

protected String getEventIdFromDestinationTable(HttpServletRequest request,
                                                String action)
Get the Event identifier from the destination table related to the input action string

Parameters:
request - the request object
action - the action string
Returns:
the Event identifier from the destination table, or null if any error occurs

getEventIdFromDestinationTable

protected String getEventIdFromDestinationTable(Table table,
                                                String action)
Get the Event identifier from the destination table related to the input action string

Parameters:
table - the table object
action - the action string
Returns:
the Event identifier from the destination table, or null if any error occurs

getEventInfo

protected EventInfo getEventInfo(String id)
Get the EventInfo object having the input identifier.

Parameters:
id - the EventInfo identifier
Returns:
the EventInfo object having the input identifier, or null if that object does not exist


Copyright © 2002-2006 DbForms. All Rights Reserved.