LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.app.behavior
Class LyDataSessionBehavior

java.lang.Object
  extended by leon.app.behavior.LyDataSessionBehavior
All Implemented Interfaces:
LyDataSessionBehaviorInterface
Direct Known Subclasses:
LySessionBehavior

public class LyDataSessionBehavior
extends java.lang.Object
implements LyDataSessionBehaviorInterface

This class implements the default behavior of a session.

See Also:
LyDataSession, LyDataSessionBehaviorInterface

Field Summary
static java.lang.String __VERSION
          File version.
 
Constructor Summary
LyDataSessionBehavior()
          Constructor.
 
Method Summary
 void close(LyDataSession session)
          Method called when a session is closed.
 void connectionLost(LyDataSession session, LyInfo server)
          Method called when a connection with a server (LyLocation or LyNotifier) is lost.
 short controlBeforeCommit(LyDataSession session, java.util.Collection<LyObject> objects)
          Method called when a context needs to control objects before commit.
 void free()
          Free this behavior.
 LyUnit getDefaultUnitForField(LyDataSession session, LyFieldInfo fieldInfo)
          Get the reference unit for the given field for the current session
 java.lang.Object getKeyValue(java.lang.String key)
          Retrieves a value from a registered key.
 LyObject getUser(LyDataSession session)
          Gets user of this session.
 void handleException(LyDataSession session, java.lang.Throwable t)
          Method called when an exception occurred during the session processing.
 void start(LyDataSession session)
          Method called when a session is started.
 void updateUndoRedo(LyDataSession session)
          /** Method called when the undo/redo status has changed.
 
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
Constructor Detail

LyDataSessionBehavior

public LyDataSessionBehavior()
Constructor.
Does nothing.

Method Detail

start

public void start(LyDataSession session)
Method called when a session is started.
The default implementation checks that the session application has a root action and validate the session if the root action is not a login action.

Specified by:
start in interface LyDataSessionBehaviorInterface
Parameters:
session - the started session.

close

public void close(LyDataSession session)
Method called when a session is closed.
The default implementation does nothing.

Specified by:
close in interface LyDataSessionBehaviorInterface
Parameters:
session - the closed session.

getUser

public LyObject getUser(LyDataSession session)
Gets user of this session.

Specified by:
getUser in interface LyDataSessionBehaviorInterface
Parameters:
session - Current session.
Returns:
The object representing current user of the session.

handleException

public void handleException(LyDataSession session,
                            java.lang.Throwable t)
Method called when an exception occurred during the session processing.
The default implementation writes the exception and abort transactions of the session.

Specified by:
handleException in interface LyDataSessionBehaviorInterface
Parameters:
session - the current session
t - The throwable instance that stopped the processing.

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.
The default implementation does nothing.

Specified by:
free in interface LyDataSessionBehaviorInterface

controlBeforeCommit

public short controlBeforeCommit(LyDataSession session,
                                 java.util.Collection<LyObject> objects)
Method called when a context needs to control objects before commit.
Result should be one of the following level:
The default implementation does nothing and return LyObject.LEVEL_OK.

Specified by:
controlBeforeCommit in interface LyDataSessionBehaviorInterface
Parameters:
session - the current session
objects - the objects to control.
Returns:
Result of calling controls.

updateUndoRedo

public void updateUndoRedo(LyDataSession session)
/** Method called when the undo/redo status has changed.
The status is available on the context manager of the application.
The default implementation does nothing.

Specified by:
updateUndoRedo in interface LyDataSessionBehaviorInterface
Parameters:
session - the current session.
See Also:
LyContextManager.isUndoAvailable(), LyContextManager.isRedoAvailable()

connectionLost

public void connectionLost(LyDataSession session,
                           LyInfo server)
Method called when a connection with a server (LyLocation or LyNotifier) is lost.

Specified by:
connectionLost in interface LyDataSessionBehaviorInterface
Parameters:
session - Current session.
server - Logical server definition

getKeyValue

public java.lang.Object getKeyValue(java.lang.String key)
Retrieves a value from a registered key.

Specified by:
getKeyValue in interface LyDataSessionBehaviorInterface
Parameters:
key - The key that must be used.
Returns:
The value stored with the key or null if the key is not registered.

getDefaultUnitForField

public LyUnit getDefaultUnitForField(LyDataSession session,
                                     LyFieldInfo fieldInfo)
Get the reference unit for the given field for the current session

Specified by:
getDefaultUnitForField in interface LyDataSessionBehaviorInterface
Parameters:
session - Current session
fieldInfo - a field
Returns:
a reference unit. Can be null.

(c) January 2013 - W4 S.A.

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