1 package com.instantbank.component.lettertemplate.ejb; 2 3 import java.util.Hashtable; 4 import java.util.ArrayList; 5 import java.io.*; 6 import java.sql.Date; 7 import java.sql.Connection; 8 9 import javax.ejb.EJBObject; 10 import java.rmi.RemoteException; 11 12 import com.instantbank.component.lettertemplate.util.*; 13 import com.instantbank.common.utilcomponents.CodeDescription; 14 import com.instantbank.common.utilcomponents.DAOException; 15 16 17 /** 18 * Business interface of letterTemplate EJB: list of services for letters 19 * module (Session Stateful EJB) 20 * 21 * @author Instant-bank (Consuelo Franky, Roberto Contreras) 22 * @created August 2002 23 */ 24 public interface LetterTemplate extends EJBObject { 25 26 // BUSINESS METHODS FOR LOADING BASIC DATA OF LETTERS: 27 28 /** 29 * Loads data of systems Fields of the current company 30 * 31 * @return Hashtable of system Fields for current company 32 * key: fieldId (in Long), 33 * value: com.instantbank.component.job.util.Field object 34 * @exception DAOException 35 * @throws RemoteException Description of the Exception 36 */ 37 public Hashtable loadFields() 38 throws RemoteException, DAOException; 39 40 41 /** 42 * Loads company fields with display information and menu references 43 * (for current company), ordered by display name. 44 * 45 * @return ArrayList of company fields where each element is an 46 * inner ArrayList composed of: fieldId(Long), displayName(String), 47 * dataType(String), menuId(Long), menuName (String) 48 * @exception DAOException 49 * @throws RemoteException Description of the Exception 50 */ 51 public ArrayList loadFieldsDisplay() 52 throws RemoteException, DAOException; 53 54 55 /** 56 * Loads system field Menus with its values 57 * ordered by description (name of menu); 58 * 59 * @return ArrayList of menus where each element is an 60 * inner ArrayList composed of: 61 * menuName(String), menuValues(ArrayList); 62 * each menuValues element is a String[] 63 * with an internalValue(String) and display(String) 64 * @exception DAOException 65 * @throws RemoteException Description of the Exception 66 */ 67 public ArrayList loadFieldMenus() 68 throws RemoteException, DAOException; 69 70 71 /** 72 * Loads data of system alias 73 * 74 * @return Hashtable of system Alias 75 * key: String[2] = [tableAlias, rootType], 76 * value: com.instantbank.component.job.util.Alias object 77 * @exception DAOException 78 * @throws RemoteException Description of the Exception 79 */ 80 public Hashtable loadAlias() 81 throws RemoteException, DAOException; 82 83 84 /** 85 * Loads display name of letter variables (fields) of the current company, 86 * ordered by display name 87 * 88 * @return ArrayList of variables where each element is an 89 * inner ArrayList with the following elements of a variable: 90 * fieldId(Long): code of field (variable) in the system, 91 * name(String): name of variable to display in user interface, 92 * type(String): type of variable: 93 * numeric: LetterTemplateGlobals.FIELD_NUMERIC, 94 * string: LetterTemplateGlobals.FIELD_STRING, 95 * date: LetterTemplateGlobals.FIELD_DATE 96 * @exception DAOException 97 * @throws RemoteException Description of the Exception 98 */ 99 public ArrayList loadVariables() 100 throws RemoteException, DAOException; 101 102 103 /** 104 * Loads code and description of format of letter variables; 105 * ordered by description 106 * 107 * @return CodeDescription[] object 108 * with [code, description] of formats 109 * @exception DAOException 110 * @throws RemoteException Description of the Exception 111 */ 112 public CodeDescription[] loadVariableFormats() 113 throws RemoteException, DAOException; 114 115 116 /** 117 * Loads code and description of printTypes; 118 * ordered by description 119 * 120 * @return CodeDescription[] object 121 * with [code, description] of printTypes 122 * @exception DAOException 123 * @throws RemoteException Description of the Exception 124 */ 125 public CodeDescription[] loadPrintTypes() 126 throws RemoteException, DAOException; 127 128 129 // BUSINESS METHODS FOR MANAGEMENT OF LETTERS CATEGORIES: 130 131 /** 132 * Loads all [code, description] of the categories of the current company; 133 * ordered by name 134 * 135 * @return CodeDescription[] object 136 * with [code, description] of the categories 137 * @exception DAOException 138 * @throws RemoteException Description of the Exception 139 */ 140 public CodeDescription[] loadCategories() 141 throws RemoteException, DAOException; 142 143 144 /** 145 * Applies a set of changes in the categories of the current company; 146 * 147 * @param items ArrayList with 3 elements of 148 * type String[] representing the attributes of items to apply: 149 * code, name and status; 150 * status indicates if the item is for inserting, deleting or updating 151 * @return ArrayList with 2 elements: 152 * (0) possible problem (String), 153 * (1) current categories list (CodeDescription[]) 154 * @exception DAOException 155 * @throws RemoteException Description of the Exception 156 */ 157 public ArrayList applyItemsCategory(ArrayList items) 158 throws RemoteException, DAOException; 159 160 161 // BUSINESS METHODS FOR MANAGEMENT OF LETTERS IMAGES REPOSITORY: 162 163 /** 164 * Stores a new image for the current company 165 * 166 * @param nameImage name of image 167 * @param image bytes of image 168 * @return code (long) assigned to the image 169 * @exception DAOException 170 * @throws RemoteException Description of the Exception 171 */ 172 public long storeImageRepository(String nameImage, byte[] image) 173 throws RemoteException, DAOException; 174 175 176 /** 177 * Loads all [code, description] of the images of the current company; 178 * ordered by name 179 * 180 * @return CodeDescription[] object with [code, description] of images 181 * @exception DAOException 182 * @throws RemoteException Description of the Exception 183 */ 184 public CodeDescription[] loadImagesNamesRepository() 185 throws RemoteException, DAOException; 186 187 188 /** 189 * Loads an image of the current company; 190 * 191 * @param nameImage name of image 192 * @return byte[] with bytes of image 193 * @exception DAOException 194 * @throws RemoteException Description of the Exception 195 */ 196 public byte[] loadImageRepository(String nameImage) 197 throws RemoteException, DAOException; 198 199 200 /** 201 * Removes an image of the current company 202 * 203 * @param nameImage name of image 204 * @exception DAOException 205 * @throws RemoteException Description of the Exception 206 */ 207 public void removeImageRepository(String nameImage) 208 throws RemoteException, DAOException; 209 210 211 /** 212 * Applies a set of changes in the images of the current company; 213 * 214 * @param items ArrayList with 2 elements of 215 * type String[] representing the attributes of items to apply: 216 * code, name and status; 217 * status indicates if the item is for deleting or updating 218 * @return ArrayList with 2 elements 219 * (0) possible problem (String), 220 * (1) current images list (CodeDescription[]) 221 * @exception DAOException 222 * @throws RemoteException Description of the Exception 223 */ 224 public ArrayList applyImagesRepository(ArrayList items) 225 throws RemoteException, DAOException; 226 227 228 // BUSINESS METHODS FOR MANAGEMENT OF LETTERS TEMPLATES 229 230 /** 231 * Stores a letters template for the current company, generating code for 232 * the template if it is new, and generating code for each component if it 233 * is new. 234 * If the template exists before, its version is validated and the 235 * old template is replaced. 236 * The associations between the template and its 237 * components are established if these associations are new. 238 * 239 * @param template to store 240 * @return CodeDescription[] with 4 [code, stamp] in the following order: 241 * template, HEADER, BODY, CLOSING 242 * @exception DAOException 243 * @throws RemoteException Description of the Exception 244 */ 245 public CodeDescription[] storeTemplate(Template template) 246 throws RemoteException, DAOException; 247 248 249 /** 250 * Loads code and description of all templates, for the current company and 251 * for the specified category; ordered by name. 252 * 253 * @param category specified letter category 254 * @param printType specified print type 255 * @return CodeDescription[] object with [code, description] of templates 256 * @exception DAOException 257 * @throws RemoteException Description of the Exception 258 */ 259 public CodeDescription[] loadTemplatesDescription 260 (long category, int printType) 261 throws RemoteException, DAOException; 262 263 264 /** 265 * Loads code and description of one template and its components for the 266 * specified template code 267 * 268 * @param templateCode code of template 269 * @return CodeDescription[] object with [code, description] of template 270 * @exception DAOException 271 * @throws RemoteException Description of the Exception 272 */ 273 public CodeDescription[] loadTemplateCodes(long templateCode) 274 throws RemoteException, DAOException; 275 276 277 /** 278 * Loads code and stamp of one template and its components for the 279 * specified template code 280 * 281 * @param category category of template 282 * @param printType type of print 283 * @param name name of template 284 * @return CodeDescription[] composed 285 * by [code, stamp] of template and its components 286 * ordered by template, HEADER, BODY, CLOSING 287 * @exception DAOException 288 * @throws RemoteException Description of the Exception 289 */ 290 public CodeDescription[] loadTemplateCodes 291 (long category, int printType, String name) 292 throws RemoteException, DAOException; 293 294 295 /** 296 * Loads code and description of one template and its components for the 297 * specified template code 298 * 299 * @param category category of template 300 * @param printType type of print 301 * @param name name of template 302 * @return CodeDescription[] composed 303 * by [code, description] of template and its components ordered by 304 * template, HEADER, BODY, CLOSING 305 * @exception DAOException 306 * @throws RemoteException Description of the Exception 307 */ 308 public CodeDescription[] loadTemplateCodeDescription 309 (long category, int printType, String name) 310 throws RemoteException, DAOException; 311 312 313 /** 314 * Loads code and stamp of template and components 315 * 316 * @param category category of template 317 * @param printType type of print 318 * @param name name of template 319 * @param header name of component header 320 * @param body name of component body 321 * @param closing name of component closing 322 * @return CodeDescription[i] for i = 1(HEADER),2(BODY),3(CLOSING) is: 323 * [code, stamp] of component, if it exists, 324 * [LetterTemplateGlobals.UNDEF,LetterTemplateGlobals.STR_UNDEF] if component doesn't exist 325 * @exception DAOException 326 * @throws RemoteException Description of the Exception 327 */ 328 public CodeDescription[] loadCodesStamps 329 (long category, int printType, String name, 330 String header, String body, String closing) 331 throws RemoteException, DAOException; 332 333 334 /** 335 * Loads a letters template of the current company, corresponding to a 336 * code. 337 * 338 * @param templateCode code of template 339 * @return Template selected 340 * @exception DAOException 341 * @throws RemoteException Description of the Exception 342 */ 343 public Template loadTemplate(long templateCode) 344 throws RemoteException, DAOException; 345 346 347 /** 348 * Removes a letters template (not its components) of the current company, 349 * corresponding to a code. 350 * 351 * @param code template code 352 * @exception DAOException 353 * @throws RemoteException Description of the Exception 354 */ 355 public void removeTemplate(long code) 356 throws RemoteException, DAOException; 357 358 359 /** 360 * Loads code, print type and name of templates and their categories names. 361 * 362 * @return ArrayList of variables where each element is an 363 * inner ArrayList with the following elements of a variable: 364 * code(Long): code of template, 365 * nameCategory(String): name of category, 366 * type(String): print type, 367 * nameTemplate (String): name of template. 368 * @exception DAOException 369 * @throws RemoteException Description of the Exception 370 */ 371 public ArrayList loadAllTemplatesDescription() 372 throws RemoteException, DAOException; 373 374 375 /** 376 * Applies a set of changes in the templates of the current company; 377 * 378 * @param items ArrayList with 4 elements of type String[] 379 * representing the attributes of items to apply: 380 * code of template, code of category, name of template and status; 381 * status indicates if the item is for deleting or updating 382 * @return ArrayList with 2 elements: 383 * (0) possible problem (String), 384 * (1) current Template description list (ArrayList) 385 * @exception DAOException 386 * @throws RemoteException Description of the Exception 387 */ 388 public ArrayList applyItemsTemplate(ArrayList items) 389 throws RemoteException, DAOException; 390 391 392 /** 393 * Load the date of template. 394 * 395 * @param templateCode Code of template. 396 * @return date date of template. 397 * @exception DAOException 398 * @throws RemoteException Description of the Exception 399 */ 400 public Date loadTemplateDate(long templateCode) 401 throws RemoteException, DAOException; 402 403 404 405 // BUSINESS METHODS FOR MANAGEMENT OF LETTERS COMPONENTS 406 407 /** 408 * Stores a letters component for the current company, generating code for 409 * the component if it is new. If the component exists before, its version 410 * is validated and the old component is replaced. 411 * 412 * @param component is the letter component to store 413 * @return CodeDescription: [code, stamp] of component 414 * @exception DAOException 415 * @throws RemoteException Description of the Exception 416 */ 417 public CodeDescription storeComponent(LetterComponent component) 418 throws RemoteException, DAOException; 419 420 421 /** 422 * Store as a letters component for the current company, generating code 423 * for the component if it is new. If the component exists before, its 424 * version is validated and the old component is replaced. The association 425 * between the template and the component is established. 426 * 427 * @param templateCode Code of template 428 * @param component letters component 429 * @return CodeDescription [code, stamp] of component 430 * @exception DAOException 431 * @throws RemoteException Description of the Exception 432 */ 433 public CodeDescription storeComponentAs(long templateCode, 434 LetterComponent component) 435 throws RemoteException, DAOException; 436 437 438 /** 439 * Loads code and description of all components, for the current company, 440 * for the specified component type and print type; ordered by name 441 * 442 * @param componentType type of components to load 443 * @param printType print type of components to load 444 * @return CodeDescription[] object 445 * with [code, description] of components 446 * @exception DAOException 447 * @throws RemoteException Description of the Exception 448 */ 449 public CodeDescription[] loadComponentsDescription 450 (int componentType, int printType) 451 throws RemoteException, DAOException; 452 453 454 /** 455 * Loads a letters component of the current company, corresponding to a 456 * code. 457 * 458 * @param code code of letters component 459 * @return LetterComponent is the loaded component 460 * @exception DAOException 461 * @throws RemoteException Description of the Exception 462 */ 463 public LetterComponent loadComponent(long code) 464 throws RemoteException, DAOException; 465 466 467 /** 468 * Removes a letters component of the current company, corresponding to a 469 * code. 470 * 471 * @param code code of letters component 472 * @exception DAOException 473 * @throws RemoteException Description of the Exception 474 */ 475 public void removeComponent(long code) 476 throws RemoteException, DAOException; 477 478 479 /** 480 * Load [code, stamp] for specified component 481 * 482 * @param componentType type of component (HEADER, BODY or CLOSING) 483 * @param printType type of print 484 * @param name name of component 485 * @return CodeDescription [code, stamp] if the component exists, 486 * [LetterTemplateGlobals.UNDEF,LetterTemplateGlobals.STR_UNDEF] if the component doesn't exist 487 * @exception DAOException 488 * @throws RemoteException Description of the Exception 489 */ 490 public CodeDescription loadComponentCode 491 (int componentType, int printType, String name) 492 throws RemoteException, DAOException; 493 494 495 /** 496 * If the relationship between Template and Component doesn't exist loads 497 * code, name and print type of components and name of component type. 498 * 499 * @return ArrayList of variables where each element is an 500 * inner ArrayList with the following elements of a variable: 501 * code(Long): code of component, 502 * nameComponentType(String):name of component type, 503 * type(String): print type, 504 * nameComponent (String): name of component. 505 * @exception DAOException 506 * @throws RemoteException Description of the Exception 507 */ 508 public ArrayList loadUnlikedComponents() 509 throws RemoteException, DAOException; 510 511 512 /** 513 * Applies a set of changes in the components of the current company where 514 * the relationship between Template and Component doesn't exist. 515 * 516 * @param items ArrayList with 3 elements of 517 * type String[] representing the attributes of items to apply: 518 * code and name of component and status; 519 * status indicates if the item is for deleting or updating 520 * @return ArrayList with 2 elements: 521 * (0) possible problem (String), 522 * (1) current Template description list (ArrayList) 523 * @exception DAOException 524 * @throws RemoteException Description of the Exception 525 */ 526 public ArrayList applyItemsComponent(ArrayList items) 527 throws RemoteException, DAOException; 528 529 530 // BUSINESS METHODS FOR LETTERS JOBS 531 532 /** 533 * Gets template variables values for one loan of the current company, 534 * which will be used in the preview of the template. 535 * 536 * @param templateCode is the code of template to preview 537 * @param templateVarsCodes template variables codes 538 * @param agreementCode Description of the Parameter 539 * @return ArrayList of one tuple that 540 * is an Object[] of Strings; each String is the value of a template 541 * variable for the chosen loan 542 * @exception DAOException 543 * @throws RemoteException Description of the Exception 544 */ 545 public ArrayList generatePreviewTemplate 546 (long templateCode, long agreementCode, Long[] templateVarsCodes) 547 throws RemoteException, DAOException; 548 549 550 /** 551 * Gets a result set executing a SQL sentence, 552 * associated with a letter job. 553 * 554 * @param sentenceSQL SQL sentence for executing 555 * @param selectFields output fields ids 556 * @param jobORDERhashtable Hashtable of job ORDER elements: 557 * key: fieldId (in Long), value: JobORDERelement 558 * @return ArrayList[] as following: 559 * ArrayList[0]: first column of the result set (i.e. agreement code) 560 * it is an ArrayList of String elements. 561 * ArrayList[1]: the others columns of the result set 562 * it is an ArrayList of String[] elements. 563 * @exception DAOException 564 * @throws RemoteException Description of the Exception 565 */ 566 public ArrayList[] executeSQL 567 (String sentenceSQL, Long[] selectFields, Hashtable jobORDERhashtable) 568 throws RemoteException, DAOException; 569 570 571 /** 572 * Loads all [code, name] of the ftp's of the current company, 573 * ordered by name 574 * 575 * @return CodeDescription[] object 576 * with [code, name] of the ftp's 577 * @exception DAOException 578 * @throws RemoteException Description of the Exception 579 */ 580 public CodeDescription[] loadFTPCodes() 581 throws RemoteException, DAOException; 582 583 584 /** 585 * Loads all [code, name] of the jobs of the current company; 586 * ordered by name 587 * 588 * @return CodeDescription[] object 589 * with [code, name] of the jobs 590 * @exception DAOException 591 * @throws RemoteException Description of the Exception 592 */ 593 public CodeDescription[] loadJobsCodes() 594 throws RemoteException, DAOException; 595 596 597 /** 598 * Loads all the calendars of the current company 599 * 600 * @return Hashtable of company calendars: 601 * key: year (Integer), 602 * value: String of 365/366 characters representing the year calendar 603 * (each day of year is a character : 604 * 'P' is it is workable(processing) day, 'N' otherwise) 605 * @exception DAOException 606 * @throws RemoteException Description of the Exception 607 */ 608 public Hashtable loadCalendars() 609 throws RemoteException, DAOException; 610 611 612 // BUSINESS METHODS TO LAUNCH AND REVIEW BATCH LETTER JOBS 613 614 /** 615 * Loads all letters Job information. 616 * 617 * @return answer The LetterBatchStartModel object with all letters Job 618 * when each atribute represents: Jobs to run, Jobs out of frequency 619 * and other Jobs(inactive,no yet active and on request) 620 * @exception DAOException 621 * @throws RemoteException Description of the Exception 622 */ 623 public LetterBatchStartModel loadLetterJob() 624 throws RemoteException, DAOException; 625 626 627 /** 628 * Loads the date (Oracle SYSDATE() function). 629 * 630 * @return date The date of Oracle SYSDATE() function. 631 * @exception DAOException 632 * @throws RemoteException Description of the Exception 633 */ 634 public Date loadSysDate() throws RemoteException, DAOException; 635 636 637 /** 638 * Loads the temporal directory path of the current company. 639 * 640 * @return path Path for the Downloads generated by the system. 641 * @exception DAOException 642 * @throws RemoteException Description of the Exception 643 */ 644 public String loadCompanyWorkDir() throws RemoteException, DAOException; 645 646 647 /** 648 * Store the log of executed letter jobs of the current company. 649 * 650 * @param resultSetLength Number of records retrieved by the job execution. 651 * @param loggeableResultSet Result set with the records retrieved by 652 * the job execution. 653 * @param foTemplate Transformed text of template used by the job execution. 654 * @param jobId Description of the Parameter 655 * @param executionDate Description of the Parameter 656 * @param success Description of the Parameter 657 * @return answer The LettersJobLogBean object with 658 * the log code, job id and execution date of executed letter jobs. 659 * @exception DAOException 660 * @parm jobId The code of letter job. 661 * @parm executionDate The date of execution letter job. 662 * @throws RemoteException Description of the Exception 663 */ 664 public LettersJobLogBean storeLetterJobLog(long jobId, Date executionDate, 665 String success, long resultSetLength, 666 String loggeableResultSet, 667 String foTemplate) 668 throws RemoteException, DAOException; 669 670 671 /** 672 * Store the Log of ftps made for executed letter jobs 673 * of the current company. 674 * 675 * @param succes Indicates if the JOB_FILE was sucessfully sent by ftp (yes) 676 * or not (no). 677 * @param attempts Number of failed attempts in sending by ftp the JOB_FILE. 678 * @param ip IP address used in last attempt in sending by ftp the JOB_FILE. 679 * @param path complementary PATH of LAST_FTP_IP_ADDRESS. 680 * @param failureDescription explanation in failure case. 681 * @param jobLogId Description of the Parameter 682 * @param fullFilePath Description of the Parameter 683 * @exception DAOException 684 * @parm jobLogId The code of letter job. 685 * @throws RemoteException Description of the Exception 686 */ 687 public void storeLetterFtpJobLog(long jobLogId, String fullFilePath, 688 boolean succes, int attempts, 689 String ip, String path, 690 String failureDescription) 691 throws RemoteException, DAOException; 692 693 694 /** 695 * Update the Log of ftps made for executed letter jobs 696 * of the current company. 697 * 698 * @param succes Indicates if the JOB_FILE was sucessfully sent by ftp (yes) 699 * or not (no). 700 * @param attempts Number of failed attempts in sending by ftp the JOB_FILE. 701 * @param ip IP address used in last attempt in sending by ftp the JOB_FILE. 702 * @param path complementary PATH of LAST_FTP_IP_ADDRESS. 703 * @param failureDescription explanation in failure case. 704 * @param jobLogId Description of the Parameter 705 * @param fullFilePath Description of the Parameter 706 * @exception DAOException 707 * @parm jobLogId The code of letter job. 708 * @throws RemoteException Description of the Exception 709 */ 710 public void updateLetterFtpJobLog(long jobLogId, String fullFilePath, 711 boolean succes, int attempts, 712 String ip, String path, 713 String failureDescription) 714 throws RemoteException, DAOException; 715 716 717 /** 718 * Update the date of execution of the letter job 719 * of the current company. 720 * 721 * @param date The date of execution of the letter job. 722 * @param jobId Description of the Parameter 723 * @exception DAOException 724 * @parm jobLogId The code of letter job. 725 * @throws RemoteException Description of the Exception 726 */ 727 public void updateJobExecDate(long jobId, Date date) 728 throws RemoteException, DAOException; 729 730 731 /** 732 * Load the data of company locations. 733 * 734 * @param ftpId The code of ftp. 735 * @return answer The CompanyLocation object with location id, path 736 * ip address, ftp login name and ftp password. 737 * @exception DAOException 738 * @throws RemoteException Description of the Exception 739 */ 740 public CompanyLocation loadCompanyLocation(long ftpId) 741 throws RemoteException, DAOException; 742 743 744 /** 745 * Review the batch of letters jobs 746 * 747 * @param dayMonthYear The date to ask for letter Job Log information 748 * @return answer The LetterBatchReviewModel object with Job Log information. 749 * @exception DAOException 750 * @throws RemoteException Description of the Exception 751 */ 752 public LetterBatchReviewModel loadLetterBatchReview(String dayMonthYear) 753 throws RemoteException, DAOException; 754 755 756 public void insertLetterARHistory(Connection dbConnection, long lCompID, long lAgrmID, Date procDate, long lLettID, long lLettCode, long lActionCode, long lResultCode) 757 throws RemoteException, DAOException; 758 } 759 760