1 package com.instantbank.component.lettertemplate.ejb;
2
3 import java.util.ArrayList;
4 import java.util.Hashtable;
5 import java.sql.Date;
6 import java.rmi.RemoteException;
7 import java.sql.Connection;
8
9 import javax.ejb.SessionBean;
10 import javax.ejb.SessionContext;
11 import javax.ejb.EJBException;
12
13 import com.instantbank.component.lettertemplate.util.*;
14
15 import com.instantbank.common.utilcomponents.CodeDescription;
16 import com.instantbank.common.utilcomponents.Debug;
17 import com.instantbank.common.utilcomponents.DAOException;
18
19
20
26 public class LetterTemplateEJB
27 implements SessionBean {
28
29
30
33 String companyId;
34
37 Long userId;
38
39
40
43 private SessionContext context;
44
47
48 private LetterTemplateDAO lettertemplateDao;
49
50
54
55 private Hashtable systemAlias = null;
56
61 private Hashtable systemFields = null;
62
63
66 private Debug debug = null;
67
68
69
70
73 public LetterTemplateEJB() { }
74
75
76
77
82 public void setSessionContext(SessionContext sc) {
83 debug = new Debug();
84 debug.setDebugginOn(true);
85 debug.setPreMessage("** LetterTemplateEJB");
86 this.context = sc;
87 }
88
89
90
93 public void ejbActivate() {
94 try {
95 getDao();
96 }
97 catch(DAOException se) {
98 throw new RuntimeException(se.getMessage());
99 }
100 debug = new Debug();
101 debug.setDebugginOn(true);
102 debug.setPreMessage("** LetterTemplateEJB");
103 }
104
105
106
109 public void ejbPassivate() {
110 lettertemplateDao = null;
111 debug = null;
112 }
113
114
115
116
117
124 public void ejbCreate(String companyId, Long userId) {
125
126 this.companyId = companyId;
127 this.userId = userId;
128 try {
129 getDao();
130 }
131 catch(DAOException se) {
132 throw new RuntimeException(se.getMessage());
133 }
134 }
135
136
137
140 public void ejbRemove() { }
141
142
143
144
145
153 public Hashtable loadFields() throws DAOException {
154 debug.println("loadFields");
155
156 Hashtable answer = null;
157 try {
158 getDao();
159 answer = lettertemplateDao.loadFields();
160 }
161 catch(DAOException se) {
162 debug.println("DAOException: " + se);
163 throw new DAOException(se.getMessage());
164 }
165 catch(Exception ex) {
166 throw new EJBException(ex.getMessage());
167 }
168 return answer;
169 }
170
171
172
181 public ArrayList loadFieldsDisplay() throws DAOException {
182 debug.println("loadFieldsDisplay");
183
184 ArrayList answer = null;
185 try {
186 getDao();
187 answer = lettertemplateDao.loadFieldsDisplay();
188 }
189 catch(DAOException se) {
190 debug.println("DAOException: " + se);
191 throw new DAOException(se.getMessage());
192 }
193 catch(Exception ex) {
194 throw new EJBException(ex.getMessage());
195 }
196 return answer;
197 }
198
199
200
211 public ArrayList loadFieldMenus() throws DAOException {
212 debug.println("loadFieldMenus");
213
214 ArrayList answer = null;
215 try {
216 getDao();
217 answer = lettertemplateDao.loadFieldMenus();
218 }
219 catch(DAOException se) {
220 debug.println("DAOException: " + se);
221 throw new DAOException(se.getMessage());
222 }
223 catch(Exception ex) {
224 throw new EJBException(ex.getMessage());
225 }
226 return answer;
227 }
228
229
230
238 public Hashtable loadAlias() throws DAOException {
239 debug.println("loadAlias");
240
241 Hashtable answer = null;
242 try {
243 getDao();
244 answer = lettertemplateDao.loadAlias();
245 }
246 catch(DAOException se) {
247 debug.println("DAOException: " + se);
248 throw new DAOException(se.getMessage());
249 }
250 catch(Exception ex) {
251 throw new EJBException(ex.getMessage());
252 }
253 return answer;
254 }
255
256
257
270 public ArrayList loadVariables() throws DAOException {
271 debug.println("loadVariables service");
272
273 ArrayList answer = null;
274 try {
275 getDao();
276 answer = lettertemplateDao.loadVariables();
277 }
278 catch(DAOException se) {
279 debug.println("DAOException: " + se);
280 throw new DAOException(se.getMessage());
281 }
282 catch(Exception ex) {
283 throw new EJBException(ex.getMessage());
284 }
285 return answer;
286 }
287
288
289
296 public CodeDescription[] loadVariableFormats() throws DAOException {
297 debug.println("loadVariableFormats service");
298
299 CodeDescription[] answer = null;
300 try {
301 getDao();
302 answer = lettertemplateDao.loadVariableFormats();
303 }
304 catch(DAOException se) {
305 debug.println("DAOException: " + se);
306 throw new DAOException(se.getMessage());
307 }
308 catch(Exception ex) {
309 throw new EJBException(ex.getMessage());
310 }
311 return answer;
312 }
313
314
315
321 public CodeDescription[] loadPrintTypes()
322 throws DAOException {
323 debug.println("loadPrintTypes service");
324
325 CodeDescription[] answer = null;
326 try {
327 getDao();
328 answer = lettertemplateDao.loadPrintTypes();
329 }
330 catch(DAOException se) {
331 debug.println("DAOException: " + se);
332 throw new DAOException(se.getMessage());
333 }
334 catch(Exception ex) {
335 throw new EJBException(ex.getMessage());
336 }
337 return answer;
338 }
339
340
341
342
343
350 public CodeDescription[] loadCategories()
351 throws DAOException {
352 debug.println("loadCategories service");
353
354 CodeDescription[] answer = null;
355 try {
356 getDao();
357 answer = lettertemplateDao.loadCategories();
358 }
359 catch(DAOException se) {
360 debug.println("DAOException: " + se);
361 throw new DAOException(se.getMessage());
362 }
363 catch(Exception ex) {
364 throw new EJBException(ex.getMessage());
365 }
366 return answer;
367 }
368
369
370
382 public ArrayList applyItemsCategory(ArrayList items)
383 throws DAOException {
384 debug.println("applyItemsCategory service");
385
386 ArrayList answer = null;
387 try {
388 getDao();
389 answer = lettertemplateDao.applyItemsCategory(items);
390 }
391 catch(DAOException se) {
392 debug.println("DAOException: " + se);
393 throw new DAOException(se.getMessage());
394 }
395 catch(Exception ex) {
396 throw new EJBException(ex.getMessage());
397 }
398 return answer;
399 }
400
401
402
403
404
412 public long storeImageRepository(String nameImage, byte[] image)
413 throws DAOException {
414 long answer;
415 debug.println("storeImageRepository service");
416 try {
417 getDao();
418 answer = lettertemplateDao.storeImageRepository(nameImage, image);
419 }
420 catch(DAOException se) {
421 debug.println("DAOException: " + se);
422 throw new DAOException(se.getMessage());
423 }
424 catch(Exception ex) {
425 throw new EJBException(ex.getMessage());
426 }
427 return answer;
428 }
429
430
431
438 public CodeDescription[] loadImagesNamesRepository()
439 throws DAOException {
440 debug.println("loadImagesNamesRepository service");
441
442 CodeDescription[] answer = null;
443 try {
444 getDao();
445 answer = lettertemplateDao.loadImagesNamesRepository();
446 }
447 catch(DAOException se) {
448 debug.println("DAOException: " + se);
449 throw new DAOException(se.getMessage());
450 }
451 catch(Exception ex) {
452 throw new EJBException(ex.getMessage());
453 }
454 return answer;
455 }
456
457
458
465 public byte[] loadImageRepository(String nameImage)
466 throws DAOException {
467 debug.println("loadImageRepository service");
468
469 byte[] answer = null;
470 try {
471 getDao();
472 answer = lettertemplateDao.loadImageRepository(nameImage);
473 }
474 catch(DAOException se) {
475 debug.println("DAOException: " + se);
476 throw new DAOException(se.getMessage());
477 }
478 catch(Exception ex) {
479 throw new EJBException(ex.getMessage());
480 }
481 return answer;
482 }
483
484
485
491 public void removeImageRepository(String nameImage)
492 throws DAOException {
493 debug.println("removeImageRepository service");
494 try {
495 getDao();
496 lettertemplateDao.removeImageRepository(nameImage);
497 }
498 catch(DAOException se) {
499 debug.println("DAOException: " + se);
500 throw new DAOException(se.getMessage());
501 }
502 catch(Exception ex) {
503 debug.println("Exception: " + ex);
504 throw new EJBException(ex.getMessage());
505 }
506 return;
507 }
508
509
510
522 public ArrayList applyImagesRepository(ArrayList items)
523 throws DAOException {
524 debug.println("applyImagesRepository service");
525
526 ArrayList answer = null;
527 try {
528 getDao();
529 answer = lettertemplateDao.applyImagesRepository(items);
530 }
531 catch(DAOException se) {
532 debug.println("DAOException: " + se);
533 throw new DAOException(se.getMessage());
534 }
535 catch(Exception ex) {
536 throw new EJBException(ex.getMessage());
537 }
538 return answer;
539 }
540
541
542
543
544
558 public CodeDescription[] storeTemplate(Template template)
559 throws DAOException {
560 debug.println("storeTemplate service");
561
562 CodeDescription[] answer = null;
563
564 try {
565 getDao();
566 answer = lettertemplateDao.storeTemplate(template);
567 }
568 catch(DAOException se) {
569 debug.println("DAOException: " + se);
570 throw new DAOException(se.getMessage());
571 }
572 catch(Exception ex) {
573 throw new EJBException(ex.getMessage());
574 }
575 return answer;
576 }
577
578
579
588 public CodeDescription[] loadTemplatesDescription
589 (long category, int printType)
590 throws DAOException {
591 debug.println("loadTemplatesDescription service");
592
593 CodeDescription[] answer = null;
594 try {
595 getDao();
596 answer = lettertemplateDao.loadTemplatesDescription(category, printType);
597 }
598 catch(DAOException se) {
599 debug.println("DAOException: " + se);
600 throw new DAOException(se.getMessage());
601 }
602 catch(Exception ex) {
603 throw new EJBException(ex.getMessage());
604 }
605 return answer;
606 }
607
608
609
617 public CodeDescription[] loadTemplateCodes(long templateCode)
618 throws DAOException {
619 debug.println("loadTemplateCodes [code, description] service");
620
621 CodeDescription[] answer = null;
622 try {
623 getDao();
624 answer = lettertemplateDao.loadTemplateCodes(templateCode);
625 }
626 catch(DAOException se) {
627 debug.println("DAOException: " + se);
628 throw new DAOException(se.getMessage());
629 }
630 catch(Exception ex) {
631 throw new EJBException(ex.getMessage());
632 }
633 return answer;
634 }
635
636
637
649 public CodeDescription[] loadTemplateCodes
650 (long category, int printType, String name)
651 throws DAOException {
652
653 debug.println("loadTemplateCodes [code, stamp] service");
654
655 CodeDescription[] answer = null;
656 try {
657 getDao();
658 answer = lettertemplateDao.loadTemplateCodes
659 (category, printType, name);
660 }
661 catch(DAOException se) {
662 debug.println("DAOException: " + se);
663 throw new DAOException(se.getMessage());
664 }
665 catch(Exception ex) {
666 throw new EJBException(ex.getMessage());
667 }
668 return answer;
669 }
670
671
672
684 public CodeDescription[] loadTemplateCodeDescription
685 (long category, int printType, String name)
686 throws DAOException {
687
688 debug.println("loadTemplateCodeDescription [code, description] service");
689
690 CodeDescription[] answer = null;
691 try {
692 getDao();
693 answer = lettertemplateDao.loadTemplateCodeDescription
694 (category, printType, name);
695 }
696 catch(DAOException se) {
697 debug.println("DAOException: " + se);
698 throw new DAOException(se.getMessage());
699 }
700 catch(Exception ex) {
701 throw new EJBException(ex.getMessage());
702 }
703 return answer;
704 }
705
706
707
721 public CodeDescription[] loadCodesStamps
722 (long category, int printType, String name,
723 String header, String body, String closing)
724 throws DAOException {
725
726 debug.println("loadCodesStamps service");
727
728 CodeDescription[] answer = null;
729 try {
730 getDao();
731 answer = lettertemplateDao.loadCodesStamps
732 (category, printType, name, header, body, closing);
733 }
734 catch(DAOException se) {
735 debug.println("DAOException: " + se);
736 throw new DAOException(se.getMessage());
737 }
738 catch(Exception ex) {
739 throw new EJBException(ex.getMessage());
740 }
741 return answer;
742 }
743
744
745
753 public Template loadTemplate(long templateCode)
754 throws DAOException {
755 debug.println("loadTemplate service");
756 Template answer = null;
757 try {
758 getDao();
759 answer = lettertemplateDao.loadTemplate(templateCode);
760 }
761 catch(DAOException se) {
762 debug.println("DAOException: " + se);
763 throw new DAOException(se.getMessage());
764 }
765 catch(Exception ex) {
766 throw new EJBException(ex.getMessage());
767 }
768 return answer;
769 }
770
771
772
779 public void removeTemplate(long code)
780 throws DAOException {
781 debug.println("removeTemplate service");
782 try {
783 getDao();
784 lettertemplateDao.removeTemplate(code);
785 }
786 catch(DAOException se) {
787 debug.println("DAOException: " + se);
788 throw new DAOException(se.getMessage());
789 }
790 catch(Exception ex) {
791 throw new EJBException(ex.getMessage());
792 }
793 }
794
795
796
807 public ArrayList loadAllTemplatesDescription()
808 throws DAOException {
809
810 debug.println("loadAllTemplatesDescription service");
811
812 ArrayList answer = null;
813 try {
814 getDao();
815 answer = lettertemplateDao.loadAllTemplatesDescription();
816 }
817 catch(DAOException se) {
818 debug.println("DAOException: " + se);
819 throw new DAOException(se.getMessage());
820 }
821 catch(Exception ex) {
822 throw new EJBException(ex.getMessage());
823 }
824 return answer;
825 }
826
827
828
840 public ArrayList applyItemsTemplate(ArrayList items)
841 throws DAOException {
842
843 debug.println("applyItemsTemplate service");
844
845 ArrayList answer = null;
846 try {
847 getDao();
848 answer = lettertemplateDao.applyItemsTemplate(items);
849 }
850 catch(DAOException se) {
851 debug.println("DAOException: " + se);
852 throw new DAOException(se.getMessage());
853 }
854 catch(Exception ex) {
855 throw new EJBException(ex.getMessage());
856 }
857 return answer;
858 }
859
860
861
868 public Date loadTemplateDate(long templateCode) throws DAOException {
869
870 debug.println("loadTemplateDate service");
871 Date answer = null;
872 try {
873 getDao();
874 answer = lettertemplateDao.loadTemplateDate(templateCode);
875 }
876 catch(DAOException se) {
877 debug.println("DAOException: " + se);
878 throw new DAOException(se.getMessage());
879 }
880 catch(Exception ex) {
881 throw new EJBException(ex.getMessage());
882 }
883 return answer;
884 }
885
886
887
888
889
898 public CodeDescription storeComponent(LetterComponent component)
899 throws DAOException {
900 debug.println("storeComponent service");
901
902 CodeDescription answer = null;
903
904 try {
905 getDao();
906 answer = lettertemplateDao.storeComponent(component);
907 }
908 catch(DAOException se) {
909 debug.println("DAOException: " + se);
910 throw new DAOException(se.getMessage());
911 }
912 catch(Exception ex) {
913 throw new EJBException(ex.getMessage());
914 }
915 return answer;
916 }
917
918
919
930 public CodeDescription storeComponentAs(long templateCode,
931 LetterComponent component)
932 throws DAOException {
933 debug.println("storeComponentAs service");
934
935 CodeDescription answer = null;
936
937 try {
938 getDao();
939 answer = lettertemplateDao.storeComponentAs(templateCode, component);
940 }
941 catch(DAOException se) {
942 debug.println("DAOException: " + se);
943 throw new DAOException(se.getMessage());
944 }
945 catch(Exception ex) {
946 throw new EJBException(ex.getMessage());
947 }
948 return answer;
949 }
950
951
952
962 public CodeDescription[] loadComponentsDescription
963 (int componentType, int printType)
964 throws DAOException {
965 debug.println("loadComponentsDescription service");
966
967 CodeDescription[] answer = null;
968 try {
969 getDao();
970 answer = lettertemplateDao.loadComponentsDescription
971 (componentType, printType);
972 }
973 catch(DAOException se) {
974 debug.println("DAOException: " + se);
975 throw new DAOException(se.getMessage());
976 }
977 catch(Exception ex) {
978 throw new EJBException(ex.getMessage());
979 }
980 return answer;
981 }
982
983
984
992 public LetterComponent loadComponent(long code)
993 throws DAOException {
994 debug.println("loadComponent service");
995 LetterComponent answer = null;
996 try {
997 getDao();
998 answer = lettertemplateDao.loadComponent(code);
999 }
1000 catch(DAOException se) {
1001 debug.println("DAOException: " + se);
1002 throw new DAOException(se.getMessage());
1003 }
1004 catch(Exception ex) {
1005 throw new EJBException(ex.getMessage());
1006 }
1007 return answer;
1008 }
1009
1010
1011
1018 public void removeComponent(long code)
1019 throws DAOException {
1020 debug.println("removeComponent service");
1021 LetterComponent answer = null;
1022 try {
1023 getDao();
1024 lettertemplateDao.removeComponent(code);
1025 }
1026 catch(DAOException se) {
1027 debug.println("DAOException: " + se);
1028 throw new DAOException(se.getMessage());
1029 }
1030 catch(Exception ex) {
1031 throw new EJBException(ex.getMessage());
1032 }
1033 }
1034
1035
1036
1046 public CodeDescription loadComponentCode
1047 (int componentType, int printType, String name)
1048 throws DAOException {
1049
1050 debug.println("loadComponentCode service");
1051
1052 CodeDescription answer = null;
1053 try {
1054 getDao();
1055 answer = lettertemplateDao.loadComponentCode
1056 (componentType, printType, name);
1057 }
1058 catch(DAOException se) {
1059 debug.println("DAOException: " + se);
1060 throw new DAOException(se.getMessage());
1061 }
1062 catch(Exception ex) {
1063 throw new EJBException(ex.getMessage());
1064 }
1065 return answer;
1066 }
1067
1068
1069
1081 public ArrayList loadUnlikedComponents()
1082 throws DAOException {
1083
1084 debug.println("loadUnlikedComponents service");
1085
1086 ArrayList answer = null;
1087 try {
1088 getDao();
1089 answer = lettertemplateDao.loadUnlikedComponents();
1090 }
1091 catch(DAOException se) {
1092 debug.println("DAOException: " + se);
1093 throw new DAOException(se.getMessage());
1094 }
1095 catch(Exception ex) {
1096 throw new EJBException(ex.getMessage());
1097 }
1098 return answer;
1099 }
1100
1101
1102
1115 public ArrayList applyItemsComponent(ArrayList items)
1116 throws DAOException {
1117 debug.println("applyItemsComponent service");
1118
1119 ArrayList answer = null;
1120 try {
1121 getDao();
1122 answer = lettertemplateDao.applyItemsComponent(items);
1123 }
1124 catch(DAOException se) {
1125 debug.println("DAOException: " + se);
1126 throw new DAOException(se.getMessage());
1127 }
1128 catch(Exception ex) {
1129 throw new EJBException(ex.getMessage());
1130 }
1131 return answer;
1132 }
1133
1134
1135
1136
1137
1149 public ArrayList generatePreviewTemplate(long templateCode, long loanCode,
1150 Long[] templateVarsCodes) throws DAOException {
1151 debug.println("generatePreviewTemplate service");
1152
1153 ArrayList answer = null;
1154 try {
1155 getSystemAlias();
1156 getSystemFields();
1157 getDao();
1158 answer = lettertemplateDao.generatePreviewTemplate
1159 (templateCode, loanCode, templateVarsCodes,
1160 systemAlias, systemFields);
1161 }
1162 catch(DAOException se) {
1163 debug.println("DAOException: " + se);
1164 throw new DAOException(se.getMessage());
1165 }
1166 catch(Exception ex) {
1167 throw new EJBException(ex.getMessage());
1168 }
1169 return answer;
1170 }
1171
1172
1173
1188 public ArrayList[] executeSQL(String sentenceSQL, Long[] selectFields,
1189 Hashtable jobORDERhashtable) throws DAOException {
1190 debug.println("executeSQL service");
1191
1192 ArrayList[] answer = null;
1193 try {
1194 getDao();
1195 getSystemFields();
1196 answer = lettertemplateDao.executeSQL
1197 (sentenceSQL, selectFields,
1198 jobORDERhashtable, systemFields);
1199 }
1200 catch(DAOException se) {
1201 debug.println("DAOException: " + se);
1202 throw new DAOException(se.getMessage());
1203 }
1204 catch(Exception ex) {
1205 throw new EJBException(ex.getMessage());
1206 }
1207 return answer;
1208 }
1209
1210
1211
1219 public CodeDescription[] loadFTPCodes() throws DAOException {
1220 debug.println("loadFTPids service");
1221
1222 CodeDescription[] answer = null;
1223 try {
1224 getDao();
1225 answer = lettertemplateDao.loadFTPCodes();
1226 }
1227 catch(DAOException se) {
1228 debug.println("DAOException: " + se);
1229 throw new DAOException(se.getMessage());
1230 }
1231 catch(Exception ex) {
1232 throw new EJBException(ex.getMessage());
1233 }
1234 return answer;
1235 }
1236
1237
1238
1246 public CodeDescription[] loadJobsCodes() throws DAOException {
1247 debug.println("loadJobsCodes service");
1248
1249 CodeDescription[] answer = null;
1250 try {
1251 getDao();
1252 answer = lettertemplateDao.loadJobsCodes();
1253 }
1254 catch(DAOException se) {
1255 debug.println("DAOException: " + se);
1256 throw new DAOException(se.getMessage());
1257 }
1258 catch(Exception ex) {
1259 throw new EJBException(ex.getMessage());
1260 }
1261 return answer;
1262 }
1263
1264
1265
1275 public Hashtable loadCalendars() throws DAOException {
1276 debug.println("loadCalendars service");
1277
1278 Hashtable answer = null;
1279 try {
1280 getDao();
1281 answer = lettertemplateDao.loadCalendars();
1282 }
1283 catch(DAOException se) {
1284 debug.println("DAOException: " + se);
1285 throw new DAOException(se.getMessage());
1286 }
1287 catch(Exception ex) {
1288 throw new EJBException(ex.getMessage());
1289 }
1290 return answer;
1291 }
1292
1293
1294
1295
1296
1297
1305 public LetterBatchStartModel loadLetterJob() throws DAOException {
1306
1307 debug.println("loadLetterJob service");
1308 LetterBatchStartModel answer = null;
1309
1310 try {
1311 getDao();
1312 answer = lettertemplateDao.loadLetterJob();
1313 }
1314 catch(DAOException se) {
1315 debug.println("DAOException: " + se);
1316 throw new DAOException(se.getMessage());
1317 }
1318 catch(Exception ex) {
1319 throw new EJBException(ex.getMessage());
1320 }
1321 return answer;
1322 }
1323
1324
1325
1331 public Date loadSysDate() throws DAOException {
1332
1333 debug.println("loadSysDate service");
1334 Date answer = null;
1335
1336 try {
1337 getDao();
1338 answer = lettertemplateDao.loadSysDate();
1339 }
1340 catch(DAOException se) {
1341 debug.println("DAOException: " + se);
1342 throw new DAOException(se.getMessage());
1343 }
1344 catch(Exception ex) {
1345 throw new EJBException(ex.getMessage());
1346 }
1347 return answer;
1348 }
1349
1350
1351
1357 public String loadCompanyWorkDir() throws DAOException {
1358
1359 debug.println("loadCompanyWorkDir service");
1360 String answer = null;
1361
1362 try {
1363 getDao();
1364 answer = lettertemplateDao.loadCompanyWorkDir();
1365 }
1366 catch(DAOException se) {
1367 debug.println("DAOException: " + se);
1368 throw new DAOException(se.getMessage());
1369 }
1370 catch(Exception ex) {
1371 throw new EJBException(ex.getMessage());
1372 }
1373 return answer;
1374 }
1375
1376
1377
1394 public LettersJobLogBean storeLetterJobLog(long jobId, Date executionDate,
1395 String success, long resultSetLength,
1396 String loggeableResultSet,
1397 String foTemplate) throws DAOException {
1398
1399 debug.println("storeLetterJobLog service");
1400 LettersJobLogBean answer = null;
1401
1402 try {
1403 getDao();
1404 answer = lettertemplateDao.storeLetterJobLog(jobId, executionDate, success,
1405 resultSetLength, loggeableResultSet, foTemplate);
1406 }
1407 catch(DAOException se) {
1408 debug.println("DAOException: " + se);
1409 throw new DAOException(se.getMessage());
1410 }
1411 catch(Exception ex) {
1412 throw new EJBException(ex.getMessage());
1413 }
1414 return answer;
1415 }
1416
1417
1418
1433 public void storeLetterFtpJobLog(long jobLogId, String fullFilePath,
1434 boolean succes, int attempts,
1435 String ip, String path,
1436 String failureDescription)
1437 throws DAOException {
1438
1439 debug.println("storeLetterFtpJobLog service");
1440
1441 try {
1442 getDao();
1443 lettertemplateDao.storeLetterFtpJobLog(jobLogId, fullFilePath,
1444 succes, attempts, ip, path,
1445 failureDescription);
1446 }
1447 catch(DAOException se) {
1448 debug.println("DAOException: " + se);
1449 throw new DAOException(se.getMessage());
1450 }
1451 catch(Exception ex) {
1452 throw new EJBException(ex.getMessage());
1453 }
1454
1455 }
1456
1457
1458
1473 public void updateLetterFtpJobLog(long jobLogId, String fullFilePath,
1474 boolean succes, int attempts,
1475 String ip, String path,
1476 String failureDescription)
1477 throws DAOException {
1478 debug.println("updateLetterFtpJobLog service");
1479
1480 try {
1481 getDao();
1482 lettertemplateDao.updateLetterFtpJobLog(jobLogId, fullFilePath,
1483 succes, attempts, ip, path,
1484 failureDescription);
1485 }
1486 catch(DAOException se) {
1487 debug.println("DAOException: " + se);
1488 throw new DAOException(se.getMessage());
1489 }
1490 catch(Exception ex) {
1491 throw new EJBException(ex.getMessage());
1492 }
1493
1494 }
1495
1496
1497
1506 public void updateJobExecDate(long jobId, Date date) throws DAOException {
1507
1508 debug.println("updateJobExecDate service");
1509
1510 try {
1511 getDao();
1512 lettertemplateDao.updateJobExecDate(jobId, date);
1513 }
1514 catch(DAOException se) {
1515 debug.println("DAOException: " + se);
1516 throw new DAOException(se.getMessage());
1517 }
1518 catch(Exception ex) {
1519 throw new EJBException(ex.getMessage());
1520 }
1521 }
1522
1523
1524
1532 public CompanyLocation loadCompanyLocation(long ftpId) throws DAOException {
1533
1534 debug.println("loadCompanyLocation service");
1535 CompanyLocation answer = null;
1536 try {
1537 getDao();
1538 answer = lettertemplateDao.loadCompanyLocation(ftpId);
1539 }
1540 catch(DAOException se) {
1541 debug.println("DAOException: " + se);
1542 throw new DAOException(se.getMessage());
1543 }
1544 catch(Exception ex) {
1545 throw new EJBException(ex.getMessage());
1546 }
1547 return answer;
1548 }
1549
1550
1551
1558 public LetterBatchReviewModel loadLetterBatchReview(String dayMonthYear)
1559 throws DAOException {
1560
1561 debug.println("loadLetterBatchReview service");
1562 LetterBatchReviewModel answer = null;
1563 try {
1564 getDao();
1565 answer = lettertemplateDao.loadLetterBatchReview(dayMonthYear);
1566 }
1567 catch(DAOException se) {
1568 debug.println("DAOException: " + se);
1569 throw new DAOException(se.getMessage());
1570 }
1571 catch(Exception ex) {
1572 throw new EJBException(ex.getMessage());
1573 }
1574 return answer;
1575 }
1576
1577
1578
1579
1585 private LetterTemplateDAO getDao() throws DAOException {
1586 if(lettertemplateDao == null) {
1587 lettertemplateDao =
1588 new LetterTemplateDAO(companyId, userId);
1589 }
1590 return lettertemplateDao;
1591 }
1592
1593
1594
1600 private Hashtable getSystemAlias() throws DAOException {
1601 if(systemAlias == null) {
1602 debug.println("systemAlias must be loaded");
1603 systemAlias = loadAlias();
1604 }
1605 return systemAlias;
1606 }
1607
1608
1609
1615 private Hashtable getSystemFields() throws DAOException {
1616 if(systemFields == null) {
1617 systemFields = loadFields();
1618 }
1619 return systemFields;
1620 }
1621
1622
1623 public void insertLetterARHistory(Connection dbConnection, long lCompID, long lAgrmID, Date procDate, long lLettID, long lLettCode, long lActionCode, long lResultCode)
1624 throws RemoteException, DAOException {
1625 debug.println("Calling LetterTemplateDAO for Letters Action Result");
1626
1627 try {
1628 getDao();
1629 lettertemplateDao.insertLetterARHistory(dbConnection, lCompID, lAgrmID, procDate, lLettID, lLettCode, lActionCode, lResultCode);
1630 }
1631 catch(DAOException se) {
1632 debug.println("DAOException: " + se);
1633 throw new DAOException(se.getMessage());
1634 }
1635 catch(Exception ex) {
1636 throw new EJBException(ex.getMessage());
1637 }
1638 }
1639
1640 }
1641
1642