db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1145732 - in /db/torque/torque4/trunk/torque-templates/src: main/java/org/apache/torque/templates/ main/java/org/apache/torque/templates/transformer/om/ main/java/org/apache/torque/templates/transformer/om/mapInit/ main/resources/org/apach...
Date Tue, 12 Jul 2011 19:26:13 GMT
Author: tfischer
Date: Tue Jul 12 19:26:12 2011
New Revision: 1145732

URL: http://svn.apache.org/viewvc?rev=1145732&view=rev
Log:
Make findbugs happy for generated code: different names for MapInit and BaseMapInit classes

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseAttributeName.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/MapInitDatabaseTransformer.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/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/test/java/org/apache/torque/templates/TestProcessing.java

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java?rev=1145732&r1=1145731&r2=1145732&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java
Tue Jul 12 19:26:12 2011
@@ -68,6 +68,10 @@ public enum TemplateOptionName implement
     /** The suffix of the name of the mapInit class. */
     OM_MAP_INIT_CLASS_NAME_SUFFIX("torque.om.mapInit.mapInitClassNameSuffix"),
 
+    /** The additional prefix of the name of the baseMapInit class. */
+    OM_BASE_MAP_INIT_CLASS_NAME_PREFIX(
+            "torque.om.mapInit.baseMapInitClassNamePrefix"),
+
     /** The prefix of the name of the manager class. */
     OM_MANAGER_CLASS_NAME_PREFIX("torque.om.className.managerClassNamePrefix"),
 

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseAttributeName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseAttributeName.java?rev=1145732&r1=1145731&r2=1145732&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseAttributeName.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/DatabaseAttributeName.java
Tue Jul 12 19:26:12 2011
@@ -28,7 +28,10 @@ import org.apache.torque.generator.sourc
 public enum DatabaseAttributeName implements SourceAttributeName
 {
     /** The name of the mapInit class to generate. */
-    MAP_INIT_CLASS_NAME("mapInitClassName");
+    MAP_INIT_CLASS_NAME("mapInitClassName"),
+
+    /** The name of the mapInit class to generate. */
+    BASE_MAP_INIT_CLASS_NAME("baseMapInitClassName");
 
     /** The name of the source element attribute, not null. */
     private String name;

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/MapInitDatabaseTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/MapInitDatabaseTransformer.java?rev=1145732&r1=1145731&r2=1145732&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/MapInitDatabaseTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/MapInitDatabaseTransformer.java
Tue Jul 12 19:26:12 2011
@@ -85,6 +85,13 @@ public class MapInitDatabaseTransformer 
         databaseElement.setAttribute(
                 DatabaseAttributeName.MAP_INIT_CLASS_NAME,
                 mapInitClassName);
+        String baseMapInitClassName
+            = controllerState.getOption(
+                    TemplateOptionName.OM_BASE_MAP_INIT_CLASS_NAME_PREFIX)
+                + mapInitClassName;
+        databaseElement.setAttribute(
+                DatabaseAttributeName.BASE_MAP_INIT_CLASS_NAME,
+                baseMapInitClassName);
         super.transform(databaseElement, controllerState);
         return databaseElement;
     }

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=1145732&r1=1145731&r2=1145732&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
Tue Jul 12 19:26:12 2011
@@ -455,7 +455,7 @@
         <action
             xsi:type="sourceElementAttributeAction"
             element="."
-            attribute="mapInitClassName"
+            attribute="baseMapInitClassName"
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>

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=1145732&r1=1145731&r2=1145732&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
Tue Jul 12 19:26:12 2011
@@ -79,6 +79,7 @@ torque.om.trackNew = true
 torque.om.generateMapInit = false
 torque.om.mapInit.mapInitClassNamePrefix = 
 torque.om.mapInit.mapInitClassNameSuffix = MapInit
+torque.om.mapInit.baseMapInitClassNamePrefix = Base
 torque.om.mapInit.mapInitPackage = org.apache.torque.linkage
 
 # Settings for foreign key methods

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=1145732&r1=1145731&r2=1145732&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
Tue Jul 12 19:26:12 2011
@@ -37,7 +37,7 @@ import org.apache.torque.TorqueException
  *
  * @see org.apache.torque.map.DatabaseMap#initialize() DatabaseMap.initialize() 
  */
-public class ${mapInitClassName}
+public class ${baseMapInitClassName}
 {
     public static final void init()
         throws TorqueException

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=1145732&r1=1145731&r2=1145732&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
Tue Jul 12 19:26:12 2011
@@ -37,6 +37,6 @@ package ${mapInitPackage};
  * @see org.apache.torque.map.DatabaseMap#initialize() DatabaseMap.initialize() 
  */
 public class ${mapInitClassName}
-		extends ${mapBuilderPackage}.${mapInitClassName}
+		extends ${mapBuilderPackage}.${baseMapInitClassName}
 {
 }

Modified: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java?rev=1145732&r1=1145731&r2=1145732&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
Tue Jul 12 19:26:12 2011
@@ -77,6 +77,7 @@ public class TestProcessing
         Map<String, String> overrideOptions = new HashMap<String, String>();
         overrideOptions.put("torque.database", "mysql");
         overrideOptions.put("torque.om.package", "org.apache.torque.test");
+        overrideOptions.put("torque.om.generateMapInit", "true");
 
         // om templates
         CustomProjectPaths projectPaths



---------------------------------------------------------------------
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