]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1069: Need to parenthesize 'where' clause of DocumentHandler for correct NXQL...
authorRichard Millet <richard.millet@berkeley.edu>
Fri, 26 Feb 2010 21:52:32 +0000 (21:52 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Fri, 26 Feb 2010 21:52:32 +0000 (21:52 +0000)
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java

index 22b49af62b39d29305855c97a33c24a1b3f1ec6c..620fa66aac98fe07949136391da28484f9544805 100644 (file)
@@ -307,8 +307,9 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
             // We should make this a property that is indexed.
             query.append(" WHERE ecm:path STARTSWITH '/" + domain + "'");
             if ((null != where) && (where.length() > 0)) {
-//              query.append(" AND " + where);
-                query.append(" AND " + where + "AND ecm:isProxy = 0");
+               // Due to an apparent bug/issue in how Nuxeo translates the NXQL query string
+               // into SQL, we need to parenthesize our 'where' clause
+                query.append(" AND " + "(" + where +")" + "AND ecm:isProxy = 0");
             }
             DocumentModelList docList = null;
             // If we have limit and/or offset, then pass true to get totalSize
@@ -319,6 +320,11 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
             } else {
                 docList = repoSession.query(query.toString());
             }
+            
+            if (logger.isDebugEnabled()) {
+                logger.debug("Executed NXQL query: " + query.toString());
+            }
+            
             //set repoSession to handle the document
             ((DocumentModelHandler) handler).setRepositorySession(repoSession);
             DocumentWrapper<DocumentModelList> wrapDoc = new DocumentWrapperImpl<DocumentModelList>(docList);