Author: tfischer Date: Sat Aug 18 03:57:20 2012 New Revision: 1374508 URL: http://svn.apache.org/viewvc?rev=1374508&view=rev Log: TORQUE-221 move MapBuilder functionality to generated Peer class
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/columnConstantInit.vm - copied unchanged from r1363742, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/columnConstantInit.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/foreignKeysInit.vm - copied unchanged from r1363742, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/foreignKeysInit.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/initDatabaseMap.vm - copied, changed from r1363742, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/initDatabaseMap.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableConstant.vm - copied, changed from r1363742, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/tableConstant.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableConstantInit.vm - copied unchanged from r1363742, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/tableConstantInit.vm Removed: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/mapBuilder.xml db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/ Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/baseMapInit.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/mapInit.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/columnConstant.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/staticInit.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstants.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.properties db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.properties Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java Sat Aug 18 03:57:20 2012 @@ -92,6 +92,7 @@ public class OMColumnTransformer Set<String> reservedConstantNames = new HashSet<String>(); reservedConstantNames.add("DATABASE"); reservedConstantNames.add("TABLE_NAME"); + reservedConstantNames.add("TABLE"); RESERVED_CONSTANT_NAMES = Collections.unmodifiableSet(reservedConstantNames); } Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java Sat Aug 18 03:57:20 2012 @@ -23,8 +23,8 @@ import static org.apache.torque.template import static org.apache.torque.templates.transformer.om.OMColumnTransformer.CURRENT_TIME; import static org.apache.torque.templates.transformer.om.OMColumnTransformer.CURRENT_TIMESTAMP; import static org.apache.torque.templates.transformer.om.OMColumnTransformer.GET_DEFAULT_DATE_METHOD_NAME; -import static org.apache.torque.templates.transformer.om.OMColumnTransformer.GET_DEFAULT_TIME_METHOD_NAME; import static org.apache.torque.templates.transformer.om.OMColumnTransformer.GET_DEFAULT_TIMESTAMP_METHOD_NAME; +import static org.apache.torque.templates.transformer.om.OMColumnTransformer.GET_DEFAULT_TIME_METHOD_NAME; import java.io.InputStreamReader; import java.util.List; @@ -431,7 +431,7 @@ public class OMTableAndViewTransformer e * * @param tableElement the table element, not null. */ - protected void setPeerImplGetterAttribute(SourceElement tableElement) + public static void setPeerImplGetterAttribute(SourceElement tableElement) { if (tableElement.getAttribute(TableAttributeName.PEER_IMPL_GETTER) != null) Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java (original) +++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java Sat Aug 18 03:57:20 2012 @@ -62,6 +62,7 @@ public class DatabaseMapInitTableTransfo } OMTableAndViewTransformer.setJavaNameAttribute(rootElement); super.transform(rootElement, controllerState); + OMTableAndViewTransformer.setPeerImplGetterAttribute(rootElement); return rootElement; } } Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml Sat Aug 18 03:57:20 2012 @@ -436,60 +436,6 @@ <outlet name="torque.om.basePeerForView.impl"/> </output> - <output name="torque.om.mapBuilder"> - <filenameOutlet - xsi:type="javaOutlet" - class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet"> - <mergepoint name="package"> - <action - xsi:type="sourceElementAttributeAction" - element="." - attribute="mapBuilderPackage" - acceptNotSet="false"/> - </mergepoint> - <mergepoint name="classname"> - <action - xsi:type="sourceElementAttributeAction" - element="." - attribute="mapBuilderClassName" - acceptNotSet="false"/> - </mergepoint> - </filenameOutlet> - <source xsi:type="fileSource" elements="database/all-tables/table"> - <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/> - <include>*schema.xml</include> - <exclude>id-table-schema.xml</exclude> - </source> - <outlet name="torque.om.mapBuilder"/> - </output> - - <output name="torque.om.mapBuilderForView"> - <filenameOutlet - xsi:type="javaOutlet" - class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet"> - <mergepoint name="package"> - <action - xsi:type="sourceElementAttributeAction" - element="." - attribute="mapBuilderPackage" - acceptNotSet="false"/> - </mergepoint> - <mergepoint name="classname"> - <action - xsi:type="sourceElementAttributeAction" - element="." - attribute="mapBuilderClassName" - acceptNotSet="false"/> - </mergepoint> - </filenameOutlet> - <source xsi:type="fileSource" elements="database/all-views/view"> - <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/> - <include>*schema.xml</include> - <exclude>id-table-schema.xml</exclude> - </source> - <outlet name="torque.om.mapBuilder"/> - </output> - <output name="torque.om.recordMapper" existingTargetStrategy="skip" outputDirKey="modifiable"> <filenameOutlet xsi:type="javaOutlet" @@ -801,7 +747,7 @@ <action xsi:type="sourceElementAttributeAction" element="." - attribute="mapBuilderPackage" + attribute="mapInitPackage" acceptNotSet="false"/> </mergepoint> <mergepoint name="classname"> Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties Sat Aug 18 03:57:20 2012 @@ -100,7 +100,7 @@ torque.om.trackSaving = true torque.om.trackLoading = true # If true, a MapInit Class is generated for each database which can be used -# to initialize all database map classes +# to create a complete database map at startup torque.om.generateMapInit = false torque.om.mapInit.databaseMapInitClassNamePrefix = torque.om.mapInit.databaseMapInitClassNameSuffix = DatabaseMapInit @@ -219,9 +219,6 @@ torque.om.className.beanClassNameSuffix # Prefix and suffix for the base bean classes torque.om.className.baseBeanClassNamePrefix = Base torque.om.className.baseBeanClassNameSuffix = Bean -# Prefix and suffix for the map builder classes -torque.om.className.mapBuilderClassNamePrefix = -torque.om.className.mapBuilderClassNameSuffix = MapBuilder # Prefix and suffix for the record mapper classes torque.om.className.recordMapperClassNamePrefix = torque.om.className.recordMapperClassNameSuffix = RecordMapper @@ -251,8 +248,8 @@ torque.om.package.baseManagerPackageSuff torque.om.package.beanPackageSuffix = .bean # package suffix for the base bean classes torque.om.package.baseBeanPackageSuffix = .bean -# package suffix for the map builder classes -torque.om.package.mapPackageSuffix = .map +# package suffix for the map init classes +torque.om.package.mapInitPackageSuffix = # Default column type if the column type is not set for a column torque.om.column.defaultType = VARCHAR Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml Sat Aug 18 03:57:20 2012 @@ -272,6 +272,9 @@ <mergepoint name="tableDatabaseNameConstants"> <action xsi:type="applyAction" outlet="torque.om.peer.base.tableDatabaseNameConstants"/> </mergepoint> + <mergepoint name="tableConstant"> + <action xsi:type="applyAction" outlet="torque.om.peer.base.tableConstant"/> + </mergepoint> <mergepoint name="columnConstants"> <action xsi:type="traverseAllAction" element="column" @@ -365,6 +368,9 @@ <mergepoint name="getTableMap"> <action xsi:type="applyAction" outlet="torque.om.peer.base.getTableMap"/> </mergepoint> + <mergepoint name="initDatabaseMap"> + <action xsi:type="applyAction" outlet="torque.om.peer.base.initDatabaseMap"/> + </mergepoint> <mergepoint name="extensions" /> </outlet> @@ -386,6 +392,9 @@ <mergepoint name="tableDatabaseNameConstants"> <action xsi:type="applyAction" outlet="torque.om.peer.base.tableDatabaseNameConstants"/> </mergepoint> + <mergepoint name="tableConstant"> + <action xsi:type="applyAction" outlet="torque.om.peer.base.tableConstant"/> + </mergepoint> <mergepoint name="columnConstants"> <action xsi:type="traverseAllAction" element="column" @@ -442,6 +451,9 @@ <mergepoint name="getTableMap"> <action xsi:type="applyAction" outlet="torque.om.peer.base.getTableMap"/> </mergepoint> + <mergepoint name="initDatabaseMap"> + <action xsi:type="applyAction" outlet="torque.om.peer.base.initDatabaseMap"/> + </mergepoint> <mergepoint name="extensions" /> </outlet> @@ -465,6 +477,11 @@ path="peer/base/tableDatabaseNameConstants.vm"> </outlet> + <outlet name="torque.om.peer.base.tableConstant" + xsi:type="velocityOutlet" + path="peer/base/tableConstant.vm"> + </outlet> + <outlet name="torque.om.peer.base.columnConstant" xsi:type="velocityOutlet" path="peer/base/columnConstant.vm"> @@ -486,8 +503,33 @@ <mergepoint name="tableDatabaseNameConstantsInit"> <action xsi:type="applyAction" outlet="torque.om.peer.base.tableDatabaseNameConstantsInit"/> </mergepoint> + <mergepoint name="tableConstantInit"> + <action xsi:type="applyAction" outlet="torque.om.peer.base.tableConstantInit"/> + </mergepoint> + <mergepoint name="columnConstantsInit"> + <action xsi:type="traverseAllAction" element="column" + outlet="torque.om.peer.base.columnConstantInit"/> + </mergepoint> + <mergepoint name="foreignKeysInit"> + <action xsi:type="applyAction" outlet="torque.om.peer.base.foreignKeysInit"/> + </mergepoint> </outlet> + <outlet name="torque.om.peer.base.tableConstantInit" + xsi:type="velocityOutlet" + path="peer/base/tableConstantInit.vm"> + </outlet> + + <outlet name="torque.om.peer.base.columnConstantInit" + xsi:type="velocityOutlet" + path="peer/base/columnConstantInit.vm"> + </outlet> + + <outlet name="torque.om.peer.base.foreignKeysInit" + xsi:type="velocityOutlet" + path="peer/base/foreignKeysInit.vm"> + </outlet> + <outlet name="torque.om.peer.base.peerImplCreator" xsi:type="velocityOutlet" path="peer/base/peerImplCreator.vm"> @@ -613,4 +655,9 @@ path="peer/base/getTableMap.vm"> </outlet> + <outlet name="torque.om.peer.base.initDatabaseMap" + xsi:type="velocityOutlet" + path="peer/base/initDatabaseMap.vm"> + </outlet> + </outlets> \ No newline at end of file Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/baseMapInit.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/baseMapInit.vm?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/baseMapInit.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/baseMapInit.vm Sat Aug 18 03:57:20 2012 @@ -24,7 +24,7 @@ ## This template expects the current source element to be a "database" element ## from the torque schema. ## -package ${mapBuilderPackage}; +package ${mapInitPackage}; /** * This is a Torque Generated class that is used to load all database map @@ -41,8 +41,9 @@ public class ${baseDatabaseMapInitClassN #set ( $databaseSetElement = $torqueGen.getSourceElement() ) #set ( $tableElements = $databaseSetElement.getChildren("table") ) #foreach ( $tableElement in $tableElements ) - #set ( $mapBuilderClassName = $tableElement.getAttribute("mapBuilderClassName") ) - ${mapBuilderClassName}.getTableMap(); + #set ( $peerClassName = $tableElement.getAttribute("peerClassName") ) + #set ( $peerImplGetter = $tableElement.getAttribute("peerImplGetter") ) + ${peerClassName}.${peerImplGetter}(); #end } } Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/mapInit.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/mapInit.vm?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/mapInit.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapInit/mapInit.vm Sat Aug 18 03:57:20 2012 @@ -37,6 +37,6 @@ package ${databaseMapInitPackage}; * @see org.apache.torque.map.DatabaseMap#initialize() DatabaseMap.initialize() */ public class ${databaseMapInitClassName} - extends ${mapBuilderPackage}.${baseDatabaseMapInitClassName} + extends ${mapInitPackage}.${baseDatabaseMapInitClassName} { } Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm Sat Aug 18 03:57:20 2012 @@ -40,6 +40,8 @@ public abstract class $basePeerClassName $torqueGen.mergepoint("log") $torqueGen.mergepoint("serialVersionUid") $torqueGen.mergepoint("tableDatabaseNameConstants") +$torqueGen.mergepoint("tableConstant") +$torqueGen.mergepoint("tableMapConstant") $torqueGen.mergepoint("columnConstants") $torqueGen.mergepoint("numColumnConstant") $torqueGen.mergepoint("inheritanceClasskeyConstants") @@ -76,5 +78,6 @@ $torqueGen.mergepoint("fillerChunkSizeGe #end #end $torqueGen.mergepoint("getTableMap") +$torqueGen.mergepoint("initDatabaseMap") $torqueGen.mergepoint("extensions") } Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeerForView.vm Sat Aug 18 03:57:20 2012 @@ -40,6 +40,8 @@ public abstract class $basePeerClassName $torqueGen.mergepoint("log") $torqueGen.mergepoint("serialVersionUid") $torqueGen.mergepoint("tableDatabaseNameConstants") +$torqueGen.mergepoint("tableConstant") +$torqueGen.mergepoint("tableMapConstant") $torqueGen.mergepoint("columnConstants") $torqueGen.mergepoint("numColumnConstant") $torqueGen.mergepoint("inheritanceClasskeyConstants") @@ -59,5 +61,6 @@ $torqueGen.mergepoint("buildColumnValues $torqueGen.mergepoint("retrieveByPK") $torqueGen.mergepoint("retrieveByPKs") $torqueGen.mergepoint("getTableMap") +$torqueGen.mergepoint("initDatabaseMap") $torqueGen.mergepoint("extensions") } Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/columnConstant.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/columnConstant.vm?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/columnConstant.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/columnConstant.vm Sat Aug 18 03:57:20 2012 @@ -27,8 +27,5 @@ ## The options and the attributes of the current source element must be set ## as velocity variables. ## -#set ( $tableElement = $torqueGen.getParent() ) -#set ( $mapBuilderClassName = $tableElement.getAttribute("mapBuilderClassName") ) /** The column for the ${name} field */ - public static final Column ${peerColumnName} - = ${mapBuilderClassName}.${peerColumnName}; + public static final ColumnMap ${peerColumnName}; Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm Sat Aug 18 03:57:20 2012 @@ -46,8 +46,13 @@ import org.apache.torque.Column; import org.apache.torque.Torque; import org.apache.torque.TorqueException; import org.apache.torque.TorqueRuntimeException; +import org.apache.torque.adapter.IDMethod; import $torqueGen.option("torque.om.criteriaClass"); +import org.apache.torque.map.DatabaseMap; import org.apache.torque.map.TableMap; +import org.apache.torque.map.ColumnMap; +import org.apache.torque.map.ForeignKeyMap; +import org.apache.torque.map.InheritanceMap; import org.apache.torque.om.mapper.RecordMapper; import org.apache.torque.om.mapper.CompositeMapper; import org.apache.torque.om.DateKey; @@ -60,7 +65,6 @@ import org.apache.torque.util.Transactio import org.apache.torque.util.ColumnValues; import org.apache.torque.util.JdbcTypedValue; -import ${mapBuilderPackage}.*; #if ($basePeerPackage != $dbObjectPackage) import ${dbObjectPackage}.*; #end \ No newline at end of file Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/initDatabaseMap.vm (from r1363742, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/initDatabaseMap.vm) URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/initDatabaseMap.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/initDatabaseMap.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/initDatabaseMap.vm&r1=1363742&r2=1374508&rev=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/initDatabaseMap.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/initDatabaseMap.vm Sat Aug 18 03:57:20 2012 @@ -19,7 +19,7 @@ ## ## version $Id$ ## -## Creates the initDatabaseMap method for a map builder object. +## Creates the initDatabaseMap method for a base peer object. ## ## This template expects the current source element to be a "table" element ## from the torque schema. Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/staticInit.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/staticInit.vm?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/staticInit.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/staticInit.vm Sat Aug 18 03:57:20 2012 @@ -27,7 +27,18 @@ ## The options and the attributes of the current source element must be set ## as velocity variables. ## +#set ( $databaseElement = $torqueGen.getParent() ) +#set ( $databaseName = $databaseElement.getAttribute("name") ) static { + DatabaseMap dbMap = Torque.getDatabaseMap("$databaseName"); + if (dbMap.getTable("$name") == null) + { + dbMap.addTable("$name"); + } $torqueGen.mergepoint("tableDatabaseNameConstantsInit") +$torqueGen.mergepoint("tableConstantInit") +$torqueGen.mergepoint("columnConstantsInit") +$torqueGen.mergepoint("foreignKeysInit") + initDatabaseMap(); } Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableConstant.vm (from r1363742, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/tableConstant.vm) URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableConstant.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableConstant.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/tableConstant.vm&r1=1363742&r2=1374508&rev=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/tableConstant.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableConstant.vm Sat Aug 18 03:57:20 2012 @@ -22,5 +22,5 @@ ## Generates the constants for the table map in the map builder class ## This template expects no input. ## - /** the table map for this class */ + /** The table map for this class. */ public static final TableMap TABLE; \ No newline at end of file Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstants.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstants.vm?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstants.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/tableDatabaseNameConstants.vm Sat Aug 18 03:57:20 2012 @@ -23,8 +23,8 @@ ## base peer class ## This template expects no input. ## - /** the default database name for this class */ + /** The default database name for this class. */ public static final String DATABASE_NAME; - /** the table name for this class */ - public static final String TABLE_NAME; \ No newline at end of file + /** The table name for this class. */ + public static final String TABLE_NAME; Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm Sat Aug 18 03:57:20 2012 @@ -75,10 +75,12 @@ import org.apache.torque.util.Transactio import org.apache.torque.util.ColumnValues; import org.apache.torque.util.JdbcTypedValue; -import ${mapBuilderPackage}.*; #if ($basePeerPackage != $dbObjectPackage) import ${dbObjectPackage}.*; #end #if ($basePeerPackage != $recordMapperPackage) import ${recordMapperPackage}.*; +#end +#if ($basePeerPackage != $peerPackage) +import ${peerPackage}.${peerClassName} #end \ No newline at end of file Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.properties URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.properties?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.properties (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.properties Sat Aug 18 03:57:20 2012 @@ -15,5 +15,6 @@ # specific language governing permissions and limitations # under the License. -${attribute(noOverride):mapBuilderClassName}=${option:torque.om.className.mapBuilderClassNamePrefix}${attribute:javaName}${option:torque.om.className.mapBuilderClassNameSuffix} -${attribute(noOverride):mapBuilderPackage}=${option:torque.om.package.package}${option:torque.om.package.mapPackageSuffix} +${attribute(noOverride):mapInitPackage}=${option:torque.om.package.package}${option:torque.om.package.mapInitPackageSuffix} +${attribute(noOverride):peerClassName}=${option:torque.om.className.peerClassNamePrefix}${attribute:javaName}${option:torque.om.className.peerClassNameSuffix} +${attribute(noOverride):peerImplClassName}=${option:torque.om.className.peerImplClassNamePrefix}${attribute:javaName}${option:torque.om.className.peerImplClassNameSuffix} Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.properties URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.properties?rev=1374508&r1=1374507&r2=1374508&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.properties (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.properties Sat Aug 18 03:57:20 2012 @@ -15,4 +15,4 @@ # specific language governing permissions and limitations # under the License. -${attribute(noOverride):mapBuilderPackage}=${option:torque.om.package.package}${option:torque.om.package.mapPackageSuffix} +${attribute(noOverride):mapInitPackage}=${option:torque.om.package.package}${option:torque.om.package.mapInitPackageSuffix} --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org