KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > mapping > ejb > MappingGenerator


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * MappingGenerator.java
26  *
27  * Created on Aug 18, 2003
28  */

29
30 package com.sun.jdo.api.persistence.mapping.ejb;
31
32 import java.util.*;
33 import java.sql.Types JavaDoc;
34 import java.io.IOException JavaDoc;
35
36 import com.sun.jdo.api.persistence.mapping.ejb.beans.*;
37
38 import com.sun.jdo.api.persistence.model.Model;
39 import com.sun.jdo.api.persistence.model.ModelException;
40 import com.sun.jdo.api.persistence.model.mapping.MappingClassElement;
41 import com.sun.jdo.api.persistence.model.mapping.MappingFieldElement;
42 import com.sun.jdo.api.persistence.model.jdo.PersistenceClassElement;
43 import com.sun.jdo.api.persistence.model.jdo.PersistenceFieldElement;
44
45 import com.sun.jdo.spi.persistence.utility.StringHelper;
46 import com.sun.jdo.spi.persistence.utility.JavaTypeHelper;
47
48 import com.sun.jdo.spi.persistence.generator.database.DatabaseGenerator;
49 import com.sun.jdo.spi.persistence.generator.database.MappingPolicy;
50
51 import org.netbeans.modules.dbschema.*;
52 import org.netbeans.modules.dbschema.jdbcimpl.SchemaElementImpl;
53 import org.netbeans.modules.dbschema.util.NameUtil;
54
55 import org.netbeans.modules.schema2beans.Schema2BeansException;
56
57 /*
58  * This class will generate mapping classes from sun-cmp-mappings.xml
59  * and dbschema if they are available in the jar, or it will generate mapping
60  * classes based on ejb-jar.xml, bean classes and policy by invoking the
61  * database generation backend.
62  *
63  * @author Jie Leng
64  */

65 public class MappingGenerator {
66
67     // Since "_JDOState" is defined as private in IASEjbCMPEntityDescriptor,
68
// redefined here for passing it in DatabaseGenerator.
69
private static final String JavaDoc CLASS_SUFFIX = "_JDOState"; // NOI18N
70

71     private static final String JavaDoc FAKE_NAME = "fakename"; // NOI18N
72

73     private final EJBInfoHelper infoHelper;
74     private final Model model;
75     private final AbstractNameMapper nameMapper;
76     private final ClassLoader JavaDoc loader;
77     private final ConversionHelper ddHelper;
78
79     /** a boolean indicating whether the jdo model and mapping model should
80      * contain generated fields
81      */

82     private boolean skipGeneratedFields = false;
83
84     //hold strong reference to mapping class elements
85
private List strongRefs = new ArrayList();
86
87     /**
88      * Constructor
89      * @param infoHelper an instance of an EJBInfoHelper
90      * @param model a model containing mapping class and
91      * persistence class information
92      * @param loader a class loader
93      * @param skipGeneratedFields a boolean indicating to remove generated
94      * fields from jdo model and mapping model
95      */

96     public MappingGenerator(EJBInfoHelper infoHelper,
97             ClassLoader JavaDoc loader, boolean skipGeneratedFields) {
98         this.infoHelper = infoHelper;
99         this.model = infoHelper.getModel();
100         this.loader = loader;
101         this.nameMapper = infoHelper.getNameMapper();
102         this.ddHelper = infoHelper.createConversionHelper();
103         this.skipGeneratedFields = skipGeneratedFields;
104     }
105
106     protected EJBInfoHelper getInfoHelper() {
107         return infoHelper;
108     }
109
110     protected ClassLoader JavaDoc getClassLoader() {
111         return loader;
112     }
113
114     protected AbstractNameMapper getNameMapper() {
115         return nameMapper;
116     }
117
118     protected ConversionHelper getConversionHelper() {
119         return ddHelper;
120     }
121
122     /**
123      * Create mapping classes and schema based on database vendor name.
124      * @param dbName a string for database vendor name
125      * @param uniqueTableNames a string to determin if use unique table names
126      * during database generation
127      * @param userPolicy a property object holding user overrides
128      * @param inputFilesPath a directory where sun-cmp-mappings.xml is located
129      * @throws IOException
130      * @throws Schema2BeansException
131      * @throws ModelException
132      * @throws DBException
133      * @throws ConversionException
134      */

135     public DatabaseGenerator.Results generateMappingClasses(String JavaDoc dbName,
136             String JavaDoc uniqueTableNames, Properties userPolicy,
137             String JavaDoc inputFilesPath)
138             throws IOException JavaDoc, Schema2BeansException, ModelException,
139             DBException, ConversionException {
140
141         // generate mapping classes and dbschema in memory
142
SunCmpMappings sunCmpMappings = null;
143
144         // sun-cmp-mappings.xml does not exist, use DatabaseGenerator
145
// to generate sun-cmp-mappings.xml, *.dbschema
146

147         List pcClasses = new ArrayList();
148         sunCmpMappings = getPartialSunCmpMappings(
149                 pcClasses,
150                 Boolean.valueOf(uniqueTableNames).booleanValue());
151
152         // load real jdo model and fake mapping model in memory
153
ddHelper.setEnsureValidation(false);
154
155         // create fake schema for partial mapping
156
SchemaElement fakeSchema = new SchemaElement(new SchemaElementImpl());
157         fakeSchema.setName(DBIdentifier.create(FAKE_NAME));
158
159         // add newly created fake schema to SchemaElement cache
160
SchemaElement.addToCache(fakeSchema);
161
162         // pass null as class loader in order for MappingFile to load schema
163
// from cache not from disk.
164
loadMappingClasses(sunCmpMappings, null);
165
166         DatabaseGenerator.Results results = generateSchema(pcClasses,
167                 dbName, uniqueTableNames, userPolicy);
168
169         SchemaElement schema = results.getSchema();
170         Set mappingClasses = results.getMappingClasses();
171
172         // remove fake schema from cache since the correct schema is generated.
173
SchemaElement.removeFromCache(FAKE_NAME);
174
175         // clean up old version of schema in SchemaElement cache
176
// if there is one
177
SchemaElement.removeFromCache(schema.getName().getName());
178
179         // add newly created schema to SchemaElement cache
180
SchemaElement.addToCache(schema);
181
182         // update mapping classes
183
updateMappingClasses(mappingClasses);
184
185         // If skipGeneratedFields is set to true, the generated fields should
186
// not be kept in jdo model and mapping model.
187
// Remove generated fields from jdo model and mapping
188
// model before returning the result.
189
if (skipGeneratedFields) {
190             Iterator iter = mappingClasses.iterator();
191             while (iter.hasNext()) {
192                 MappingClassElement mapClassElt = (MappingClassElement)iter.next();
193                 if (mapClassElt != null) {
194                     String JavaDoc className = mapClassElt.getName();
195                     String JavaDoc ejbName = nameMapper.getEjbNameForPersistenceClass(
196                         className);
197
198                     PersistenceClassElement pce = (PersistenceClassElement)
199                             model.getPersistenceClass(className);
200                     PersistenceFieldElement[] allFields = pce.getFields();
201                     if (allFields != null) {
202                         List generatedFieldList = new ArrayList();
203
204                         // In order to avoid concurrentmod exception,
205
// loop through all persistence fields to put generated
206
// fields in a list, loop though the list to remove
207
// the generated fields from the model.
208
for (int i = 0; i < allFields.length; i++) {
209                             PersistenceFieldElement pfe = allFields[i];
210                             if (pfe != null) {
211                                 String JavaDoc pFieldName = pfe.getName();
212                                 String JavaDoc ejbFieldName = nameMapper.
213                                     getEjbFieldForPersistenceField(className,
214                                     pFieldName);
215                                 if (nameMapper.isGeneratedField(ejbName,
216                                     ejbFieldName)) {
217                                     generatedFieldList.add(pfe);
218                                 }
219                             }
220                         }
221
222                         // If the field is a version field, don't remove it
223
// from the model even though it is generated because
224
// it is needed to hold the version column information.
225
Iterator iterator = generatedFieldList.iterator();
226                         while (iterator.hasNext()) {
227                             PersistenceFieldElement pfe =
228                                 (PersistenceFieldElement)iterator.next();
229                             MappingFieldElement mfe = mapClassElt.
230                                  getField(pfe.getName());
231                             if (mfe != null && (!mfe.isVersion())) {
232                                 model.removeFieldElement(pfe);
233                                 mapClassElt.removeField(mfe);
234                             }
235                         }
236                     }
237                 }
238             }
239         }
240
241         return results;
242     }
243
244     /**
245      * load mapping classes from SunCmpMappings object
246      * @param sunMapping a SunCmpMappings object representing
247      * sun-cmp-mappings.xml in memory
248      * @param classLoader a class loader object
249      * @return a map object containing ejb names and mapping classes
250      * @throws DBException
251      * @throws ModelException
252      * @throws ConversionException
253      */

254     protected Map loadMappingClasses(SunCmpMappings sunMapping,
255         ClassLoader JavaDoc classLoader)
256         throws DBException, ModelException, ConversionException {
257         MappingFile mapFile = new MappingFile(classLoader);
258
259         Map allMappings = mapFile.intoMappingClasses(sunMapping, ddHelper);
260
261         updateMappingClasses(allMappings.values());
262
263         return allMappings;
264     }
265
266     /**
267      * Clean up strong reference. It should be called by end of deployment
268      * or deploytool.
269      */

270     public void cleanup() {
271         // Remove the strong references to MappingClassElements
272
// needed during deployment. The mapping class cache
273
// can now be cleaned up by the garbage collector.
274
strongRefs.clear();
275     }
276
277     /**
278      * Call DatabaseGenerator to generate database model and mapping model
279      * @param pcClasses a list of DatabaseGenerator.GeneratorNameTuple objects
280      * @param dbVendorName the string of database name
281      * @param useUniqueTableNames the string to determine use of unique table
282      * names for database generation
283      * @param userPolicy the property having user defined mappings between
284      * class field and jdbc type
285      * @return DatabaseGenerator.Results contains mapping classes and schema
286      * @throws IOException
287      * @throws DBException
288      * @throws ModelException
289      */

290     private DatabaseGenerator.Results generateSchema(List pcClasses,
291             String JavaDoc dbName, String JavaDoc useUniqueTableNames,
292             Properties userPolicy)
293             throws IOException JavaDoc, DBException, ModelException {
294
295         MappingPolicy mappingPolicy = MappingPolicy.getMappingPolicy(dbName);
296         mappingPolicy.setUserPolicy(userPolicy);
297
298         if (isPropertyDefined(useUniqueTableNames)) {
299             // It was explicitly set.
300
mappingPolicy.setUniqueTableName(
301                 Boolean.valueOf(useUniqueTableNames).booleanValue());
302         }
303
304        return DatabaseGenerator.generate(
305                 model, pcClasses, mappingPolicy,
306                 infoHelper.getSchemaNameToGenerate(), CLASS_SUFFIX, true);
307     }
308
309     /**
310      * Puts mapping classes into model's cache
311      * @param mappingClasses a collection of mapping classes
312      */

313     private void updateMappingClasses(Collection mappingClasses) {
314         Iterator iter = mappingClasses.iterator();
315         while (iter.hasNext()) {
316             MappingClassElement mapClassElt = (MappingClassElement)iter.next();
317             //put it in the models' cache
318
model.updateKeyForClass(mapClassElt, null);
319             //keep a strong ref
320
strongRefs.add(mapClassElt);
321         }
322     }
323
324     /**
325      * Generates partial sun-cmp-mapping (contains fake table name and
326      * fake column name) for MappingFile.intoMappings()
327      * @param pcClasses a list of DatabaseGenerator.NameTuple objects
328      * @param useUniqueTableNames a boolean to determine whether to use
329      * unique table names during database generation
330      * @return a SunCmpMappings object
331      * @throws Schema2BeansException
332      */

333     private SunCmpMappings getPartialSunCmpMappings(List pcClasses,
334              boolean useUniqueTableNames) throws Schema2BeansException {
335
336        // Create a new name mapper with perisistence class name differing
337
// from bean name if useUniqueTableName flag is true.
338
// So persistence class name can be used for unique table name.
339
AbstractNameMapper nameMapper2 = (useUniqueTableNames) ?
340                 infoHelper.createUniqueNameMapper() : nameMapper;
341
342         SunCmpMappings mappings = null;
343         mappings = new SunCmpMappings();
344         SunCmpMapping mapping = new SunCmpMapping();
345         mapping.setSchema(FAKE_NAME);
346
347         Iterator iter = infoHelper.getEjbNames().iterator();
348         while (iter.hasNext()) {
349             String JavaDoc ejbName = (String JavaDoc)iter.next();
350             String JavaDoc pcClass = ddHelper.getMappedClassName(ejbName);
351             String JavaDoc hashClassName = JavaTypeHelper.getShortClassName(pcClass);
352
353             // Make sure hash class name differs from ejb name
354
// if useUniqueTableName flag is true.
355
// if useUniqueTableName flag is false, ejb name is used for
356
// table name and hash class name is ignored.
357
if (useUniqueTableNames & hashClassName.equals(ejbName)) {
358                 hashClassName = JavaTypeHelper.getShortClassName(
359                        nameMapper2.getPersistenceClassForEjbName(ejbName));
360                 pcClasses.add(new DatabaseGenerator.NameTuple(
361                        pcClass, ejbName, hashClassName));
362             }
363             else {
364                 pcClasses.add(new DatabaseGenerator.NameTuple(
365                        pcClass, ejbName));
366             }
367
368             EntityMapping entity = new EntityMapping();
369             entity.setEjbName(ejbName);
370             entity.setTableName(FAKE_NAME);
371             Collection fields = infoHelper.getFieldsForEjb(ejbName);
372             Collection rels = infoHelper.getRelationshipsForEjb(ejbName);
373             fields.removeAll(rels);
374             // cmp field
375
Iterator fIter = fields.iterator();
376             while (fIter.hasNext()) {
377                 String JavaDoc fieldName = (String JavaDoc)fIter.next();
378                 CmpFieldMapping cmpField = new CmpFieldMapping();
379                 cmpField.setFieldName(fieldName);
380                 cmpField.addColumnName(FAKE_NAME);
381                 entity.addCmpFieldMapping(cmpField);
382             }
383             // cmr field
384
fIter = rels.iterator();
385             while (fIter.hasNext()) {
386                 String JavaDoc fieldName = (String JavaDoc)fIter.next();
387                 CmrFieldMapping cmrField = new CmrFieldMapping();
388                 cmrField.setCmrFieldName(fieldName);
389                 ColumnPair columnPair = new ColumnPair();
390                 columnPair.addColumnName(FAKE_NAME);
391                 columnPair.addColumnName(FAKE_NAME);
392                 cmrField.addColumnPair(columnPair);
393                 entity.addCmrFieldMapping(cmrField);
394             }
395             mapping.addEntityMapping(entity);
396         }
397
398         mappings.addSunCmpMapping(mapping);
399
400         return mappings;
401     }
402
403     /**
404      * Returns <code>true</code> if the specified propertyValue represents
405      * a defined value, <code>false</code> otherwise. This implementation
406      * returns <code>true</code> if the value is not empty, but subclasses
407      * may override this method to compare to a constant which represents an
408      * undefined value.
409      * @param propertyValue the value to be tested for defined
410      * @return <code>true</code> if the specified propertyValue represents
411      * a defined value, <code>false</code> otherwise
412      */

413     protected boolean isPropertyDefined(String JavaDoc propertyValue) {
414         return !StringHelper.isEmpty(propertyValue);
415     }
416
417     /**
418      * Update column in the SchemaElement with jdbc type and its length,
419      * scale and precision.
420      * @param column a ColumnElement to be updated
421      * @param jdbcType jdbc type from java.sql.Types
422      * @param length an Integer for length or <code>null</code>
423      * if it does not apply
424      * @param scale an Integer for scale or <code>null</code>
425      * if it does not apply
426      * @param precision an Integer for precision or <code>null</code>
427      * if it does not apply
428      */

429     public static void updateColumn(ColumnElement column, int jdbcType,
430             Integer JavaDoc length, Integer JavaDoc scale, Integer JavaDoc precision)
431             throws DBException {
432
433         column.setType(jdbcType);
434         column.setLength(length);
435         column.setScale(scale);
436         column.setPrecision(precision);
437     }
438
439     /**
440      * This method updates properties which stores user override policy.
441      * @param prop the property for user override
442      * @param className a string for bean class
443      * @param fieldName a string for field
444      * @param jdbcType jdbc type from java.sql.Types
445      * @param length an Integer for length or <code>null</code>
446      * if it does not apply
447      * @param scale an Integer for scale or <code>null</code>
448      * if it does not apply
449      * @param precision an Integer for precision or <code>null</code>
450      * if it does not apply
451      */

452     public static void updateProperties(Properties prop, String JavaDoc className,
453             String JavaDoc fieldName, int jdbcType, Integer JavaDoc length, Integer JavaDoc scale,
454             Integer JavaDoc precision) {
455
456         prop.setProperty(
457                 MappingPolicy.getOverrideForType(className, fieldName),
458                 MappingPolicy.getJdbcTypeName(jdbcType));
459
460         updateProperty(prop, MappingPolicy.getOverrideForLength(
461                 className, fieldName), length);
462
463         updateProperty(prop, MappingPolicy.getOverrideForScale(
464                 className, fieldName), scale);
465
466         updateProperty(prop, MappingPolicy.getOverrideForPrecision(
467                 className, fieldName), precision);
468     }
469
470     /**
471      * This method updates property. If the value is not <code>null</code>,
472      * update the property. If the value is <code>null</code>,
473      * remove the property.
474      * @param prop a property object which needs to be updated
475      * @param key a key for the property
476      * @param value a value for the propety
477      */

478     private static void updateProperty(Properties prop, String JavaDoc key,
479             Integer JavaDoc value) {
480         if (value != null) {
481             prop.setProperty(key, value.toString());
482         }
483         else {
484            prop.remove(key);
485         }
486     }
487
488     /**
489      * The contents of this class will eventually be added to SQLTypeUtil
490      * in dbmodel. It is an util class which provides methods for jdbc type
491      * compatible and jdbc attribute.
492      */

493     public static class SQLTypeUtil {
494
495         private static final Map characterMap = new HashMap();
496         private static final Map numericMap = new HashMap();
497         private static final Map blobMap = new HashMap();
498         private static final Map timeMap = new HashMap();
499         
500         private static final String JavaDoc NONE_ATTRIBUTE = "none";
501         private static final String JavaDoc LENGTH_ATTRIBUTE = "length";
502         private static final String JavaDoc SCALE_ATTRIBUTE = "scale";
503         private static final String JavaDoc SCALE_PRECISION_ATTRIBUTE = "scale-precision";
504
505         static {
506             characterMap.put(new Integer JavaDoc(Types.CHAR), LENGTH_ATTRIBUTE);
507             characterMap.put(new Integer JavaDoc(Types.VARCHAR), LENGTH_ATTRIBUTE);
508             characterMap.put(new Integer JavaDoc(Types.CLOB), LENGTH_ATTRIBUTE);
509
510             numericMap.put(new Integer JavaDoc(Types.BIT), NONE_ATTRIBUTE);
511             numericMap.put(new Integer JavaDoc(Types.TINYINT), NONE_ATTRIBUTE);
512             numericMap.put(new Integer JavaDoc(Types.SMALLINT), NONE_ATTRIBUTE);
513             numericMap.put(new Integer JavaDoc(Types.BIGINT), NONE_ATTRIBUTE);
514             numericMap.put(new Integer JavaDoc(Types.INTEGER), NONE_ATTRIBUTE);
515             numericMap.put(new Integer JavaDoc(Types.DOUBLE), NONE_ATTRIBUTE);
516             numericMap.put(new Integer JavaDoc(Types.DECIMAL), SCALE_PRECISION_ATTRIBUTE);
517             numericMap.put(new Integer JavaDoc(Types.REAL), NONE_ATTRIBUTE);
518
519             blobMap.put(new Integer JavaDoc(Types.BLOB), LENGTH_ATTRIBUTE);
520
521             timeMap.put(new Integer JavaDoc(Types.DATE), NONE_ATTRIBUTE);
522             timeMap.put(new Integer JavaDoc(Types.TIME), NONE_ATTRIBUTE);
523             timeMap.put(new Integer JavaDoc(Types.TIMESTAMP), NONE_ATTRIBUTE);
524         }
525
526         /** Returns if the given data type is numeric type or not.
527          * @param jdbcType the type from java.sql.Types
528          * @return <code>true</code> if the given type is numeric type;
529          * <code>false</code> otherwise
530          */

531         public static boolean isNumeric (int jdbcType) {
532             return checkType(jdbcType, numericMap);
533         }
534
535         /** Returns if the given data type is character type or not.
536          * @param jdbcType the type from java.sql.Types
537          * @return <code>true</code> if the given type is character type;
538          * <code>false</code> otherwise
539          */

540         public static boolean isCharacter (int jdbcType) {
541             return checkType(jdbcType, characterMap);
542         }
543
544         /** Returns if a given data type is blob type or not.
545          * @param jdbcType the type from java.sql.Types
546          * @return <code>true</code> if the give type is blob type;
547          * <code>false</code> otherwise
548          */

549         public static boolean isBlob (int jdbcType) {
550             return checkType(jdbcType, blobMap);
551         }
552
553         /** Returns if a given data type is time type or not.
554          * @param jdbcType the type from java.sql.Types
555          * @return <code>true</code> if the give type is time type;
556          * <code>false</code> otherwise
557          */

558         public static boolean isTime (int jdbcType) {
559             return checkType(jdbcType, timeMap);
560         }
561
562         private static boolean checkType(int jdbcType, Map jdbcTypes) {
563             return jdbcTypes.containsKey(new Integer JavaDoc(jdbcType));
564         }
565
566         /** Returns a collection of compatible jdbc types.
567          * @param jdbcType the type from java.sql.Types
568          * @return a collection of compatible jdbc types
569          */

570         public static Collection getCompatibleTypes(int jdbcType) {
571             if (isNumeric(jdbcType)) {
572                 return numericMap.keySet();
573             }
574             else if (isCharacter(jdbcType)) {
575                 return characterMap.keySet();
576             }
577             else if (isBlob(jdbcType)) {
578                 return blobMap.keySet();
579             }
580             else if (isTime(jdbcType)) {
581                 return timeMap.keySet();
582             }
583             return null;
584         }
585
586         /**
587          * This method returns true if the jdbc type has scale.
588          * @param jdbcType a jdbc type from java.sql.Types
589          * @return <code>true</code> if the type has scale;
590          * <code>false</code> otherwise
591          */

592         public static boolean hasScale(int jdbcType) {
593             if (getAttribute(jdbcType).equals(SCALE_ATTRIBUTE)
594                     || getAttribute(jdbcType).equals(SCALE_PRECISION_ATTRIBUTE))
595                 return true;
596             return false;
597         }
598
599         /**
600          * This method returns true if the jdbc type has precision.
601          * If the jdbc type has the precision, it means it also has scale.
602          * @param jdbcType a jdbc type from java.sql.Types
603          * @return <code>true</code> if the type has precision;
604          * <code>false</code> otherwise
605          */

606         public static boolean hasPrecision(int jdbcType) {
607             if (getAttribute(jdbcType).equals(SCALE_PRECISION_ATTRIBUTE))
608                 return true;
609             return false;
610         }
611
612         /**
613          * This method returns true if the jdbc type has length
614          * @param jdbcType a jdbc type from java.sql.Types
615          * @return <code>true</code> if the type has length;
616          * <code>false</code> otherwise
617          */

618         public static boolean hasLength(int jdbcType) {
619             if (getAttribute(jdbcType).equals(LENGTH_ATTRIBUTE))
620                 return true;
621             return false;
622         }
623
624         private static String JavaDoc getAttribute(int jdbcType) {
625             if (isNumeric(jdbcType)) {
626                 return (String JavaDoc)numericMap.get(new Integer JavaDoc(jdbcType));
627             }
628             else if (isCharacter(jdbcType)) {
629                 return (String JavaDoc)characterMap.get(new Integer JavaDoc(jdbcType));
630             }
631             else if (isBlob(jdbcType)) {
632                 return (String JavaDoc)blobMap.get(new Integer JavaDoc(jdbcType));
633             }
634             else if (isTime(jdbcType)) {
635                 return (String JavaDoc)timeMap.get(new Integer JavaDoc(jdbcType));
636             }
637             return NONE_ATTRIBUTE;
638         }
639     }
640 }
641
Popular Tags