com.instantbank.component.parameter.ejb
Class ParameterEJB

java.lang.Object
  |
  +--com.instantbank.component.parameter.ejb.ParameterEJB
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean

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

Session Stateful EJB for for servicing ear : managamente of parameters

Author:
Instant-bank (Roberto Contreras)
See Also:
Serialized Form

Field Summary
(package private)  java.lang.String companyId
          current company
private  javax.ejb.SessionContext context
          session context
private  Debug debug
           
private  ParameterDAO parameterDao
          ParameterDAO object for interacting with the database
(package private)  java.lang.Long userId
          current user
 
Constructor Summary
ParameterEJB()
          Constructor
 
Method Summary
 java.util.ArrayList applyItemsParamLevel1Points(java.util.ArrayList items)
          Applies a set of changes in the values of parameter level 1 of the current company.
 java.util.ArrayList applyItemsParamLevel2Points(java.util.ArrayList items)
          Applies a set of changes in the values of parameter level 2 of the current company.
 void ejbActivate()
          Actions after swapping
 void ejbCreate(java.lang.String companyId, java.lang.Long userId)
          Get attribute values: companyId, userId and ParameterDAO object (parameterDao attribute)
 void ejbPassivate()
          Actions before swapping
 void ejbRemove()
          Action before removing EJB instance
private  ParameterDAO getDao()
          Obtains a DAO instance assigning to parameterDao attribute
 CodeDescription[] listParamLevel1Points()
          Loads all [code, value] of the values of parameter level 1 of the current company.
 CodeDescription[] listParamLevel2Points()
          Loads all [code, value] of the values of parameter level 2 of the current company.
 java.util.ArrayList listParamRestrictions()
          Loads the set parameters restrictions of the current company for each group parameter.
 ParameterModel listParamValues(java.lang.String codeParamater)
          Loads the set parameters values of the current company for the parameter without warning colors.
 java.util.Hashtable loadLevel1Code()
          Loads the value an code of level 1 point
 java.util.Hashtable loadLevel2Code()
          Loads the value an code of level 2 point
 java.util.ArrayList loadParamLevelsName()
          Loads parameters levels names of the current company.
 java.util.ArrayList loadParamSearchValues()
          Loads parameters search order of the current company.
 void setSessionContext(javax.ejb.SessionContext sc)
          Set session context
 java.util.ArrayList updateParamLevelsName(java.util.ArrayList items)
          Applies a set of updates in the parameters levels names of the current company.
 java.util.ArrayList updateParamRestrictions(java.util.Hashtable items)
          Applies a set of updates in the parameters restrictions in the current company.
 java.util.ArrayList updateParamSearchValues(java.util.ArrayList items)
          Applies a set of updates in the parameters search order of the current company.
 java.lang.String updateParamValues(ParameterValue items, java.util.Hashtable level1Code, java.util.Hashtable level2Code)
          Applies a set of updates in the parameters values in the current company.
 ParameterModel verifyParamValues(ParameterValue items)
          Check the parameters values and set warning colors to ParameterModel object of the current company for the parameter.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

companyId

java.lang.String companyId
current company

userId

java.lang.Long userId
current user

context

private javax.ejb.SessionContext context
session context

parameterDao

private ParameterDAO parameterDao
ParameterDAO object for interacting with the database

debug

private Debug debug
Constructor Detail

ParameterEJB

public ParameterEJB()
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(java.lang.String companyId,
                      java.lang.Long userId)
Get attribute values: companyId, userId and ParameterDAO object (parameterDao attribute)
Parameters:
companyId - current company
userId - current user

ejbRemove

public void ejbRemove()
Action before removing EJB instance
Specified by:
ejbRemove in interface javax.ejb.SessionBean

loadParamLevelsName

public java.util.ArrayList loadParamLevelsName()
                                        throws DAOException
Loads parameters levels names of the current company.
Returns:
ArrayList object with 2 elements: (0) parameter level 1 name. (1) parameter level 2 name.
Throws:
DAOException - Description of the Exception

updateParamLevelsName

public java.util.ArrayList updateParamLevelsName(java.util.ArrayList items)
                                          throws DAOException
Applies a set of updates in the parameters levels names of the current company.
Parameters:
items - ArrayList with 2 elements of type String representing the attributes of items to apply param name of level 1 and level 2.
Returns:
ArrayList object with 2 elements: (0) probabily problem. (1) ArrayList with a set of parameters levels names.
Throws:
DAOException - Description of the Exception

listParamLevel1Points

public CodeDescription[] listParamLevel1Points()
                                        throws DAOException
Loads all [code, value] of the values of parameter level 1 of the current company.
Returns:
CodeDescription[] object with [code, value] of the values of parameter level 1.
Throws:
DAOException - Description of the Exception

applyItemsParamLevel1Points

public java.util.ArrayList applyItemsParamLevel1Points(java.util.ArrayList items)
                                                throws DAOException
Applies a set of changes in the values of parameter level 1 of the current company.
Parameters:
items - ArrayList with 3 elements of type String[] representing the attributes of items to apply code, value and status. Status indicates if the item is for inserting, deleting or updating (ServicingGlobals.INSERT, ServicingGlobals.DELETE, ServicingGlobals.UPDATE)
Returns:
ArrayList with 2 elements: (0) possible problem (String), (1) current values of parameter level 1 list (CodeDescription[])
Throws:
DAOException - Description of the Exception

listParamLevel2Points

public CodeDescription[] listParamLevel2Points()
                                        throws DAOException
Loads all [code, value] of the values of parameter level 2 of the current company.
Returns:
CodeDescription[] object with [code, value] of the values of parameter level 2.
Throws:
DAOException - Description of the Exception

applyItemsParamLevel2Points

public java.util.ArrayList applyItemsParamLevel2Points(java.util.ArrayList items)
                                                throws DAOException
Applies a set of changes in the values of parameter level 2 of the current company.
Parameters:
items - ArrayList with 3 elements of type String[] representing the attributes of items to apply code, value and status. Status indicates if the item is for inserting, deleting or updating (ServicingGlobals.INSERT, ServicingGlobals.DELETE, ServicingGlobals.UPDATE)
Returns:
ArrayList with 2 elements: (0) possible problem (String), (1) current values of parameter level 2 list (CodeDescription[])
Throws:
DAOException - Description of the Exception

loadParamSearchValues

public java.util.ArrayList loadParamSearchValues()
                                          throws DAOException
Loads parameters search order of the current company.
Returns:
ArrayList object with 2 elements: (0) parameter search 2 value. (1) parameter search 3 value.
Throws:
DAOException - Description of the Exception

updateParamSearchValues

public java.util.ArrayList updateParamSearchValues(java.util.ArrayList items)
                                            throws DAOException
Applies a set of updates in the parameters search order of the current company.
Parameters:
items - ArrayList with 2 elements of type String representing the attributes of items to apply parameters search order.
Returns:
ArrayList object with 2 elements: (0) probabily problem. (1) ArrayList with a set of parameters search order.
Throws:
DAOException - Description of the Exception

listParamRestrictions

public java.util.ArrayList listParamRestrictions()
                                          throws DAOException
Loads the set parameters restrictions of the current company for each group parameter.
Returns:
ArrayList object with (n) elements. When each element is representing a group parameter and its parameters restrictions of type GroupParam.
Throws:
DAOException - Description of the Exception

updateParamRestrictions

public java.util.ArrayList updateParamRestrictions(java.util.Hashtable items)
                                            throws DAOException
Applies a set of updates in the parameters restrictions in the current company.
Parameters:
items - Hashtable with (n) elements of type ParmRestrictionUpdate. When each element is representing the attributes of parameter restrictions.
Returns:
ArrayList object with (n) elements. When each element is representing a group parameter and its parameters restrictions of type GroupParam.
Throws:
DAOException - Description of the Exception

listParamValues

public ParameterModel listParamValues(java.lang.String codeParamater)
                               throws DAOException
Loads the set parameters values of the current company for the parameter without warning colors.
Parameters:
codeParamater - Description of the Parameter
Returns:
ParameterModel object. When its atributes are representing the all values and warning colors for the parameter.
Throws:
DAOException - Description of the Exception

loadLevel1Code

public java.util.Hashtable loadLevel1Code()
                                   throws DAOException
Loads the value an code of level 1 point
Returns:
level1Code The Hashtable object with value of level 1 point as the key and the code of point 1 as value.
Throws:
DAOException - Description of the Exception

loadLevel2Code

public java.util.Hashtable loadLevel2Code()
                                   throws DAOException
Loads the value an code of level 2 point
Returns:
level1Code The Hashtable object with value of level 2 point as the key and the code of point 2 as value.
Throws:
DAOException - Description of the Exception

updateParamValues

public java.lang.String updateParamValues(ParameterValue items,
                                          java.util.Hashtable level1Code,
                                          java.util.Hashtable level2Code)
                                   throws DAOException
Applies a set of updates in the parameters values in the current company.
Parameters:
items - ParameterValue object with the value of code parameter, type of parameter and a Hashtable with the point1+"|"+point2 as the Key and the value of parameter as the Value.
level1Code - The Hashtable object with value of level 1 point as the key and the code of point 1 as value.
level2Code - The Hashtable object with value of level 2 point as the key and the code of point 2 as value.
Returns:
codeParameter The value of code parameter.
Throws:
DAOException - Description of the Exception

verifyParamValues

public ParameterModel verifyParamValues(ParameterValue items)
                                 throws DAOException
Check the parameters values and set warning colors to ParameterModel object of the current company for the parameter. This service doesn't save parameters values in the data base. Only verify warning colors.
Parameters:
items - ParameterValue object with the value of code parameter, type of parameter and a Hashtable with the point1+"|"+point2 as the Key and the value of parameter as the Value.
Returns:
ParameterModel object. When its atributes are representing the all values and warning colors for the parameter.
Throws:
DAOException - Description of the Exception

getDao

private ParameterDAO getDao()
                     throws DAOException
Obtains a DAO instance assigning to parameterDao attribute
Returns:
The dao value
Throws:
DAOException -