Package org.apache.torque.templates.transformer.om

## Class OMForeignKeyTransformer

- java.lang.Object
- - org.apache.torque.templates.transformer.om.OMForeignKeyTransformer

-     public class OMForeignKeyTransformer
      extends Object

  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.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OMForeignKeyTransformer()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `createLocalElementForReference​(SourceElement localTable, SourceElement reference)` | Creates the child element "local-column" for the reference element and adds the local column as a child of it.
    `void` | `transform​(SourceElement foreignKey, ControllerState controllerState)` |
    `void` | `transformSecondPass​(SourceElement foreignKey, ControllerState controllerState)` | Second pass of the transformation.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OMForeignKeyTransformer

          public OMForeignKeyTransformer()

  - ### Method Detail

    - #### transform

          public void transform​(SourceElement foreignKey,
                                ControllerState controllerState)
                         throws SourceTransformerException

      Throws:
        `SourceTransformerException`

    - #### transformSecondPass

          public void transformSecondPass​(SourceElement foreignKey,
                                          ControllerState controllerState)
                                   throws SourceTransformerException

      Second pass of the transformation. Performs all steps which require that the first pass is complete.
      Parameters:
        `foreignKey` - the element to transform, not null.
        `controllerState` - the controller state, not null.
      Throws:
        `SourceTransformerException` - if the transformation fails

    - #### createLocalElementForReference

          protected void createLocalElementForReference​(SourceElement localTable,
                                                        SourceElement reference)
                                                 throws SourceTransformerException

      Creates the child element "local-column" for the reference element and adds the local column as a child of it.
      Parameters:
        `localTable` - the local table element.
        `reference` - the referenced element to enrich.
      Throws:
        `SourceTransformerException` - if the referenced column cannot be found.