db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r910600 [20/29] - in /db/torque/torque4/trunk: maven-torque-gf-plugin/ maven-torque-gf-plugin/src/ maven-torque-gf-plugin/src/main/ maven-torque-gf-plugin/src/main/java/ maven-torque-gf-plugin/src/main/java/org/ maven-torque-gf-plugin/src/m...
Date Tue, 16 Feb 2010 17:16:02 GMT
Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyColumnTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyColumnTransformer.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyColumnTransformer.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyColumnTransformer.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,219 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.torque.gf.control.ControllerState;
+import org.apache.torque.gf.source.RichSourceElementImpl;
+import org.apache.torque.gf.source.SourceElement;
+import org.apache.torque.gf.source.transform.SourceTransformerException;
+import org.apache.torque.templates.TorqueSchemaAttributeName;
+import org.apache.torque.templates.TorqueSchemaElementName;
+
+/**
+ * Sets the referenced and referencing columns for the column.
+ * These references are defined by foreign key definitions.
+ * The structure before transformation is:
+ *
+ * database
+ *   table
+ *     column
+ *     column
+ *     ...
+ *     foreign-key
+ *       reference
+ *     foreign-key
+ *       reference
+ *       reference
+ *       ...
+ *     ...
+ *   table
+ *   table
+ *   ...
+ *
+ * The structure after transformation is
+ * database
+ *   table
+ *     column
+ *       referenced-column (a foreign key exists containing the current column
+ *                          as local reference)
+ *         column (the foreign reference of the said foreign key)
+ *         foreign-key (the foreign key defining the relation)
+ *       referencing-column (a foreign key exists containing the current column
+ *                           as foreign reference)
+ *         column (the local reference of the said foreign key)
+ *         foreign-key (the foreign key defining the relation)
+ *       referencing-column
+ *         column
+ *         foreign-key
+ *       ...
+ *     column
+ *     ...
+ *     foreign-key
+ *       reference
+ *     foreign-key
+ *       reference
+ *       reference
+ *       ...
+ *     ...
+ *   table
+ *   table
+ *   ...
+ *
+ * Note that the foreign keys in the foreign-keys and referencing-foreign-keys
+ * are
+ */
+public class OMForeignKeyColumnTransformer
+{
+    public void transform(
+            SourceElement column,
+            ControllerState controllerState)
+        throws SourceTransformerException
+    {
+        if (!TorqueSchemaElementName.COLUMN.getName().equals(column.getName()))
+        {
+            throw new IllegalArgumentException("Illegal element Name "
+                    + column.getName());
+        }
+        Object localColumnName
+                = column.getAttribute(TorqueSchemaAttributeName.NAME);
+        SourceElement localTable = column.getParent();
+        Object localTableName
+                = localTable.getAttribute(TorqueSchemaAttributeName.NAME);
+        SourceElement database = localTable.getParent();
+
+        // create the referencedColumn elements
+        {
+            List<SourceElement> tableForeignKeys
+                    = localTable.getChildren(
+                        TorqueSchemaElementName.FOREIGN_KEY.getName());
+
+            // find foreign keys with this column as local reference
+            // and create a referencedColumn element for each.
+            for (SourceElement foreignKey : tableForeignKeys)
+            {
+                List<SourceElement> references
+                        = foreignKey.getChildren(
+                            TorqueSchemaElementName.REFERENCE.getName());
+                for (SourceElement reference : references)
+                {
+                    if (localColumnName.equals(reference.getAttribute(
+                            TorqueSchemaAttributeName.LOCAL)))
+                    {
+                        SourceElement referencedColumn
+                                = new RichSourceElementImpl(
+                                    ColumnChildElementName.REFERENCED_COLUMN);
+                        referencedColumn.addChild(foreignKey);
+                        String foreignTableName
+                                = (String) foreignKey.getAttribute(
+                                    TorqueSchemaAttributeName.FOREIGN_TABLE);
+                        String foreignColumnName
+                                = (String) reference.getAttribute(
+                                        TorqueSchemaAttributeName.FOREIGN);
+                        SourceElement foreignTable = FindHelper.findTable(
+                                database,
+                                foreignTableName);
+                        if (foreignTable == null)
+                        {
+                            throw new SourceTransformerException(
+                                    "Foreign table with name "
+                                    + foreignTableName
+                                    + " not found for a foreignKey of table "
+                                    + localTableName);
+                        }
+                        SourceElement foreignColumn = FindHelper.findColumn(
+                                foreignTable,
+                                foreignColumnName);
+                        if (foreignColumn == null)
+                        {
+                            throw new SourceTransformerException(
+                                    "Referenced Column with table name "
+                                    + foreignTableName
+                                    + " and column name "
+                                    + foreignColumnName
+                                    + " not found for a foreignKey of table "
+                                    + localTableName);
+                        }
+                        referencedColumn.addChild(foreignColumn);
+                        column.addChild(referencedColumn);
+                        break;
+                    }
+                }
+            }
+        }
+
+        //create the referencing-column elements
+        List<SourceElement> allTables
+                = database.getChildren(TorqueSchemaElementName.TABLE.getName());
+        for (SourceElement foreignTable : allTables)
+        {
+            String foreignTableName
+                    = (String) foreignTable.getAttribute(
+                            TorqueSchemaAttributeName.NAME);
+            List<SourceElement> foreignKeys
+                    = foreignTable.getChildren(
+                        TorqueSchemaElementName.FOREIGN_KEY.getName());
+            for (SourceElement foreignKey : foreignKeys)
+            {
+                if (!localTableName.equals(foreignKey.getAttribute(
+                        TorqueSchemaAttributeName.FOREIGN_TABLE)))
+                {
+                    continue;
+                }
+                List<SourceElement> references
+                        = foreignKey.getChildren(
+                            TorqueSchemaElementName.REFERENCE.getName());
+                for (SourceElement reference : references)
+                {
+                    Object referenceForeignColumnName
+                            = reference.getAttribute(
+                                    TorqueSchemaAttributeName.FOREIGN_TABLE);
+                    String referenceLocalColumnName
+                            = (String) reference.getAttribute(
+                                    TorqueSchemaAttributeName.LOCAL);
+                    if (localColumnName.equals(referenceForeignColumnName))
+                    {
+                        SourceElement referencingColumn
+                                = new RichSourceElementImpl(
+                                        ColumnChildElementName.REFERENCING_COLUMN);
+                        referencingColumn.addChild(foreignKey);
+                        referencingColumn.addChild(foreignTable);
+                        SourceElement localColumn = FindHelper.findColumn(
+                                foreignTable,
+                                referenceLocalColumnName);
+                        if (localColumn == null)
+                        {
+                            throw new SourceTransformerException(
+                                    "Local Column with column name "
+                                    + referenceLocalColumnName
+                                    + " not found in one of the foreignKeys"
+                                    + " of table "
+                                    + foreignTableName);
+                        }
+                        referencingColumn.addChild(localColumn);
+                        column.addChild(referencingColumn);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,585 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.torque.gf.control.ControllerState;
+import org.apache.torque.gf.source.RichSourceElementImpl;
+import org.apache.torque.gf.source.SourceElement;
+import org.apache.torque.gf.source.transform.SourceTransformerException;
+import org.apache.torque.templates.TorqueSchemaAttributeName;
+import org.apache.torque.templates.TorqueSchemaElementName;
+
+/**
+ * Sets the foreign tables for each of the foreign keys,
+ * and define variables, getters and setters for the complexObjectModel.
+ *
+ * So the source elements are (attributes not shown)
+ * foreign-key
+ *   reference
+ *   reference
+ *   ...
+ *
+ * and the result is
+ * foreign-key
+ *   reference
+ *     local-column
+ *       column
+ *     foreign-column
+ *       column
+ *   reference
+ *     local-column
+ *       column
+ *     foreign-column
+ *       column
+ *   ...
+ *   local-field (properties for the field on the local table's database object
+ *                referencing the foreign database object)
+ *   foreign-field (properties for the field on the foreign table's
+ *                  database object referencing the local database objects)
+ *   table (the foreign referenced table)
+ *
+ * On running this transformer, the javaName Attribute on the columns
+ * must be set properly.
+ */
+public class OMForeignKeyTransformer
+{
+    private static final String LOCAL_FIELD_NAME_PREFIX_OPTION
+            = "torque.om.complexObjectModel.localFieldNamePrefix";
+    private static final String LOCAL_FIELD_NAME_SUFFIX_OPTION
+            = "torque.om.complexObjectModel.localFieldNameSuffix";
+    private static final String LOCAL_FIELD_NAME_RELATED_BY_OPTION
+            = "torque.om.complexObjectModel.localFieldNameRelatedBy";
+    private static final String FOREIGN_FIELD_NAME_PREFIX_OPTION
+        = "torque.om.complexObjectModel.foreignFieldNamePrefix";
+    private static final String FOREIGN_FIELD_NAME_SUFFIX_OPTION
+        = "torque.om.complexObjectModel.foreignFieldNameSuffix";
+    private static final String FOREIGN_FIELD_NAME_RELATED_BY_OPTION
+        = "torque.om.complexObjectModel.foreignFieldNameRelatedBy";
+    private static final String FOREIGN_FIELD_TYPE_OPTION
+        = "torque.om.complexObjectModel.foreignFieldType";
+    private static final String FOREIGN_FIELD_INIT_TYPE_OPTION
+        = "torque.om.complexObjectModel.foreignFieldInitType";
+    private static final String JAVA5_OPTION
+        = "torque.om.java5";
+
+    public void transform(
+            SourceElement foreignKey,
+            ControllerState controllerState)
+        throws SourceTransformerException
+    {
+        if (!TorqueSchemaElementName.FOREIGN_KEY.getName().equals(
+                foreignKey.getName()))
+        {
+            throw new IllegalArgumentException("Illegal element Name "
+                    + foreignKey.getName());
+        }
+
+        SourceElement localTable = foreignKey.getParent();
+        String localTableName = (String) localTable.getAttribute(
+                TorqueSchemaAttributeName.NAME);
+        SourceElement database = localTable.getParent();
+
+        String foreignTableName = (String) foreignKey.getAttribute(
+                TorqueSchemaAttributeName.FOREIGN_TABLE);
+        SourceElement foreignTable
+                = FindHelper.findTable(database, foreignTableName);
+        foreignKey.addChild(foreignTable);
+
+        for (SourceElement reference : foreignKey.getChildren(
+                TorqueSchemaElementName.REFERENCE))
+        {
+            // create child element "local" for reference
+            // and add local column to it
+            {
+                String localColumnName = (String)
+                        reference.getAttribute(
+                                TorqueSchemaAttributeName.LOCAL);
+                SourceElement localColumnElement
+                        = new RichSourceElementImpl(
+                                ReferenceChildElementName.LOCAL_COLUMN);
+                SourceElement column
+                        = FindHelper.findColumn(localTable, localColumnName);
+                localColumnElement.addChild(column);
+                reference.addChild(localColumnElement);
+            }
+            // create child element "foreign" for reference
+            // and add foreign column
+            {
+                String foreignColumnName = (String)
+                        reference.getAttribute(
+                                TorqueSchemaAttributeName.FOREIGN);
+                SourceElement foreignColumnElement
+                        = new RichSourceElementImpl(
+                                ReferenceChildElementName.FOREIGN_COLUMN);
+                SourceElement column
+                        = FindHelper.findColumn(foreignTable, foreignColumnName);
+                foreignColumnElement.addChild(column);
+                reference.addChild(foreignColumnElement);
+            }
+        }
+
+        {
+            // create attributes for a field in the local table referencing
+            // the foreign table. This field will store one instance of the
+            // foreign table's java object.
+            StringBuilder referencedBySuffix = new StringBuilder();
+            List<SourceElement> referencingSameTable
+                    = FindHelper.findForeignKeyByReferencedTable(
+                            localTable,
+                            foreignTableName);
+            if (referencingSameTable.size() > 1
+                    || foreignKey.getAttribute(
+                            TorqueSchemaAttributeName.FOREIGN_TABLE)
+                        .equals(localTableName))
+            {
+                referencedBySuffix.append((String) controllerState.getOption(
+                        LOCAL_FIELD_NAME_RELATED_BY_OPTION));
+                for (SourceElement reference : foreignKey.getChildren(
+                        TorqueSchemaElementName.REFERENCE))
+                {
+                    SourceElement localColumnElement
+                            = reference.getChildren(
+                                    ReferenceChildElementName.LOCAL_COLUMN)
+                                .get(0);
+                    SourceElement localColumn
+                            = localColumnElement.getChildren(
+                                    TorqueSchemaElementName.COLUMN)
+                                .get(0);
+                    String fieldName = (String) localColumn.getAttribute(
+                            JavaFieldAttributeName.FIELD_NAME);
+                    referencedBySuffix.append(
+                            StringUtils.capitalize(fieldName));
+                }
+            }
+            // the field name to create the bean getter and setter names
+            String beanGetterSetterFieldName
+                    = (String) foreignTable.getAttribute(
+                            TableAttributeName.BEAN_CLASS_NAME)
+                        + referencedBySuffix;
+            {
+                // the field name for the variable used
+                String localFieldName = (String) controllerState.getOption(
+                            LOCAL_FIELD_NAME_PREFIX_OPTION)
+                        + foreignTable.getAttribute(
+                                TableAttributeName.DB_OBJECT_CLASS_NAME)
+                        + controllerState.getOption(
+                                    LOCAL_FIELD_NAME_SUFFIX_OPTION)
+                        + referencedBySuffix;
+                // the field name to create the getter and setter names
+                String getterSetterFieldName
+                        = (String) foreignTable.getAttribute(
+                                TableAttributeName.DB_OBJECT_CLASS_NAME)
+                            + referencedBySuffix;
+
+                SourceElement localFieldElement
+                        = new RichSourceElementImpl(
+                                ForeignKeyChildElementName.LOCAL_FIELD);
+
+                localFieldElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_NAME,
+                        localFieldName.toString());
+
+                String fieldType = (String) foreignTable.getAttribute(
+                        TableAttributeName.DB_OBJECT_CLASS_NAME);
+                localFieldElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_TYPE,
+                        fieldType);
+                localFieldElement.setAttribute(
+                        JavaFieldAttributeName.DEFAULT_VALUE,
+                        "null");
+                {
+                    String getterName = FieldHelper.getGetterName(
+                            getterSetterFieldName,
+                            fieldType,
+                            controllerState);
+                    localFieldElement.setAttribute(
+                            JavaFieldAttributeName.GETTER_NAME,
+                            getterName);
+                }
+                {
+                    String setterName = FieldHelper.getSetterName(
+                            getterSetterFieldName);
+                    localFieldElement.setAttribute(
+                            JavaFieldAttributeName.SETTER_NAME,
+                            setterName);
+                    localFieldElement.setAttribute(
+                            JavaFieldAttributeName.SETTER_THROWS,
+                            "TorqueException");
+                }
+                {
+                    String beanGetterName = FieldHelper.getGetterName(
+                            beanGetterSetterFieldName,
+                            fieldType,
+                            controllerState);
+                    localFieldElement.setAttribute(
+                            ForeignKeyChildAttributeName.BEAN_GETTER,
+                            beanGetterName);
+                }
+                {
+                    String beanSetterName = FieldHelper.getSetterName(
+                            beanGetterSetterFieldName);
+                    localFieldElement.setAttribute(
+                            ForeignKeyChildAttributeName.BEAN_SETTER,
+                            beanSetterName);
+                }
+
+                foreignKey.addChild(localFieldElement);
+            }
+            {
+                // the field name for the variable used
+                String localBeanFieldName = (String) controllerState.getOption(
+                            LOCAL_FIELD_NAME_PREFIX_OPTION)
+                        + foreignTable.getAttribute(
+                                TableAttributeName.BEAN_CLASS_NAME)
+                        + controllerState.getOption(
+                                    LOCAL_FIELD_NAME_SUFFIX_OPTION)
+                        + referencedBySuffix;
+                SourceElement localFieldInBeanElement
+                        = new RichSourceElementImpl(
+                                ForeignKeyChildElementName.LOCAL_FIELD_IN_BEAN);
+
+                localFieldInBeanElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_NAME,
+                        localBeanFieldName.toString());
+
+                String fieldType = (String) foreignTable.getAttribute(
+                        TableAttributeName.BEAN_CLASS_NAME);
+                localFieldInBeanElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_TYPE,
+                        fieldType);
+                localFieldInBeanElement.setAttribute(
+                        JavaFieldAttributeName.DEFAULT_VALUE,
+                        "null");
+                {
+                    String getterName = FieldHelper.getGetterName(
+                            beanGetterSetterFieldName,
+                            fieldType,
+                            controllerState);
+                    localFieldInBeanElement.setAttribute(
+                            JavaFieldAttributeName.GETTER_NAME,
+                            getterName);
+                }
+                {
+                    String setterName = FieldHelper.getSetterName(
+                            beanGetterSetterFieldName);
+                    localFieldInBeanElement.setAttribute(
+                            JavaFieldAttributeName.SETTER_NAME,
+                            setterName);
+                }
+                foreignKey.addChild(localFieldInBeanElement);
+
+            }
+        }
+
+        {
+            // create attributes for a field in the foreign table referencing
+            // the local table. As more than one foreign object can point
+            // to this object, it needs to be a collection.
+            StringBuilder referencedBySuffix = new StringBuilder();
+            List<SourceElement> referencingSameTable
+                    = FindHelper.findForeignKeyByReferencedTable(
+                            localTable,
+                            foreignTableName);
+            if (referencingSameTable.size() > 1)
+            {
+                referencedBySuffix.append((String) controllerState.getOption(
+                        FOREIGN_FIELD_NAME_RELATED_BY_OPTION));
+                for (SourceElement reference : foreignKey.getChildren(
+                        TorqueSchemaElementName.REFERENCE))
+                {
+                    SourceElement localColumnElement
+                            = reference.getChildren(
+                                    ReferenceChildElementName.LOCAL_COLUMN)
+                                .get(0);
+                    SourceElement localColumn
+                            = localColumnElement.getChildren(
+                                    TorqueSchemaElementName.COLUMN)
+                                .get(0);
+                    String fieldName = (String) localColumn.getAttribute(
+                            JavaFieldAttributeName.FIELD_NAME);
+                    referencedBySuffix.append(
+                            StringUtils.capitalize(fieldName));
+                }
+            }
+            // the field name to create the name of the bean getter and setter
+            String beanGetterSetterFieldName
+                    = (String) localTable.getAttribute(
+                            TableAttributeName.BEAN_CLASS_NAME)
+                        + referencedBySuffix;
+            {
+                // the field name for the variable used
+                String foreignFieldName = (String) controllerState.getOption(
+                            FOREIGN_FIELD_NAME_PREFIX_OPTION)
+                        + localTable.getAttribute(
+                                TableAttributeName.DB_OBJECT_CLASS_NAME)
+                        + controllerState.getOption(
+                            FOREIGN_FIELD_NAME_SUFFIX_OPTION)
+                        + referencedBySuffix;
+                // the field name to create the name of the getter and setter
+                String getterSetterFieldName
+                        = (String) localTable.getAttribute(
+                                TableAttributeName.DB_OBJECT_CLASS_NAME)
+                            + referencedBySuffix;
+                SourceElement foreignFieldElement
+                        = new RichSourceElementImpl(
+                                ForeignKeyChildElementName.FOREIGN_FIELD);
+
+                foreignFieldElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_NAME,
+                        foreignFieldName);
+                foreignFieldElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_ACCESS_MODIFIER,
+                        "protected");
+                {
+                    // the field name to cache the used Criteria
+                    String criteriaFieldName = "last"
+                            + StringUtils.capitalize(getterSetterFieldName)
+                            + "Criteria";
+                    foreignFieldElement.setAttribute(
+                            ForeignKeyChildAttributeName
+                                    .FOREIGN_COLUMN_CRITERIA_CACHE_FIELD,
+                            criteriaFieldName);
+                }
+
+
+                String fieldContainedType = (String) localTable.getAttribute(
+                        TorqueSchemaAttributeName.JAVA_NAME);
+                foreignFieldElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_CONTAINED_TYPE,
+                        fieldContainedType);
+
+                String fieldType = (String) controllerState.getOption(
+                        FOREIGN_FIELD_TYPE_OPTION);
+                if ("true".equals(controllerState.getOption(JAVA5_OPTION)))
+                {
+                    fieldType = fieldType + "<" + fieldContainedType + ">";
+                }
+                foreignFieldElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_TYPE,
+                        fieldType);
+
+                foreignFieldElement.setAttribute(
+                        JavaFieldAttributeName.DEFAULT_VALUE,
+                        "null");
+                {
+                    String getterName = FieldHelper.getGetterName(
+                                getterSetterFieldName,
+                                fieldType,
+                                controllerState)
+                            + "s";
+                    foreignFieldElement.setAttribute(
+                            JavaFieldAttributeName.GETTER_NAME,
+                            getterName);
+                }
+                {
+                    String setterName = FieldHelper.getSetterName(
+                                getterSetterFieldName)
+                            + "s";
+                    foreignFieldElement.setAttribute(
+                            JavaFieldAttributeName.SETTER_NAME,
+                                setterName);
+                }
+                {
+                    String adderName = FieldHelper.getAdderName(
+                            getterSetterFieldName);
+                    foreignFieldElement.setAttribute(
+                            JavaFieldAttributeName.ADDER_NAME,
+                            adderName);
+                }
+                {
+                    String initializerName = FieldHelper.getInitializerName(
+                            getterSetterFieldName);
+                    foreignFieldElement.setAttribute(
+                            JavaFieldAttributeName.INITIALIZER_NAME,
+                            initializerName);
+                }
+                {
+                    String beanGetterName = FieldHelper.getGetterName(
+                                beanGetterSetterFieldName,
+                                fieldType,
+                                controllerState)
+                            + "s";
+                    foreignFieldElement.setAttribute(
+                            ForeignKeyChildAttributeName.BEAN_GETTER,
+                            beanGetterName);
+                }
+                {
+                    String beanSetterName = FieldHelper.getSetterName(
+                                beanGetterSetterFieldName)
+                            + "s";
+                    foreignFieldElement.setAttribute(
+                            ForeignKeyChildAttributeName.BEAN_SETTER,
+                            beanSetterName);
+                }
+                {
+                    String initType = (String) controllerState.getOption(
+                            FOREIGN_FIELD_INIT_TYPE_OPTION);
+                    if ("true".equals(controllerState.getOption(JAVA5_OPTION)))
+                    {
+                        initType = initType + "<" + fieldContainedType + ">";
+                    }
+                    foreignFieldElement.setAttribute(
+                            JavaFieldAttributeName.INITIALIZER_TYPE,
+                            initType);
+
+                }
+                {
+                    // Name for a getter in the foreign table to
+                    // retrieve entries in the foreign table plus the joined
+                    // entries in the local table.
+                    String joinGetterFieldName
+                            = StringUtils.capitalize(getterSetterFieldName)
+                            + "sJoin"
+                            + foreignTable.getAttribute(
+                                TorqueSchemaAttributeName.JAVA_NAME);
+                    String joinGetterName = FieldHelper.getGetterName(
+                            joinGetterFieldName,
+                            fieldType,
+                            controllerState);
+                    foreignFieldElement.setAttribute(
+                            ForeignKeyChildAttributeName
+                                .FOREIGN_FIELD_JOIN_GETTER,
+                            joinGetterName);
+                }
+                {
+                    // Name for a getter in the foreign table to
+                    // retrieve entries in the foreign table plus all joined
+                    // entries, except the entries in the local table.
+                    String joinAllExceptGetterFieldName
+                            = StringUtils.capitalize(getterSetterFieldName)
+                            + "sJoinAllExcept"
+                            + foreignTable.getAttribute(
+                                    TorqueSchemaAttributeName.JAVA_NAME);
+                    String joinAllExceptGetterName = FieldHelper.getGetterName(
+                            joinAllExceptGetterFieldName,
+                            fieldType,
+                            controllerState);
+                    foreignFieldElement.setAttribute(
+                            ForeignKeyChildAttributeName
+                                .FOREIGN_FIELD_JOIN_GETTER,
+                            joinAllExceptGetterName);
+                }
+                {
+                    // Name for the doSelectJoinXXX method in the Peer Class
+                    // of the foreign table.
+                    String peerJoinSelectMethodName
+                            = "doSelectJoin"
+                                + foreignTable.getAttribute(
+                                        TorqueSchemaAttributeName.JAVA_NAME)
+                                + referencedBySuffix;
+                    foreignFieldElement.setAttribute(
+                            ForeignKeyChildAttributeName
+                                .PEER_JOIN_SELECT_METHOD,
+                            peerJoinSelectMethodName);
+                }
+                {
+                    // Name for the doSelectJoinAllExceptXXX method
+                    // in the Peer Class of the foreign table.
+                    String peerJoinAllExceptSelectMethodName
+                            = "doSelectJoinAllExcept"
+                                + foreignTable.getAttribute(
+                                        TorqueSchemaAttributeName.JAVA_NAME)
+                                + referencedBySuffix;
+                    foreignFieldElement.setAttribute(
+                            ForeignKeyChildAttributeName
+                                .PEER_JOIN_ALL_EXCEPT_SELECT_METHOD,
+                            peerJoinAllExceptSelectMethodName);
+                }
+                foreignKey.addChild(foreignFieldElement);
+            }
+            {
+                // the field name for the variable used
+                String foreignFieldInBeanName
+                        = (String) controllerState.getOption(
+                                FOREIGN_FIELD_NAME_PREFIX_OPTION)
+                            + localTable.getAttribute(
+                                    TableAttributeName.BEAN_CLASS_NAME)
+                            + controllerState.getOption(
+                                FOREIGN_FIELD_NAME_SUFFIX_OPTION)
+                            + referencedBySuffix;
+                SourceElement foreignFieldInBeanElement
+                        = new RichSourceElementImpl(
+                            ForeignKeyChildElementName.FOREIGN_FIELD_IN_BEAN);
+
+                foreignFieldInBeanElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_NAME,
+                        foreignFieldInBeanName);
+                foreignFieldInBeanElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_ACCESS_MODIFIER,
+                        "protected");
+
+                String fieldContainedType = (String) localTable.getAttribute(
+                        TableAttributeName.BEAN_CLASS_NAME);
+                foreignFieldInBeanElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_CONTAINED_TYPE,
+                        fieldContainedType);
+
+                String fieldType = (String) controllerState.getOption(
+                        FOREIGN_FIELD_TYPE_OPTION);
+                if ("true".equals(controllerState.getOption(JAVA5_OPTION)))
+                {
+                    fieldType = fieldType + "<" + fieldContainedType + ">";
+                }
+                foreignFieldInBeanElement.setAttribute(
+                        JavaFieldAttributeName.FIELD_TYPE,
+                        fieldType);
+
+                {
+                    String initType = (String) controllerState.getOption(
+                            FOREIGN_FIELD_INIT_TYPE_OPTION);
+                    if ("true".equals(controllerState.getOption(JAVA5_OPTION)))
+                    {
+                        initType = initType + "<" + fieldContainedType + ">";
+                    }
+                    foreignFieldInBeanElement.setAttribute(
+                            JavaFieldAttributeName.INITIALIZER_TYPE,
+                            initType);
+
+                }
+
+                foreignFieldInBeanElement.setAttribute(
+                        JavaFieldAttributeName.DEFAULT_VALUE,
+                        "null");
+                {
+                    String getterName = FieldHelper.getGetterName(
+                                beanGetterSetterFieldName,
+                                fieldType,
+                                controllerState)
+                            + "s";
+                    foreignFieldInBeanElement.setAttribute(
+                            JavaFieldAttributeName.GETTER_NAME,
+                            getterName);
+                }
+                {
+                    String setterName = FieldHelper.getSetterName(
+                                beanGetterSetterFieldName)
+                            + "s";
+                    foreignFieldInBeanElement.setAttribute(
+                            JavaFieldAttributeName.SETTER_NAME,
+                                setterName);
+                }
+                foreignKey.addChild(foreignFieldInBeanElement);
+            }
+        }
+    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMInheritanceTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMInheritanceTransformer.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMInheritanceTransformer.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMInheritanceTransformer.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,153 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.torque.gf.control.ControllerState;
+import org.apache.torque.gf.source.SourceElement;
+import org.apache.torque.gf.source.transform.SourceTransformerException;
+import org.apache.torque.templates.TorqueSchemaAttributeName;
+import org.apache.torque.templates.TorqueSchemaElementName;
+
+/**
+ * Transforms an Inheritance element.
+ */
+public class OMInheritanceTransformer
+{
+    private static final String INPUT_KEY_ATTRIBUTE = "key";
+    private static final String CLASSKEY_CONSTANT_ATTRIBUTE = "classkeyConstant";
+    private static final String CLASSNAME_CONSTANT_ATTRIBUTE = "classnameConstant";
+    private static final String CLASS_CONSTANT_ATTRIBUTE = "classConstant";
+    private static final String CLASS_NAME_ATTRIBUTE = "className";
+    private static final String PACKAGE_ATTRIBUTE = "package";
+    private static final String BEAN_PACKAGE_ATTRIBUTE = "beanPackage";
+    private static final String BEAN_EXTENDS_ATTRIBUTE = "beanExtends";
+    private static final String BEAN_CLASS_NAME_ATTRIBUTE = "beanClassName";
+
+    public void transform(
+            SourceElement inheritanceElement,
+            ControllerState controllerState)
+        throws SourceTransformerException
+    {
+        if (!TorqueSchemaElementName.INHERITANCE.getName().equals(
+                inheritanceElement.getName()))
+        {
+            throw new IllegalArgumentException("Illegal element Name "
+                    + inheritanceElement.getName());
+        }
+        String key = (String)
+                inheritanceElement.getAttribute(INPUT_KEY_ATTRIBUTE);
+        if (key == null)
+        {
+            throw new IllegalArgumentException(
+                    "Attribute \"key\" not set in Element "
+                        + TorqueSchemaElementName.INHERITANCE.getName());
+        }
+        inheritanceElement.setAttribute(
+                CLASSKEY_CONSTANT_ATTRIBUTE, "CLASSKEY_" + key.toUpperCase());
+        inheritanceElement.setAttribute(
+                CLASSNAME_CONSTANT_ATTRIBUTE, "CLASSNAME_" + key.toUpperCase());
+        inheritanceElement.setAttribute(
+                CLASS_CONSTANT_ATTRIBUTE, "CLASS_" + key.toUpperCase());
+
+        SourceElement tableElement
+                = inheritanceElement.getParent().getParent();
+        String className = (String)inheritanceElement.getAttribute(
+                TorqueSchemaAttributeName.CLASS.getName());
+        if (className == null)
+        {
+            className = (String) tableElement.getAttribute(
+                    TableAttributeName.DB_OBJECT_CLASS_NAME);
+        }
+        inheritanceElement.setAttribute(
+                CLASS_NAME_ATTRIBUTE, className);
+        inheritanceElement.setAttribute(
+                PACKAGE_ATTRIBUTE,
+                tableElement.getAttribute(
+                        TableAttributeName.DB_OBJECT_PACKAGE));
+        {
+            String extendsAttribute = (String) inheritanceElement.getAttribute(
+                    TorqueSchemaAttributeName.EXTENDS.getName());
+            String beanExtends = (String) inheritanceElement.getAttribute(
+                    BEAN_EXTENDS_ATTRIBUTE);
+            if (extendsAttribute == null)
+            {
+                extendsAttribute = (String) tableElement.getAttribute(
+                        TableAttributeName.DB_OBJECT_CLASS_NAME);
+                inheritanceElement.setAttribute(
+                        TorqueSchemaAttributeName.EXTENDS.getName(),
+                        extendsAttribute);
+                inheritanceElement.setAttribute(
+                        BEAN_EXTENDS_ATTRIBUTE,
+                        tableElement.getAttribute(
+                                TableAttributeName.BEAN_CLASS_NAME));
+            }
+            else if (beanExtends == null)
+            {
+                // we try to guess the extendsBean from extends
+                // and the bean package
+                int lastDot = extendsAttribute.lastIndexOf(".");
+                String unqualifiedClassname;
+                if (lastDot != -1)
+                {
+                    unqualifiedClassname
+                            = extendsAttribute.substring(lastDot + 1);
+                }
+                else
+                {
+                    unqualifiedClassname = extendsAttribute;
+                }
+                beanExtends = controllerState.getOption(
+                            "torque.om.className.beanClassNamePrefix")
+                        + unqualifiedClassname
+                        + controllerState.getOption(
+                            "torque.om.className.beanClassNameSuffix");
+                inheritanceElement.setAttribute(
+                        BEAN_EXTENDS_ATTRIBUTE,
+                        beanExtends);
+            }
+        }
+        {
+            int lastDot = className.lastIndexOf(".");
+            String unqualifiedClassname;
+            if (lastDot != -1)
+            {
+                unqualifiedClassname
+                        = className.substring(lastDot + 1);
+            }
+            else
+            {
+                unqualifiedClassname = className;
+            }
+            String beanClassName = controllerState.getOption(
+                        "torque.om.className.beanClassNamePrefix")
+                    + unqualifiedClassname
+                    + controllerState.getOption(
+                        "torque.om.className.beanClassNameSuffix");
+            inheritanceElement.setAttribute(
+                    BEAN_CLASS_NAME_ATTRIBUTE,
+                    beanClassName);
+
+        }
+        inheritanceElement.setAttribute(
+                BEAN_PACKAGE_ATTRIBUTE,
+                tableElement.getAttribute(
+                        TableAttributeName.BEAN_PACKAGE));
+    }
+ }

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMReferencingForeignKeyTableTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMReferencingForeignKeyTableTransformer.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMReferencingForeignKeyTableTransformer.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMReferencingForeignKeyTableTransformer.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,100 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.torque.gf.control.ControllerState;
+import org.apache.torque.gf.source.RichSourceElementImpl;
+import org.apache.torque.gf.source.SourceElement;
+import org.apache.torque.gf.source.transform.SourceTransformerException;
+import org.apache.torque.templates.TorqueSchemaAttributeName;
+import org.apache.torque.templates.TorqueSchemaElementName;
+
+/**
+ * Sets the foreign tables for each of the foreign keys,
+ * and define variables, getters and setters for the complexObjectModel.
+ *
+ * So the source elements are (already processed by OMForeignKeyTransformer)
+ * table
+ *   foreign-key
+ *     ...
+ *     table (the foreign referenced table)
+ *   foreign-key
+ *     ...
+ *     table
+ *   ...
+
+ * and the outcome is
+ *
+ * table
+ *   foreign-key
+ *     ...
+ *     table (the referenced table in the foreign key)
+ *   foreign-key
+ *     ...
+ *     table
+ *   ...
+ *   referencing-foreign-keys
+ *     foreign-key (a foreign key where the foreignTable is the current table)
+ *       ...
+ *       table (the referenced table in the foreign key, i.e this table.)
+ *     foreign-key
+ *       ...
+ *       table
+ *   ...
+ *
+ * On running this transformer, the table element in the foreign-key elements
+ * must be set properly.
+ */
+public class OMReferencingForeignKeyTableTransformer
+{
+    public void transform(
+            SourceElement table,
+            ControllerState controllerState)
+        throws SourceTransformerException
+    {
+        SourceElement database = table.getParent();
+        String tableName = (String) table.getAttribute(
+                TorqueSchemaAttributeName.NAME.getName());
+        List<SourceElement> referencingForeignKeys
+                = new ArrayList<SourceElement>();
+        for (SourceElement otherTable : database.getChildren(
+                TorqueSchemaElementName.TABLE.getName()))
+        {
+            List<SourceElement> referencingFromOtherTable
+                    = FindHelper.findForeignKeyByReferencedTable(
+                        otherTable,
+                        tableName);
+            referencingForeignKeys.addAll(referencingFromOtherTable);
+        }
+
+        SourceElement referencingForeignKeysElement
+                = new RichSourceElementImpl(
+                        TableChildElementName.REFERENCING_FOREIGN_KEYS);
+        table.addChild(referencingForeignKeysElement);
+
+        for (SourceElement foreignKey : referencingForeignKeys)
+        {
+            referencingForeignKeysElement.addChild(foreignKey);
+        }
+    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,320 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.InputStreamReader;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.torque.gf.control.ControllerState;
+import org.apache.torque.gf.processor.string.Camelbacker;
+import org.apache.torque.gf.source.RichSourceElementImpl;
+import org.apache.torque.gf.source.SourceElement;
+import org.apache.torque.gf.source.transform.AttributeTransformer;
+import org.apache.torque.gf.source.transform.SourceTransformerException;
+import org.apache.torque.templates.TemplateOptionName;
+import org.apache.torque.templates.TorqueSchemaAttributeName;
+import org.apache.torque.templates.TorqueSchemaElementName;
+import org.apache.torque.templates.TorqueSchemaIdMethod;
+import org.apache.torque.templates.TorqueSchemaInheritance;
+import org.apache.torque.templates.transformer.CollectAttributeSetTrueTransformer;
+
+/**
+ * Transforms the tables in the OM model.
+ */
+public class OMTableTransformer extends AttributeTransformer
+{
+    private static OMColumnTransformer columnTransformer
+            = new OMColumnTransformer();;
+
+    private static OMReferencingForeignKeyTableTransformer
+            referencingForeignKeyTableTransformer
+                = new OMReferencingForeignKeyTableTransformer();
+
+    private static CollectAttributeSetTrueTransformer primaryKeyTransformer
+            = new CollectAttributeSetTrueTransformer();
+
+    private static Camelbacker camelbacker = new Camelbacker();
+
+    public OMTableTransformer() throws SourceTransformerException
+    {
+        super(new InputStreamReader(
+                OMTableTransformer.class.getResourceAsStream(
+                        "OMTableTransformer.properties")));
+    }
+
+
+    public SourceElement transform(
+            SourceElement tableElement,
+            ControllerState controllerState)
+        throws SourceTransformerException
+    {
+        checkElementName(tableElement);
+        setJavaNameAttribute(tableElement);
+        setIdMethodAttribute(tableElement);
+        setSequenceAttributeIfNecessary(tableElement);
+
+        // sets all the attributes defined in OMTableTransformer.properties
+        super.transform(tableElement, controllerState);
+
+        setManagerClassNameAttributes(tableElement, controllerState);
+
+        createInheritanceColumnChildIfNecessary(tableElement);
+        primaryKeyTransformer.transform(tableElement, controllerState,
+                TorqueSchemaElementName.COLUMN,
+                TorqueSchemaAttributeName.PRIMARY_KEY,
+                TableChildElementName.PRIMARY_KEYS);
+
+        // position is one based
+        int columnPosition = 1;
+        for (SourceElement element : tableElement.getChildren(
+                TorqueSchemaElementName.COLUMN))
+        {
+            columnTransformer.transform(
+                    element,
+                    controllerState,
+                    columnPosition);
+            columnPosition++;
+        }
+
+        referencingForeignKeyTableTransformer.transform(
+                tableElement,
+                controllerState);
+        return tableElement;
+    }
+
+    /**
+     * Checks that the table element has the correct element name.
+     *
+     * @param tableElement the table element to check, not null.
+     *
+     * @throws IllegalArgumentException if the name of the element is wrong.
+     */
+    private void checkElementName(SourceElement tableElement)
+    {
+        if (!TorqueSchemaElementName.TABLE.getName().equals(
+                tableElement.getName()))
+        {
+            throw new IllegalArgumentException("Illegal element Name "
+                    + tableElement.getName());
+        }
+    }
+
+    /**
+     * Sets the javaName attribute of the table element, if not
+     * already set.
+     *
+     * @param tableElement the table element, not null.
+     *
+     * @throws SourceTransformerException if both attributes javaName and name
+     *         are not set on the tableElement.
+     */
+    protected void setJavaNameAttribute(SourceElement tableElement)
+            throws SourceTransformerException
+    {
+        // set javaName attribute
+        Object javaName = tableElement.getAttribute(
+                TorqueSchemaAttributeName.JAVA_NAME);
+        if (javaName == null)
+        {
+            Object inputName = tableElement.getAttribute(
+                    TorqueSchemaAttributeName.NAME);
+            if (inputName == null)
+            {
+                throw new SourceTransformerException("The required attribute "
+                        + TorqueSchemaAttributeName.NAME
+                        + " on element "
+                        + tableElement.getName()
+                        + " is null");
+            }
+            javaName = camelbacker.process(inputName.toString());
+            tableElement.setAttribute(
+                    TorqueSchemaAttributeName.JAVA_NAME,
+                    javaName);
+        }
+    }
+
+    protected void setIdMethodAttribute(SourceElement tableElement)
+            throws SourceTransformerException
+    {
+        Object idMethod = tableElement.getAttribute(
+                TorqueSchemaAttributeName.ID_METHOD);
+        // TODO: in the 3.3 schema, "null" is the default value for idMethod.
+        // Therefore we must test for this explicit string.
+        // Can be removed once the dtd/schema is updated.
+        if (idMethod == null
+            || TorqueSchemaIdMethod.NULL.getName().equals(idMethod))
+        {
+            idMethod = tableElement.getParent().getAttribute(
+                    TorqueSchemaAttributeName.DEFAULT_ID_METHOD);
+            if (idMethod == null)
+            {
+                throw new SourceTransformerException("The attribute "
+                        + TorqueSchemaAttributeName.DEFAULT_ID_METHOD
+                        + " is not set on the database element "
+                        + " and no id method is given on table "
+                        + tableElement.getName());
+            }
+            tableElement.setAttribute(
+                    TorqueSchemaAttributeName.ID_METHOD,
+                    idMethod);
+        }
+    }
+
+    protected void setSequenceAttributeIfNecessary(SourceElement tableElement)
+    {
+        // set sequence attribute
+        if (!TorqueSchemaIdMethod.NATIVE.getName().equals(
+                tableElement.getAttribute(TorqueSchemaAttributeName.ID_METHOD)))
+        {
+            return;
+        }
+
+        List<SourceElement> idMethodParams = tableElement.getChildren(
+                TorqueSchemaElementName.ID_METHOD_PARAMETER);
+        if (idMethodParams.isEmpty()
+            && tableElement.getAttribute(TableAttributeName.SEQUENCE) == null)
+        {
+            tableElement.setAttribute(
+                    TableAttributeName.SEQUENCE,
+                    (String) tableElement.getAttribute(
+                          TorqueSchemaAttributeName.NAME)
+                        + "_SEQ");
+        }
+        else
+        {
+            tableElement.setAttribute(
+                    TableAttributeName.SEQUENCE,
+                        idMethodParams.get(0).getAttribute(
+                            TorqueSchemaAttributeName.VALUE.getName()));
+        }
+    }
+
+
+    protected void setManagerClassNameAttributes(
+                SourceElement tableElement,
+                ControllerState controllerState)
+            throws SourceTransformerException
+    {
+        // Managers must be named after an interface if there is one.
+        String interfaceName = (String) tableElement.getAttribute(
+                TorqueSchemaAttributeName.INTERFACE);
+        if (interfaceName == null)
+        {
+            String managerClassName = controllerState.getStringOption(
+                    TemplateOptionName.OM_MANAGER_CLASS_NAME_PREFIX)
+                + tableElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME)
+                + controllerState.getStringOption(
+                    TemplateOptionName.OM_MANAGER_CLASS_NAME_SUFFIX);
+            tableElement.setAttribute(
+                    TableAttributeName.MANAGER_CLASS_NAME,
+                    managerClassName);
+            String baseManagerClassName = controllerState.getStringOption(
+                    "torque.om.className.baseManagerClassNamePrefix")
+                + tableElement.getAttribute(TorqueSchemaAttributeName.JAVA_NAME)
+                + controllerState.getStringOption(
+                    "torque.om.className.baseManagerClassNameSuffix");
+            tableElement.setAttribute(
+                    TableAttributeName.BASE_MANAGER_CLASS_NAME,
+                    baseManagerClassName);
+        }
+        else
+        {
+            if (StringUtils.isBlank(interfaceName))
+            {
+                throw new SourceTransformerException("The attribute "
+                        + TorqueSchemaAttributeName.INTERFACE
+                        + " is blank on table "
+                        + tableElement.getName());
+            }
+            int dotPosition = interfaceName.lastIndexOf(".");
+            if (dotPosition != -1)
+            {
+                interfaceName = interfaceName.substring(dotPosition + 1);
+            }
+            if (StringUtils.isBlank(interfaceName))
+            {
+                throw new SourceTransformerException("The attribute "
+                        + TorqueSchemaAttributeName.INTERFACE
+                        + " ends with a dot on table "
+                        + tableElement.getName());
+            }
+
+            // first character upper case
+            if (interfaceName.length() == 1)
+            {
+                interfaceName = interfaceName.toUpperCase();
+            }
+            else
+            {
+                interfaceName = interfaceName.substring(0, 1).toUpperCase()
+                    + interfaceName.substring(1);
+            }
+
+            String managerClassName = controllerState.getOption(
+                    TemplateOptionName.OM_MANAGER_CLASS_NAME_PREFIX)
+                + interfaceName
+                + controllerState.getOption(
+                        TemplateOptionName.OM_MANAGER_CLASS_NAME_SUFFIX);
+            tableElement.setAttribute(
+                    TableAttributeName.MANAGER_CLASS_NAME,
+                    managerClassName);
+            String baseManagerClassName = controllerState.getOption(
+                    "torque.om.className.baseManagerClassNamePrefix")
+                + interfaceName
+                + controllerState.getOption(
+                    "torque.om.className.baseManagerClassNameSuffix");
+            tableElement.setAttribute(
+                    TableAttributeName.BASE_MANAGER_CLASS_NAME,
+                    baseManagerClassName);
+        }
+    }
+
+    public void createInheritanceColumnChildIfNecessary(
+                SourceElement tableElement)
+            throws SourceTransformerException
+    {
+        boolean inheritanceFound = false;
+        for (SourceElement columnElement : tableElement.getChildren(
+                TorqueSchemaElementName.COLUMN))
+        {
+            if (TorqueSchemaInheritance.SINGLE.getValue().equals(
+                    columnElement.getAttribute(
+                        TorqueSchemaAttributeName.INHERITANCE)))
+            {
+                if (inheritanceFound)
+                {
+                    throw new SourceTransformerException(
+                            "more than one column with "
+                                + TorqueSchemaAttributeName.INHERITANCE
+                                + " set to \"single\" found in table "
+                                + tableElement.getAttribute(
+                                        tableElement.getName()));
+                }
+                SourceElement inheritanceColumnElement
+                        = new RichSourceElementImpl(
+                                TableChildElementName.INHERITANCE_COLUMN);
+                inheritanceColumnElement.addChild(columnElement);
+                tableElement.addChild(inheritanceColumnElement);
+                inheritanceFound = true;
+            }
+        }
+    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,127 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.torque.gf.control.ControllerState;
+import org.apache.torque.gf.source.SourceElement;
+import org.apache.torque.gf.source.transform.SourceTransformer;
+import org.apache.torque.gf.source.transform.SourceTransformerException;
+import org.apache.torque.templates.TemplateOptionName;
+import org.apache.torque.templates.TorqueSchemaElementName;
+
+/**
+ * Performs the transformations which are necessary to apply the templates
+ * to the source tree.
+ * This transformer performs the following actions:
+ * <ul>
+ *   <li>adds attributes to source elements</li>
+ *   <li>links elements to other source elements</li>
+ * </ul>
+ * No elements or attributes are deleted.
+ *
+ * TODO: add links to other transformers which are applied to certain elements
+ *       of the source tree
+ *
+ * $Id: $
+ */
+public class OMTransformer implements SourceTransformer
+{
+    /**
+     * The transformer which adds references to the foreign keys referenced by
+     * this column or referencing this column.
+     *
+     * @see OMForeignKeyColumnTransformer
+     */
+    private static final OMForeignKeyColumnTransformer foreignKeyColumnTransformer
+        = new OMForeignKeyColumnTransformer();
+
+    /**
+     * The transformer which adds references to the referenced and referencing
+     * columns, tables and fields to the foreign key.
+     *
+     * @see OMForeignKeyTransformer
+     */
+    private static final OMForeignKeyTransformer foreignKeyTransformer
+        = new OMForeignKeyTransformer();
+
+    /**
+     * The transformer which adds transforms the table and column elements
+     * of the schema.
+     *
+     * @see OMTableTransformer
+     */
+    private static final OMTableTransformer tableTransformer;
+
+    static
+    {
+        try
+        {
+            tableTransformer = new OMTableTransformer();
+        }
+        catch (SourceTransformerException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Transforms the source tree so it can be used by the om templates.
+     *
+     * @param root the database root element of the source tree, not null.
+     * @param controllerState the controller state, not null.
+     *
+     * @throws SourceTransformerException if the transformation fails.
+     */
+    public SourceElement transform(
+            SourceElement root,
+            ControllerState controllerState)
+        throws SourceTransformerException
+    {
+        TemplateOptionName.checkRequiredOptions(controllerState);
+
+        for (SourceElement tableElement : root.getChildren(
+                TorqueSchemaElementName.TABLE.getName()))
+        {
+            tableTransformer.transform(
+                    tableElement,
+                    controllerState);
+        }
+
+        for (SourceElement tableElement : root.getChildren(
+                TorqueSchemaElementName.TABLE.getName()))
+        {
+            for (SourceElement columnElement : tableElement.getChildren(
+                    TorqueSchemaElementName.COLUMN.getName()))
+            {
+                foreignKeyColumnTransformer.transform(
+                        columnElement,
+                        controllerState);
+            }
+            for (SourceElement foreignKeyElement : tableElement.getChildren(
+                    TorqueSchemaElementName.FOREIGN_KEY.getName()))
+            {
+                foreignKeyTransformer.transform(
+                        foreignKeyElement,
+                        controllerState);
+            }
+        }
+        return root;
+    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ReferenceChildElementName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ReferenceChildElementName.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ReferenceChildElementName.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ReferenceChildElementName.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,70 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.torque.gf.source.SourceElementName;
+
+/**
+ * Contains the child elements for a reference source element which are not
+ * defined in the Torque schema. These elements might be created
+ * in the transformation.
+ */
+public enum ReferenceChildElementName implements SourceElementName
+{
+    /**
+     * The  element containing the local column for the parent reference
+     * element.
+     */
+    LOCAL_COLUMN("local-column"),
+    /**
+     * The  element containing the foreign column for the parent reference
+     * element.
+     */
+    FOREIGN_COLUMN("foreign-column");
+
+    /** The name of the source element, not null. */
+    private String name;
+
+    /**
+     * Constructor.
+     *
+     * @param name the name of the source element, not null.
+     */
+    private ReferenceChildElementName(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * Returns the name of the referenced source element.
+     *
+     * @return the name of the referenced source element.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    @Override
+    public String toString()
+    {
+        return name;
+    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,93 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.torque.gf.source.SourceAttributeName;
+
+/**
+ * Contains the attributes for a table source element which are not
+ * defined in the Torque schema.
+ */
+public enum TableAttributeName implements SourceAttributeName
+{
+    /**
+     * The name of the sequence for the field.
+     */
+    SEQUENCE("sequence"),
+
+    /**
+     * The name of the manager class.
+     */
+    MANAGER_CLASS_NAME("managerClassName"),
+
+    /**
+     * The name of the base manager class.
+     */
+    BASE_MANAGER_CLASS_NAME("baseManagerClassName"),
+
+    /**
+     * The name of the database object class.
+     */
+    DB_OBJECT_CLASS_NAME("dbObjectClassName"),
+
+    /**
+     * The package name of the database object.
+     */
+    DB_OBJECT_PACKAGE("dbObjectPackage"),
+
+    /**
+     * The name of the bean class.
+     */
+    BEAN_CLASS_NAME("beanClassName"),
+
+    /**
+     * The package name of the bean class.
+     */
+    BEAN_PACKAGE("beanPackage");
+
+    /** The name of the source element attribute, not null. */
+    private String name;
+
+    /**
+     * Constructor.
+     *
+     * @param name the name of the source element attribute, not null.
+     */
+    private TableAttributeName(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * Returns the name of the referenced source element attribute.
+     *
+     * @return the name of the referenced source element attribute.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    @Override
+    public String toString()
+    {
+        return name;
+    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,68 @@
+package org.apache.torque.templates.transformer.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.torque.gf.source.SourceElementName;
+
+/**
+ * Contains the child elements for a table source element which are not
+ * defined in the Torque schema. These elements might be created
+ * in tre transformation
+ */
+public enum TableChildElementName implements SourceElementName
+{
+    /**
+     * The element containing the inheritance column.
+     */
+    INHERITANCE_COLUMN("inheritance-column"),
+
+    REFERENCING_FOREIGN_KEYS("referencing-foreign-keys"),
+
+    PRIMARY_KEYS("primary-keys");
+
+    /** The name of the source element, not null. */
+    private String name;
+
+    /**
+     * Constructor.
+     *
+     * @param name the name of the source element, not null.
+     */
+    private TableChildElementName(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * Returns the name of the referenced source element.
+     *
+     * @return the name of the referenced source element.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    @Override
+    public String toString()
+    {
+        return name;
+    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/dbobject/base/BaseDbObjectTableTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/dbobject/base/BaseDbObjectTableTransformer.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/dbobject/base/BaseDbObjectTableTransformer.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/dbobject/base/BaseDbObjectTableTransformer.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,90 @@
+package org.apache.torque.templates.transformer.om.dbobject.base;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.InputStreamReader;
+
+import org.apache.torque.gf.control.ControllerState;
+import org.apache.torque.gf.source.SourceElement;
+import org.apache.torque.gf.source.transform.AttributeTransformer;
+import org.apache.torque.gf.source.transform.SourceTransformerException;
+import org.apache.torque.templates.TemplateOptionName;
+import org.apache.torque.templates.TorqueSchemaAttributeName;
+import org.apache.torque.templates.TorqueSchemaElementName;
+
+public class BaseDbObjectTableTransformer extends AttributeTransformer
+{
+    public BaseDbObjectTableTransformer() throws SourceTransformerException
+    {
+        super(new InputStreamReader(
+                BaseDbObjectTableTransformer.class
+                   .getResourceAsStream(
+                        "BaseDbObjectTableTransformer.properties")));
+    }
+
+
+    public SourceElement transform(
+            SourceElement tableElement,
+            ControllerState controllerState)
+        throws SourceTransformerException
+    {
+        if (!TorqueSchemaElementName.TABLE.getName().equals(
+                tableElement.getName()))
+        {
+            throw new IllegalArgumentException("Illegal element Name "
+                    + tableElement.getName());
+        }
+
+        setBaseClass(tableElement, controllerState);
+        return super.transform(tableElement, controllerState);
+    }
+
+    /**
+     * Sets the base class attribute on the table element if it is not
+     * already set.
+     *
+     * @param tableElement the table attribute to process, not null.
+     * @param controllerState the controller state, not null.
+     */
+    private void setBaseClass(
+            SourceElement tableElement,
+            ControllerState controllerState)
+    {
+        Object baseClass = tableElement.getAttribute(
+                TorqueSchemaAttributeName.BASE_CLASS);
+        if (baseClass == null)
+        {
+            baseClass = tableElement.getParent().getAttribute(
+                    TorqueSchemaAttributeName.BASE_CLASS);
+        }
+        if (baseClass == null)
+        {
+            baseClass = controllerState.getOption(
+                    TemplateOptionName.OM_DB_OBJECT_DEFAULT_BASE_CLASS);
+        }
+        if (baseClass == null)
+        {
+            baseClass = "";
+        }
+        tableElement.setAttribute(
+                TorqueSchemaAttributeName.BASE_CLASS,
+                baseClass);
+    }
+ }

Added: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/dbobject/base/BaseDbObjectTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/dbobject/base/BaseDbObjectTransformer.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/dbobject/base/BaseDbObjectTransformer.java (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/dbobject/base/BaseDbObjectTransformer.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,50 @@
+package org.apache.torque.templates.transformer.om.dbobject.base;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.torque.gf.control.ControllerState;
+import org.apache.torque.gf.source.SourceElement;
+import org.apache.torque.gf.source.SourcePath;
+import org.apache.torque.gf.source.transform.SourceTransformer;
+import org.apache.torque.gf.source.transform.SourceTransformerException;
+import org.apache.torque.templates.TorqueSchemaElementName;
+
+public class BaseDbObjectTransformer implements SourceTransformer
+{
+    public SourceElement transform(
+            SourceElement root,
+            ControllerState controllerState)
+        throws SourceTransformerException
+    {
+        BaseDbObjectTableTransformer tableTransformer
+                = new BaseDbObjectTableTransformer();
+        List<SourceElement> elements
+                = SourcePath.getElements(
+                        root,
+                        TorqueSchemaElementName.TABLE.getName());
+        for (SourceElement tableElement : elements)
+        {
+            tableTransformer.transform(tableElement, controllerState);
+        }
+        return root;
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message