com.cinecolombia.component.Security.ejb
Class SecurityEJB

java.lang.Object
  |
  +--com.cinecolombia.component.Security.ejb.SecurityEJB
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean

public class SecurityEJB
extends java.lang.Object
implements javax.ejb.SessionBean

Session Stateful EJB for cinecolombia module

Author:
CincoSOFT
See Also:
Serialized Form
Created:
Junio 2003

Field Summary
private  java.lang.String companyId
          current company
private  javax.ejb.SessionContext context
          session context
private  Debug debug
          for debugging
private  SecurityDAO securityDao
          SecurityDAO object for interacting with the database
private  java.lang.Long userId
          current user
 
Constructor Summary
SecurityEJB()
          Constructor
 
Method Summary
 void ejbActivate()
          Actions after swapping
 void ejbCreate()
          ejbCreate
 void ejbPassivate()
          Actions before swapping
 void ejbRemove()
          Action before removing EJB instance
private  SecurityDAO getDao()
          Obtains a DAO instance assigning to securityDao attribute
 java.util.ArrayList getUserProfile(java.lang.String userName, java.lang.String companyNumber)
          Loads user profile: global data and security user actions
 java.util.Hashtable getUsersRoles()
          Loads users and associated roles of the system
 void inactivateUser(long idUsuario)
          set user to inactive state
 ParametrosGlobalesModel loadCompany()
          Get global parameters of current company
 Profile loadProfile(long idProfile)
          Get complete data of a profile
 java.util.ArrayList loadSystemProfiles()
          Get list of system profiles ordered by nombre_perfil
 User loadUser(long idUsuario)
          Get data of selected user
 java.util.ArrayList loadUserModulosConPermisos(long idUsuario)
          Get list of system modules and the permissions of user.
 java.util.ArrayList loadUserProfiles(long idUsuario)
          Get list of user profiles (for a specific user) ordered by nombre_perfil
 java.util.ArrayList loadUsers()
          Get list of active users ordered by codigoUsuario
 void removeProfile(long idProfile)
          Remove complete data of a profile
 void revokePermisosUsuario(long idUsuario, long[] codigosRevocados)
          Revoke every especial permissions of user
 void setSessionContext(javax.ejb.SessionContext sc)
          Set session context
 void setState(java.lang.String companyId, java.lang.Long userId)
          Set state of EJB
 void storePermisosUsuario(long idUsuario, AccionPermisoEspecial accionesPermisoEspecial)
          Save new especial permissions of user
 void storeProfile(long idProfile, java.lang.String profileName, long[] allowedActions)
          Set complete data of a profile
 void storeUser(User user, long[] userProfilesCodes)
          Store user
 void updateCompany(ParametrosGlobalesValue value)
          Set global parameters of current company
 void updatePassword(java.lang.String newPassword)
          Update the password of the user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

companyId

private java.lang.String companyId
current company


userId

private java.lang.Long userId
current user


context

private javax.ejb.SessionContext context
session context


securityDao

private SecurityDAO securityDao
SecurityDAO object for interacting with the database


debug

private Debug debug
for debugging

Constructor Detail

SecurityEJB

public SecurityEJB()
Constructor

Method Detail

setSessionContext

public void setSessionContext(javax.ejb.SessionContext sc)
Set session context

Specified by:
setSessionContext in interface javax.ejb.SessionBean
Parameters:
sc - The new sessionContext value

ejbActivate

public void ejbActivate()
Actions after swapping

Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
Actions before swapping

Specified by:
ejbPassivate in interface javax.ejb.SessionBean

ejbCreate

public void ejbCreate()
ejbCreate


ejbRemove

public void ejbRemove()
Action before removing EJB instance

Specified by:
ejbRemove in interface javax.ejb.SessionBean

getUserProfile

public java.util.ArrayList getUserProfile(java.lang.String userName,
                                          java.lang.String companyNumber)
                                   throws DAOException
Loads user profile: global data and security user actions

Parameters:
userName - Description of the Parameter
companyNumber - Description of the Parameter
Returns:
ArrayList with 2 elements: userGlobals: String[] composed of: companyName, userId, companySessionTime, companyId, password userActions: Hashtable of: (usecase, useCaseActions) where useCaseActions is an ArrayList of actions and each action is a String
Throws:
DAOException

getUsersRoles

public java.util.Hashtable getUsersRoles()
                                  throws DAOException
Loads users and associated roles of the system

Returns:
Hashtable of: (user, userRoles) where user is a String (codigo_usuario), userRoles is an ArrayList of roles and each role is a String
Throws:
DAOException

setState

public void setState(java.lang.String companyId,
                     java.lang.Long userId)
              throws DAOException
Set state of EJB

Parameters:
companyId -
userId -
Throws:
DAOException

loadUsers

public java.util.ArrayList loadUsers()
                              throws DAOException
Get list of active users ordered by codigoUsuario

Returns:
ArrayList where each element is a User
Throws:
DAOException

loadSystemProfiles

public java.util.ArrayList loadSystemProfiles()
                                       throws DAOException
Get list of system profiles ordered by nombre_perfil

Returns:
ArrayList where each element is a CodeDescription composed by: (codigo_perfil, nombre_perfil)
Throws:
DAOException

loadUser

public User loadUser(long idUsuario)
              throws DAOException
Get data of selected user

Parameters:
idUsuario - Description of the Parameter
Returns:
User with data of user
Throws:
DAOException

loadUserProfiles

public java.util.ArrayList loadUserProfiles(long idUsuario)
                                     throws DAOException
Get list of user profiles (for a specific user) ordered by nombre_perfil

Parameters:
idUsuario - Description of the Parameter
Returns:
ArrayList where each element is a CodeDescription composed by: (codigo_perfil, nombre_perfil)
Throws:
DAOException

storeUser

public void storeUser(User user,
                      long[] userProfilesCodes)
               throws DAOException
Store user

Parameters:
user - data of the user
userProfilesCodes - profiles of the user
Throws:
DAOException

inactivateUser

public void inactivateUser(long idUsuario)
                    throws DAOException
set user to inactive state

Parameters:
idUsuario - identifier of the user
Throws:
DAOException

updatePassword

public void updatePassword(java.lang.String newPassword)
                    throws DAOException
Update the password of the user

Parameters:
newPassword - new password of the user
Throws:
DAOException

loadProfile

public Profile loadProfile(long idProfile)
                    throws DAOException
Get complete data of a profile

Parameters:
idProfile - code of Profile
Returns:
profile Object composed by profiles' information(Profile Module, UseCase and Action).
Throws:
DAOException

storeProfile

public void storeProfile(long idProfile,
                         java.lang.String profileName,
                         long[] allowedActions)
                  throws DAOException
Set complete data of a profile

Parameters:
idProfile - Code of Profile
profileName - Name of Perfil
allowedActions - List of actions allowed
Throws:
DAOException

removeProfile

public void removeProfile(long idProfile)
                   throws DAOException
Remove complete data of a profile

Parameters:
idProfile - Code of Profile
Throws:
DAOException

loadCompany

public ParametrosGlobalesModel loadCompany()
                                    throws DAOException
Get global parameters of current company

Returns:
answer ParametrosGlobalesModel Object.
Throws:
DAOException

updateCompany

public void updateCompany(ParametrosGlobalesValue value)
                   throws DAOException
Set global parameters of current company

Parameters:
value - ParametrosGlobalesValue Object.
Throws:
DAOException

loadUserModulosConPermisos

public java.util.ArrayList loadUserModulosConPermisos(long idUsuario)
                                               throws DAOException
Get list of system modules and the permissions of user.

Parameters:
idUsuario - Code of user
Returns:
ArrayList where each element is a ModuloConPermisos
Throws:
DAOException

revokePermisosUsuario

public void revokePermisosUsuario(long idUsuario,
                                  long[] codigosRevocados)
                           throws DAOException
Revoke every especial permissions of user

Parameters:
idUsuario - User code
codigosRevocados - List of revoked especial permissions
Throws:
DAOException

storePermisosUsuario

public void storePermisosUsuario(long idUsuario,
                                 AccionPermisoEspecial accionesPermisoEspecial)
                          throws DAOException
Save new especial permissions of user

Parameters:
idUsuario - User code
accionesPermisoEspecial - Set of new especial permissions
Throws:
DAOException

getDao

private SecurityDAO getDao()
                    throws DAOException
Obtains a DAO instance assigning to securityDao attribute

Returns:
The dao value
Throws:
DAOException