LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.app.behavior
Class LyDataApplicationBehavior

java.lang.Object
  extended by leon.app.behavior.LyDataApplicationBehavior
All Implemented Interfaces:
LyApplicationBehaviorInterface, LySessionListenerInterface
Direct Known Subclasses:
LyApplicationBehavior

public class LyDataApplicationBehavior
extends java.lang.Object
implements LyApplicationBehaviorInterface

Default implementation of the LyApplicationBehavior. This implementation does nothing.

See Also:
LyApplicationBehaviorInterface, LyApplication

Field Summary
static java.lang.String __VERSION
          File version
static java.lang.String PREF_BLOB_COL
          constant for blob column for saving preferences in a blob.
static java.lang.String PREF_DATE_COL
          constant for date column for saving preferences in a blob.
static java.lang.String PREF_ID_COL
          constant for id column for saving preferences in a blob.
static java.lang.String PREF_TABLE
          constant for table name for saving preferences in a blob.
static java.lang.String PREF_TYPE_COL
          constant for pref type column for saving preferences in a blob.
static java.lang.String PREF_USER_COL
          constant for userId column for saving preferences in a blob.
 
Constructor Summary
LyDataApplicationBehavior()
          Constructor.
 
Method Summary
 void addSpecificEncoders(LyApplication application, LyDataProvider provider)
          Adds specific encoders for new providers if needed.
 void afterCommit(LyApplication application, java.lang.String idTransaction, java.lang.String locationId)
          Method called after a transaction has been comitted on a location.
 void afterRollback(LyApplication application, java.lang.String idTransaction, java.lang.String locationId)
          Method called after a transaction has been rollbacked on a location.
 void beforeCommit(LyApplication application, java.lang.String idTransaction, java.lang.String locationId)
          Method called before a transaction should be committed on a location.
 void beforeRollback(LyApplication application, java.lang.String idTransaction, java.lang.String locationId)
          Method called before a transaction should be rollbacked on a location.
 void begin(LyApplication application, java.lang.String idTransaction, java.lang.String locationId)
          Method called when a transaction begins on a location.
 void close(LyApplication application)
          Method called when an application is closed.
 void connectionLost(LyApplication application, LyInfo server)
          Method called when a connection with a server (LyLocation or LyNotifier) is lost.
 void createDaemons(LyApplication application)
          Creates daemons to manage relations within an application.
 boolean deleteExtraInfo(LyApplication application, LyExtraInfoInterface info)
          Delete given extra info like preferences, charts or treemap configurations.
 boolean deleteExtraInfoFromDB(LyApplication application, java.lang.String extraInfoId)
          Delete given extra info like preferences, charts or treemap configurations from database.
 boolean enableLoadUnloadData(LyClassInfo classInfo)
          Indicates whether data may be loaded / unloaded for given class info.
 void free()
          Free this behavior.
 LyEventManager getEventManager(LyApplication application)
          Get the event manager for the given application.
 LyInfoList<LyClassInfo> getLogicalClasses(LyApplication application, LyObjectId objectId, LyValueSet values)
          Method used to find logical classes of a peer object identifier.
 double getNextDouble(LyApplication application, LyClass objectClass)
          Used to get an unique double value for the specified application.
 float getNextFloat(LyApplication application, LyClass objectClass)
          Used to get an unique float value for the specified application.
 int getNextInt(LyApplication application, LyClass objectClass)
          Used to get an unique int value for the specified application.
 long getNextLong(LyApplication application, LyClass objectClass)
          Used to get an unique long value for the specified application.
 short getNextShort(LyApplication application, LyClass objectClass)
          Used to get an unique short value for the specified application.
 int getPriorityLevel(LyApplication application, LyObject object)
          Gets the control priority level of the application.
 LyInfoList<LyClassInfo> getSubClasses(LyApplication application, LyObjectId objectId, LyValueSet values)
          Method used by abstract classes to define which subclass has to be loaded.
 java.lang.String[][] getSupportedLanguages(LyApplication application)
          Gets all languages that the given application supports.
 java.lang.String[] getSupportedTimeZones(LyApplication application)
          Get all timezone supported by this application.
 void loadData(LyApplication application)
          Method called when datas are loaded for an application.
 void loadData(LyApplication application, LyInfoList<LyClassInfo> classes)
          Load data for given classes.
 LyInfoList<LyInfo> loadExtraInfos(LyApplication application)
          Load extra infos.
 java.util.Vector<LyExtraInfoInterface> loadExtraInfosFromDB(LyApplication application, java.lang.String prefType, java.lang.String userId)
          Load extra info like preferences, charts, treemap configurations or form saves.
 LyInfoList<LyInfo> loadPreferences(LyApplication application)
          Load application preferences.
 LyInfoList<LyInfo> parseExtraFromDB(LyApplication application, java.lang.String prefType, java.lang.String userId)
          Method for parsing extra information such as charts or preferences.
 void saveData(LyApplication application)
          Method called when datas are saved for an application.
 boolean saveExtraInfo(LyApplication application, LyExtraInfoInterface info)
          Save given extra info like preferences, charts or treemap configurations.
 boolean saveExtraInfo(LyApplication application, LyExtraInfoInterface info, LyXmlWriterInterface writer)
          Save given extra info like preferences, charts or treemap configurations.
 void sessionAdded(LyApplication application, LyDataSession session)
          Method called when a session is added to the application.
 void sessionLoggedIn(LyApplication application, LyDataSession session, LyObject user)
          Method called when a user logged in a session.
 void sessionRemoved(LyApplication application, LyDataSession session)
          Method called when a session is removed from the application.
 void sleep(LyApplication application)
          Method called when an application falls in sleeping mode.
 boolean start(LyApplication application)
          Method called when an application is starting.
 boolean started(LyApplication application)
          Method called when an application is started.
 void transactionCompleted(LyApplication application, java.util.Vector<java.lang.String> idTransactions, java.util.Vector<java.lang.String> locationIds)
          Method called after a transaction was successfully completed (commit and notification done).
 void unloadData(LyApplication application)
          Method called when datas are unloaded for an application.
 void update(LyApplication application, java.lang.String idTransaction, java.lang.String locationId, java.lang.String request)
          Method called when a request is sent in a transaction for a location.
 void wakeUp(LyApplication application)
          Method called when an application is awake from sleeping mode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version

See Also:
Constant Field Values

PREF_TABLE

public static java.lang.String PREF_TABLE
constant for table name for saving preferences in a blob.


PREF_ID_COL

public static java.lang.String PREF_ID_COL
constant for id column for saving preferences in a blob.


PREF_TYPE_COL

public static java.lang.String PREF_TYPE_COL
constant for pref type column for saving preferences in a blob.


PREF_USER_COL

public static java.lang.String PREF_USER_COL
constant for userId column for saving preferences in a blob.


PREF_DATE_COL

public static java.lang.String PREF_DATE_COL
constant for date column for saving preferences in a blob.


PREF_BLOB_COL

public static java.lang.String PREF_BLOB_COL
constant for blob column for saving preferences in a blob.

Constructor Detail

LyDataApplicationBehavior

public LyDataApplicationBehavior()
Constructor. Sets the priority level to null.

Method Detail

start

public boolean start(LyApplication application)
Method called when an application is starting. This method is called before loading project and creating providers see started(LyApplication) to be notified after generic staring process.
This implementation does nothing and return true.

Specified by:
start in interface LyApplicationBehaviorInterface
Parameters:
application - Application that is starting.
Returns:
true
See Also:
started(LyApplication)

started

public boolean started(LyApplication application)
Method called when an application is started. This method is called after loading project and creating providers see start(LyApplication) to be notified before generic staring process.
This implementation does nothing and return true.

Specified by:
started in interface LyApplicationBehaviorInterface
Parameters:
application - Application that is started.
Returns:
true
See Also:
start(LyApplication)

createDaemons

public void createDaemons(LyApplication application)
Creates daemons to manage relations within an application.
This implementation does nothing.

Specified by:
createDaemons in interface LyApplicationBehaviorInterface
Parameters:
application - Current application.

loadPreferences

public LyInfoList<LyInfo> loadPreferences(LyApplication application)
Load application preferences.

Specified by:
loadPreferences in interface LyApplicationBehaviorInterface
Parameters:
application - Application on which preferences are loaded.
Returns:
List of preferences of the application.

loadExtraInfos

public LyInfoList<LyInfo> loadExtraInfos(LyApplication application)
Load extra infos.

Specified by:
loadExtraInfos in interface LyApplicationBehaviorInterface
Parameters:
application - Application on which extra infos (like charts or treemap configurations) are loaded.
Returns:
List of extra infos for the application.

sessionAdded

public void sessionAdded(LyApplication application,
                         LyDataSession session)
Method called when a session is added to the application.
This implementation does nothing.

Specified by:
sessionAdded in interface LyApplicationBehaviorInterface
Specified by:
sessionAdded in interface LySessionListenerInterface
Parameters:
application - Application in which a session is added.
session - Session added to the application.

sessionLoggedIn

public void sessionLoggedIn(LyApplication application,
                            LyDataSession session,
                            LyObject user)
Method called when a user logged in a session.

Specified by:
sessionLoggedIn in interface LySessionListenerInterface
Parameters:
application - Application in which a session is added.
session - Session added to the application.
user - User that logged in.

sessionRemoved

public void sessionRemoved(LyApplication application,
                           LyDataSession session)
Method called when a session is removed from the application.
This implementation does nothing.

Specified by:
sessionRemoved in interface LyApplicationBehaviorInterface
Specified by:
sessionRemoved in interface LySessionListenerInterface
Parameters:
application - Application in which a session is removed.
session - Session removed from the application.

loadData

public void loadData(LyApplication application)
Method called when datas are loaded for an application.
This implementation does nothing.

Specified by:
loadData in interface LyApplicationBehaviorInterface
Parameters:
application - Application for which datas are loaded.

unloadData

public void unloadData(LyApplication application)
Method called when datas are unloaded for an application.
This implementation does nothing.

Specified by:
unloadData in interface LyApplicationBehaviorInterface
Parameters:
application - Application for which datas are unloaded.

saveData

public void saveData(LyApplication application)
Method called when datas are saved for an application.
This implementation does nothing.

Specified by:
saveData in interface LyApplicationBehaviorInterface
Parameters:
application - Application for which datas are saved.

close

public void close(LyApplication application)
Method called when an application is closed.
This implementation does nothing.

Specified by:
close in interface LyApplicationBehaviorInterface
Parameters:
application - Application that is closed.

sleep

public void sleep(LyApplication application)
Method called when an application falls in sleeping mode.
This implementation does nothing.

Specified by:
sleep in interface LyApplicationBehaviorInterface
Parameters:
application - Application for which datas are saved.

wakeUp

public void wakeUp(LyApplication application)
Method called when an application is awake from sleeping mode.
This implementation does nothing.

Specified by:
wakeUp in interface LyApplicationBehaviorInterface
Parameters:
application - Application that is awake.

getSupportedLanguages

public java.lang.String[][] getSupportedLanguages(LyApplication application)
Gets all languages that the given application supports.
This implementation returns the if set, the values extracted from the LY_LANGUAGES ini variable

Specified by:
getSupportedLanguages in interface LyApplicationBehaviorInterface
Parameters:
application - Application that is awake.
Returns:
a list of supported languages

getSupportedTimeZones

public java.lang.String[] getSupportedTimeZones(LyApplication application)
Get all timezone supported by this application. If the LY_TIMEZONES env variable is set, this method returns the contents of this variable as a list. Otherwise, it returns null; Validity of a time zone depends on the java.util.TimeZone class. An unknow timezone for the TimeZone class is interpreted as GMT.

Specified by:
getSupportedTimeZones in interface LyApplicationBehaviorInterface
Parameters:
application - the current application
Returns:
a list of supported timezones.

addSpecificEncoders

public void addSpecificEncoders(LyApplication application,
                                LyDataProvider provider)
Adds specific encoders for new providers if needed. An encoder is used to encode a request made on a data source and decode results to give a response. For instance, the LySqlRequestEncoder encodes and decodes SQL queries to a RDBMS.
This implementation does nothing.

Specified by:
addSpecificEncoders in interface LyApplicationBehaviorInterface
Parameters:
application - Current application.
provider - provider which may need an encoder

connectionLost

public void connectionLost(LyApplication application,
                           LyInfo server)
Method called when a connection with a server (LyLocation or LyNotifier) is lost.
This implementation shows a message indicating the connection is lost and closes all dialog windows.

Specified by:
connectionLost in interface LyApplicationBehaviorInterface
Parameters:
application - Current application.
server - Logical server definition

getPriorityLevel

public int getPriorityLevel(LyApplication application,
                            LyObject object)
Gets the control priority level of the application. This level is used to enable/disable controls.

Specified by:
getPriorityLevel in interface LyApplicationBehaviorInterface
Parameters:
application - Current application.
object - the object on which the control is applied.
Returns:
the priority level of the application.

begin

public void begin(LyApplication application,
                  java.lang.String idTransaction,
                  java.lang.String locationId)
Method called when a transaction begins on a location.
This implementation print a trace about the begining of the transaction if the environment debug level is LyEnvironment.DEBUG_TRANSACTION.

Specified by:
begin in interface LyApplicationBehaviorInterface
Parameters:
application - Current application
idTransaction - Id of the begin transaction
locationId - Id of the location

update

public void update(LyApplication application,
                   java.lang.String idTransaction,
                   java.lang.String locationId,
                   java.lang.String request)
Method called when a request is sent in a transaction for a location.
The default implementation print a trace about the transaction update if the environment debug level is LyEnvironment.DEBUG_TRANSACTION.

Specified by:
update in interface LyApplicationBehaviorInterface
Parameters:
application - Current application
idTransaction - Id of the transaction
locationId - Id of the location
request - Sent request if the request has a string representation

beforeCommit

public void beforeCommit(LyApplication application,
                         java.lang.String idTransaction,
                         java.lang.String locationId)
Method called before a transaction should be committed on a location.
The default implementation print a trace about the transaction before commit if the environment debug level is LyEnvironment.DEBUG_TRANSACTION.

Specified by:
beforeCommit in interface LyApplicationBehaviorInterface
Parameters:
application - Current application
idTransaction - Id of the transaction
locationId - Id of the location

afterCommit

public void afterCommit(LyApplication application,
                        java.lang.String idTransaction,
                        java.lang.String locationId)
Method called after a transaction has been comitted on a location.
The default implementation print a trace about the transaction after commit if the environment debug level is LyEnvironment.DEBUG_TRANSACTION.

Specified by:
afterCommit in interface LyApplicationBehaviorInterface
Parameters:
application - Current application
idTransaction - Id of the transaction
locationId - Id of the location

beforeRollback

public void beforeRollback(LyApplication application,
                           java.lang.String idTransaction,
                           java.lang.String locationId)
Method called before a transaction should be rollbacked on a location.
The default implementation print a trace about the transaction before roolback if the environment debug level is LyEnvironment.DEBUG_TRANSACTION.

Specified by:
beforeRollback in interface LyApplicationBehaviorInterface
Parameters:
application - Current application
idTransaction - Id of the transaction
locationId - Id of the location

afterRollback

public void afterRollback(LyApplication application,
                          java.lang.String idTransaction,
                          java.lang.String locationId)
Method called after a transaction has been rollbacked on a location.
The default implementation print a trace about the transaction after rollback if the environment debug level is LyEnvironment.DEBUG_TRANSACTION.

Specified by:
afterRollback in interface LyApplicationBehaviorInterface
Parameters:
application - Current application
idTransaction - Id of the transaction
locationId - Id of the location

transactionCompleted

public void transactionCompleted(LyApplication application,
                                 java.util.Vector<java.lang.String> idTransactions,
                                 java.util.Vector<java.lang.String> locationIds)
Method called after a transaction was successfully completed (commit and notification done).
The default implementation print a trace about transactions of the given list ending if the environment debug level is LyEnvironment.DEBUG_TRANSACTION.

Specified by:
transactionCompleted in interface LyApplicationBehaviorInterface
Parameters:
application - the current application
idTransactions - List of involved transaction ids
locationIds - list of involved locations ids

getSubClasses

public LyInfoList<LyClassInfo> getSubClasses(LyApplication application,
                                             LyObjectId objectId,
                                             LyValueSet values)
Method used by abstract classes to define which subclass has to be loaded.
This implementation does nothing and return null.

Specified by:
getSubClasses in interface LyApplicationBehaviorInterface
Parameters:
application - current application.
objectId - the object identifier to be loaded
values - optional additional values we might know about the object : this parameter is usually null.
Returns:
the list of classes if found or null to use generic processing. Note : an empty list aborts generic processing (not found in any subclass)

getLogicalClasses

public LyInfoList<LyClassInfo> getLogicalClasses(LyApplication application,
                                                 LyObjectId objectId,
                                                 LyValueSet values)
Method used to find logical classes of a peer object identifier.
This implementation does nothing and return null.

Specified by:
getLogicalClasses in interface LyApplicationBehaviorInterface
Parameters:
application - current application.
objectId - an object identifier of a peer object (use LyClassInfo.getObjectClass() to get the peer class : instance of LyClass)
values - optional additional values we might know about the object : this parameter is usually null.
Returns:
the list of classes if found or null to use generic processing. Note : an empty lists aborts generic processing (not found in any subclass)

getNextShort

public short getNextShort(LyApplication application,
                          LyClass objectClass)
Used to get an unique short value for the specified application.

Specified by:
getNextShort in interface LyApplicationBehaviorInterface
Parameters:
application - current application
objectClass - the class for which a new object is created.
Returns:
An unique value as short for the specified application.

getNextInt

public int getNextInt(LyApplication application,
                      LyClass objectClass)
Used to get an unique int value for the specified application.

Specified by:
getNextInt in interface LyApplicationBehaviorInterface
Parameters:
application - current application
objectClass - the class for which a new object is created.
Returns:
An unique value as int for the specified application.

getNextLong

public long getNextLong(LyApplication application,
                        LyClass objectClass)
Used to get an unique long value for the specified application.

Specified by:
getNextLong in interface LyApplicationBehaviorInterface
Parameters:
application - current application
objectClass - the class for which a new object is created.
Returns:
An unique value as long for the specified application.

getNextFloat

public float getNextFloat(LyApplication application,
                          LyClass objectClass)
Used to get an unique float value for the specified application.

Specified by:
getNextFloat in interface LyApplicationBehaviorInterface
Parameters:
application - current application
objectClass - the class for which a new object is created.
Returns:
An unique value as float for the specified application.

getNextDouble

public double getNextDouble(LyApplication application,
                            LyClass objectClass)
Used to get an unique double value for the specified application.

Specified by:
getNextDouble in interface LyApplicationBehaviorInterface
Parameters:
application - current application
objectClass - the class for which a new object is created.
Returns:
An unique value as double for the specified application.

free

public void free()
Free this behavior.
This method is provided to allow behavior to unregister itself from object sources or workspaces if needed.
It should be called only by the controller that built this behavior.
This implementation does nothing.

Specified by:
free in interface LyApplicationBehaviorInterface

loadData

public void loadData(LyApplication application,
                     LyInfoList<LyClassInfo> classes)
Load data for given classes.
This implementation does nothing.

Specified by:
loadData in interface LyApplicationBehaviorInterface
Parameters:
application - Application for which classes are loaded.
classes - List of classes to load.
See Also:
LyApplication.loadData(), LyClassInfo

enableLoadUnloadData

public boolean enableLoadUnloadData(LyClassInfo classInfo)
Indicates whether data may be loaded / unloaded for given class info.

Specified by:
enableLoadUnloadData in interface LyApplicationBehaviorInterface
Parameters:
classInfo - class info for which data may be loaded / unloaded
Returns:
true if data may be loaded / unloaded

parseExtraFromDB

public LyInfoList<LyInfo> parseExtraFromDB(LyApplication application,
                                           java.lang.String prefType,
                                           java.lang.String userId)
Method for parsing extra information such as charts or preferences.

Specified by:
parseExtraFromDB in interface LyApplicationBehaviorInterface
Parameters:
application - Application for which classes are loaded.
prefType - identifies the preference type : "preference", "chart", "sticker" or "treemap_configuration"
userId - User id (may be null when info is shared).
Returns:
List of loaded infos.

saveExtraInfo

public boolean saveExtraInfo(LyApplication application,
                             LyExtraInfoInterface info)
Save given extra info like preferences, charts or treemap configurations.

Specified by:
saveExtraInfo in interface LyApplicationBehaviorInterface
Parameters:
application - Application on which extra info is saved.
info - Info to be saved.
Returns:
True if extra info was successfully saved.

saveExtraInfo

public boolean saveExtraInfo(LyApplication application,
                             LyExtraInfoInterface info,
                             LyXmlWriterInterface writer)
Save given extra info like preferences, charts or treemap configurations.

Specified by:
saveExtraInfo in interface LyApplicationBehaviorInterface
Parameters:
application - Application on which extra info is saved.
info - Info to be saved.
writer - Writer interface.
Returns:
True if extra info was successfully saved.

loadExtraInfosFromDB

public java.util.Vector<LyExtraInfoInterface> loadExtraInfosFromDB(LyApplication application,
                                                                   java.lang.String prefType,
                                                                   java.lang.String userId)
Load extra info like preferences, charts, treemap configurations or form saves.

Specified by:
loadExtraInfosFromDB in interface LyApplicationBehaviorInterface
Parameters:
application - Application on which extra info is saved.
type - Extra info type.
id - Id of saved info.
Returns:
Info that was saved.

deleteExtraInfo

public boolean deleteExtraInfo(LyApplication application,
                               LyExtraInfoInterface info)
Delete given extra info like preferences, charts or treemap configurations.

Specified by:
deleteExtraInfo in interface LyApplicationBehaviorInterface
Parameters:
application - Application on which extra info is deleted.
info - Info to be deleted.
Returns:
True if extra info was successfully deleted.

deleteExtraInfoFromDB

public boolean deleteExtraInfoFromDB(LyApplication application,
                                     java.lang.String extraInfoId)
Delete given extra info like preferences, charts or treemap configurations from database.

Parameters:
application - Application on which extra info is deleted.
extraInfoId - Id of the extra info to be deleted.
Returns:
True if extra info was successfully deleted.

getEventManager

public LyEventManager getEventManager(LyApplication application)
Get the event manager for the given application. This implementation returns null.

Specified by:
getEventManager in interface LyApplicationBehaviorInterface
Parameters:
application - the current application
Returns:
an event manager. If null is returned, default event manager will be instanciated.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com