1    package com.instantbank.common.utilcomponents;
2    
3    
4    /**
5     *  Enumeration of lettertemplate ear constants
6     *
7     * @author Instant-bank (Rodrigo Lopez, Consuelo Franky)
8     * @created August 2002
9     */
10   public interface LetterTemplateGlobals {
11   
12     // CONSTANTS FOR UNDEFINED :
13     /**
14      *  Value for miscelaneous undefined codes.
15      */
16     public static final int UNDEF = -1;
17   
18     /**
19      *  Repeated name.
20      */
21     public static final int REPEATED_NAME = -2;
22   
23     /**
24      *  String representation for the UNDEF value.
25      */
26     public static final String STR_UNDEF = "undef";
27   
28     /**
29      *  Name of the template and/or component that has not been explicitly named.
30      */
31     public static final String STR_UNNAMED = "unnamed";
32   
33     /**
34      * String denoting lack of information.
35      */
36     public static final String STR_NO_INFO = "-------";
37   
38     /**
39      *  Code for trouble signaling.
40      */
41     public static final int TROUBLE_SIGNAL = -2;
42   
43     // CONSTANTS OF TEMPLATE STRUCTURE :
44   
45     /**
46      *  Index of a letter template inside the <a
47      *  href="../../lettertemplate/editor/applet/package-summary.html#thbc">THBC order.</a> .
48      */
49     public static final int TEMPLATE_INDEX = 0;
50   
51     /**
52      *  Index of the header letter component inside the <a
53      *  href="../../lettertemplate/editor/applet/package-summary.html#thbc">THBC order.</a> .
54      */
55     public static final int HEADER_INDEX = 1;
56   
57     /**
58      *  Index of the body component code inside the <a
59      *  href="../../lettertemplate/editor/applet/package-summary.html#thbc">THBC order.</a> .
60      */
61     public static final int BODY_INDEX = 2;
62   
63     /**
64      *  Index of the closing component code inside the <a
65      *  href="../../lettertemplate/editor/applet/package-summary.html#thbc">THBC order.</a> .
66      */
67     public static final int CLOSING_INDEX = 3;
68   
69     /**
70      *  Index of the Letter Template Category inside the <a
71      *  href="../../lettertemplate/editor/applet/package-summary.html#thbccr">THBCCR order.</a> .
72      */
73     public static final int CATEGORY = 4;
74   
75     /**
76      *  Index of the "response" inside the <a
77      *  href="../../lettertemplate/editor/applet/package-summary.html#thbccr">THBCCR order.</a> .
78      */
79     public static final int RESPONSE = 5;
80   
81     /**
82      * Default left margin
83      */
84     public static final int DEFAULT_LEFT_MARGIN = 1440;
85     /**
86      * Default right margin
87      */
88     public static final int DEFAULT_RIGHT_MARGIN = 850;
89   
90     /**
91      * Default top margin
92      */
93     public static final int DEFAULT_TOP_MARGIN = 1134;
94   
95     /**
96      * Default bottom margin
97      */
98     public static final int DEFAULT_BOTTOM_MARGIN = 1134;
99   
100    // CONSTANTS FOR BLOB DATA :
101  
102    /**
103     *  Maximum size of a letter image (bytes).
104     */
105    public static final int MAX_IMAGE_SIZE = 400000;
106  
107    /**
108     *  Maximum size of a letter component RTF text.
109     */
110    public static final int MAX_TEXT_SIZE = 150000;
111  
112    // CONSTANTS FOR APPLYING ITEMS TO THE DB :
113  
114    /**
115     *  Status of an item for inserting in the DB
116     */
117    public static final String INSERT = "A";  // append
118  
119    /**
120     *  Status of an item for deleting from the DB
121     */
122    public static final String DELETE = "D";  // delete
123  
124    /**
125     *  Status of an item for updating the DB
126     */
127    public static final String UPDATE = "M";  // modify
128  
129    // CONSTANTS FOR PREVIEW OF A TEMPLATE:
130  
131    /**
132     *  dummy agreement code for preview of templates
133     */
134    public static final long DUMMY_LOAN = 1;
135  
136    /**
137     *  letter down name for any preview of templates
138     */
139    public static final String DOWN_PREVIEW_NAME = "PREVIEW";
140  
141    /**
142     *  column name of Agreement Code field, used as where rule for template preview
143     */
144    public static final String AGREEMENT_CODE_VARIABLE = "AGRM_CODE";
145  
146    /**
147     *  Pattern expected from date values coming from the data base. It is used to
148     *  parse those strings into Dates.
149     */
150    public static final String DATE_PARSING_PATTERN = "yyyy-MM-dd";
151  
152    /**
153     * Display value of a bad formated or invalid date
154     */
155    public static final String BAD_FORMATED_DATE = "--/--/----";
156  
157    /**
158     * Value of a "void" date offset.
159     */
160    public static final Long VOIDELTA = new Long(0);
161  
162    // CONSTANTS FOR JOBS:
163  
164    /**
165     *  default job frequency
166     */
167    public static final String DEFAULT_JOB_FREQUENCY = "on_request";
168  
169    /**
170     *  default job status
171     */
172    public static final String DEFAULT_JOB_STATUS = "active";
173    public static final long DEFAULT_QUEUE_TYPE = 3;  // OTHER
174    public static final String DEFAULT_UNICITY = "yes";
175  
176  
177    /**
178     * Active job status
179     */
180    public static final String ACTIVE = "active";
181    public static final String INACTIVE = "inactive";
182  
183    //  job frequencies:
184    /**
185     *  On request job status
186     */
187    public static final String ON_REQUEST = "on_request";
188    public static final String YEARLY = "annual";
189    public static final String MONTHLY = "monthly";
190    public static final String WEEKLY = "weekly";
191    public static final String DAILY = "daily";
192  
193    /**
194     *   OR connector in where conditions
195     */
196    public static final String OR_CONNECTOR = "OR";
197  
198    /**
199     *   AND connector in where conditions
200     */
201    public static final String AND_CONNECTOR = "AND";
202  
203    /**
204     *   OR THE connector in where conditions
205     */
206    public static final String ORTHE_CONNECTOR = "OR THE";
207  
208    /**
209     *   empty connector in where conditions
210     */
211    public static final String EMPTY_CONNECTOR = "";
212  
213    /**
214     *   ascending direction in order element
215     */
216    public static final String ASCENDING_DIRECTION = "ascending";
217  
218    /**
219     *   descending direction in order element
220     */
221    public static final String DESCENDING_DIRECTION = "descending";
222  
223    /**
224     *  A letter job was successfully executed
225     */
226    public static final String LETTER_JOB_OK = "yes";
227  
228    /**
229     * A letter job was not executed because it is out of date.
230     */
231    public static final String LETTER_JOB_OUTDATED = "outdated";
232  
233    /**
234     * A letter job was not executed because there are inconsistencies
235     * in the date offsets of the variables in its letter template.
236     */
237    public static final String LETTER_JOB_OFFSET_INCONSISTENCY = "offset";
238  
239    // CONSTANTS FOR FIELDS AND ALIAS :
240  
241    /**
242     *  type of a numeric field
243     */
244    public static final String FIELD_NUMERIC = "number";
245  
246    /**
247     *  type of a string field
248     */
249    public static final String FIELD_STRING = "string";
250  
251    /**
252     *  type of a date field
253     */
254    public static final String FIELD_DATE = "date";
255  
256    /**
257     * Offset not allowed for a date field.
258     */
259    public static final String NO_OFFSET = "no";
260  
261    /**
262     * Offset allowed in workable days for a date field.
263     */
264    public static final String WORKABLE_DAYS_OFFSET = "workable";
265  
266    /**
267     * Offset in chronological days for a date field.
268     */
269    public static final String CHRONO_DAYS_OFFSET = "chronological";
270  
271    /**
272     *  root type for joins based in AGREEMENTS table
273     */
274    public static final String ROOT_AGREEMENTS = "agreements";
275  
276    /**
277     *  table alias for AGREEMENTS table
278     */
279    public static final String AGREEMENTS_ALIAS = "AGREEMENTS";
280  
281    /**
282     *   category of normal fields
283     */
284    public static final String NORMAL_FIELDS = "normal";
285  
286    /**
287     *   category of temporal fields
288     */
289    public static final String TEMPORAL_FIELDS = "temporal";
290  
291    /**
292     *   category of derived fields
293     */
294    public static final String DERIVED_FIELDS = "derived";
295  
296    //  types of joins
297    /**
298     *   type of a simple join
299     */
300    public static final String SIMPLE_JOIN = "simple";
301  
302    /**
303     *   type of a outer join
304     */
305    public static final String OUTER_JOIN = "outer";
306  
307    /**
308     *   type of a field menu with fixed values
309     */
310    public static final String FIXED_MENU = "fixed";
311  
312    /**
313     *  SYSDATE field
314     */
315    public static final String SYSDATE = "SYSDATE";
316  
317    /**
318     *  COMPANY_DATE field
319     */
320    public static final String COMPANY_DATE = "COMPANY_DATE";
321  
322  // CONSTANTS FOR LAUNCHING BATCH OF LETTER JOBS:
323  
324    /**
325     *   types of a letter Job for launching batch
326     */
327    public static final String RUN = "run";
328    public static final String OUT = "out";
329    public static final String OTHER = "other";
330  
331    // CONSTANTS FOR EXECUTING BATCH OF LETTER JOBS:
332  
333    /**
334     * Default Max size of a generated zip file containing letters (in bytes).
335     */
336    public static final int ZIP_LETTERS_FILE_MAX_SIZE = 524288;  //512K
337  
338    /**
339     * Subdirectory for zip letter files generation
340     */
341    public static final String LETTER_JOBS_DIR = "letterjobs";
342  
343    /**
344     * Letters job JMS Factory
345     */
346    public static final String LETTERS_JMS_FACTORY = "LettersJobJMSFactory";
347  
348    /**
349     * Letters Job JMS Queue
350     */
351    public static final String LETTERS_JOB_JMS_QUEUE = "LettersJobJMSQueue";
352  
353    /**
354     * Letters ftp JMS Queue
355     */
356    public static final String LETTERS_FTP_JMS_QUEUE = "LettersFtpJMSQueue";
357  
358    /**
359     * Max number of attempts for a ftp file transmission.
360     */
361    public static final int MAX_FTP_TRANSFER_ATTEMPTS = 5;
362  
363    /**
364     * Config dir for the rtf2fo api
365     */
366    public static final String RTF_TO_FO_CONFDIR =
367      "c:/bea/wlserver6.0/config/rtf2fo";
368  
369    // XSLT SHEET FOR TEMPLATES:
370  
371    /**
372     * Source of the xslt sheet for templates' variables filling.
373     */
374    public static final String fillSheet =
375      "<?xml version='1.0'?>" +
376      "<xsl:stylesheet version='1.0' " +
377      "  xmlns:xsl='http://www.w3.org/1999/XSL/Transform' " +
378      "  xmlns:fo='http://www.w3.org/1999/XSL/Format'>" +
379      "  <xsl:param name='template'/>" +
380      "  <xsl:param name='base'/>" +
381      "  <xsl:template match='varvalues'>" +
382      "    <xsl:apply-templates select='document($template,$base)/*'>" +
383      "      <xsl:with-param name='data' select='/'/>" +
384      "    </xsl:apply-templates>" +
385      "  </xsl:template>" +
386      "  <xsl:template match='*' priority='-1'>" +
387      "    <xsl:param name='data'/>" +
388      "    <xsl:copy>" +
389      "      <xsl:copy-of select='@*'/>" +
390      "      <xsl:apply-templates>" +
391      "        <xsl:with-param name='data' select='$data'/>" +
392      "      </xsl:apply-templates>" +
393      "    </xsl:copy>" +
394      "  </xsl:template>" +
395      "  <xsl:template match='docvar'>" +
396      "    <xsl:param name='data' />" +
397      "    <xsl:variable name='name' select='@name'/>" +
398      "    <fo:inline><xsl:value-of select='$data//*[local-name()=$name]'/></fo:inline>" +
399      "  </xsl:template>" +
400      "</xsl:stylesheet>";
401  
402  }
403