org.objectweb.telosys.screen.core
Class StandardScreenManager

java.lang.Object
  extended byorg.objectweb.telosys.common.TelosysObject
      extended byorg.objectweb.telosys.screen.core.StandardScreenCommon
          extended byorg.objectweb.telosys.screen.core.StandardScreenManager
All Implemented Interfaces:
ScreenManager
Direct Known Subclasses:
StandardScreenDataAccessor

public abstract class StandardScreenManager
extends org.objectweb.telosys.screen.core.StandardScreenCommon
implements ScreenManager

Standard implementation for the ScreenManager interface
Abstract class designed to be specialized for each screen

Since:
1.0.0

Field Summary
protected static int DEFAULT_DATABASE
           
protected static int NO_DATABASE
           
 
Constructor Summary
StandardScreenManager(java.lang.Class screenDataClass)
          Constructor for default database
StandardScreenManager(java.lang.Class screenDataClass, int iDatabaseId)
          Constructor for specific database
 
Method Summary
abstract  void delete(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Implementation of the "delete" action
 void doDelete(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Entry point for "delete" action
 void doInit(ScreenData screenData, ScreenContext screenContext, java.util.Map param, DatabaseSession dbSession)
           
 void doInsert(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Entry point for "insert" action
 void doLoad(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Entry point for "load" action
 void doSave(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Entry point for "save" action
 void doUpdate(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Entry point for "update" action
 void eventCreate(ScreenContext screenContext, ScreenRequestParameters params, ScreenSession screenSession, DatabaseSession dbSession)
          Entry point for a "create event", origin : ScreenContextManager ("open" or "use" and not found)
 void eventReuse(ScreenContext screenContext, ScreenRequestParameters params, ScreenSession screenSession, DatabaseSession dbSession)
          Entry point for a "reuse event", origin : ScreenContextManager ("use" and found)
protected  StandardDAO getDAO(java.lang.Class beanClass)
          Returns the DAO for the given bean class and the default database
protected  StandardDAO getDAO(java.lang.Class beanClass, DatabaseSession dbSession)
          Returns the DAO for the given bean class and db session
protected  StandardDAO getDAO(java.lang.Class beanClass, int iDatabaseId)
          Returns the DAO for the given bean class and db id
 int getDatabaseId()
          Returns the Database Id used by the ScreenManager . 0 to N : the Databse Id specified .
 DatabaseSession getDatabaseSession()
          Returns a new DatabaseSession instance corresponding to
the DatabaseId associated with the current screen context.
protected  ScreenApplication getScreenApplication()
          Returns the ScreenApplication object
protected  javax.servlet.ServletContext getServletContext()
          Returns the ServletContext object
 void init(ScreenData screenData, ScreenContext context, java.util.Map parameters, DatabaseSession dbSession)
          Deprecated.  
abstract  void insert(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Implementation of the "insert" action
abstract  void load(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Implementation of the "load" action
 void onCreate(ScreenContext screenContext, ScreenRequestParameters params, ScreenSession screenSession, DatabaseSession dbSession)
          Implementation of the "onCreate" event, this method is designed to be overridden if necessary
 void onReuse(ScreenContext screenContext, ScreenRequestParameters params, ScreenSession screenSession, DatabaseSession dbSession)
          Implementation of the "onReuse" event, this method is designed to be overridden if necessary
abstract  void save(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Implementation of the "save" action
abstract  void update(ScreenData screenData, ScreenContext screenContext, ScreenRequest request, ScreenResponse response, DatabaseSession dbSession)
          Implementation of the "update" action
 
Methods inherited from class org.objectweb.telosys.common.TelosysObject
error, error, error, getFlagTrace, info, setFlagTrace, trace, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DATABASE

protected static final int DEFAULT_DATABASE
See Also:
Constant Field Values

NO_DATABASE

protected static final int NO_DATABASE
See Also:
Constant Field Values
Constructor Detail

StandardScreenManager

public StandardScreenManager(java.lang.Class screenDataClass)
Constructor for default database

Parameters:
screenDataClass - the ScreenData class

StandardScreenManager

public StandardScreenManager(java.lang.Class screenDataClass,
                             int iDatabaseId)
Constructor for specific database

Parameters:
screenDataClass - the ScreenData class
iDatabaseId - the id of the Database to use (to get a connection)
Method Detail

load

public abstract void load(ScreenData screenData,
                          ScreenContext screenContext,
                          ScreenRequest request,
                          ScreenResponse response,
                          DatabaseSession dbSession)
                   throws TelosysException
Implementation of the "load" action

Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

save

public abstract void save(ScreenData screenData,
                          ScreenContext screenContext,
                          ScreenRequest request,
                          ScreenResponse response,
                          DatabaseSession dbSession)
                   throws TelosysException
Implementation of the "save" action

Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

insert

public abstract void insert(ScreenData screenData,
                            ScreenContext screenContext,
                            ScreenRequest request,
                            ScreenResponse response,
                            DatabaseSession dbSession)
                     throws TelosysException
Implementation of the "insert" action

Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

update

public abstract void update(ScreenData screenData,
                            ScreenContext screenContext,
                            ScreenRequest request,
                            ScreenResponse response,
                            DatabaseSession dbSession)
                     throws TelosysException
Implementation of the "update" action

Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

delete

public abstract void delete(ScreenData screenData,
                            ScreenContext screenContext,
                            ScreenRequest request,
                            ScreenResponse response,
                            DatabaseSession dbSession)
                     throws TelosysException
Implementation of the "delete" action

Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

onCreate

public void onCreate(ScreenContext screenContext,
                     ScreenRequestParameters params,
                     ScreenSession screenSession,
                     DatabaseSession dbSession)
              throws TelosysException
Implementation of the "onCreate" event, this method is designed to be overridden if necessary

Parameters:
screenContext -
params -
screenSession -
dbSession -
Throws:
TelosysException

onReuse

public void onReuse(ScreenContext screenContext,
                    ScreenRequestParameters params,
                    ScreenSession screenSession,
                    DatabaseSession dbSession)
             throws TelosysException
Implementation of the "onReuse" event, this method is designed to be overridden if necessary

Parameters:
screenContext -
params -
screenSession -
dbSession -
Throws:
TelosysException

init

public void init(ScreenData screenData,
                 ScreenContext context,
                 java.util.Map parameters,
                 DatabaseSession dbSession)
          throws TelosysException
Deprecated.  

Method for manual Screen Data initialization (if the ScreenContext has created programmaticaly)
This method is designed to be overridden if necessary
It is no longer used by the framework, and now considered as deprecated (use onCreate and onReuse instead)

Parameters:
screenData -
context -
parameters -
dbSession -
Throws:
TelosysException

getDatabaseSession

public DatabaseSession getDatabaseSession()
                                   throws TelosysException
Description copied from interface: ScreenManager
Returns a new DatabaseSession instance corresponding to
the DatabaseId associated with the current screen context.
NB :
. each call returns a NEW INSTANCE
This instance is not the same as the DatabaseSession parameter used in
the ScreenManager methods, and it is not stored as thread-local variable.
. it's the programmer's reponsability to managed the DatabaseSession return
e.g. : this DatabaseSession must be closed after use. In classical cases, this method is not supposed to be used

Specified by:
getDatabaseSession in interface ScreenManager
Returns:
Throws:
TelosysException

getDatabaseId

public int getDatabaseId()
Description copied from interface: ScreenManager
Returns the Database Id used by the ScreenManager . 0 to N : the Databse Id specified . DEFAULT_DATABASE : the default database id defined in the Data Access Layer . NO_DATABASE : the ScreenManager is not supposed to use a database

Specified by:
getDatabaseId in interface ScreenManager
Returns:

doInit

public void doInit(ScreenData screenData,
                   ScreenContext screenContext,
                   java.util.Map param,
                   DatabaseSession dbSession)
            throws TelosysException
Specified by:
doInit in interface ScreenManager
Parameters:
screenData -
screenContext -
param -
dbSession -
Throws:
TelosysException

doLoad

public void doLoad(ScreenData screenData,
                   ScreenContext screenContext,
                   ScreenRequest request,
                   ScreenResponse response,
                   DatabaseSession dbSession)
            throws TelosysException
Description copied from interface: ScreenManager
Entry point for "load" action

Specified by:
doLoad in interface ScreenManager
Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

doSave

public void doSave(ScreenData screenData,
                   ScreenContext screenContext,
                   ScreenRequest request,
                   ScreenResponse response,
                   DatabaseSession dbSession)
            throws TelosysException
Description copied from interface: ScreenManager
Entry point for "save" action

Specified by:
doSave in interface ScreenManager
Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

doInsert

public void doInsert(ScreenData screenData,
                     ScreenContext screenContext,
                     ScreenRequest request,
                     ScreenResponse response,
                     DatabaseSession dbSession)
              throws TelosysException
Description copied from interface: ScreenManager
Entry point for "insert" action

Specified by:
doInsert in interface ScreenManager
Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

doUpdate

public void doUpdate(ScreenData screenData,
                     ScreenContext screenContext,
                     ScreenRequest request,
                     ScreenResponse response,
                     DatabaseSession dbSession)
              throws TelosysException
Description copied from interface: ScreenManager
Entry point for "update" action

Specified by:
doUpdate in interface ScreenManager
Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

doDelete

public void doDelete(ScreenData screenData,
                     ScreenContext screenContext,
                     ScreenRequest request,
                     ScreenResponse response,
                     DatabaseSession dbSession)
              throws TelosysException
Description copied from interface: ScreenManager
Entry point for "delete" action

Specified by:
doDelete in interface ScreenManager
Parameters:
screenData -
screenContext -
request -
response -
dbSession -
Throws:
TelosysException

eventCreate

public final void eventCreate(ScreenContext screenContext,
                              ScreenRequestParameters params,
                              ScreenSession screenSession,
                              DatabaseSession dbSession)
                       throws TelosysException
Description copied from interface: ScreenManager
Entry point for a "create event", origin : ScreenContextManager ("open" or "use" and not found)

Specified by:
eventCreate in interface ScreenManager
Parameters:
screenContext -
params -
screenSession -
dbSession -
Throws:
TelosysException

eventReuse

public final void eventReuse(ScreenContext screenContext,
                             ScreenRequestParameters params,
                             ScreenSession screenSession,
                             DatabaseSession dbSession)
                      throws TelosysException
Description copied from interface: ScreenManager
Entry point for a "reuse event", origin : ScreenContextManager ("use" and found)

Specified by:
eventReuse in interface ScreenManager
Parameters:
screenContext -
params -
screenSession -
dbSession -
Throws:
TelosysException

getScreenApplication

protected final ScreenApplication getScreenApplication()
Returns the ScreenApplication object

Returns:

getServletContext

protected final javax.servlet.ServletContext getServletContext()
Returns the ServletContext object

Returns:

getDAO

protected final StandardDAO getDAO(java.lang.Class beanClass)
                            throws TelosysException
Returns the DAO for the given bean class and the default database

Parameters:
beanClass -
Returns:
Throws:
TelosysException
Since:
1.1.0

getDAO

protected final StandardDAO getDAO(java.lang.Class beanClass,
                                   DatabaseSession dbSession)
                            throws TelosysException
Returns the DAO for the given bean class and db session

Parameters:
beanClass -
dbSession -
Returns:
Throws:
TelosysException
Since:
1.0.2

getDAO

protected final StandardDAO getDAO(java.lang.Class beanClass,
                                   int iDatabaseId)
                            throws TelosysException
Returns the DAO for the given bean class and db id

Parameters:
beanClass -
iDatabaseId -
Returns:
Throws:
TelosysException
Since:
1.0.2