Class OMForeignKeyTransformer
java.lang.Object
org.apache.torque.templates.transformer.om.OMForeignKeyTransformer
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateLocalElementForReference(SourceElement localTable, SourceElement reference) Creates the child element "local-column" for the reference element and adds the local column as a child of it.voidtransform(SourceElement foreignKey, ControllerState controllerState) voidtransformSecondPass(SourceElement foreignKey, ControllerState controllerState) Second pass of the transformation.
-
Constructor Details
-
OMForeignKeyTransformer
public OMForeignKeyTransformer()
-
-
Method Details
-
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.
-