jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r770673 - /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java
Date Fri, 01 May 2009 13:32:52 GMT
Author: jukka
Date: Fri May  1 13:32:52 2009
New Revision: 770673

URL: http://svn.apache.org/viewvc?rev=770673&view=rev
Log:
JCR-2094: Use an enumeration for QOM operators

Leverage the Operator enumeration in sql2.Parser

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java?rev=770673&r1=770672&r2=770673&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java
Fri May  1 13:32:52 2009
@@ -41,6 +41,8 @@
 import javax.jcr.query.qom.Source;
 import javax.jcr.query.qom.StaticOperand;
 
+import org.apache.jackrabbit.spi.commons.query.qom.Operator;
+
 /**
  * The SQL2 parser can convert a JCR-SQL2 query to a QueryObjectModel.
  */
@@ -276,35 +278,19 @@
     private Constraint parseCondition(DynamicOperand left) throws RepositoryException {
         Constraint c;
         if (readIf("=")) {
-            c = factory.comparison(left,
-                    QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
-                    parseStaticOperand());
+            c = Operator.EQ.comparison(factory, left, parseStaticOperand());
         } else if (readIf("<>")) {
-            c = factory.comparison(left,
-                    QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO,
-                    parseStaticOperand());
+            c = Operator.NE.comparison(factory, left, parseStaticOperand());
         } else if (readIf("<")) {
-            c = factory.comparison(left,
-                    QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN,
-                    parseStaticOperand());
+            c = Operator.LT.comparison(factory, left, parseStaticOperand());
         } else if (readIf(">")) {
-            c = factory.comparison(left,
-                    QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN,
-                    parseStaticOperand());
+            c = Operator.GT.comparison(factory, left, parseStaticOperand());
         } else if (readIf("<=")) {
-            c = factory.comparison(left,
-                    QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO,
-                    parseStaticOperand());
+            c = Operator.LE.comparison(factory, left, parseStaticOperand());
         } else if (readIf(">=")) {
-            c = factory
-                    .comparison(
-                            left,
-                            QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO,
-                            parseStaticOperand());
+            c = Operator.GE.comparison(factory, left, parseStaticOperand());
         } else if (readIf("LIKE")) {
-            c = factory.comparison(left,
-                    QueryObjectModelConstants.JCR_OPERATOR_LIKE,
-                    parseStaticOperand());
+            c = Operator.LIKE.comparison(factory, left, parseStaticOperand());
         } else if (readIf("IS")) {
             boolean not = readIf("NOT");
             read("NULL");
@@ -328,9 +314,8 @@
                 c = getPropertyExistence(pv);
             } else {
                 read("LIKE");
-                c = factory.not(factory.comparison(left,
-                        QueryObjectModelConstants.JCR_OPERATOR_LIKE,
-                        parseStaticOperand()));
+                c = factory.not(Operator.LIKE.comparison(
+                        factory, left, parseStaticOperand()));
             }
         } else {
             throw getSyntaxError();



Mime
View raw message