com.instantbank.component.job.ejb
Class JobDAO

java.lang.Object
  |
  +--com.instantbank.component.job.ejb.JobDAO

public class JobDAO
extends java.lang.Object

This class has JDBC calls required by EJB job for implementing its services

Author:
Instant-bank (Consuelo Franky)

Field Summary
private  javax.sql.DataSource datasource
          datasource corresponding to the database
private  java.sql.Connection dbConnection
          connection with the database
private  Debug debug
          debug utility
private  boolean jobMasterchanged
          signales if job master data must be updated in the DB
private  JobModel jobModel
          model of Job
private  boolean jobORDERchanged
          signales if jobORDER details must be updated in the DB
private  boolean jobSELECTchanged
          signales if jobSELECT details must be updated in the DB
private  boolean jobWHEREchanged
          signales if jobWHERE details must be updated in the DB
 
Constructor Summary
JobDAO()
          Constructor: searchs the DataSource in the InitialContext
 
Method Summary
private  void deleteJob()
          Deletes the current Job (master part) in the database, in table: DatabaseNames.LETT_JOB
private  void deleteJobLogs()
          Deletes log data of the current Job in the database, in tables: DatabaseNames.LETT_JOB_LOG, LETT_JOB_FTP_LOG
private  void deleteJobORDER()
          Deletes ORDER elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_ORDER
private  void deleteJobSELECT()
          Deletes SELECT elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_SELECT
private  void deleteJobWHERE()
          Deletes WHERE elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_WHERE
 void ejbCreate(JobModel jobModel)
          Supports ejbCreate() method of Job EJB: stores state of new ejb instance in the database (inserting master and details of jobModel attribute); updates jobId, with value assigned by DB; updates jobModel with state master value of the database.
 java.lang.Long ejbFindByName(java.lang.String companyId, java.lang.String name)
          Supports ejbFindByName() method of Job EJB: checks existence of ejb instance in the database
 java.lang.Long ejbFindByPrimaryKey(java.lang.Long jobId)
          Supports ejbFindByPrimaryKey() method of Job EJB: checks existence of ejb instance in the database
 void ejbLoad(java.lang.Long jobId)
          Supports ejbLoad() method of Job EJB: loads from database master and details of instance
 boolean ejbRemove(java.lang.Long jobId)
          Supports ejbRemove() method of Job EJB: removes from database master and details of ejb instance
 void ejbStore(JobModel jobModel)
          Supports ejbStore() method of Job EJB: updates in database master and details of instance
private  java.lang.Long existsJobByName(java.lang.String companyId, java.lang.String name)
          Checks existence of a Job in the database, from DatabaseNames.LETT_JOB
private  boolean existsJobLogs()
          Checks if it exists log data of the current Job in the database, in table: DatabaseNames.LETT_JOB_LOG
private  boolean existsKey(java.lang.Long jobId)
          Checks existence of a Job in the database, from DatabaseNames.LETT_JOB
 java.lang.Long getJobId()
          Getter method for jobId
 JobModel getModel()
          Getter method for jobModel attribute
private  void insertJob()
          Inserts the current Job (master part) in the database, in table: DatabaseNames.LETT_JOB
private  void insertJobORDER()
          Inserts ORDER elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_ORDER
private  void insertJobSELECT()
          Inserts SELECT elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_SELECT
private  void insertJobWHERE()
          Inserts WHERE elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_WHERE
private  void selectJob()
          Selects the current Job (master part) from the database, table: DatabaseNames.LETT_JOB
private  java.lang.Long selectJobId()
          Gets Id assigned by the database to the current job (jobId), in table DatabaseNames.LETT_JOB
private  void selectJobORDER()
          Selects ORDER elements of the current Job from the database, in table: DatabaseNames.LETT_JOB_ORDER
private  void selectJobSELECT()
          Selects SELECT elements of the current Job from the database, in table: DatabaseNames.LETT_JOB_SELECT
private  void selectJobWHERE()
          Selects WHERE elements of the current Job from the database, in table: DatabaseNames.LETT_JOB_WHERE
private  java.sql.Date selectVersion()
          Gets version (last_changed_date) of the current job, in table DatabaseNames.LETT_JOB
 void setJobId(java.lang.Long jobId)
          Setter method on jobId
 void setJobMasterchanged(boolean jobMasterchanged)
          Setter method on jobMasterchanged
 void setJobORDERchanged(boolean jobORDERchanged)
          Setter method on jobORDERchanged
 void setJobSELECTchanged(boolean jobSELECTchanged)
          Setter method on jobSELECTchanged
 void setJobWHEREchanged(boolean jobWHEREchanged)
          Setter method on jobWHEREchanged
 void setVersion(java.sql.Date version)
          Setter method on version
private  void updateJob()
          Updates the current Job (master part) in the database, in table: DatabaseNames.LETT_JOB
 
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
model of Job

jobMasterchanged

private boolean jobMasterchanged
signales if job master data must be updated in the DB

jobSELECTchanged

private boolean jobSELECTchanged
signales if jobSELECT details must be updated in the DB

jobWHEREchanged

private boolean jobWHEREchanged
signales if jobWHERE details must be updated in the DB

jobORDERchanged

private boolean jobORDERchanged
signales if jobORDER details must be updated in the DB

dbConnection

private java.sql.Connection dbConnection
connection with the database

datasource

private javax.sql.DataSource datasource
datasource corresponding to the database

debug

private Debug debug
debug utility
Constructor Detail

JobDAO

public JobDAO()
       throws DAOException
Constructor: searchs the DataSource in the InitialContext
Throws:
DAOException - Description of the Exception
Method Detail

getModel

public JobModel getModel()
Getter method for jobModel attribute
Returns:
jobModel value

getJobId

public java.lang.Long getJobId()
Getter method for jobId
Returns:
jobId value (attribute of jobModel)

setJobId

public void setJobId(java.lang.Long jobId)
Setter method on jobId
Parameters:
jobId - The new jobId value (attribute of jobModel)

setVersion

public void setVersion(java.sql.Date version)
Setter method on version
Parameters:
version - The new version value (attribute of jobModel)

setJobMasterchanged

public void setJobMasterchanged(boolean jobMasterchanged)
Setter method on jobMasterchanged
Parameters:
jobMasterchanged - The new jobMasterchanged value

setJobSELECTchanged

public void setJobSELECTchanged(boolean jobSELECTchanged)
Setter method on jobSELECTchanged
Parameters:
jobSELECTchanged - The new jobSELECTchanged value

setJobWHEREchanged

public void setJobWHEREchanged(boolean jobWHEREchanged)
Setter method on jobWHEREchanged
Parameters:
jobWHEREchanged - The new jobWHEREchanged value

setJobORDERchanged

public void setJobORDERchanged(boolean jobORDERchanged)
Setter method on jobORDERchanged
Parameters:
jobORDERchanged - The new jobORDERchanged value

ejbCreate

public void ejbCreate(JobModel jobModel)
               throws DAOException
Supports ejbCreate() method of Job EJB: stores state of new ejb instance in the database (inserting master and details of jobModel attribute); updates jobId, with value assigned by DB; updates jobModel with state master value of the database.
Parameters:
jobModel - state value of Job EJB
Throws:
DAOException -  

ejbFindByPrimaryKey

public java.lang.Long ejbFindByPrimaryKey(java.lang.Long jobId)
                                   throws DAOException
Supports ejbFindByPrimaryKey() method of Job EJB: checks existence of ejb instance in the database
Parameters:
jobId - key value of instance
Returns:
key value of instance if it exists in the database
Throws:
DAOException -  

ejbFindByName

public java.lang.Long ejbFindByName(java.lang.String companyId,
                                    java.lang.String name)
                             throws DAOException
Supports ejbFindByName() method of Job EJB: checks existence of ejb instance in the database
Parameters:
companyId - current company
name - job name
Returns:
key value of instance if it exists in the database
Throws:
DAOException -  

ejbRemove

public boolean ejbRemove(java.lang.Long jobId)
                  throws DAOException
Supports ejbRemove() method of Job EJB: removes from database master and details of ejb instance
Parameters:
jobId - key value of instance
Returns:
true if the job was deleted; false otherwise
Throws:
DAOException -  

ejbLoad

public void ejbLoad(java.lang.Long jobId)
             throws DAOException
Supports ejbLoad() method of Job EJB: loads from database master and details of instance
Parameters:
jobId - key value of instance
Throws:
DAOException -  

ejbStore

public void ejbStore(JobModel jobModel)
              throws DAOException
Supports ejbStore() method of Job EJB: updates in database master and details of instance
Parameters:
jobModel - state value of Job EJB
Throws:
DAOException -  

existsKey

private boolean existsKey(java.lang.Long jobId)
                   throws DAOException
Checks existence of a Job in the database, from DatabaseNames.LETT_JOB
Parameters:
jobId - identifier of the job
Returns:
true if the job exists in the database false otherwise
Throws:
DAOException -  

existsJobByName

private java.lang.Long existsJobByName(java.lang.String companyId,
                                       java.lang.String name)
                                throws DAOException
Checks existence of a Job in the database, from DatabaseNames.LETT_JOB
Parameters:
companyId - current company
name - job name
Returns:
job ID if the job exists in the database null otherwise
Throws:
DAOException -  

insertJob

private void insertJob()
                throws DAOException
Inserts the current Job (master part) in the database, in table: DatabaseNames.LETT_JOB
Throws:
DAOException -  

selectJobId

private java.lang.Long selectJobId()
                            throws DAOException
Gets Id assigned by the database to the current job (jobId), in table DatabaseNames.LETT_JOB
Returns:
jobId
Throws:
DAOException -  

selectVersion

private java.sql.Date selectVersion()
                             throws DAOException
Gets version (last_changed_date) of the current job, in table DatabaseNames.LETT_JOB
Returns:
version
Throws:
DAOException -  

insertJobSELECT

private void insertJobSELECT()
                      throws DAOException
Inserts SELECT elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_SELECT
Throws:
DAOException -  

insertJobWHERE

private void insertJobWHERE()
                     throws DAOException
Inserts WHERE elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_WHERE
Throws:
DAOException -  

insertJobORDER

private void insertJobORDER()
                     throws DAOException
Inserts ORDER elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_ORDER
Throws:
DAOException -  

deleteJob

private void deleteJob()
                throws DAOException
Deletes the current Job (master part) in the database, in table: DatabaseNames.LETT_JOB
Throws:
DAOException -  

deleteJobSELECT

private void deleteJobSELECT()
                      throws DAOException
Deletes SELECT elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_SELECT
Throws:
DAOException -  

deleteJobWHERE

private void deleteJobWHERE()
                     throws DAOException
Deletes WHERE elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_WHERE
Throws:
DAOException -  

deleteJobORDER

private void deleteJobORDER()
                     throws DAOException
Deletes ORDER elements of the current Job in the database, in table: DatabaseNames.LETT_JOB_ORDER
Throws:
DAOException -  

existsJobLogs

private boolean existsJobLogs()
                       throws DAOException
Checks if it exists log data of the current Job in the database, in table: DatabaseNames.LETT_JOB_LOG
Returns:
true if log data exists false otherwise
Throws:
DAOException -  

deleteJobLogs

private void deleteJobLogs()
                    throws DAOException
Deletes log data of the current Job in the database, in tables: DatabaseNames.LETT_JOB_LOG, LETT_JOB_FTP_LOG
Throws:
DAOException -  

selectJob

private void selectJob()
                throws DAOException
Selects the current Job (master part) from the database, table: DatabaseNames.LETT_JOB
Throws:
DAOException -  

selectJobSELECT

private void selectJobSELECT()
                      throws DAOException
Selects SELECT elements of the current Job from the database, in table: DatabaseNames.LETT_JOB_SELECT
Throws:
DAOException -  

selectJobWHERE

private void selectJobWHERE()
                     throws DAOException
Selects WHERE elements of the current Job from the database, in table: DatabaseNames.LETT_JOB_WHERE
Throws:
DAOException -  

selectJobORDER

private void selectJobORDER()
                     throws DAOException
Selects ORDER elements of the current Job from the database, in table: DatabaseNames.LETT_JOB_ORDER
Throws:
DAOException -  

updateJob

private void updateJob()
                throws DAOException
Updates the current Job (master part) in the database, in table: DatabaseNames.LETT_JOB
Throws:
DAOException -