com.instantbank.lettertemplate.control.ejb
Class LetterTemplateControllerEJB

java.lang.Object
  |
  +--com.instantbank.lettertemplate.control.ejb.LetterTemplateControllerEJB
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean

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

Session Bean implementation for LetterTemplateController EJB. This is the EJB-tier controller of the MVC. It is implemented as a session EJB. It controls all the activities that happen in a client session (managing update events through handleEvent() method) It also provides mechanisms to access other session EJBs and variables: get services for obtaining session variables and for contacting EJBs (entity or session) which are instanced for the user.

Author:
Instant-bank (Consuelo Franky)
See Also:
Serialized Form

Field Summary
private  Debug debug
           
private  Job job
           
private  LetterTemplate letterTemplate
           
private  javax.ejb.SessionContext sc
           
private  StateMachine sm
           
 
Constructor Summary
LetterTemplateControllerEJB()
          Constructor for the LetterTemplateControllerEJB object
 
Method Summary
 void ejbActivate()
          activation after swapping
 void ejbCreate()
          after creation of ejb instance
 void ejbPassivate()
          before swappping
 void ejbRemove()
          before remove ejb instance
 LetterTemplate getLetterTemplate(java.lang.String companyId, java.lang.Long userId)
          Get reference to LetterTemplate EJB
 Job getNewJob(java.lang.String companyId, java.lang.Long userId, java.lang.String name, long ftpPrimaryId, long ftpAlternateId)
          Get reference to a new Job EJB
 Job getOldJob(java.lang.Long jobId)
          Get reference to an existent Job EJB
 java.lang.String getW()
           
 java.util.Collection handleEvent(LetterTemplateEvent ese)
          Principal service: Feeds the specified event to the state machine of the business logic.
 void setJobNull()
          Sets null to job attribute:
 void setSessionContext(javax.ejb.SessionContext sc)
          Sets the sessionContext attribute of the LetterTemplateControllerEJB object
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

sm

private StateMachine sm

letterTemplate

private LetterTemplate letterTemplate

job

private Job job

sc

private javax.ejb.SessionContext sc

debug

private Debug debug
Constructor Detail

LetterTemplateControllerEJB

public LetterTemplateControllerEJB()
Constructor for the LetterTemplateControllerEJB object
Method Detail

setSessionContext

public void setSessionContext(javax.ejb.SessionContext sc)
Sets the sessionContext attribute of the LetterTemplateControllerEJB object
Specified by:
setSessionContext in interface javax.ejb.SessionBean
Parameters:
sc - The new sessionContext value

ejbActivate

public void ejbActivate()
activation after swapping
Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
before swappping
Specified by:
ejbPassivate in interface javax.ejb.SessionBean

ejbCreate

public void ejbCreate()
after creation of ejb instance

ejbRemove

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

handleEvent

public java.util.Collection handleEvent(LetterTemplateEvent ese)
                                 throws LetterTemplateEventException
Principal service: Feeds the specified event to the state machine of the business logic.
Parameters:
ese - event corresponding to user request
Returns:
a list of models (EJBs names) that got updated because of the processing of this event. In addition, the first element of the list contains the service answer (or the "" string when this answer is not required)
Throws:
LetterTemplateEventException -  

setJobNull

public void setJobNull()
Sets null to job attribute:

getLetterTemplate

public LetterTemplate getLetterTemplate(java.lang.String companyId,
                                        java.lang.Long userId)
Get reference to LetterTemplate EJB
Parameters:
companyId - current company
userId - current user
Returns:
the LetterTemplate session EJB associated with this session.

getOldJob

public Job getOldJob(java.lang.Long jobId)
Get reference to an existent Job EJB
Parameters:
jobId - primary key of the Job
Returns:
the Job entity EJB associated.

getNewJob

public Job getNewJob(java.lang.String companyId,
                     java.lang.Long userId,
                     java.lang.String name,
                     long ftpPrimaryId,
                     long ftpAlternateId)
Get reference to a new Job EJB
Parameters:
companyId - current company
userId - current user
name - name of Job
ftpPrimaryId - primary ftp associated to the Job
ftpAlternateId - alternate ftp associated to the Job
Returns:
a new Job entity EJB associated with this session.

getW

public java.lang.String getW()
Returns:
the w variable for this session: these variables are maintained by StateMachine javaBean