|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.instantbank.component.lettertemplate.ejb.LetterTemplateDAO
This class has JDBC calls required by EJB letterTemplate for implementing its services
Field Summary | |
private java.util.GregorianCalendar |
calendar
GregorianCalendar |
private java.util.Hashtable |
companyCalendars
calendars of current company |
(package private) java.lang.String |
companyId
current company |
private javax.sql.DataSource |
datasource
datasource corresponding to the database |
private java.sql.Connection |
dbConnection
connection with the database |
private Debug |
debug
for debugging |
private java.text.DateFormat |
form
Format Date of US (Mon day, Year) |
private java.util.Date |
toDay
The Date of today |
(package private) java.lang.Long |
userId
current user |
Constructor Summary | |
LetterTemplateDAO(java.lang.String companyId,
java.lang.Long userId)
Constructor: searchs the DataSource in the InitialContext |
Method Summary | |
java.util.ArrayList |
applyImagesRepository(java.util.ArrayList items)
Applies a set of changes in the images of the current company in DatabaseNames.LETT_IMAGES_REPOSITORY ; |
java.util.ArrayList |
applyItemsCategory(java.util.ArrayList items)
Applies a set of changes in the categories of the current company; in DatabaseNames.LETT_CATEGORY; |
java.util.ArrayList |
applyItemsComponent(java.util.ArrayList items)
Applies a set of changes in the components of the current company where the relationship between Template and Component doesn't exist from DatabaseNames.LETT_VARIABLE, LETT_IMAGE, LETT_COMPONENT. |
java.util.ArrayList |
applyItemsTemplate(java.util.ArrayList items)
Applies a set of changes in the templates of the current company from DatabaseNames.LETT_TEMPLATE_COMPONENT_LINK and LETT_TEMPLATE. |
private LetterComponent |
auxLoadComponent(long componentCode,
java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
Auxiliary for loadComponent: loads a letter component from tables DatabaseNames.LETT_COMPONENT, LETT_VARIABLE, LETT_IMAGE |
private java.lang.String |
auxReplaceWorkableOperator(java.lang.String sentence,
java.lang.String workableOperator,
java.sql.Date sysDate,
java.sql.Date companyDate)
Auxiliary for executeSQL service. |
private CodeDescription |
auxStoreComponent(LetterComponent component,
java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
Auxiliary for storeComponent: stores a letter component in tables DatabaseNames.LETT_COMPONENT, LETT_VARIABLE, LETT_IMAGE |
private java.lang.String |
auxTransformWorkableOffset(java.lang.String sentenceSQL,
java.sql.Date sysDate,
java.sql.Date companyDate)
Auxiliary for executeSQL service. |
java.util.ArrayList[] |
executeSQL(java.lang.String sentenceSQL,
java.lang.Long[] selectFields,
java.util.Hashtable jobORDERhashtable,
java.util.Hashtable systemFields)
Gets a result set executing a SQL sentence, associated with a letter job. |
java.util.ArrayList |
generatePreviewTemplate(long templateCode,
long loanCode,
java.lang.Long[] templateVarsCodes,
java.util.Hashtable systemAlias,
java.util.Hashtable systemFields)
Gets template variables values for one loan of the current company, which will be used in a preview of the template. |
void |
insertLetterARHistory(java.sql.Connection dbConnection,
long lCompID,
long lAgrmID,
java.sql.Date procDate,
long lLettID,
long lLettCode,
long lActionCode,
long lResultCode)
|
private void |
linkTemplateComponent(long templateCode,
long componentCode,
java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
Auxiliary for linking a template and a component precondition there isn't any link before between template and component |
java.util.Hashtable |
loadAlias()
Loads data of DatabaseNames.LETT_ALIAS |
java.util.ArrayList |
loadAllTemplatesDescription()
Loads code, print type, category and name of templates and their categories names. |
java.util.Hashtable |
loadCalendars()
Loads all the calendars of the current company; from DatabaseNames.CALENDARS; |
CodeDescription[] |
loadCategories()
Loads all [code, description] of the categories of the current company, in DatabaseNames.LETT_CATEGORY; ordered by name |
CodeDescription[] |
loadCodesStamps(long category,
int printType,
java.lang.String name,
java.lang.String header,
java.lang.String body,
java.lang.String closing)
Loads code and stamp of template and components from DatabaseNames.LETT_TEMPLATE and LETT_COMPONENT tables |
CompanyLocation |
loadCompanyLocation(long ftpId)
Load the data of company locations from DatabaseNames.COMPANY_LOCATIONS table. |
java.lang.String |
loadCompanyWorkDir()
Loads the temporal directory path of the current company. |
LetterComponent |
loadComponent(long componentCode)
Loads a letters component of the current company, corresponding to a code, from tables DatabaseNames.LETT_COMPONENT, LETT_IMAGE, LETT_VARIABLE |
CodeDescription |
loadComponentCode(int componentType,
int printType,
java.lang.String name)
Load [code, stamp] for specified component from DatabaseNames.LETT_COMPONENT table |
CodeDescription[] |
loadComponentsDescription(int componentType,
int printType)
Loads code and description of all components, for the current company, for the specified component type and print type; from DatabaseNames.LETT_COMPONENT table; ordered by name |
java.util.ArrayList |
loadFieldMenus()
Loads system field Menus with its values ordered by description (name of menu); from DatabaseNames.LETT_FIELD_MENU, LETT_FIELD_VALUE |
java.util.Hashtable |
loadFields()
Loads data of DatabaseNames.LETT_FIELD of the current company (i.e. |
java.util.ArrayList |
loadFieldsDisplay()
Loads company fields with display information and menu references (for current company). |
CodeDescription[] |
loadFTPCodes()
Loads all [code, name] of the ftp's of the current company, from DatabaseNames.COMPANY_ADDRESSES and COMPANY_LOCATIONS tables; ordered by name |
byte[] |
loadImageRepository(java.lang.String nameImage)
Loads an image of the current company; from DatabaseNames.LETT_IMAGES_REPOSITORY |
CodeDescription[] |
loadImagesNamesRepository()
Loads all [code, description] of the images of the current company; ordered by name from DatabaseNames.LETT_IMAGES_REPOSITORY |
CodeDescription[] |
loadJobsCodes()
Loads all [code, name] of the jobs of the current company; from DatabaseNames.LETT_JOB; ordered by name |
LetterBatchReviewModel |
loadLetterBatchReview(java.lang.String dayMonthYear)
Review the batch of letters jobs from tables |
LetterBatchStartModel |
loadLetterJob()
Loads all letters Job information. |
java.lang.String |
loadLoanDummy()
Load the dummy loan of a company from DatabaseNames.PREVIEW_LOAN table. |
CodeDescription[] |
loadPrintTypes()
Loads code and description of printTypes; from DatabaseNames.LETT_PRINT_TYPE table; ordered by description |
java.sql.Date |
loadSysDate()
Loads the date (Oracle SYSDATE() function). |
Template |
loadTemplate(long templateCode)
Loads a letters template of the current company, corresponding to a code, from tables DatabaseNames.LETT_TEMPLATE, LETT_TEMPLATE_COMPONENT_LINK, LETT_COMPONENT, LETT_IMAGE, LETT_VARIABLE |
CodeDescription[] |
loadTemplateCodeDescription(long category,
int printType,
java.lang.String name)
Loads code and description of one template and its components for the specified template code from DatabaseNames.LETT_TEMPLATE, DatabaseNames.LETT_COMPONENT tables |
CodeDescription[] |
loadTemplateCodes(long templateCode)
Loads code and description of one template and its components for the specified template code from DatabaseNames.LETT_TEMPLATE, DatabaseNames.LETT_COMPONENT tables |
CodeDescription[] |
loadTemplateCodes(long category,
int printType,
java.lang.String name)
Loads code and stamp of one template and its components for the specified template code from DatabaseNames.LETT_TEMPLATE, DatabaseNames.LETT_COMPONENT tables |
java.sql.Date |
loadTemplateDate(long templateCode)
Load the date of template from DatabaseNames.LETT_TEMPLATE table. |
CodeDescription[] |
loadTemplatesDescription(long category,
int printType)
Loads code and description of all templates, for the current company and for the specified category; from DatabaseNames.LETT_TEMPLATE table; ordered by name. |
java.util.ArrayList |
loadUnlikedComponents()
If the relationship between Template and Component doesn't exist loads code, name and print type of components and name of component type from DatabaseNames.LETT_COMPONENT, LETT_COMPONENT_TYPE, LETT_PRINT_TYPE and LETT_TEMPLATE_COMPONENT_LINK. |
CodeDescription[] |
loadVariableFormats()
Loads code and description of format of letter variables from DatabaseNames.LETT_FORMAT table; ordered by description |
java.util.ArrayList |
loadVariables()
Loads name of letter variables of the current company, ordered by name from DatabaseNames.LETT_FIELD and DatabaseNames.LETT_COMPANY_FIELD |
void |
removeComponent(long componentCode)
Removes a letters component of the current company, corresponding to a code, from tables DatabaseNames.LETT_COMPONENT, LETT_IMAGE, LETT_VARIABLE Fails if the component has links with one or several templates |
void |
removeImageRepository(java.lang.String nameImage)
Removes an image of the current company in DatabaseNames.LETT_IMAGES_REPOSITORY |
void |
removeTemplate(long templateCode)
Removes a letters template (not its components) of the current company, corresponding to a code, from tables DatabaseNames.LETT_TEMPLATE and LETT_TEMPLATE_COMPONENT_LINK |
CodeDescription |
storeComponent(LetterComponent component)
Stores a letters component for the current company, in tables DatabaseNames.LETT_COMPONENT, LETT_IMAGE, LETT_VARIABLE Generates code for the component if it is new. |
CodeDescription |
storeComponentAs(long templateCode,
LetterComponent component)
Store as a letters component for the current company in tables DatabaseNames.LETT_COMPONENT, LETT_IMAGE, LETT_VARIABLE generating code for the component if it is new. |
long |
storeImageRepository(java.lang.String nameImage,
byte[] image)
Stores a new image for the current company in DatabaseNames.LETT_IMAGES_REPOSITORY |
void |
storeLetterFtpJobLog(long jobLogId,
java.lang.String fullFilePath,
boolean succes,
int attempts,
java.lang.String ip,
java.lang.String path,
java.lang.String failureDescription)
Store the Log of ftps made for executed letter jobs of the current company in DatabaseNames.LETT_JOB_FTP_LOG table. |
LettersJobLogBean |
storeLetterJobLog(long jobId,
java.sql.Date executionDate,
java.lang.String success,
long resultSetLength,
java.lang.String loggeableResultSet,
java.lang.String foTemplate)
Store the log of executed letter jobs of the current company. |
CodeDescription[] |
storeTemplate(Template template)
Stores a letters template for the current company, in tables DatabaseNames.LETT_TEMPLATE, LETT_COMPONENT, LETT_IMAGE, LETT_VARIABLE Generates code for the template if it is new, and generates code for each component if it is new. |
void |
updateJobExecDate(long jobId,
java.sql.Date date)
Update the date of execution of the letter job of the current company. |
void |
updateLetterFtpJobLog(long jobLogId,
java.lang.String fullFilePath,
boolean succes,
int attempts,
java.lang.String ip,
java.lang.String path,
java.lang.String failureDescription)
Update the Log of ftps made for executed letter jobs of the current company in DatabaseNames.LETT_JOB_FTP_LOG table. |
private java.lang.String |
verifyDate(java.lang.String frequency,
java.lang.String status,
java.sql.Date activationDate,
java.sql.Date lastDate,
java.lang.String empty)
Auxiliary for loadLetterJob service. |
Methods inherited from class java.lang.Object |
|
Field Detail |
java.lang.String companyId
java.lang.Long userId
private java.sql.Connection dbConnection
private javax.sql.DataSource datasource
private java.text.DateFormat form
private java.util.GregorianCalendar calendar
private java.util.Date toDay
private java.util.Hashtable companyCalendars
private Debug debug
Constructor Detail |
public LetterTemplateDAO(java.lang.String companyId, java.lang.Long userId) throws DAOException
companyId
- current companyuserId
- current userDAOException
- Description of the ExceptionDAOException
- Description of the ExceptionMethod Detail |
public java.util.Hashtable loadFields() throws DAOException
DAOException
- public java.util.ArrayList loadFieldsDisplay() throws DAOException
DAOException
- public java.util.ArrayList loadFieldMenus() throws DAOException
DAOException
- public java.util.Hashtable loadAlias() throws DAOException
DAOException
- public java.util.ArrayList loadVariables() throws DAOException
DAOException
- public CodeDescription[] loadVariableFormats() throws DAOException
DAOException
- public CodeDescription[] loadPrintTypes() throws DAOException
DAOException
- public CodeDescription[] loadCategories() throws DAOException
DAOException
- public java.util.ArrayList applyItemsCategory(java.util.ArrayList items) throws DAOException
items
- ArrayList with 3 elements of
type String[] representing the attributes of items to apply code,
name and status status indicates if the item is for inserting,
deleting or updating
(LetterTemplateGlobals.INSERT, LetterTemplateGlobals.DELETE, LetterTemplateGlobals.UPDATE)DAOException
- public long storeImageRepository(java.lang.String nameImage, byte[] image) throws DAOException
nameImage
- name of imageimage
- bytes of imageDAOException
- public CodeDescription[] loadImagesNamesRepository() throws DAOException
DAOException
- public byte[] loadImageRepository(java.lang.String nameImage) throws DAOException
nameImage
- name of imageDAOException
- public void removeImageRepository(java.lang.String nameImage) throws DAOException
nameImage
- name of imageDAOException
- public java.util.ArrayList applyImagesRepository(java.util.ArrayList items) throws DAOException
items
- ArrayList with 2 elements of
type String[] representing the attributes of items to apply code,
name and status; status indicates if the item is for deleting or
updating (LetterTemplateGlobals.DELETE, LetterTemplateGlobals.UPDATE).DAOException
- public CodeDescription[] storeTemplate(Template template) throws DAOException
template
- to storeDAOException
- public CodeDescription[] loadTemplatesDescription(long category, int printType) throws DAOException
category
- specified letter categoryprintType
- specified print typeDAOException
- public CodeDescription[] loadTemplateCodes(long templateCode) throws DAOException
templateCode
- code of templateDAOException
- public CodeDescription[] loadTemplateCodes(long category, int printType, java.lang.String name) throws DAOException
category
- category of templateprintType
- type of printname
- name of templateDAOException
- public CodeDescription[] loadTemplateCodeDescription(long category, int printType, java.lang.String name) throws DAOException
category
- category of templateprintType
- type of printname
- name of templateDAOException
- public CodeDescription[] loadCodesStamps(long category, int printType, java.lang.String name, java.lang.String header, java.lang.String body, java.lang.String closing) throws DAOException
category
- category of templateprintType
- type of printname
- name of templateheader
- name of component headerbody
- name of component bodyclosing
- name of component closingDAOException
- public Template loadTemplate(long templateCode) throws DAOException
templateCode
- code of templateDAOException
- public void removeTemplate(long templateCode) throws DAOException
templateCode
- code of templateDAOException
- public java.util.ArrayList loadAllTemplatesDescription() throws DAOException
DAOException
- public java.util.ArrayList applyItemsTemplate(java.util.ArrayList items) throws DAOException
items
- ArrayList with 4 elements of
type String[] representing the attributes of items to apply:
code of template, code of category, name of template and status;
status indicates if the item is for deleting or updating
(LetterTemplateGlobals.DELETE, LetterTemplateGlobals.UPDATE).DAOException
- public java.sql.Date loadTemplateDate(long templateCode) throws DAOException
templateCode
- Code of template.DAOException
- public java.lang.String loadLoanDummy() throws DAOException
DAOException
- java.rmi.RemoteException
- Description of the Exceptionpublic CodeDescription storeComponent(LetterComponent component) throws DAOException
component
- is the letter component to storeDAOException
- public CodeDescription storeComponentAs(long templateCode, LetterComponent component) throws DAOException
templateCode
- code of templatecomponent
- is the letter component to storeDAOException
- public CodeDescription[] loadComponentsDescription(int componentType, int printType) throws DAOException
componentType
- type of components to loadprintType
- print type of components to loadDAOException
- public LetterComponent loadComponent(long componentCode) throws DAOException
componentCode
- code of component to loadDAOException
- public void removeComponent(long componentCode) throws DAOException
componentCode
- is the component code to removeDAOException
- public CodeDescription loadComponentCode(int componentType, int printType, java.lang.String name) throws DAOException
componentType
- type of component (HEADER, BODY or CLOSING)printType
- type of printname
- name of componentDAOException
- public java.util.ArrayList loadUnlikedComponents() throws DAOException
DAOException
- public java.util.ArrayList applyItemsComponent(java.util.ArrayList items) throws DAOException
items
- ArrayList with 3 elements of
type String[] representing the attributes of items to apply:
code, name of component and status; status indicates if the item is for
deleting or updatingDAOException
- public java.util.ArrayList generatePreviewTemplate(long templateCode, long loanCode, java.lang.Long[] templateVarsCodes, java.util.Hashtable systemAlias, java.util.Hashtable systemFields) throws DAOException
templateCode
- is the code of template to previewloanCode
- is the code of the loan (i.e. agreement)templateVarsCodes
- template variables codessystemAlias
- Hashtable of system Alias
key: String = tableAlias|rootType
value: Alias objectsystemFields
- Hashtable of system Fields for current company
key: fieldId (in Long), value: Field objectDAOException
- public java.util.ArrayList[] executeSQL(java.lang.String sentenceSQL, java.lang.Long[] selectFields, java.util.Hashtable jobORDERhashtable, java.util.Hashtable systemFields) throws DAOException
sentenceSQL
- SQL sentence for executing;
in addition to SQL sintax, it can contain ++ or -- operators
that must be transformed in workable days offsetselectFields
- output fields ids (in job SELECT order)
or a Long[] of length 0 if there are no output fields.jobORDERhashtable
- Hashtable of job ORDER elements:
key: fieldId (in Long), value: JobORDERelementsystemFields
- Hashtable of system Fields for current company
key: fieldId (in Long), value: Field objectDAOException
- public CodeDescription[] loadFTPCodes() throws DAOException
DAOException
- public CodeDescription[] loadJobsCodes() throws DAOException
DAOException
- public java.util.Hashtable loadCalendars() throws DAOException
DAOException
- public LetterBatchStartModel loadLetterJob() throws DAOException
DAOException
- public java.sql.Date loadSysDate() throws DAOException
DAOException
- public java.lang.String loadCompanyWorkDir() throws DAOException
DAOException
- public LettersJobLogBean storeLetterJobLog(long jobId, java.sql.Date executionDate, java.lang.String success, long resultSetLength, java.lang.String loggeableResultSet, java.lang.String foTemplate) throws DAOException
resultSetLength
- Number of records retrieved by the job execution.loggeableResultSet
- Result set with the records retrieved by
the job execution.foTemplate
- Transformed text of template used by the job execution.jobId
- Description of the ParameterexecutionDate
- Description of the Parametersuccess
- Description of the ParameterDAOException
- public void storeLetterFtpJobLog(long jobLogId, java.lang.String fullFilePath, boolean succes, int attempts, java.lang.String ip, java.lang.String path, java.lang.String failureDescription) throws DAOException
succes
- Indicates if the JOB_FILE was sucessfully sent by ftp (yes)
or not (no).attempts
- Number of failed attempts in sending by ftp the JOB_FILE.ip
- IP address used in last attempt in sending by ftp the JOB_FILE
(null when the job is not distributed by ftp).path
- complementary PATH of LAST_FTP_IP_ADDRESS.
(null when the job is not distributed by ftp).failureDescription
- explanation in failure case
(null when the job is not distributed by ftp).jobLogId
- Description of the ParameterfullFilePath
- Description of the ParameterDAOException
- public void updateLetterFtpJobLog(long jobLogId, java.lang.String fullFilePath, boolean succes, int attempts, java.lang.String ip, java.lang.String path, java.lang.String failureDescription) throws DAOException
succes
- Indicates if the JOB_FILE was sucessfully sent by ftp (yes)
or not (no).attempts
- Number of failed attempts in sending by ftp the JOB_FILE.ip
- IP address used in last attempt in sending by ftp the JOB_FILE.path
- complementary PATH of LAST_FTP_IP_ADDRESS.failureDescription
- explanation in failure case.jobLogId
- Description of the ParameterfullFilePath
- Description of the ParameterDAOException
- public void updateJobExecDate(long jobId, java.sql.Date date) throws DAOException
date
- The date of execution of the letter job.jobId
- Description of the ParameterDAOException
- public CompanyLocation loadCompanyLocation(long ftpId) throws DAOException
ftpId
- The code of ftp.DAOException
- public LetterBatchReviewModel loadLetterBatchReview(java.lang.String dayMonthYear) throws DAOException
dayMonthYear
- The date to ask for letter Job Log informationDAOException
- private CodeDescription auxStoreComponent(LetterComponent component, java.sql.PreparedStatement ps, java.sql.ResultSet rs) throws java.lang.Exception
component
- to store (LetterComponent)ps
- auxiliary PreparedStatementrs
- auxiliary ResultSetjava.lang.Exception
- private LetterComponent auxLoadComponent(long componentCode, java.sql.PreparedStatement ps, java.sql.ResultSet rs) throws java.lang.Exception
componentCode
- code of component to loadps
- auxiliary PreparedStatementrs
- auxiliary ResultSetjava.lang.Exception
- private void linkTemplateComponent(long templateCode, long componentCode, java.sql.PreparedStatement ps, java.sql.ResultSet rs) throws java.lang.Exception
templateCode
- code of templatecomponentCode
- code of componentps
- auxiliary PreparedStatementrs
- auxiliary ResultSetjava.lang.Exception
- private java.lang.String verifyDate(java.lang.String frequency, java.lang.String status, java.sql.Date activationDate, java.sql.Date lastDate, java.lang.String empty)
frequency
- The frequency of letter job generation.status
- The state of letter job.activationDate
- Date in which the letter job can be executed the first time.lastDate
- The date of last execution of the letter job.empty
- If lastDate is null its value is LetterTemplateGlobals.STR_UNDEFprivate java.lang.String auxTransformWorkableOffset(java.lang.String sentenceSQL, java.sql.Date sysDate, java.sql.Date companyDate) throws DAOException
sentenceSQL
- The SQL sentence to transform.sysDate
- Date of today.companyDate
- batch Date of current company.DAOException
- Description of the Exceptionprivate java.lang.String auxReplaceWorkableOperator(java.lang.String sentence, java.lang.String workableOperator, java.sql.Date sysDate, java.sql.Date companyDate) throws DAOException
sentence
- The SQL sentence to transform.workableOperator
- The workable operator (++ or -- )sysDate
- Date of today.companyDate
- batch Date of current company.DAOException
- Description of the Exceptionpublic void insertLetterARHistory(java.sql.Connection dbConnection, long lCompID, long lAgrmID, java.sql.Date procDate, long lLettID, long lLettCode, long lActionCode, long lResultCode) throws java.rmi.RemoteException, DAOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |