You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2010/10/12 20:50:50 UTC

svn commit: r1021885 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-tools/src/main/java/org/apache/cayenne/gen/ framework/maven-cayenne-plugin/ framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/

Author: aadamchik
Date: Tue Oct 12 18:50:49 2010
New Revision: 1021885

URL: http://svn.apache.org/viewvc?rev=1021885&view=rev
Log:
CAY-1490 Maven cgen: all and datamap modes can not be activated

patch by Andrei Veprev
adding TODO comments pointing to API weirdness

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
    cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml
    cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=1021885&r1=1021884&r2=1021885&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Tue Oct 12 18:50:49 2010
@@ -72,6 +72,7 @@ Bug Fixes Since 3.0.1:
 CAY-1485 Memory information for about dialog
 CAY-1488 OutOfMemory when selecting "Remove Foreign Keys Mapped as Object Attributes"
 CAY-1484 Flattened attribute queries are incorrectly generated
+CAY-1490 Maven cgen: all and datamap modes can not be activated
 
 ----------------------------------
 Release: 3.0.1

Modified: cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java?rev=1021885&r1=1021884&r2=1021885&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java Tue Oct 12 18:50:49 2010
@@ -541,8 +541,11 @@ public class ClassGenerationAction {
     }
 
     public void addQueries(Collection<Query> queries) {
-        if (artifactsGenerationMode == ArtifactsGenerationMode.DATAMAP || 
-                artifactsGenerationMode == ArtifactsGenerationMode.ALL ) {
+        if (artifactsGenerationMode == ArtifactsGenerationMode.DATAMAP
+                || artifactsGenerationMode == ArtifactsGenerationMode.ALL) {
+
+            // TODO: andrus 10.12.2010 - why not also check for empty query list?? Or
+            // create a better API for enabling DataMapArtifact
             if (queries != null) {
                 artifacts.add(new DataMapArtifact(dataMap, queries));
             }
@@ -574,17 +577,14 @@ public class ClassGenerationAction {
     }
 
     public void setArtifactsGenerationMode(String mode) {
-        if (ArtifactsGenerationMode.ENTITY.getLabel()
-                .equalsIgnoreCase(mode)){
-        this.artifactsGenerationMode = ArtifactsGenerationMode.ENTITY;
-        } else {
-            if (ArtifactsGenerationMode.DATAMAP.getLabel()
-                .equalsIgnoreCase(mode)){
-                this.artifactsGenerationMode = ArtifactsGenerationMode.DATAMAP;
-            } else {
-                this.artifactsGenerationMode = ArtifactsGenerationMode.ALL;
-            }
+        if (ArtifactsGenerationMode.ENTITY.getLabel().equalsIgnoreCase(mode)) {
+            this.artifactsGenerationMode = ArtifactsGenerationMode.ENTITY;
+        }
+        else if (ArtifactsGenerationMode.DATAMAP.getLabel().equalsIgnoreCase(mode)) {
+            this.artifactsGenerationMode = ArtifactsGenerationMode.DATAMAP;
+        }
+        else {
+            this.artifactsGenerationMode = ArtifactsGenerationMode.ALL;
         }
-                
     }
 }

Modified: cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml?rev=1021885&r1=1021884&r2=1021885&view=diff
==============================================================================
--- cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml (original)
+++ cayenne/main/trunk/framework/maven-cayenne-plugin/pom.xml Tue Oct 12 18:50:49 2010
@@ -77,6 +77,12 @@
 		</dependency>
 
         <dependency>
+            <groupId>org.apache.cayenne.unpublished</groupId>
+            <artifactId>cayenne-project-unpublished</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
 			<groupId>org.apache.cayenne</groupId>
 			<artifactId>cayenne-tools</artifactId>
 			<version>${version}</version>

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=1021885&r1=1021884&r2=1021885&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 Tue Oct 12 18:50:49 2010
@@ -228,6 +228,7 @@ public class CayenneGeneratorMojo extend
 			generator.addEntities(filterAction.getFilteredEntities(dataMap));
 			generator.addEmbeddables(filterAction
 					.getFilteredEmbeddables(dataMap));
+			generator.addQueries(dataMap.getQueries());
 			generator.execute();
 		} catch (Exception e) {
 			throw new MojoExecutionException("Error generating classes: ", e);