jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r770726 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/query/lucene/join/ test/java/org/apache/jackrabbit/api/jsr283/query/qom/ test/java/org/apache/jackrabbit/core/query/
Date Fri, 01 May 2009 15:47:06 GMT
Author: jukka
Date: Fri May  1 15:47:06 2009
New Revision: 770726

URL: http://svn.apache.org/viewvc?rev=770726&view=rev
Log:
JCR-2095: Use an enumeration for QOM join types

More JoinType fixes

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Join.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Join.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Join.java?rev=770726&r1=770725&r2=770726&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Join.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/join/Join.java
Fri May  1 15:47:06 2009
@@ -17,31 +17,29 @@
 package org.apache.jackrabbit.core.query.lucene.join;
 
 import java.io.IOException;
-import java.util.List;
 import java.util.Arrays;
 import java.util.LinkedList;
+import java.util.List;
 
-import javax.jcr.query.qom.QueryObjectModelConstants;
-
+import org.apache.jackrabbit.core.HierarchyManager;
+import org.apache.jackrabbit.core.query.lucene.HierarchyResolver;
 import org.apache.jackrabbit.core.query.lucene.MultiColumnQueryHits;
 import org.apache.jackrabbit.core.query.lucene.ScoreNode;
-import org.apache.jackrabbit.core.query.lucene.HierarchyResolver;
-import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.commons.query.qom.JoinConditionImpl;
+import org.apache.jackrabbit.spi.commons.query.qom.ChildNodeJoinConditionImpl;
 import org.apache.jackrabbit.spi.commons.query.qom.DefaultQOMTreeVisitor;
 import org.apache.jackrabbit.spi.commons.query.qom.DescendantNodeJoinConditionImpl;
 import org.apache.jackrabbit.spi.commons.query.qom.EquiJoinConditionImpl;
-import org.apache.jackrabbit.spi.commons.query.qom.ChildNodeJoinConditionImpl;
+import org.apache.jackrabbit.spi.commons.query.qom.JoinConditionImpl;
 import org.apache.jackrabbit.spi.commons.query.qom.JoinType;
 import org.apache.jackrabbit.spi.commons.query.qom.SameNodeJoinConditionImpl;
-import org.apache.lucene.search.SortComparatorSource;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.search.SortComparatorSource;
 
 /**
  * <code>Join</code> implements the result of a join.
  */
-public class Join implements MultiColumnQueryHits, QueryObjectModelConstants {
+public class Join implements MultiColumnQueryHits {
 
     /**
      * The outer query hits.
@@ -166,10 +164,9 @@
                     Name innerName;
                     Name innerPropName;
                     Name outerPropName;
-                    if (isInner || src1 == left
-                            && JCR_JOIN_TYPE_LEFT_OUTER.equals(joinType)
-                            || src1 == right
-                            && JCR_JOIN_TYPE_RIGHT_OUTER.equals(joinType)) {
+                    if (isInner
+                            || src1 == left && JoinType.LEFT == joinType
+                            || src1 == right && JoinType.RIGHT == joinType) {
                         outer = src1;
                         outerIdx = getIndex(outer, node.getSelector1QName());
                         inner = src2;
@@ -195,10 +192,8 @@
                     MultiColumnQueryHits child = getSourceWithName(node.getChildSelectorQName(),
left, right);
                     MultiColumnQueryHits parent = getSourceWithName(node.getParentSelectorQName(),
left, right);
                     Condition c;
-                    if (child == left
-                            && JCR_JOIN_TYPE_LEFT_OUTER.equals(joinType)
-                            || child == right
-                            && JCR_JOIN_TYPE_RIGHT_OUTER.equals(joinType)) {
+                    if (child == left && JoinType.LEFT == joinType
+                            || child == right && JoinType.RIGHT == joinType) {
                         outer = child;
                         outerIdx = getIndex(outer, node.getChildSelectorQName());
                         c = new ChildNodeJoin(parent, reader, resolver, node);
@@ -218,10 +213,9 @@
                     MultiColumnQueryHits src1 = getSourceWithName(node.getSelector1QName(),
left, right);
                     MultiColumnQueryHits src2 = getSourceWithName(node.getSelector2QName(),
left, right);
                     Condition c;
-                    if (isInner || src1 == left
-                            && JCR_JOIN_TYPE_LEFT_OUTER.equals(joinType)
-                            || src1 == right
-                            && JCR_JOIN_TYPE_RIGHT_OUTER.equals(joinType)) {
+                    if (isInner
+                            || src1 == left && JoinType.LEFT == joinType
+                            || src1 == right && JoinType.RIGHT == joinType) {
                         outer = src1;
                         outerIdx = getIndex(outer, node.getSelector1QName());
                         if (node.getSelector2QPath() != null) {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java?rev=770726&r1=770725&r2=770726&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/AbstractQOMTest.java
Fri May  1 15:47:06 2009
@@ -27,7 +27,6 @@
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.Row;
 import javax.jcr.query.RowIterator;
-import javax.jcr.query.qom.QueryObjectModelConstants;
 import javax.jcr.query.qom.QueryObjectModelFactory;
 
 import org.apache.jackrabbit.core.query.QueryImpl;
@@ -37,9 +36,7 @@
 /**
  * <code>AbstractQOMTest</code> is a base class for test cases on the JQOM.
  */
-public class AbstractQOMTest
-        extends AbstractQueryTest
-        implements QueryObjectModelConstants {
+public class AbstractQOMTest extends AbstractQueryTest {
 
     protected QueryObjectModelFactory qomFactory;
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java?rev=770726&r1=770725&r2=770726&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/query/qom/SameNodeJoinConditionTest.java
Fri May  1 15:47:06 2009
@@ -56,12 +56,11 @@
 
     public void testLeftOuterJoin() throws RepositoryException {
        QueryObjectModel qom = qomFactory.createQuery(
-               qomFactory.join(
-                        qomFactory.selector(testNodeType, LEFT),
-                        qomFactory.selector(mixReferenceable, RIGHT),
-                        JCR_JOIN_TYPE_LEFT_OUTER,
-                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")
-                ),
+               JoinType.LEFT.join(
+                       qomFactory,
+                       qomFactory.selector(testNodeType, LEFT),
+                       qomFactory.selector(mixReferenceable, RIGHT),
+                       qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
                qomFactory.descendantNode(LEFT, testRoot),
                null, null);
 
@@ -77,12 +76,11 @@
 
     public void testRightOuterJoin() throws RepositoryException {
         QueryObjectModel qom = qomFactory.createQuery(
-                qomFactory.join(
-                         qomFactory.selector(mixReferenceable, LEFT),
-                         qomFactory.selector(testNodeType, RIGHT),
-                         JCR_JOIN_TYPE_RIGHT_OUTER,
-                         qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")
-                 ),
+                JoinType.RIGHT.join(
+                        qomFactory,
+                        qomFactory.selector(mixReferenceable, LEFT),
+                        qomFactory.selector(testNodeType, RIGHT),
+                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT, ".")),
                 qomFactory.descendantNode(RIGHT, testRoot),
                 null, null);
 
@@ -92,12 +90,11 @@
 
     public void testRightOuterJoinWithPath() throws RepositoryException {
         QueryObjectModel qom = qomFactory.createQuery(
-                qomFactory.join(
-                         qomFactory.selector(mixReferenceable, LEFT),
-                         qomFactory.selector(testNodeType, RIGHT),
-                         JCR_JOIN_TYPE_RIGHT_OUTER,
-                         qomFactory.sameNodeJoinCondition(LEFT, RIGHT, nodeName2)
-                 ),
+                JoinType.RIGHT.join(
+                        qomFactory,
+                        qomFactory.selector(mixReferenceable, LEFT),
+                        qomFactory.selector(testNodeType, RIGHT),
+                        qomFactory.sameNodeJoinCondition(LEFT, RIGHT, nodeName2)),
                 qomFactory.descendantNode(RIGHT, testRoot),
                 null, null);
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java?rev=770726&r1=770725&r2=770726&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/UpperLowerCaseQueryTest.java
Fri May  1 15:47:06 2009
@@ -25,7 +25,6 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.QueryResult;
-import javax.jcr.query.qom.QueryObjectModelConstants;
 
 import org.apache.jackrabbit.spi.commons.query.qom.Operator;
 
@@ -34,7 +33,7 @@
  * fn:upper-case() in XPath, LOWER() and UPPER() in SQL and UpperCase and
  * LowerCase in JQOM.
  */
-public class UpperLowerCaseQueryTest extends AbstractQueryTest implements QueryObjectModelConstants
{
+public class UpperLowerCaseQueryTest extends AbstractQueryTest {
 
     public void testEqualsGeneralComparison() throws RepositoryException {
         check(new String[]{"foo", "Foo", "fOO", "FOO", "fooBar", "fo", "fooo"},



Mime
View raw message