com.instantbank.component.job.ejb
Class JobEJB

java.lang.Object
  |
  +--com.instantbank.component.job.ejb.JobEJB
All Implemented Interfaces:
javax.ejb.EnterpriseBean, javax.ejb.EntityBean, java.io.Serializable

public class JobEJB
extends java.lang.Object
implements javax.ejb.EntityBean

Entity BMP EJB for modeling a job (master-details)

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

Field Summary
private  AuxGenerateSQLtext auxSQL
          supports SQL sentence generation
private  javax.ejb.EntityContext context
          entity context
private  Debug debug
          for debug
private  JobDAO jobDao
          JobDAO object for interacting with the database
private  JobModel jobModel
           
 
Constructor Summary
JobEJB()
          Constructor
 
Method Summary
private  java.lang.String buildFROM(java.util.ArrayList participantTables)
          Generate job sqlText corresponding to FROM part
private  java.lang.String buildORDER()
          Generate job sqlText corresponding to ORDER part.
private  java.lang.String buildSELECT()
          Generate job sqlText corresponding to SELECT part
private  java.lang.String buildWHERE_CONDITIONS()
          Generate job sqlText corresponding to WHERE conditions part
private  java.lang.String buildWHERE_JOINS(java.util.ArrayList participantTables)
          Generate job sqlText corresponding to WHERE join part
 void ejbActivate()
          Actions after swapping
 java.lang.Long ejbCreate(java.lang.String companyId, java.lang.Long userId, java.lang.String name, long ftpPrimaryId, long ftpAlternateId)
          Assigns value to the state of the new ejb instance, in main memory and in the database.
 java.lang.Long ejbFindByName(java.lang.String companyId, java.lang.String name)
          Finds an existent ejb instance in the database
 java.lang.Long ejbFindByPrimaryKey(java.lang.Long jobId)
          Finds an existentf ejb instance in the database
 void ejbLoad()
          Loads from database state of ejb instance
 void ejbPassivate()
          Actions before swapping
 void ejbPostCreate(java.lang.String companyId, java.lang.Long userId, java.lang.String name, long ftpPrimaryId, long ftpAlternateId)
          Additional action after ejbCreate() method.
 void ejbRemove()
          Removes ejb instance from the database.
 void ejbStore()
          Stores in database the state of ejb instance
 java.lang.String generateSQLtext(java.util.Hashtable systemFields, java.util.Hashtable systemAlias, java.lang.String rootType)
          Generate sqlText associated to the job (updates state of ejb instance: jobModel.sqlText)
private  JobDAO getDao()
          Obtains a DAO instance assigning it to jobDao attribute
 JobModel getState()
          Gets state value of ejb instance
 void setDescription(java.lang.String description)
          Sets value to the description of ejb instance (updates state of ejb instance: jobModel.description)
 void setEntityContext(javax.ejb.EntityContext sc)
          Set session context
 void setJobORDER(java.util.Collection jobORDER)
          Sets value to the jobORDER of ejb instance (updates state of ejb instance: jobModel.jobORDER)
 void setJobSELECT(java.util.Collection jobSELECT)
          Sets value to the jobSELECT of ejb instance (updates state of ejb instance: jobModel.jobSELECT)
 void setJobWHERE(java.util.Collection jobWHERE)
          Sets value to the jobWHERE of ejb instance (updates state of ejb instance: jobModel.jobWHERE)
 void setState(JobModel jobModel)
          Sets value to the state of ejb instance
 void setTemplate(long templateCode)
          Sets value to the templateCode of ejb instance (updates state of ejb instance: jobModel.templateCode)
 void unsetEntityContext()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

jobModel

private JobModel jobModel

context

private javax.ejb.EntityContext context
entity context

jobDao

private JobDAO jobDao
JobDAO object for interacting with the database

auxSQL

private AuxGenerateSQLtext auxSQL
supports SQL sentence generation

debug

private Debug debug
for debug
Constructor Detail

JobEJB

public JobEJB()
Constructor
Method Detail

setEntityContext

public void setEntityContext(javax.ejb.EntityContext sc)
Set session context
Specified by:
setEntityContext in interface javax.ejb.EntityBean
Parameters:
sc - The new sessionContext value

unsetEntityContext

public void unsetEntityContext()
Specified by:
unsetEntityContext in interface javax.ejb.EntityBean

ejbActivate

public void ejbActivate()
Actions after swapping
Specified by:
ejbActivate in interface javax.ejb.EntityBean

ejbPassivate

public void ejbPassivate()
Actions before swapping
Specified by:
ejbPassivate in interface javax.ejb.EntityBean

ejbCreate

public java.lang.Long ejbCreate(java.lang.String companyId,
                                java.lang.Long userId,
                                java.lang.String name,
                                long ftpPrimaryId,
                                long ftpAlternateId)
                         throws javax.ejb.CreateException
Assigns value to the state of the new ejb instance, in main memory and in the database.
Parameters:
companyId - current company
userId - current user
name - job name
ftpPrimaryId - a ftp location id of the company (it csn be LetterTemplateGlobals.UNDEF)
ftpAlternateId - an alternate ftp location id of the company (it csn be LetterTemplateGlobals.UNDEF)
Returns:
reference to the new instance EJB
Throws:
javax.ejb.CreateException -  

ejbPostCreate

public void ejbPostCreate(java.lang.String companyId,
                          java.lang.Long userId,
                          java.lang.String name,
                          long ftpPrimaryId,
                          long ftpAlternateId)
                   throws javax.ejb.CreateException
Additional action after ejbCreate() method.
Parameters:
companyId - current company
userId - current user
name - job name
ftpPrimaryId - a ftp location id of the company
ftpAlternateId - an alternate ftp location id of the company
Throws:
javax.ejb.CreateException -  

ejbFindByPrimaryKey

public java.lang.Long ejbFindByPrimaryKey(java.lang.Long jobId)
                                   throws javax.ejb.FinderException
Finds an existentf ejb instance in the database
Parameters:
jobId - key value of instance
Returns:
key value of ejb instance if it exists in the database
Throws:
javax.ejb.FinderException -  

ejbFindByName

public java.lang.Long ejbFindByName(java.lang.String companyId,
                                    java.lang.String name)
                             throws javax.ejb.FinderException
Finds an existent ejb instance in the database
Parameters:
companyId - current company
name - job name
Returns:
reference to the instance EJB
Throws:
javax.ejb.FinderException -  

ejbRemove

public void ejbRemove()
               throws javax.ejb.RemoveException
Removes ejb instance from the database.
Specified by:
ejbRemove in interface javax.ejb.EntityBean
Throws:
javax.ejb.RemoveException -  

ejbLoad

public void ejbLoad()
Loads from database state of ejb instance
Specified by:
ejbLoad in interface javax.ejb.EntityBean

ejbStore

public void ejbStore()
Stores in database the state of ejb instance
Specified by:
ejbStore in interface javax.ejb.EntityBean

getState

public JobModel getState()
Gets state value of ejb instance
Returns:
value of jobModel attribute

setState

public void setState(JobModel jobModel)
Sets value to the state of ejb instance
Parameters:
jobModel - new value to assign to jobModel attribute

setTemplate

public void setTemplate(long templateCode)
Sets value to the templateCode of ejb instance (updates state of ejb instance: jobModel.templateCode)
Parameters:
templateCode - new value to assign to templateCode

setDescription

public void setDescription(java.lang.String description)
Sets value to the description of ejb instance (updates state of ejb instance: jobModel.description)
Parameters:
description - new value to assign to description

setJobSELECT

public void setJobSELECT(java.util.Collection jobSELECT)
Sets value to the jobSELECT of ejb instance (updates state of ejb instance: jobModel.jobSELECT)
Parameters:
jobSELECT - new value to assign to jobSELECT

setJobWHERE

public void setJobWHERE(java.util.Collection jobWHERE)
Sets value to the jobWHERE of ejb instance (updates state of ejb instance: jobModel.jobWHERE)
Parameters:
jobWHERE - new value to assign to jobWHERE

setJobORDER

public void setJobORDER(java.util.Collection jobORDER)
Sets value to the jobORDER of ejb instance (updates state of ejb instance: jobModel.jobORDER)
Parameters:
jobORDER - new value to assign to jobORDER

generateSQLtext

public java.lang.String generateSQLtext(java.util.Hashtable systemFields,
                                        java.util.Hashtable systemAlias,
                                        java.lang.String rootType)
Generate sqlText associated to the job (updates state of ejb instance: jobModel.sqlText)
Parameters:
systemFields - Hashtable of system Fields for current company key: fieldId (in Long), value: Field object
systemAlias - Hashtable of system Alias key: String = tableAlias|rootType value: Alias object
rootType - root type for joins
Returns:
sql text generated

buildSELECT

private java.lang.String buildSELECT()
Generate job sqlText corresponding to SELECT part
Returns:
sql text generated for SELECT part

buildWHERE_JOINS

private java.lang.String buildWHERE_JOINS(java.util.ArrayList participantTables)
Generate job sqlText corresponding to WHERE join part
Parameters:
participantTables - output ArrayList of tables that participate in the SQL sentence (initially empty for this method); type of each element: ParticipantTable.
Returns:
sql text generated for WHERE join part

buildWHERE_CONDITIONS

private java.lang.String buildWHERE_CONDITIONS()
Generate job sqlText corresponding to WHERE conditions part
Returns:
sql text generated for WHERE conditions part

buildFROM

private java.lang.String buildFROM(java.util.ArrayList participantTables)
Generate job sqlText corresponding to FROM part
Parameters:
participantTables - ArrayList of tables that participate in the SQL sentence; type of each element: ParticipantTable.
Returns:
sql text generated for FROM part

buildORDER

private java.lang.String buildORDER()
Generate job sqlText corresponding to ORDER part. It is assumed that the set of jobORDER elements is the same set of jobSELECT elements (therefore, jobORDER is not empty and it does not add new participant tables with respect to jobSELECT).
Returns:
sql text generated for ORDER part

getDao

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