jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r987315 - /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/
Date Thu, 19 Aug 2010 21:25:52 GMT
Author: jukka
Date: Thu Aug 19 21:25:51 2010
New Revision: 987315

URL: http://svn.apache.org/viewvc?rev=987315&view=rev
Log:
JCR-2721: Add toString() methods to QOM tree classes

Add toString() methods to the rest of the QOM tree classes

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/AbstractQOMNode.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeJoinConditionImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ComparisonImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeJoinConditionImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchScoreImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LengthImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LiteralImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LowerCaseImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeLocalNameImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeNameImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/OrderingImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyExistenceImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyValueImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelTree.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeJoinConditionImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/UpperCaseImpl.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/AbstractQOMNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/AbstractQOMNode.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/AbstractQOMNode.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/AbstractQOMNode.java
Thu Aug 19 21:25:51 2010
@@ -91,6 +91,15 @@ public abstract class AbstractQOMNode {
         }
     }
 
+    protected String quote(Path path) {
+        String str = getJCRPath(path);
+        if (str.indexOf(':') != -1 || str.indexOf('/') != -1) {
+            return "[" + str + "]";
+        } else {
+            return str;
+        }
+    }
+
     protected String protect(Object expression) {
         String str = expression.toString();
         if (str.indexOf(" ") != -1) {

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeImpl.java
Thu Aug 19 21:25:51 2010
@@ -97,4 +97,11 @@ public class ChildNodeImpl extends Const
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return "ISCHILDNODE(" + getSelectorName() + ", " + quote(path) + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeJoinConditionImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeJoinConditionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ChildNodeJoinConditionImpl.java
Thu Aug 19 21:25:51 2010
@@ -93,4 +93,13 @@ public class ChildNodeJoinConditionImpl
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        String child = getChildSelectorName();
+        String parent = getParentSelectorName();
+        return "ISCHILDNODE(" + child + ", " + parent + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ComparisonImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ComparisonImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ComparisonImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/ComparisonImpl.java
Thu Aug 19 21:25:51 2010
@@ -109,7 +109,7 @@ public class ComparisonImpl extends Cons
     //------------------------< Object >----------------------------------------
 
     public String toString() {
-        return operator.formatSql(protect(operand1), protect(operand2));
+        return operator.formatSql(operand1.toString(), operand2.toString());
     }
 
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeImpl.java
Thu Aug 19 21:25:51 2010
@@ -102,4 +102,10 @@ public class DescendantNodeImpl
         return visitor.visit(this, data);
     }
 
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return "ISDESCENDANTNODE(" + getSelectorName() + ", " + quote(path) + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeJoinConditionImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeJoinConditionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/DescendantNodeJoinConditionImpl.java
Thu Aug 19 21:25:51 2010
@@ -93,4 +93,13 @@ public class DescendantNodeJoinCondition
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        String descendant = getDescendantSelectorName();
+        String ancestor = getAncestorSelectorName();
+        return "ISDESCENDANTNODE(" + descendant + ", " + ancestor + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchImpl.java
Thu Aug 19 21:25:51 2010
@@ -116,4 +116,23 @@ public class FullTextSearchImpl
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("CONTAINS(");
+        builder.append(getSelectorName());
+        if (propertyName != null) {
+            builder.append(".");
+            builder.append(quote(propertyName));
+            builder.append(", ");
+        } else {
+            builder.append(".*, ");
+        }
+        builder.append(getFullTextSearchExpression());
+        builder.append(")");
+        return builder.toString();
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchScoreImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchScoreImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchScoreImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/FullTextSearchScoreImpl.java
Thu Aug 19 21:25:51 2010
@@ -43,4 +43,11 @@ public class FullTextSearchScoreImpl
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return "SCORE(" + getSelectorName() + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LengthImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LengthImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LengthImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LengthImpl.java
Thu Aug 19 21:25:51 2010
@@ -56,4 +56,11 @@ public class LengthImpl extends DynamicO
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return "LENGTH(" + getPropertyValue() + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LiteralImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LiteralImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LiteralImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LiteralImpl.java
Thu Aug 19 21:25:51 2010
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.spi.common
 
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 
+import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.query.qom.Literal;
@@ -57,15 +58,43 @@ public class LiteralImpl extends StaticO
 
     public String toString() {
         try {
-            String str = value.getString();
-            if (str.indexOf(' ') != -1) {
-                str = "\"" + str + "\"";
+            switch (value.getType()) {
+            case PropertyType.BINARY:
+                return cast("BINARY");
+            case PropertyType.BOOLEAN:
+                return cast("BOOLEAN");
+            case PropertyType.DATE:
+                return cast("DATE");
+            case PropertyType.DECIMAL:
+                return cast("DECIMAL");
+            case PropertyType.DOUBLE:
+            case PropertyType.LONG:
+                return value.getString();
+            case PropertyType.NAME:
+                return cast("NAME");
+            case PropertyType.PATH:
+                return cast("PATH");
+            case PropertyType.REFERENCE:
+                return cast("REFERENCE");
+            case PropertyType.STRING:
+                return escape();
+            case PropertyType.URI:
+                return cast("URI");
+            case PropertyType.WEAKREFERENCE:
+                return cast("WEAKREFERENCE");
+            default:
+                return escape();
             }
-            return str;
         } catch (RepositoryException e) {
             return value.toString();
         }
     }
 
+    private String cast(String type) throws RepositoryException {
+        return "CAST(" + escape() + " AS " + type + ")";
+    }
 
+    private String escape() throws RepositoryException {
+        return "'" + value.getString().replace("'", "''") + "'";
+    }
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LowerCaseImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LowerCaseImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LowerCaseImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/LowerCaseImpl.java
Thu Aug 19 21:25:51 2010
@@ -56,4 +56,11 @@ public class LowerCaseImpl extends Dynam
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return "LOWER(" + operand + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeLocalNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeLocalNameImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeLocalNameImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeLocalNameImpl.java
Thu Aug 19 21:25:51 2010
@@ -43,4 +43,11 @@ public class NodeLocalNameImpl
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return "LOCALNAME(" + getSelectorName() + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeNameImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeNameImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/NodeNameImpl.java
Thu Aug 19 21:25:51 2010
@@ -41,4 +41,11 @@ public class NodeNameImpl extends Dynami
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return "NAME(" + getSelectorName() + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/OrderingImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/OrderingImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/OrderingImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/OrderingImpl.java
Thu Aug 19 21:25:51 2010
@@ -90,4 +90,15 @@ public class OrderingImpl extends Abstra
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        if (order == Order.ASCENDING) {
+            return operand + " ASC";
+        } else {
+            return operand + " DESC";
+        }
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyExistenceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyExistenceImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyExistenceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyExistenceImpl.java
Thu Aug 19 21:25:51 2010
@@ -95,4 +95,11 @@ public class PropertyExistenceImpl
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return getSelectorName() + "." + quote(propertyName) + " IS NOT NULL";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyValueImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyValueImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/PropertyValueImpl.java
Thu Aug 19 21:25:51 2010
@@ -71,4 +71,11 @@ public class PropertyValueImpl
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return getSelectorName() + "." + quote(propertyName);
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelTree.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelTree.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelTree.java
Thu Aug 19 21:25:51 2010
@@ -235,11 +235,15 @@ public class QueryObjectModelTree extend
         StringBuilder builder = new StringBuilder();
 
         builder.append("SELECT ");
-        for (int i = 0; i < columns.length; i++) {
-            if (i > 0) {
-                builder.append(", ");
+        if (columns != null && columns.length > 0) {
+            for (int i = 0; i < columns.length; i++) {
+                if (i > 0) {
+                    builder.append(", ");
+                }
+                builder.append(columns[i]);
             }
-            builder.append(columns[i]);
+        } else {
+            builder.append("*");
         }
 
         builder.append(" FROM ");
@@ -250,6 +254,16 @@ public class QueryObjectModelTree extend
             builder.append(constraint);
         }
 
+        if (orderings != null && orderings.length > 0) {
+            builder.append(" ORDER BY ");
+            for (int i = 0; i < orderings.length; i++) {
+                if (i > 0) {
+                    builder.append(", ");
+                }
+                builder.append(orderings[i]);
+            }
+        }
+
         return builder.toString();
     }
 

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeImpl.java
Thu Aug 19 21:25:51 2010
@@ -90,4 +90,11 @@ public class SameNodeImpl extends Constr
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return "ISSAMENODE(" + getSelectorName() + ", " + quote(path) + ")";
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeJoinConditionImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeJoinConditionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/SameNodeJoinConditionImpl.java
Thu Aug 19 21:25:51 2010
@@ -119,4 +119,22 @@ public class SameNodeJoinConditionImpl
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("ISSAMENODE(");
+        builder.append(getSelector1Name());
+        builder.append(", ");
+        builder.append(getSelector2Name());
+        if (selector2Path != null) {
+            builder.append(", ");
+            builder.append(quote(selector2Path));
+        }
+        builder.append(")");
+        return builder.toString();
+    }
+
+
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/UpperCaseImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/UpperCaseImpl.java?rev=987315&r1=987314&r2=987315&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/UpperCaseImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/UpperCaseImpl.java
Thu Aug 19 21:25:51 2010
@@ -56,4 +56,11 @@ public class UpperCaseImpl extends Dynam
     public Object accept(QOMTreeVisitor visitor, Object data) throws Exception {
         return visitor.visit(this, data);
     }
+
+    //------------------------< Object >----------------------------------------
+
+    public String toString() {
+        return "UPPER(" + operand + ")";
+    }
+
 }



Mime
View raw message