cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From and...@apache.org
Subject svn commit: r890508 - in /cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor: ObjectQueryPropertiesPanel.java SelectPropertiesPanel.java
Date Mon, 14 Dec 2009 22:30:06 GMT
Author: andrey
Date: Mon Dec 14 22:30:06 2009
New Revision: 890508

URL: http://svn.apache.org/viewvc?rev=890508&view=rev
Log:
CAY-1334 Modeler is trying to load data object classes when selecting a query

Modified:
    cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java?rev=890508&r1=890507&r2=890508&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjectQueryPropertiesPanel.java
Mon Dec 14 22:30:06 2009
@@ -27,6 +27,7 @@
 
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.SelectQuery;
 
 import com.jgoodies.forms.builder.PanelBuilder;
 import com.jgoodies.forms.layout.CellConstraints;
@@ -96,9 +97,6 @@
     public void initFromModel(Query query) {
         super.initFromModel(query);
 
-        dataRows
-                .setSelected(query
-                        .getMetaData(mediator.getCurrentDataDomain().getEntityResolver())
-                        .isFetchingDataRows());
+        dataRows.setSelected(((SelectQuery) query).isFetchingDataRows());
     }
 }

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java?rev=890508&r1=890507&r2=890508&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectPropertiesPanel.java
Mon Dec 14 22:30:06 2009
@@ -35,7 +35,6 @@
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 
-import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.map.event.QueryEvent;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.util.CayenneWidgetFactory;
@@ -141,26 +140,28 @@
      * query is changed.
      */
     public void initFromModel(Query query) {
-        EntityResolver resolver = mediator.getCurrentDataDomain().getEntityResolver();
         DefaultComboBoxModel cacheModel = new DefaultComboBoxModel(CACHE_POLICIES);
-
-        QueryCacheStrategy selectedStrategy = query
-                .getMetaData(resolver)
-                .getCacheStrategy();
+        
+        // TODO (andrey, 15/12/09)
+        //do not use metadata, as it triggers CDO class loading (CAY-1334)
+        //to avoid this evil hack, we need some common interface for SelectQuery, EJBQL
+        // & SQLTemplate, but 3.0 API is frozen now
+        QueryCacheStrategy selectedStrategy = (QueryCacheStrategy)
+            PropertyUtils.getProperty(query, "cacheStrategy");
 
         cacheModel.setSelectedItem(selectedStrategy != null
                 ? selectedStrategy
                 : QueryCacheStrategy.getDefaultStrategy());
         cacheStrategy.setModel(cacheModel);
 
-        String[] cacheGroupsArray = query.getMetaData(resolver).getCacheGroups();
+        String[] cacheGroupsArray = (String[]) PropertyUtils.getProperty(query, "cacheGroups");
         cacheGroups.setText(toCacheGroupsString(cacheGroupsArray));
         setCacheGroupsEnabled(selectedStrategy != null
                 && selectedStrategy != QueryCacheStrategy.NO_CACHE);
 
-        fetchOffset.setText(String.valueOf(query.getMetaData(resolver).getFetchOffset()));
-        fetchLimit.setText(String.valueOf(query.getMetaData(resolver).getFetchLimit()));
-        pageSize.setText(String.valueOf(query.getMetaData(resolver).getPageSize()));
+        fetchOffset.setText(String.valueOf(PropertyUtils.getProperty(query, "fetchOffset")));
+        fetchLimit.setText(String.valueOf(PropertyUtils.getProperty(query, "fetchLimit")));
+        pageSize.setText(String.valueOf(PropertyUtils.getProperty(query, "pageSize")));
     }
 
     protected String toCacheGroupsString(String[] groups) {



Mime
View raw message