cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r602750 - in /cayenne/main/trunk/framework: cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/ cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/...
Date Sun, 09 Dec 2007 22:59:45 GMT
Author: aadamchik
Date: Sun Dec  9 14:59:44 2007
New Revision: 602750

URL: http://svn.apache.org/viewvc?rev=602750&view=rev
Log:
CAY-926 Refactoring class generator classes
(cleanup)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ArtifactsGenerationMode.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomModeController.java
    cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ArtifactsGenerationMode.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ArtifactsGenerationMode.java?rev=602750&r1=602749&r2=602750&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ArtifactsGenerationMode.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ArtifactsGenerationMode.java
Sun Dec  9 14:59:44 2007
@@ -26,5 +26,16 @@
  */
 public enum ArtifactsGenerationMode {
 
-    datamap, entity
+    // TODO: andrus 12/9/2007 - label names are old... need to call it something else...
+    SINGLE_RUN("datamap"), RUN_PER_ARTIFACT("entity");
+
+    private String label;
+
+    private ArtifactsGenerationMode(String label) {
+        this.label = label;
+    }
+
+    public String getLabel() {
+        return label;
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java?rev=602750&r1=602749&r2=602750&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
Sun Dec  9 14:59:44 2007
@@ -194,7 +194,7 @@
             for (Artifact artifact : artifacts) {
                 execute(artifact);
 
-                if (artifactsGenerationMode == ArtifactsGenerationMode.datamap) {
+                if (artifactsGenerationMode == ArtifactsGenerationMode.SINGLE_RUN) {
                     // TODO: andrus 12/9/2007 - should we run at least once if there are
                     // no artifacts? Current behavior is copied from the legacy code.
                     break;
@@ -536,7 +536,11 @@
         this.embeddableSuperTemplate = embeddableSuperTemplate;
     }
 
-    public void setArtifactsGenerationMode(ArtifactsGenerationMode artifactsGenerationMode)
{
-        this.artifactsGenerationMode = artifactsGenerationMode;
+    public void setArtifactsGenerationMode(String mode) {
+        this.artifactsGenerationMode = ArtifactsGenerationMode.RUN_PER_ARTIFACT
+                .getLabel()
+                .equalsIgnoreCase(mode)
+                ? ArtifactsGenerationMode.RUN_PER_ARTIFACT
+                : ArtifactsGenerationMode.SINGLE_RUN;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java?rev=602750&r1=602749&r2=602750&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java
Sun Dec  9 14:59:44 2007
@@ -130,12 +130,9 @@
     }
 
     @Override
-    public void setArtifactsGenerationMode(ArtifactsGenerationMode artifactsGenerationMode)
{
-        if (artifactsGenerationMode == null) {
-            artifactsGenerationMode = ArtifactsGenerationMode.entity;
-        }
-        generator.setMode(artifactsGenerationMode.name());
-    }
+    public void setArtifactsGenerationMode(String mode) {
+        generator.setMode(mode);
+    };
 
     @Override
     public void setContext(VelocityContext context) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java?rev=602750&r1=602749&r2=602750&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
Sun Dec  9 14:59:44 2007
@@ -26,6 +26,7 @@
 import org.apache.cayenne.gen.ClassGenerator;
 import org.apache.cayenne.gen.ClientClassGenerationAction;
 import org.apache.cayenne.gen.DefaultClassGenerator;
+import org.apache.cayenne.gen.MapClassGenerator;
 import org.apache.cayenne.map.DataMap;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.types.Path;
@@ -67,7 +68,7 @@
 
     public CayenneGeneratorTask() {
         this.makepairs = true;
-        this.mode = ArtifactsGenerationMode.entity.name();
+        this.mode = ArtifactsGenerationMode.RUN_PER_ARTIFACT.getLabel();
         this.outputPattern = "*.java";
         this.usepkgpath = true;
     }
@@ -94,8 +95,7 @@
         action.setDestDir(destDir);
         action.setEncoding(encoding);
         action.setMakePairs(makepairs);
-        action.setArtifactsGenerationMode(ArtifactsGenerationMode.valueOf(mode
-                .toLowerCase()));
+        action.setArtifactsGenerationMode(mode);
         action.setOutputPattern(outputPattern);
         action.setOverwrite(overwrite);
         action.setSuperPkg(superpkg);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomModeController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomModeController.java?rev=602750&r1=602749&r2=602750&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomModeController.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/CustomModeController.java
Sun Dec  9 14:59:44 2007
@@ -31,7 +31,6 @@
 import org.apache.cayenne.gen.ClassGenerationAction;
 import org.apache.cayenne.gen.ClassGenerationAction1_1;
 import org.apache.cayenne.gen.ClassGenerator;
-import org.apache.cayenne.gen.ArtifactsGenerationMode;
 import org.apache.cayenne.modeler.CodeTemplateManager;
 import org.apache.cayenne.modeler.dialog.pref.PreferenceDialog;
 import org.apache.cayenne.modeler.pref.DataMapDefaults;
@@ -224,8 +223,8 @@
         String mode = modesByLabel
                 .get(view.getGenerationMode().getSelectedItem())
                 .toString();
-        generator.setArtifactsGenerationMode(ArtifactsGenerationMode.valueOf(mode));
-        
+        generator.setArtifactsGenerationMode(mode);
+
         String version = getVersion();
 
         String superKey = view.getSuperclassTemplate().getSelectedItem().toString();

Modified: cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java?rev=602750&r1=602749&r2=602750&view=diff
==============================================================================
--- cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
(original)
+++ cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
Sun Dec  9 14:59:44 2007
@@ -293,10 +293,7 @@
 		action.setDestDir(destDir);
 		action.setEncoding(encoding);
 		action.setMakePairs(makePairs);
-		action
-				.setArtifactsGenerationMode(mode != null ? ArtifactsGenerationMode
-						.valueOf(mode.toLowerCase())
-						: ArtifactsGenerationMode.entity);
+		action.setArtifactsGenerationMode(mode);
 		action.setOutputPattern(outputPattern);
 		action.setOverwrite(overwrite);
 		action.setSuperPkg(superPkg);



Mime
View raw message