com.acsinet_solutions.cetia4.service
Class ContextSession

java.lang.Object
  extended by com.acsinet_solutions.cetia4.service.ContextSession

public final class ContextSession
extends java.lang.Object

A context session utility class that works as facade for the current user session. Current implementation stores session info in a ThreadLocal variable; but if this class may be used with EJB, alternative implementations that work according to EJB rules may be needed. In those cases, a mechanism for alternative backend session info obtention implementations may be the solution.

Derechos Reservados

Author:
Santiago Arriaga

Constructor Summary
ContextSession()
           
 
Method Summary
static void clearSession()
          Clear the context session for this thread; sets the thread local value to null.
static java.lang.String getFname()
           
static java.lang.String getLname1()
           
static java.lang.String getLogin()
           
static java.util.Set getRoles()
           
static UserSession getSession()
          Return the session in stack or the system session.
static int getUserId()
           
static void setSession(UserSession session)
          Set the context session for this thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextSession

public ContextSession()
Method Detail

setSession

public static void setSession(UserSession session)
Set the context session for this thread.


clearSession

public static void clearSession()
Clear the context session for this thread; sets the thread local value to null.


getUserId

public static int getUserId()
See Also:
UserSession.getUserId()

getLogin

public static java.lang.String getLogin()
See Also:
UserSession.getLogin()

getFname

public static java.lang.String getFname()
See Also:
UserSession.getFname()

getLname1

public static java.lang.String getLname1()
See Also:
UserSession.getLname1()

getRoles

public static java.util.Set getRoles()
See Also:
UserSession.getRoles()

getSession

public static final UserSession getSession()
Return the session in stack or the system session.

Returns:
A not-null UserSession instance