public class MappingGenerator extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MappingGenerator.SQLTypeUtil
The contents of this class will eventually be added to SQLTypeUtil
in dbmodel.
|
| Constructor and Description |
|---|
MappingGenerator(EJBInfoHelper infoHelper,
ClassLoader loader,
boolean skipGeneratedFields)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
Clean up strong reference.
|
com.sun.jdo.spi.persistence.generator.database.DatabaseGenerator.Results |
generateMappingClasses(String dbName,
Boolean uniqueTableNames,
Properties userPolicy,
String inputFilesPath)
Create mapping classes and schema based on database vendor name.
|
protected ClassLoader |
getClassLoader() |
protected ConversionHelper |
getConversionHelper() |
protected EJBInfoHelper |
getInfoHelper() |
protected AbstractNameMapper |
getNameMapper() |
protected boolean |
isPropertyDefined(String propertyValue)
Returns
true if the specified propertyValue represents
a defined value, false otherwise. |
protected Map |
loadMappingClasses(SunCmpMappings sunMapping,
ClassLoader classLoader)
load mapping classes from SunCmpMappings object
|
static void |
updateColumn(org.netbeans.modules.dbschema.ColumnElement column,
int jdbcType,
Integer length,
Integer scale,
Integer precision)
Update column in the SchemaElement with jdbc type and its length,
scale and precision.
|
static void |
updateProperties(Properties prop,
String className,
String fieldName,
int jdbcType,
Integer length,
Integer scale,
Integer precision)
This method updates properties which stores user override policy.
|
public MappingGenerator(EJBInfoHelper infoHelper, ClassLoader loader, boolean skipGeneratedFields)
infoHelper - an instance of an EJBInfoHelperloader - a class loaderskipGeneratedFields - a boolean indicating to remove generated
fields from jdo model and mapping modelprotected EJBInfoHelper getInfoHelper()
protected ClassLoader getClassLoader()
protected AbstractNameMapper getNameMapper()
protected ConversionHelper getConversionHelper()
public com.sun.jdo.spi.persistence.generator.database.DatabaseGenerator.Results generateMappingClasses(String dbName, Boolean uniqueTableNames, Properties userPolicy, String inputFilesPath) throws IOException, org.netbeans.modules.schema2beans.Schema2BeansException, com.sun.jdo.api.persistence.model.ModelException, org.netbeans.modules.dbschema.DBException, ConversionException
dbName - a string for database vendor nameuniqueTableNames - a Boolean to determin if use unique table names
during database generationuserPolicy - a property object holding user overridesinputFilesPath - a directory where sun-cmp-mappings.xml is locatedIOExceptionorg.netbeans.modules.schema2beans.Schema2BeansExceptioncom.sun.jdo.api.persistence.model.ModelExceptionorg.netbeans.modules.dbschema.DBExceptionConversionExceptionprotected Map loadMappingClasses(SunCmpMappings sunMapping, ClassLoader classLoader) throws org.netbeans.modules.dbschema.DBException, com.sun.jdo.api.persistence.model.ModelException, ConversionException
sunMapping - a SunCmpMappings object representing
sun-cmp-mappings.xml in memoryclassLoader - a class loader objectorg.netbeans.modules.dbschema.DBExceptioncom.sun.jdo.api.persistence.model.ModelExceptionConversionExceptionpublic void cleanup()
protected boolean isPropertyDefined(String propertyValue)
true if the specified propertyValue represents
a defined value, false otherwise. This implementation
returns true if the value is not empty, but subclasses
may override this method to compare to a constant which represents an
undefined value.propertyValue - the value to be tested for definedtrue if the specified propertyValue represents
a defined value, false otherwisepublic static void updateColumn(org.netbeans.modules.dbschema.ColumnElement column,
int jdbcType,
Integer length,
Integer scale,
Integer precision)
throws org.netbeans.modules.dbschema.DBException
column - a ColumnElement to be updatedjdbcType - jdbc type from java.sql.Typeslength - an Integer for length or null
if it does not applyscale - an Integer for scale or null
if it does not applyprecision - an Integer for precision or null
if it does not applyorg.netbeans.modules.dbschema.DBExceptionpublic static void updateProperties(Properties prop, String className, String fieldName, int jdbcType, Integer length, Integer scale, Integer precision)
prop - the property for user overrideclassName - a string for bean classfieldName - a string for fieldjdbcType - jdbc type from java.sql.Typeslength - an Integer for length or null
if it does not applyscale - an Integer for scale or null
if it does not applyprecision - an Integer for precision or null
if it does not applyCopyright © 2014. All rights reserved.