org.hibernate.tool.hbm2x.doc
Class DocHelper

java.lang.Object
  extended by org.hibernate.tool.hbm2x.doc.DocHelper

public final class DocHelper
extends Object

This helper class is used expose hibernate mapping information to the templates.

Author:
Ricardo C. Moral, Amit Bhayani

Field Summary
static String DEFAULT_NO_PACKAGE
          Name to use if there are no packages specified for any class
static String DEFAULT_NO_SCHEMA_NAME
          Name to use if the schema is not specified.
 
Constructor Summary
DocHelper(org.hibernate.cfg.Configuration cfg, Cfg2JavaTool cfg2JavaTool)
          Constructor.
 
Method Summary
 org.hibernate.cfg.Configuration getCfg()
          Returns the Hibernate Configuration.
 List getClasses()
          Return a sorted List of all POJOClass
 List getClasses(String packageName)
          return a sorted List of POJOClass corresponding to packageName passed
 Map getClassesByPackage()
          return a Map which has List of POJOClass as value keyed by package name as String.
 POJOClass getComponentPOJO(org.hibernate.mapping.Property property)
          Method used in class.vm template to get the ComponentPOJO class corresponding to Property if its of Type Component.
 List getInheritanceHierarchy(POJOClass pc)
           
 List getOrderedProperties(POJOClass pojoClass)
           
 List getOrderedSimpleProperties(POJOClass pojoClass)
           
 List getPackages()
          Return a sorted List of packages
 List getProperties(org.hibernate.mapping.Table table, org.hibernate.mapping.Column column)
          Returns the properties that map to a column.
 String getPropertyType(org.hibernate.mapping.Property p)
           
 String getQualifiedColumnName(org.hibernate.mapping.Table table, org.hibernate.mapping.Column column)
          Returns the qualified name of a column.
 String getQualifiedSchemaName(org.hibernate.mapping.Table table)
          Returns the qualified schema name for a table.
 String getQualifiedTableName(org.hibernate.mapping.Table table)
          Returns the qualified name of a table.
 List getSchemas()
          Returns a list with all the schemas.
 List getSimpleProperties(POJOClass pojoClass)
           
 String getSQLTypeName(org.hibernate.mapping.Column column)
          Get the SQL type name for a column.
 List getTables()
          Return all the tables.
 List getTables(String schema)
          Return the list of tables for a particular schema.
 Map getTablesBySchema()
          Return a Map with the tables keyed by Schema.
 List getValues(org.hibernate.mapping.Table table, org.hibernate.mapping.Column column)
          Returns the values that use the specified column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NO_SCHEMA_NAME

public static final String DEFAULT_NO_SCHEMA_NAME
Name to use if the schema is not specified.

See Also:
Constant Field Values

DEFAULT_NO_PACKAGE

public static final String DEFAULT_NO_PACKAGE
Name to use if there are no packages specified for any class

See Also:
Constant Field Values
Constructor Detail

DocHelper

public DocHelper(org.hibernate.cfg.Configuration cfg,
                 Cfg2JavaTool cfg2JavaTool)
Constructor.

Parameters:
cfg - Hibernate configuration.
Method Detail

getCfg

public org.hibernate.cfg.Configuration getCfg()
Returns the Hibernate Configuration.

Returns:
the Hibernate Configuration.

getTablesBySchema

public Map getTablesBySchema()
Return a Map with the tables keyed by Schema. The keys are the schema names and the values are Lists of tables.

Returns:
a Map with the tables keyed by Schema Name.

getClassesByPackage

public Map getClassesByPackage()
return a Map which has List of POJOClass as value keyed by package name as String.

Returns:

getSchemas

public List getSchemas()
Returns a list with all the schemas.

Returns:
a list with all the schemas.

getPackages

public List getPackages()
Return a sorted List of packages

Returns:

getTables

public List getTables(String schema)
Return the list of tables for a particular schema.

Parameters:
schema - the name of the schema.
Returns:
a list with all the tables.

getClasses

public List getClasses(String packageName)
return a sorted List of POJOClass corresponding to packageName passed

Parameters:
packageName - packageName other than DEFAULT_NO_PACKAGE
Returns:
a sorted List of POJOClass

getTables

public List getTables()
Return all the tables.

Returns:
all the tables.

getClasses

public List getClasses()
Return a sorted List of all POJOClass

Returns:

getQualifiedSchemaName

public String getQualifiedSchemaName(org.hibernate.mapping.Table table)
Returns the qualified schema name for a table. The qualified schema name will include the catalog name if one is specified.

Parameters:
table - the table.
Returns:
the qualified schema name for the table.

getQualifiedTableName

public String getQualifiedTableName(org.hibernate.mapping.Table table)
Returns the qualified name of a table.

Parameters:
table - the table.
Returns:
the qualified name of the table.

getPropertyType

public String getPropertyType(org.hibernate.mapping.Property p)

getQualifiedColumnName

public String getQualifiedColumnName(org.hibernate.mapping.Table table,
                                     org.hibernate.mapping.Column column)
Returns the qualified name of a column.

Parameters:
table - the table.
column - the column
Returns:
the FQN of the column.

getSQLTypeName

public String getSQLTypeName(org.hibernate.mapping.Column column)
Get the SQL type name for a column.

Parameters:
column - the column.
Returns:
a String with the SQL type name.

getValues

public List getValues(org.hibernate.mapping.Table table,
                      org.hibernate.mapping.Column column)
Returns the values that use the specified column.

Parameters:
table - the table.
column - the column.
Returns:
a list with the values.

getProperties

public List getProperties(org.hibernate.mapping.Table table,
                          org.hibernate.mapping.Column column)
Returns the properties that map to a column.

Parameters:
table - the table.
column - the column.
Returns:
a list of properties.

getComponentPOJO

public POJOClass getComponentPOJO(org.hibernate.mapping.Property property)
Method used in class.vm template to get the ComponentPOJO class corresponding to Property if its of Type Component.

Parameters:
property - Get ComponentPOJO corresponding to this Property
Returns:
POJOClass for Property

getInheritanceHierarchy

public List getInheritanceHierarchy(POJOClass pc)

getOrderedProperties

public List getOrderedProperties(POJOClass pojoClass)

getSimpleProperties

public List getSimpleProperties(POJOClass pojoClass)

getOrderedSimpleProperties

public List getOrderedSimpleProperties(POJOClass pojoClass)