KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > dods > xslt > DODSTag


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: DODSTag.java,v 1.3 2005/05/27 09:50:11 predrag Exp $
22  */

23
24 /*
25  * DODSTag.java
26  *
27  * @author Nenad Vico
28  *
29  */

30 package org.enhydra.dods.xslt;
31
32 import java.io.*;
33 import java.util.*;
34 import org.enhydra.dods.Common;
35
36 /**
37  *
38  * Utility class for DODS template xsl transformation.
39  *
40  */

41 public class DODSTag {
42     protected DODSTag() {}
43
44     /**
45      * Generate SUPER_LOADDATA tag.
46      *
47      * @param className Class member name (column table name).
48      *
49      * @return SUPER_LOADDATA tag
50      *
51      * @exception Exception Null pointer exception.
52      */

53     static public String JavaDoc superLoadData(String JavaDoc className) throws Exception JavaDoc {
54         if (-1 != className.indexOf("GenericDO")) {
55             return new String JavaDoc("");
56         } else {
57             return new String JavaDoc("super.loadData();");
58         }
59     }
60     static final String JavaDoc defaultStringLength = "32";
61
62     /**
63      * Generate DECL_MAX_LENGTH tag.
64      *
65      * @param name Column name.
66      * @param size Column size.
67      * @param dbtype Column database type.
68      * @param type Column java type.
69      *
70      * @return SECL_MAX_LENGTH tag.
71      *
72      * @exception Exception Null pointer exception.
73      */

74     static public String JavaDoc declMaxLength(String JavaDoc name, String JavaDoc size, String JavaDoc dbtype, String JavaDoc type) throws Exception JavaDoc {
75         String JavaDoc valueMaxLength = "";
76         String JavaDoc declMaxLength = "";
77
78         if (type.equals("String")) {
79             if (dbtype.equals("LONGVARCHAR")) {
80                 valueMaxLength = size = "0";
81             } else {
82                 if (null == size || 0 == size.length()) {
83                     size = defaultStringLength;
84                 }
85                 valueMaxLength = name + "_MaxLength";
86                 declMaxLength = "static public final int " + valueMaxLength
87                         + " = " + size + ";";
88             }
89         }
90         return declMaxLength;
91     }
92
93     /**
94      * Generate MARK_NEW_VALUE_EXTRAS tag.
95      *
96      * @param name Column name.
97      * @param dbtype Column database type.
98      * @param type Column java type.
99      * @param canBeeNull "true" if column can be null, otherwise "false".
100      *
101      * @return MARK_NEW_VALUE_EXTRAS tag.
102      *
103      * @exception Exception Null pointer exception.
104      */

105     static public String JavaDoc markNewValueExtras(String JavaDoc name, String JavaDoc dbtype, String JavaDoc type, String JavaDoc canBeeNull) throws Exception JavaDoc {
106         String JavaDoc valueMaxLength = "";
107         String JavaDoc markNewValue_extraParms = "";
108
109         if (type.equals("String")) {
110             if (dbtype.equals("LONGVARCHAR")) {
111                 valueMaxLength = "0";
112             } else {
113                 valueMaxLength = name + "_MaxLength";
114             }
115             markNewValue_extraParms = ", 0, " + valueMaxLength + ", "
116                     + canBeeNull;
117         }
118         return markNewValue_extraParms;
119     }
120
121     /**
122      * Generate BIG_DECIMAL_SCALE tag.
123      *
124      * @param type Column java type.
125      * @param size Column size.
126      * @param objRef "true" if column is objectRefereence, otherwise "false".
127      * @param foreignKey "true" if column is foreignKey, otherwise "false".
128      *
129      * @return BIG_DECIMAL_SCALE tag.
130      *
131      * @exception Exception Null pointer exception.
132      */

133     static public String JavaDoc bigDecimalScale(String JavaDoc type, String JavaDoc size, String JavaDoc objRef, String JavaDoc foreignKey) throws Exception JavaDoc {
134         String JavaDoc bigDecimalScale = "";
135
136         if (type.equals("java.math.BigDecimal")) {
137             if (null == size || 0 == size.length()) {
138                 bigDecimalScale = ", 0";
139             } else {
140                 bigDecimalScale = ", " + size;
141             }
142         }
143         
144         if (objRef.equals("true")) {
145             if (foreignKey.equals("false")) {
146                 bigDecimalScale = ", 0";
147             }
148         }
149         return bigDecimalScale;
150     }
151
152     /**
153      * Generate ARRAY_QUERY_NAME tag.
154      *
155      * @param objName Object/table name.
156      * @param pack Package name.
157      * @param name Column name.
158      * @param isArray "true" if this is array, otherwise "false".
159      *
160      * @return ARRAY_QUERY_NAME tag.
161      *
162      * @exception Exception Null pointer exception.
163      */

164     static public String JavaDoc arrayQueryName(String JavaDoc objName, String JavaDoc pack, String JavaDoc name, String JavaDoc isArray) throws Exception JavaDoc {
165         String JavaDoc arrayQueryName = "";
166
167         if (isArray.equals("true")) {
168             arrayQueryName = pack + "." + objName + "_" + name + "Query";
169         }
170         return arrayQueryName;
171     }
172
173     /**
174      * Generate ARRAY_DO_NAME tag.
175      *
176      * @param objName Object/table name.
177      * @param name Attribute name.
178      * @param isArray "true" if this is array, otherwise "false".
179      *
180      * @return ARRAY_DO_NAME tag.
181      *
182      * @exception Exception Null pointer exception.
183      */

184     static public String JavaDoc arrayDOName(String JavaDoc objName, String JavaDoc name, String JavaDoc isArray) throws Exception JavaDoc {
185         String JavaDoc arrayDOName = "";
186
187         if (isArray.equals("true")) {
188             arrayDOName = objName + "_" + name + "DO";
189         }
190         return arrayDOName;
191     }
192     public static Vector columnNamesVect;
193     public static Vector primaryKeysVect;
194     public static Vector refsN21Vect;
195     public static Vector refAttrs;
196  
197     /**
198      * Initialize column names <CODE>Vector</CODE>.
199      *
200      * @exception Exception Null pointer exception.
201      */

202     static public void initColumn() throws Exception JavaDoc {
203         columnNamesVect = new Vector();
204         primaryKeysVect = new Vector();
205         refsN21Vect = new Vector();
206         fKGroupedByRefDO = new Hashtable();
207     }
208
209     /**
210      * Add column name in columnNames <CODE>Vector</CODE>.
211      *
212      * @param name Column name.
213      * @param isPrimaryKey "true" if the column is primary key, otherwise "false".
214      * @param isObjRef "true" if the column references an table, otherwise "false".
215      * @param isUsedForQuery "true" if the column is used for query, otherwise "false".
216      * @param isForeignKey "true" if the column is foreign key, otherwise "false".
217      * @param objRefDOisAbstract "true" if the object the column references is abstract, otherwise "false".
218      *
219      * @exception Exception Null pointer exception.
220      */

221     static public void addColumnName(String JavaDoc name, String JavaDoc isPrimaryKey, String JavaDoc isObjRef, String JavaDoc isUsedForQuery, String JavaDoc isForeignKey, String JavaDoc objRefDOisAbstract) throws Exception JavaDoc {
222         columnNamesVect.add(name);
223         if (isPrimaryKey.equals("true")) {
224             primaryKeysVect.add(name);
225         }
226     }
227
228     /**
229      * Initialize refererr <CODE>Vector</CODE>.
230      *
231      * @exception Exception Null pointer exception.
232      */

233     static public void initRefererr() throws Exception JavaDoc {
234         refsN21Vect = new Vector();
235     }
236
237     /**
238      * Add Refererr atribute in <CODE>Vector</CODE>.
239      *
240      * @param name Attribute name.
241      * @param do_name Name of refererr DO.
242      * @param classPackage Name of classes package.
243      * @param className Name of object's class.
244      *
245      * @exception Exception Null pointer exception.
246      */

247     static public void addRefAttr(String JavaDoc name, String JavaDoc do_name, String JavaDoc classPackage, String JavaDoc className) throws Exception JavaDoc {
248         if (do_name.equals((classPackage + "." + className))) {
249             String JavaDoc[] pair = new String JavaDoc[2];
250
251             pair[0] = name;
252             pair[1] = do_name;
253             refsN21Vect.add(pair);
254         }
255     }
256
257     /**
258      * Generate INSERT_COLUMN_NAMES tag.
259      *
260      * @return INSERT_COLUMN_NAMES tag.
261      *
262      * @exception Exception Null pointer exception.
263      */

264     static public String JavaDoc insertColumnNames() throws Exception JavaDoc {
265         String JavaDoc sql_insert_column_names = "";
266         String JavaDoc comma = "";
267         int i;
268
269         for (i = 0; i < columnNamesVect.size(); i++) {
270             sql_insert_column_names += comma + columnNamesVect.elementAt(i);
271             comma = ", ";
272         }
273         if (0 == primaryKeysVect.size()) {
274             sql_insert_column_names += ", \" + get_OIdColumnName() + \", \" + get_versionColumnName() + \"";
275         }
276         return sql_insert_column_names;
277     }
278
279     /**
280      * Generate INSERT_QUESTION_MARKS tag.
281      *
282      * @return INSERT_QUESTION_MARKS tag.
283      *
284      * @exception Exception Null pointer exception.
285      */

286     static public String JavaDoc insertQuestionMarks() throws Exception JavaDoc {
287         String JavaDoc sql_insert_question_marks = "";
288         String JavaDoc comma = "";
289
290         if (0 == primaryKeysVect.size()) {
291             sql_insert_question_marks = "?, ?, ";
292         } // oid and version
293
int i;
294
295         for (i = 0; i < columnNamesVect.size(); i++) {
296             sql_insert_question_marks += comma + "?";
297             comma = ", ";
298         }
299         return sql_insert_question_marks;
300     }
301
302     /**
303      * Generate UPDATE_WHERE_CLAUSE tag.
304      *
305      * @return UPDATE_WHERE_CLAUSE tag.
306      *
307      * @exception Exception Null pointer exception.
308      */

309     static public String JavaDoc updateWhereClause() throws Exception JavaDoc {
310         String JavaDoc updateWhereClauseString = "\" + get_OIdColumnName() + \" = ? and \" + get_versionColumnName() + \" = ?";
311
312         /*
313          String updateWhereClauseString = "";
314          String commaPK = "";
315          int i;
316          for(i=0; i< primaryKeysVect.size(); i++) {
317          updateWhereClauseString += commaPK + " " + primaryKeysVect.elementAt(i) + " = ?";
318          commaPK = ", ";
319          }
320          */

321         return updateWhereClauseString;
322     }
323
324     /**
325      * Generate UPDATE_QUAL_QUESTION_MARKS tag.
326      *
327      * @return UPDATE_QUAL_QUESTION_MARKS tag.
328      *
329      * @exception Exception Null pointer exception.
330      */

331     static public String JavaDoc updateQualQuestionMarks() throws Exception JavaDoc {
332         String JavaDoc sql_update_question_marks = "";
333         String JavaDoc comma = "";
334         int i;
335
336         for (i = 0; i < columnNamesVect.size(); i++) {
337             sql_update_question_marks += comma + columnNamesVect.elementAt(i)
338                     + " = ?";
339             comma = ", ";
340         }
341         return sql_update_question_marks;
342     }
343
344     /**
345      * Generate MEMBER_REMARKS tag.
346      *
347      * @param isForeignKey "true" if column is foreign key, otherwise "false".
348      * @param isPrimaryKey "true" if column is primary key, otherwise "false".
349      *
350      * @return MEMBER_REMARKS tag.
351      *
352      * @exception Exception Null pointer exception.
353      */

354     static public String JavaDoc memberRemarks(String JavaDoc isForeignKey, String JavaDoc isPrimaryKey) throws Exception JavaDoc {
355         String JavaDoc memberRemarks = "";
356
357         if (isForeignKey.equals("true")) {
358             memberRemarks += "(FK)";
359         }
360         if (isPrimaryKey.equals("true")) {
361             memberRemarks += "(PK)";
362         }
363         return memberRemarks;
364     }
365
366     /**
367      * Generate DUMP_METHOD tag.
368      *
369      * @param name Column name.
370      * @param isObjRef "true" if column is Object Reference, otherwise "false".
371      * @param isForeignKey "true" if column is foreign key, otherwise "false".
372      *
373      * @return DUMP_METHOD tag.
374      *
375      * @exception Exception Null pointer exception.
376      */

377     static public String JavaDoc dumpMethod(String JavaDoc name, String JavaDoc isObjRef, String JavaDoc isForeignKey) throws Exception JavaDoc {
378         String JavaDoc dumpMethod = "";
379
380         if (isObjRef.equals("true") && isForeignKey.equals("false")) {
381             dumpMethod = "( null == data." + name + " ? null " + " : data."
382                     + name + ".toString( indentCount + 1 ) )";
383         } else {
384             dumpMethod = "data." + name;
385         }
386         return dumpMethod;
387     }
388
389     /**
390      * Generate DUMP_METHOD1 tag.
391      *
392      * changed a bit for "double_trouble" template ;)
393      *
394      * @param name Column name.
395      * @param isObjRef "true" if column is Object Reference, otherwise "false".
396      * @param isForeignKey "true" if column is foreign key, otherwise "false".
397      *
398      * @return DUMP_METHOD tag.
399      *
400      * @exception Exception Null pointer exception.
401      */

402     static public String JavaDoc dumpMethod1(String JavaDoc name, String JavaDoc isObjRef, String JavaDoc isForeignKey) throws Exception JavaDoc {
403         String JavaDoc dumpMethod = "";
404
405         name = name.toUpperCase(java.util.Locale.ENGLISH).substring(0, 1).concat(name.substring(1));
406         if (isObjRef.equals("true") && isForeignKey.equals("false")) {
407             dumpMethod = " ( null == get_DataStruct().get" + name + "() ? null "
408                     + " : get_DataStruct().get" + name + "().get_OId())";
409         } else {
410             dumpMethod = "get_DataStruct().get" + name + "()";
411         }
412         return dumpMethod;
413     }
414
415     /**
416      * Generate GET_ARRAY_DO_METHOD_NAME tag.
417      *
418      * @param DOName Refererr DO name.
419      * @param attrName Refererr attribute name.
420      *
421      * @return GET_ARRAY_DO_METHOD_NAME tag.
422      *
423      * @exception Exception Null pointer exception.
424      */

425     static public String JavaDoc getArrayDO(String JavaDoc DOName, String JavaDoc attrName) throws Exception JavaDoc {
426         String JavaDoc get_array_DO = "get" + DOName + "DOArray";
427
428         if (1 < refsN21Vect.size()) {
429             get_array_DO += "_" + attrName;
430         }
431         return get_array_DO;
432     }
433
434     /**
435      * Get DO name from full DO name (name with package).
436      *
437      * @param fullname Name of DO with package.
438      *
439      * @return DO name from full DO name (DO name without package).
440      *
441      * @exception Exception Null pointer exception.
442      */

443     static public String JavaDoc getDoName(String JavaDoc fullname) throws Exception JavaDoc {
444         String JavaDoc doName = fullname.substring(fullname.lastIndexOf('.') + 1);
445
446         return doName;
447     }
448
449     /**
450      * Generate GET_ARRAY_DO_METHOD_NAME tag for N2N.
451      *
452      * @param name2 Name of refererr DO.
453      * @param name Column name.
454      *
455      * @return GET_ARRAY_DO_METHOD_NAME tag.
456      *
457      * @exception Exception Null pointer exception.
458      */

459     static public String JavaDoc getArrayDON2N(String JavaDoc name2, String JavaDoc name) throws Exception JavaDoc {
460         String JavaDoc get_array_DO = "get" + name2 + "DOArray_via_" + name;
461
462         return get_array_DO;
463     }
464
465     /**
466      * Generate GET_SINGLE_DO_METHOD_NAME tag.
467      *
468      * @param DOName Name of refererr DO.
469      * @param attrName Name of Refererr attribute.
470      *
471      * @return GET_ARRAY_DO_METHOD_NAME tag.
472      *
473      * @exception Exception Null pointer exception.
474      */

475     static public String JavaDoc getSingleDO(String JavaDoc DOName, String JavaDoc attrName) throws Exception JavaDoc {
476         String JavaDoc get_single_DO = "get" + DOName + "DO";
477
478         if (1 < refsN21Vect.size()) {
479             get_single_DO += "_" + attrName;
480         }
481         return get_single_DO;
482     }
483
484     /**
485      * Generate ADD_SINGLE_DO_METHOD_NAME tag.
486      *
487      * @param DOName Name of refererr DO.
488      * @param attrName Name of Refererr attribute.
489      *
490      * @return ADD_ARRAY_DO_METHOD_NAME tag.
491      *
492      * @exception Exception Null pointer exception.
493      */

494     static public String JavaDoc addSingleDO(String JavaDoc DOName, String JavaDoc attrName) throws Exception JavaDoc {
495         String JavaDoc add_single_DO = "add" + DOName + "DO";
496
497         if (1 < refsN21Vect.size()) {
498             add_single_DO += "_" + attrName;
499         }
500         return add_single_DO;
501     }
502
503     /**
504      * Generate REMOVE_DO_METHOD_NAME tag.
505      *
506      * @param DOName Name of refererr DO.
507      * @param attrName Name of Refererr attribute.
508      *
509      * @return REMOVE_DO_METHOD_NAME tag.
510      *
511      * @exception Exception Null pointer exception.
512      */

513     static public String JavaDoc removeSingleDO(String JavaDoc DOName, String JavaDoc attrName) throws Exception JavaDoc {
514         String JavaDoc remove_single_DO = "remove" + DOName + "DO";
515
516         if (1 < refsN21Vect.size()) {
517             remove_single_DO += "_" + attrName;
518         }
519         return remove_single_DO;
520     }
521
522     /**
523      * Compare referrer DO name.
524      *
525      * @param classPackage Class package of referrer table.
526      * @param className Class name of referrer table.
527      * @param DOName Name of refererr DO.
528      *
529      * @return "true" if it is equal, otherwise "false".
530      *
531      * @exception Exception Null pointer exception.
532      */

533     static public String JavaDoc compareReferrerDoName(String JavaDoc classPackage, String JavaDoc className, String JavaDoc DOName) throws Exception JavaDoc {
534         if ((classPackage + "." + className).equals(DOName)) {
535             return "true";
536         } else {
537             return "false";
538         }
539     }
540     static public Hashtable fKGroupedByRefDO;
541
542     /**
543      * Generate Hashtable of foreign keys, grouped by Referenced DO.
544      *
545      * @param name Column name.
546      * @param isRefConstraint "true" if column has referece constraint, otherwise "false".
547      * @param refName Name of Referenced DO.
548      * @param pack Referenced DO package.
549      * @param fKeyColName Foreign key column name.
550      * @param foreignKeyGroup Foreign key group.
551      *
552      * @exception Exception Null pointer exception.
553      */

554     static public void addFK(String JavaDoc name, String JavaDoc isRefConstraint, String JavaDoc refName, String JavaDoc pack, String JavaDoc fKeyColName, String JavaDoc foreignKeyGroup) throws Exception JavaDoc {
555         if (isRefConstraint.equals("true")) {
556             String JavaDoc nameOfPKinReferencedTable = fKeyColName;
557
558             if (null != nameOfPKinReferencedTable
559                     && 0 != nameOfPKinReferencedTable.length()) {
560                 // a is a foreign key Attribute
561
Hashtable groups = (Hashtable) fKGroupedByRefDO.get(refName);
562
563                 if (null == groups) {
564                     groups = new Hashtable();
565                     fKGroupedByRefDO.put(refName, groups);
566                 }
567                 Vector pairs = (Vector) groups.get(foreignKeyGroup);
568
569                 if (null == pairs) {
570                     pairs = new Vector();
571                     groups.put(foreignKeyGroup, pairs);
572                 }
573                 String JavaDoc[] pk_fk_pair = new String JavaDoc[ 2 ];
574
575                 pk_fk_pair[0] = nameOfPKinReferencedTable;
576                 pk_fk_pair[1] = name; // name of FK column
577
pairs.addElement(pk_fk_pair);
578             }
579         }
580     }
581     static public Enumeration enumFKGroupedByRefDOKeys;
582     static public Enumeration enumFKGroupedByRefDOElements;
583     static public FKElements elements;
584     static class FKElements {
585         public String JavaDoc fkRefName;
586         public String JavaDoc getMethodName;
587         public String JavaDoc setMethodName;
588         public StringWriter fKsetQueryCalls;
589         public StringWriter fKsetCalls;
590         public FKElements() {
591             fkRefName = "";
592             getMethodName = "";
593             setMethodName = "";
594             fKsetQueryCalls = new StringWriter();
595             fKsetCalls = new StringWriter();
596         }
597     }
598
599     /**
600      * Initialize enumeration of foreign keys grouped by Referenced DO.
601      *
602      * @exception Exception Null pointer exception.
603      */

604     static public void initEnumFKGroupedByRefDO() throws Exception JavaDoc {
605         enumFKGroupedByRefDOKeys = fKGroupedByRefDO.keys();
606         enumFKGroupedByRefDOElements = fKGroupedByRefDO.elements();
607         elements = new FKElements();
608     }
609
610     /**
611      * Test if enumeration of foreign keys has more elements.
612      *
613      * @return String "true" if enumeration of foreign keys
614      * has more elements, otherwise "false".
615      *
616      * @exception Exception Null pointer exception.
617      */

618     static public String JavaDoc hasMoreElements() throws Exception JavaDoc {
619         String JavaDoc ret = "false";
620
621         if (enumFKGroupedByRefDOKeys.hasMoreElements()) {
622             ret = "true";
623             enumFKGroupedByRefDOElements.hasMoreElements();
624             elements.fkRefName = (String JavaDoc) enumFKGroupedByRefDOKeys.nextElement();
625             Hashtable fkGroups = (Hashtable) enumFKGroupedByRefDOElements.nextElement();
626
627             for (Enumeration e2 = fkGroups.keys(); e2.hasMoreElements();) {
628                 String JavaDoc fkGroup = (String JavaDoc) e2.nextElement();
629
630                 elements.getMethodName = "_" + fkGroup;
631                 elements.setMethodName = "_" + fkGroup;
632                 Vector v = (Vector) fkGroups.get(fkGroup);
633
634                 for (int i = 0; i < v.size(); i++) {
635                     String JavaDoc[] pk_fk_pair = (String JavaDoc[]) v.elementAt(i);
636                     String JavaDoc pkName = Common.capitalizeName(pk_fk_pair[0]);
637                     String JavaDoc fkName = Common.capitalizeName(pk_fk_pair[1]);
638
639                     /*
640                      // prepare data for setting START_MEMBER_NOT_IN_COMBO_FK tag
641                      numColumnsInFK.put( fkName, new Integer( v.size() ) );
642                      fkNameByFkRef.put( fkName, fkRef );
643                      */

644                     // set tags for generating method contents
645
elements.fKsetQueryCalls.write(" q.setQuery" + fkName
646                             + "( get" + pkName + "() );\n");
647                     elements.fKsetCalls.write(" _set" + fkName + "( x.get"
648                             + pkName + "() );\n");
649                 } // for
650
} // for
651
} // if
652
return ret;
653     }
654
655     /**
656      * Get FK_REF tag.
657      *
658      * @return FK_REF tag.
659      *
660      * @exception Exception Null pointer exception.
661      */

662     static public String JavaDoc getFKRef() throws Exception JavaDoc {
663         return elements.fkRefName;
664     }
665
666     /**
667      * Get FK_REF_GET_METHOD tag.
668      *
669      * @return FK_REF_GET_METHOD tag.
670      *
671      * @exception Exception Null pointer exception.
672      */

673     static public String JavaDoc getMethodName() throws Exception JavaDoc {
674         return elements.getMethodName;
675     }
676
677     /**
678      * Get FK_REF_SET_METHOD tag.
679      *
680      * @return FK_REF_SET_METHOD tag.
681      *
682      * @exception Exception Null pointer exception.
683      */

684     static public String JavaDoc setMethodName() throws Exception JavaDoc {
685         return elements.setMethodName;
686     }
687
688     /**
689      * Get FK_SETQUERY_CALLS tag.
690      *
691      * @return FK_SETQUERY_CALLS tag.
692      *
693      * @exception Exception Null pointer exception.
694      */

695     static public String JavaDoc getFKsetQueryCalls() throws Exception JavaDoc {
696         return elements.fKsetQueryCalls.toString();
697     }
698
699     /**
700      * Get FK_SET_CALLS tag.
701      *
702      * @return FK_SET_CALLS tag.
703      *
704      * @exception Exception Null pointer exception.
705      */

706     static public String JavaDoc getFKsetCalls() throws Exception JavaDoc {
707         return elements.fKsetCalls.toString();
708     }
709     static public int counter = 0;
710
711     /**
712      * Return counter and increment them.
713      *
714      * @return current counter.
715      */

716     static public void resetCounter() {
717         counter = 0;
718     }
719
720     /**
721      * Increment counter.
722      */

723     static public void incCounter() {
724         counter++;
725     }
726
727     /**
728      * Return counter.
729      *
730      * @return current counter.
731      */

732     static public String JavaDoc getCounter() {
733         return "" + counter;
734     }
735     
736         /**
737      * Return counter.
738      *
739      * @return current counter.
740      */

741     static public String JavaDoc convertJavaTypes(String JavaDoc typ ) {
742
743       String JavaDoc retValue;
744       
745       if(typ.equals("boolean"))
746             retValue = "new Boolean(x)";
747       else if(typ.equals("int"))
748             retValue = "new Integer(x)";
749       else if(typ.equals("long"))
750             retValue = "new Long(x)";
751       else if(typ.equals("float"))
752             retValue = "new Float(x)";
753       else if(typ.equals("double"))
754             retValue = "new Double(x)";
755       else if(typ.equals("byte"))
756             retValue = "new Byte(x)";
757       else if(typ.equals("short"))
758             retValue = "new Short(x)";
759       else if(typ.equals("char"))
760             retValue = "new Char(x)";
761       else
762             retValue = "x";
763
764         return retValue;
765     }
766 }
767
Popular Tags