org.hibernate.envers.configuration.metadata
Class MetadataTools

java.lang.Object
  extended by org.hibernate.envers.configuration.metadata.MetadataTools

public class MetadataTools
extends Object

Author:
Adam Warski (adam at warski dot org), Lukasz Antoniak (lukasz dot antoniak at gmail dot com)

Nested Class Summary
static class MetadataTools.ColumnNameIterator
          An iterator over column names.
 
Constructor Summary
MetadataTools()
           
 
Method Summary
static void addColumn(org.dom4j.Element any_mapping, Column column)
          Adds column element with the following attributes (unless empty): name, length, scale, precision, sql-type, read and write.
static org.dom4j.Element addColumn(org.dom4j.Element parent, String name, Integer length, Integer scale, Integer precision, String sqlType, String customRead, String customWrite)
          Adds new column element.
static org.dom4j.Element addColumn(org.dom4j.Element parent, String name, Integer length, Integer scale, Integer precision, String sqlType, String customRead, String customWrite, boolean quoted)
           
static void addColumns(org.dom4j.Element any_mapping, Iterator<Column> columns)
           
static void addColumnsOrFormulas(org.dom4j.Element element, Iterator columnIterator)
          Adds all column or formula elements.
static void addFormula(org.dom4j.Element element, Formula formula)
          Adds formula element.
static org.dom4j.Element addNativelyGeneratedId(org.dom4j.Element parent, String name, String type)
           
static org.dom4j.Element addOrModifyColumn(org.dom4j.Element parent, String name)
          Column name shall be wrapped with '`' signs if quotation required.
static org.dom4j.Element addProperty(org.dom4j.Element parent, String name, String type, boolean insertable, boolean key)
           
static org.dom4j.Element addProperty(org.dom4j.Element parent, String name, String type, boolean insertable, boolean updateable, boolean key)
           
static org.dom4j.Element createEntity(org.dom4j.Document document, AuditTableData auditTableData, String discriminatorValue)
           
static org.dom4j.Element createJoin(org.dom4j.Element parent, String tableName, String schema, String catalog)
           
static org.dom4j.Element createSubclassEntity(org.dom4j.Document document, String subclassType, AuditTableData auditTableData, String extendsEntityName, String discriminatorValue)
           
static MetadataTools.ColumnNameIterator getColumnNameIterator(Iterator<Column> columnIterator)
           
static MetadataTools.ColumnNameIterator getColumnNameIterator(JoinColumn[] joinColumns)
           
static void prefixNamesInPropertyElement(org.dom4j.Element element, String prefix, MetadataTools.ColumnNameIterator columnNameIterator, boolean changeToKey, boolean insertable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataTools

public MetadataTools()
Method Detail

addNativelyGeneratedId

public static org.dom4j.Element addNativelyGeneratedId(org.dom4j.Element parent,
                                                       String name,
                                                       String type)

addProperty

public static org.dom4j.Element addProperty(org.dom4j.Element parent,
                                            String name,
                                            String type,
                                            boolean insertable,
                                            boolean updateable,
                                            boolean key)

addProperty

public static org.dom4j.Element addProperty(org.dom4j.Element parent,
                                            String name,
                                            String type,
                                            boolean insertable,
                                            boolean key)

addOrModifyColumn

public static org.dom4j.Element addOrModifyColumn(org.dom4j.Element parent,
                                                  String name)
Column name shall be wrapped with '`' signs if quotation required.


addColumn

public static org.dom4j.Element addColumn(org.dom4j.Element parent,
                                          String name,
                                          Integer length,
                                          Integer scale,
                                          Integer precision,
                                          String sqlType,
                                          String customRead,
                                          String customWrite)
Adds new column element. Method assumes that the value of name attribute is already wrapped with '`' signs if quotation required. It shall be invoked when column name is taken directly from configuration file and not from PersistentClass descriptor.


addColumn

public static org.dom4j.Element addColumn(org.dom4j.Element parent,
                                          String name,
                                          Integer length,
                                          Integer scale,
                                          Integer precision,
                                          String sqlType,
                                          String customRead,
                                          String customWrite,
                                          boolean quoted)

createEntity

public static org.dom4j.Element createEntity(org.dom4j.Document document,
                                             AuditTableData auditTableData,
                                             String discriminatorValue)

createSubclassEntity

public static org.dom4j.Element createSubclassEntity(org.dom4j.Document document,
                                                     String subclassType,
                                                     AuditTableData auditTableData,
                                                     String extendsEntityName,
                                                     String discriminatorValue)

createJoin

public static org.dom4j.Element createJoin(org.dom4j.Element parent,
                                           String tableName,
                                           String schema,
                                           String catalog)

addColumns

public static void addColumns(org.dom4j.Element any_mapping,
                              Iterator<Column> columns)

addColumn

public static void addColumn(org.dom4j.Element any_mapping,
                             Column column)
Adds column element with the following attributes (unless empty): name, length, scale, precision, sql-type, read and write.

Parameters:
any_mapping - Parent element.
column - Column descriptor.

prefixNamesInPropertyElement

public static void prefixNamesInPropertyElement(org.dom4j.Element element,
                                                String prefix,
                                                MetadataTools.ColumnNameIterator columnNameIterator,
                                                boolean changeToKey,
                                                boolean insertable)

addFormula

public static void addFormula(org.dom4j.Element element,
                              Formula formula)
Adds formula element.

Parameters:
element - Parent element.
formula - Formula descriptor.

addColumnsOrFormulas

public static void addColumnsOrFormulas(org.dom4j.Element element,
                                        Iterator columnIterator)
Adds all column or formula elements.

Parameters:
element - Parent element.
columnIterator - Iterator pointing at Column and/or Formula objects.

getColumnNameIterator

public static MetadataTools.ColumnNameIterator getColumnNameIterator(Iterator<Column> columnIterator)

getColumnNameIterator

public static MetadataTools.ColumnNameIterator getColumnNameIterator(JoinColumn[] joinColumns)


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.