cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: CAY-2235 Deprecate Query.getDataMap() method
Date Thu, 16 Feb 2017 07:59:56 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master daee122c5 -> 51a3399d4


CAY-2235 Deprecate Query.getDataMap() method


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/51a3399d
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/51a3399d
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/51a3399d

Branch: refs/heads/master
Commit: 51a3399d42f8325bc8baa3138923e39879201c47
Parents: daee122
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Thu Feb 16 10:58:47 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Thu Feb 16 10:58:47 2017 +0300

----------------------------------------------------------------------
 .../cayenne/lifecycle/id/StringIdQuery.java     |  5 ++
 .../DefaultConfigurationNodeParentGetter.java   |  6 ++
 .../apache/cayenne/access/DataDomainQuery.java  |  1 +
 .../access/ObjectsFromDataRowsQuery.java        |  2 +
 .../org/apache/cayenne/map/QueryDescriptor.java |  3 +-
 .../org/apache/cayenne/query/AbstractQuery.java |  6 ++
 .../org/apache/cayenne/query/BatchQuery.java    |  4 +
 .../org/apache/cayenne/query/EJBQLQuery.java    |  5 ++
 .../org/apache/cayenne/query/IndirectQuery.java |  3 +
 .../java/org/apache/cayenne/query/Query.java    |  3 +
 .../org/apache/cayenne/query/QueryChain.java    |  7 ++
 .../org/apache/cayenne/query/RefreshQuery.java  |  3 +
 .../apache/cayenne/remote/IncrementalQuery.java |  3 +
 .../cayenne/remote/IncrementalSelectQuery.java  |  2 +
 .../org/apache/cayenne/remote/RangeQuery.java   |  2 +
 .../org/apache/cayenne/query/MockQuery.java     | 23 +----
 docs/doc/src/main/resources/RELEASE-NOTES.txt   |  1 +
 .../cayenne/modeler/action/CopyAction.java      |  3 +-
 .../cayenne/modeler/action/RemoveAction.java    | 91 +++++---------------
 19 files changed, 83 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/StringIdQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/StringIdQuery.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/StringIdQuery.java
index a5a37e4..2b28f44 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/StringIdQuery.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/StringIdQuery.java
@@ -68,7 +68,9 @@ public class StringIdQuery implements Query {
         return Arrays.asList(stringIds);
     }
 
+    @Deprecated
     protected String name;
+    @Deprecated
     protected DataMap dataMap;
     protected Collection<String> stringIds;
 
@@ -252,6 +254,7 @@ public class StringIdQuery implements Query {
                 "This query was supposed to be replace with a set of SelectQueries during
the route phase");
     }
 
+    @Deprecated
     public String getName() {
         return name;
     }
@@ -260,10 +263,12 @@ public class StringIdQuery implements Query {
         this.name = name;
     }
 
+    @Deprecated
     public DataMap getDataMap() {
         return dataMap;
     }
 
+    @Deprecated
     public void setDataMap(DataMap dataMap) {
         this.dataMap = dataMap;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-project/src/main/java/org/apache/cayenne/project/DefaultConfigurationNodeParentGetter.java
----------------------------------------------------------------------
diff --git a/cayenne-project/src/main/java/org/apache/cayenne/project/DefaultConfigurationNodeParentGetter.java
b/cayenne-project/src/main/java/org/apache/cayenne/project/DefaultConfigurationNodeParentGetter.java
index 669d80b..3458c73 100644
--- a/cayenne-project/src/main/java/org/apache/cayenne/project/DefaultConfigurationNodeParentGetter.java
+++ b/cayenne-project/src/main/java/org/apache/cayenne/project/DefaultConfigurationNodeParentGetter.java
@@ -33,6 +33,7 @@ import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.map.ProcedureParameter;
+import org.apache.cayenne.map.QueryDescriptor;
 
 public class DefaultConfigurationNodeParentGetter implements ConfigurationNodeParentGetter
{
 
@@ -107,5 +108,10 @@ public class DefaultConfigurationNodeParentGetter implements ConfigurationNodePa
         public ConfigurationNode visitProcedureParameter(ProcedureParameter parameter) {
             return (ConfigurationNode) parameter.getParent();
         }
+
+        @Override
+        public ConfigurationNode visitQuery(QueryDescriptor query) {
+            return query.getDataMap();
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainQuery.java b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainQuery.java
index 5077359..0488065 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataDomainQuery.java
@@ -107,6 +107,7 @@ class DataDomainQuery implements Query, QueryMetadata {
         return null;
     }
 
+    @Deprecated
     public DataMap getDataMap() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/access/ObjectsFromDataRowsQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/ObjectsFromDataRowsQuery.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/ObjectsFromDataRowsQuery.java
index 40277bd..ee23454 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/ObjectsFromDataRowsQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/ObjectsFromDataRowsQuery.java
@@ -68,10 +68,12 @@ class ObjectsFromDataRowsQuery implements Query, QueryMetadata {
         return null;
     }
 
+    @Deprecated
     public String getName() {
         return null;
     }
 
+    @Deprecated
     public DataMap getDataMap() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/map/QueryDescriptor.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/map/QueryDescriptor.java b/cayenne-server/src/main/java/org/apache/cayenne/map/QueryDescriptor.java
index 378eb5f..fe18894 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/map/QueryDescriptor.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/map/QueryDescriptor.java
@@ -83,8 +83,7 @@ public class QueryDescriptor implements Serializable, ConfigurationNode,
XMLSeri
             case PROCEDURE_QUERY:
                 return procedureQueryDescriptor();
             default:
-                QueryDescriptor descriptor = new QueryDescriptor(type);
-                return descriptor;
+                return new QueryDescriptor(type);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/query/AbstractQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/AbstractQuery.java b/cayenne-server/src/main/java/org/apache/cayenne/query/AbstractQuery.java
index 7cab054..3b1dc21 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/AbstractQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/AbstractQuery.java
@@ -37,12 +37,16 @@ public abstract class AbstractQuery extends CacheableQuery {
      * DbEntity, depending on the specific query and how it was constructed.
      */
     protected Object root;
+
+    @Deprecated
     protected String name;
+    @Deprecated
     protected DataMap dataMap;
 
     /**
      * @since 3.1
      */
+    @Deprecated
     public DataMap getDataMap() {
         return dataMap;
     }
@@ -50,6 +54,7 @@ public abstract class AbstractQuery extends CacheableQuery {
     /**
      * @since 3.1
      */
+    @Deprecated
     public void setDataMap(DataMap dataMap) {
         this.dataMap = dataMap;
     }
@@ -69,6 +74,7 @@ public abstract class AbstractQuery extends CacheableQuery {
      * 
      * @since 1.1
      */
+    @Deprecated
     public void setName(String name) {
         this.name = name;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/query/BatchQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/BatchQuery.java b/cayenne-server/src/main/java/org/apache/cayenne/query/BatchQuery.java
index 7042039..de191a7 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/BatchQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/BatchQuery.java
@@ -41,11 +41,13 @@ public abstract class BatchQuery implements Query {
      */
     protected DbEntity dbEntity;
 
+    @Deprecated
     protected String name;
 
     /**
      * @since 3.1
      */
+    @Deprecated
     protected DataMap dataMap;
 
     /**
@@ -85,6 +87,7 @@ public abstract class BatchQuery implements Query {
      * @since 3.1
      */
     @Override
+    @Deprecated
     public DataMap getDataMap() {
         return dataMap;
     }
@@ -92,6 +95,7 @@ public abstract class BatchQuery implements Query {
     /**
      * @since 3.1
      */
+    @Deprecated
     public void setDataMap(DataMap dataMap) {
         this.dataMap = dataMap;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/query/EJBQLQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/EJBQLQuery.java b/cayenne-server/src/main/java/org/apache/cayenne/query/EJBQLQuery.java
index e778096..14c09c0 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/EJBQLQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/EJBQLQuery.java
@@ -38,7 +38,9 @@ import java.util.Map;
  */
 public class EJBQLQuery extends CacheableQuery implements XMLSerializable {
 
+    @Deprecated
     protected String name;
+    @Deprecated
     protected DataMap dataMap;
     protected String ejbqlStatement;
     
@@ -58,6 +60,7 @@ public class EJBQLQuery extends CacheableQuery implements XMLSerializable
{
     /**
      * @since 3.1
      */
+    @Deprecated
     public DataMap getDataMap() {
         return dataMap;
     }
@@ -66,6 +69,7 @@ public class EJBQLQuery extends CacheableQuery implements XMLSerializable
{
     /**
      * @since 3.1
      */
+    @Deprecated
     public void setDataMap(DataMap dataMap) {
         this.dataMap = dataMap;
     }
@@ -138,6 +142,7 @@ public class EJBQLQuery extends CacheableQuery implements XMLSerializable
{
         return name;
     }
 
+    @Deprecated
     public void setName(String name) {
         this.name = name;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/query/IndirectQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/IndirectQuery.java b/cayenne-server/src/main/java/org/apache/cayenne/query/IndirectQuery.java
index fa7a305..c916972 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/IndirectQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/IndirectQuery.java
@@ -47,6 +47,7 @@ public abstract class IndirectQuery implements Query {
 	 * @since 3.1
 	 */
 	@Override
+	@Deprecated
 	public DataMap getDataMap() {
 		return dataMap;
 	}
@@ -54,6 +55,7 @@ public abstract class IndirectQuery implements Query {
 	/**
 	 * @since 3.1
 	 */
+	@Deprecated
 	public void setDataMap(DataMap dataMap) {
 		this.dataMap = dataMap;
 	}
@@ -72,6 +74,7 @@ public abstract class IndirectQuery implements Query {
 		return name;
 	}
 
+	@Deprecated
 	public void setName(String name) {
 		this.name = name;
 	}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/query/Query.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/Query.java b/cayenne-server/src/main/java/org/apache/cayenne/query/Query.java
index 0dbfc92..d0790b9 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/Query.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/Query.java
@@ -70,10 +70,13 @@ public interface Query extends Serializable {
      * @since 1.1
      * @deprecated {@link QueryDescriptor#getName()} should be used instead
      */
+    @Deprecated
     String getName();
 
     /**
      * @since 3.1
+     * @deprecated since 4.0, {@link QueryDescriptor#getDataMap()} should be used instead
      */
+    @Deprecated
     DataMap getDataMap();
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/query/QueryChain.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/QueryChain.java b/cayenne-server/src/main/java/org/apache/cayenne/query/QueryChain.java
index f6082ec..272c681 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/QueryChain.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/QueryChain.java
@@ -37,11 +37,14 @@ import java.util.Collection;
 public class QueryChain implements Query {
 
     protected Collection<Query> chain;
+
+    @Deprecated
     protected String name;
 
     /**
      * @since 3.1
      */
+    @Deprecated
     protected DataMap dataMap;
 
     /**
@@ -112,10 +115,12 @@ public class QueryChain implements Query {
                 + "and should've been split into separate queries during routing phase.");
     }
 
+    @Deprecated
     public String getName() {
         return name;
     }
 
+    @Deprecated
     public void setName(String name) {
         this.name = name;
     }
@@ -123,6 +128,7 @@ public class QueryChain implements Query {
     /**
      * @since 3.1
      */
+    @Deprecated
     public DataMap getDataMap() {
         return dataMap;
     }
@@ -130,6 +136,7 @@ public class QueryChain implements Query {
     /**
      * @since 3.1
      */
+    @Deprecated
     public void setDataMap(DataMap dataMap) {
         this.dataMap = dataMap;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/query/RefreshQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/RefreshQuery.java b/cayenne-server/src/main/java/org/apache/cayenne/query/RefreshQuery.java
index c2935ae..c31ce92 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/RefreshQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/RefreshQuery.java
@@ -135,6 +135,7 @@ public class RefreshQuery implements Query {
                 return wrappedMd;
             }
 
+            @Deprecated
             public String getName() {
                 return query.getName();
             }
@@ -146,12 +147,14 @@ public class RefreshQuery implements Query {
                 query.route(router, resolver, this);
             }
 
+            @Deprecated
             public DataMap getDataMap() {
                 return query.getDataMap();
             }
         };
     }
 
+    @Deprecated
     public DataMap getDataMap() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
b/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
index 4ff953c..9541a42 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalQuery.java
@@ -71,13 +71,16 @@ class IncrementalQuery implements Query {
         return query.createSQLAction(visitor);
     }
 
+    @Deprecated
     public String getName() {
         return query.getName();
     }
 
     /**
      * @since 3.1
+     * @deprecated since 4.0
      */
+    @Deprecated
     public DataMap getDataMap() {
         return query.getDataMap();
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
b/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
index 135bbcb..d869d4c 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/remote/IncrementalSelectQuery.java
@@ -159,6 +159,7 @@ class IncrementalSelectQuery<T> extends SelectQuery<T> {
 	}
 
 	@Override
+	@Deprecated
 	public String getName() {
 		return query.getName();
 	}
@@ -272,6 +273,7 @@ class IncrementalSelectQuery<T> extends SelectQuery<T> {
 	}
 
 	@Override
+	@Deprecated
 	public void setName(String name) {
 		query.setName(name);
 	}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/main/java/org/apache/cayenne/remote/RangeQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/remote/RangeQuery.java b/cayenne-server/src/main/java/org/apache/cayenne/remote/RangeQuery.java
index 5c7467e..970b5a7 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/remote/RangeQuery.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/remote/RangeQuery.java
@@ -159,6 +159,7 @@ class RangeQuery implements Query {
         throw new UnsupportedOperationException();
     }
 
+    @Deprecated
     public String getName() {
         throw new UnsupportedOperationException();
     }
@@ -170,6 +171,7 @@ class RangeQuery implements Query {
     /**
      * @since 3.1
      */
+    @Deprecated
     public DataMap getDataMap() {
         throw new UnsupportedOperationException();
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/cayenne-server/src/test/java/org/apache/cayenne/query/MockQuery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/MockQuery.java b/cayenne-server/src/test/java/org/apache/cayenne/query/MockQuery.java
index 1526b13..ba3276b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/MockQuery.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/MockQuery.java
@@ -19,14 +19,11 @@
 
 package org.apache.cayenne.query;
 
-import org.apache.cayenne.configuration.ConfigurationNodeVisitor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.EntityResolver;
 
 public class MockQuery implements Query {
 
-    protected String name;
-    protected DataMap dataMap;
     protected boolean selecting;
     protected boolean routeCalled;
 
@@ -37,18 +34,9 @@ public class MockQuery implements Query {
     public MockQuery() {
     }
 
-    
+    @Deprecated
     public DataMap getDataMap() {
-        return dataMap;
-    }
-
-    
-    public void setDataMap(DataMap dataMap) {
-        this.dataMap = dataMap;
-    }
-
-    public MockQuery(String name) {
-        this.name = name;
+        return null;
     }
 
     public QueryMetadata getMetaData(EntityResolver resolver) {
@@ -63,12 +51,9 @@ public class MockQuery implements Query {
         return selecting;
     }
 
+    @Deprecated
     public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
+        return null;
     }
 
     public SQLAction createSQLAction(SQLActionVisitor visitor) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index 86cc57c..56984e8 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -31,6 +31,7 @@ CAY-2212 cdbimport cleanup and configuration schema refactoring
 CAY-2223 JCacheQueryCache - a query cache provider to plug in JCache implementers
 CAY-2225 Extensible CacheInvalidationFilter logic
 CAY-2228 Deprecate multiple cache groups in caching and query API
+CAY-2235 Deprecate Query.getDataMap() method
 
 Bug Fixes:
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java
index ce9a82f..f5c8301 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java
@@ -37,6 +37,7 @@ import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.map.ProcedureParameter;
+import org.apache.cayenne.map.QueryDescriptor;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.editor.ObjCallbackMethod;
@@ -123,7 +124,7 @@ public class CopyAction extends CayenneAction {
         }
 
         if (object instanceof DataMap
-                || object instanceof Query
+                || object instanceof QueryDescriptor
                 || object instanceof DbEntity
                 || object instanceof ObjEntity
                 || object instanceof Embeddable

http://git-wip-us.apache.org/repos/asf/cayenne/blob/51a3399d/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java
index 8dcf52f..db1fee6 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java
@@ -577,43 +577,17 @@ public class RemoveAction extends CayenneAction {
      */
     @Override
     public boolean enableForPath(ConfigurationNode object) {
-        if (object == null) {
-            return false;
-        }
-
-        if (object instanceof DataChannelDescriptor) {
-            return true;
-        }
-        else if (object instanceof DataMap) {
-            return true;
-        }
-        else if (object instanceof DataNodeDescriptor) {
-            return true;
-        }
-        else if (object instanceof Entity) {
-            return true;
-        }
-        else if (object instanceof Attribute) {
-            return true;
-        }
-        else if (object instanceof Relationship) {
-            return true;
-        }
-        else if (object instanceof Procedure) {
-            return true;
-        }
-        else if (object instanceof ProcedureParameter) {
-            return true;
-        }
-        else if (object instanceof Embeddable) {
-            return true;
-        }
-        else if (object instanceof EmbeddableAttribute) {
-            return true;
-        }
-        else {
-            return false;
-        }
+        return (object instanceof DataChannelDescriptor)
+                || (object instanceof DataMap)
+                || (object instanceof DataNodeDescriptor)
+                || (object instanceof Entity)
+                || (object instanceof Attribute)
+                || (object instanceof Relationship)
+                || (object instanceof Procedure)
+                || (object instanceof ProcedureParameter)
+                || (object instanceof QueryDescriptor)
+                || (object instanceof Embeddable)
+                || (object instanceof EmbeddableAttribute);
     }
 
     /**
@@ -632,42 +606,23 @@ public class RemoveAction extends CayenneAction {
                 undo = new RemoveUndoableEdit(application, (DataMap) object);
                 removeDataMap((DataMap) object);
             }
-        }
-        else if (object instanceof DataNodeDescriptor) {
+        } else if (object instanceof DataNodeDescriptor) {
             undo = new RemoveUndoableEdit(application, (DataNodeDescriptor) object);
-
             removeDataNode((DataNodeDescriptor) object);
-        }
-        else if (object instanceof DbEntity) {
-            undo = new RemoveUndoableEdit(
-                    ((DbEntity) object).getDataMap(),
-                    (DbEntity) object);
-
+        } else if (object instanceof DbEntity) {
+            undo = new RemoveUndoableEdit(((DbEntity) object).getDataMap(), (DbEntity) object);
             removeDbEntity(((DbEntity) object).getDataMap(), (DbEntity) object);
-        }
-        else if (object instanceof ObjEntity) {
-            undo = new RemoveUndoableEdit(
-                    ((ObjEntity) object).getDataMap(),
-                    (ObjEntity) object);
-
+        } else if (object instanceof ObjEntity) {
+            undo = new RemoveUndoableEdit(((ObjEntity) object).getDataMap(), (ObjEntity)
object);
             removeObjEntity(((ObjEntity) object).getDataMap(), (ObjEntity) object);
-        }
-        else if (object instanceof QueryDescriptor) {
-            undo = new RemoveUndoableEdit(((Query) object).getDataMap(), (QueryDescriptor)
object);
-
-            removeQuery(((Query) object).getDataMap(), (QueryDescriptor) object);
-        }
-        else if (object instanceof Procedure) {
-            undo = new RemoveUndoableEdit(
-                    ((Procedure) object).getDataMap(),
-                    (Procedure) object);
-
+        } else if (object instanceof QueryDescriptor) {
+            undo = new RemoveUndoableEdit(((QueryDescriptor) object).getDataMap(), (QueryDescriptor)
object);
+            removeQuery(((QueryDescriptor) object).getDataMap(), (QueryDescriptor) object);
+        } else if (object instanceof Procedure) {
+            undo = new RemoveUndoableEdit(((Procedure) object).getDataMap(), (Procedure)
object);
             removeProcedure(((Procedure) object).getDataMap(), (Procedure) object);
-        }
-        else if (object instanceof Embeddable) {
-            undo = new RemoveUndoableEdit(
-                    ((Embeddable) object).getDataMap(),
-                    (Embeddable) object);
+        } else if (object instanceof Embeddable) {
+            undo = new RemoveUndoableEdit(((Embeddable) object).getDataMap(), (Embeddable)
object);
             removeEmbeddable(((Embeddable) object).getDataMap(), (Embeddable) object);
         }
 


Mime
View raw message