cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/2] cayenne git commit: CAY-2293 Object Select Query: Qualifier field can't be empty after the change
Date Wed, 03 May 2017 15:20:33 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master a20830220 -> c04206edf


CAY-2293 Object Select Query: Qualifier field can't be empty after the change


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

Branch: refs/heads/master
Commit: 9d022051193296e581b883032d50146d4de363e0
Parents: 0ac7dd4
Author: Anton Dreka <drekoas@gmail.com>
Authored: Wed May 3 13:55:45 2017 +0300
Committer: Anton Dreka <drekoas@gmail.com>
Committed: Wed May 3 13:55:45 2017 +0300

----------------------------------------------------------------------
 .../modeler/editor/SelectQueryMainTab.java      | 33 +++++++++-----------
 1 file changed, 15 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/9d022051/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryMainTab.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryMainTab.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryMainTab.java
index 1225c60..7575a56 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryMainTab.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryMainTab.java
@@ -137,7 +137,7 @@ public class SelectQueryMainTab extends JPanel {
 
     private void initController() {
         RootSelectionHandler rootHandler = new RootSelectionHandler();
-        
+
         queryRoot.addActionListener(rootHandler);
         queryRoot.addFocusListener(rootHandler);
         queryRoot.getEditor().getEditorComponent().addFocusListener(rootHandler);
@@ -214,20 +214,17 @@ public class SelectQueryMainTab extends JPanel {
         }
 
         Expression qualifier = createQualifier(text);
-        if (qualifier != null)
-        {
-            //getQuery() is not null if we reached here
-            getQuery().setQualifier(qualifier);
-            mediator.fireQueryEvent(new QueryEvent(this, getQuery()));
-        }
-        
+
+        //getQuery() is not null if we reached here
+        getQuery().setQualifier((qualifier));
+        mediator.fireQueryEvent(new QueryEvent(this, getQuery()));
     }
-    
+
     /**
      * Method to create and check an expression
      * @param text String to be converted as Expression
      * @return Expression if a new expression was created, null otherwise.
-     * @throws ValidationException if <code>text</code> can't be converted  
+     * @throws ValidationException if <code>text</code> can't be converted
      */
     Expression createQualifier(String text) throws ValidationException
     {
@@ -235,23 +232,23 @@ public class SelectQueryMainTab extends JPanel {
         if (query == null) {
             return null;
         }
-        
+
         ExpressionConvertor convertor = new ExpressionConvertor();
         try {
             String oldQualifier = convertor.valueAsString(query.getQualifier());
             if (!Util.nullSafeEquals(oldQualifier, text)) {
                 Expression exp = (Expression) convertor.stringAsValue(text);
-                
+
                 /*
                  * Advanced checking. See CAY-888 #1
                  */
                 if (query.getRoot() instanceof Entity) {
                     checkExpression((Entity) query.getRoot(), exp);
                 }
-                
+
                 return exp;
             }
-            
+
             return null;
         }
         catch (IllegalArgumentException ex) {
@@ -298,13 +295,13 @@ public class SelectQueryMainTab extends JPanel {
                     + "'. Use a different name.");
         }
     }
-    
+
     /**
      * Advanced checking of an expression, needed because Expression.fromString()
      * might terminate normally, but returned Expression will not be appliable
      * for real Entities.
      * Current implementation assures all attributes in expression are present in
-     * Entity  
+     * Entity
      * @param root Root of a query
      * @param ex Expression to check
      * @throws ValidationException when something's wrong
@@ -316,13 +313,13 @@ public class SelectQueryMainTab extends JPanel {
                  * Try to iterate through path, if some attributes are not present,
                  * exception will be raised
                  */
-                
+
                 Iterator<CayenneMapEntry> path = root.resolvePathComponents(ex);
                 while (path.hasNext()) {
                     path.next();
                 }
             }
-            
+
             if (ex != null) {
                 for (int i = 0; i < ex.getOperandCount(); i++) {
                     if (ex.getOperand(i) instanceof Expression) {


Mime
View raw message