1 package com.instantbank.lettertemplate.previewPrint.web;
2
3 import java.io.*;
4 import java.net.*;
5 import java.util.*;
6 import javax.naming.*;
7 import javax.rmi.*;
8 import javax.servlet.http.HttpServletRequest;
9
10 import oracle.xml.parser.v2.*;
11 import org.w3c.dom.*;
12 import org.xml.sax.*;
13 import com.instantbank.lettertemplate.control.util.WebKeys;
14 import com.instantbank.common.utilcomponents.Debug;
15
16
22 public class PreviewPrintTranslator
23 implements Serializable {
24
25
26 private String[] codetemplate;
27 private String[] category;
28 private String[] printtype;
29 private String[] nametempl;
30 private int nlLengthT;
31
32 private Debug debug = null;
33
34
35
41 public void setData(HttpServletRequest request) {
42
43 debug = new Debug();
44 debug.setDebugginOn(true);
45 debug.setPreMessage("** PreviewPrintTranslator: ");
46
47 try {
48 ArrayList listTempl = new ArrayList();
49 ArrayList item = new ArrayList();
50
51 listTempl = (ArrayList)request.getAttribute(WebKeys.TemplatesList);
52 nlLengthT = listTempl.size();
53 codetemplate = new String[nlLengthT];
54 category = new String[nlLengthT];
55 printtype = new String[nlLengthT];
56 nametempl = new String[nlLengthT];
57
58 for(int i = 0; i < nlLengthT; i++) {
59 item = (ArrayList)(listTempl.get(i));
60 codetemplate[i] = String.valueOf(((Long)item.get(0)).longValue());
61 category[i] = (String)item.get(1);
62 printtype[i] = (String)item.get(2);
63 nametempl[i] = (String)item.get(3);
64 }
65 }
66
67 catch(Exception e) {
68 debug.println("Exception unexpected:" + e.getMessage());
69 }
70 }
71
72
73
79 public String getTemplatesArray() {
80 String Head = null;
81 String Body = null;
82 char Ch = '"';
83
84 Head = "numberOfItems = " + nlLengthT + "; \n" +
85 "numberOfDeleted=0;\n";
86 Body = "";
87 for(int i = 0; i < nlLengthT; i++) {
88 Body = Body +
89 "itemsArray[" + i + "] = new Item("
90 + Ch + codetemplate[i] + Ch + ","
91 + Ch + category[i] + Ch + ","
92 + Ch + printtype[i] + Ch + ","
93 + Ch + nametempl[i] + Ch + ","
94 + Ch + "N" + Ch +
95 ");\n";
96 }
97
98 return (Head + Body);
99 }
100 }
101
102