manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1359564 - in /manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src: main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/ test/java/org/apache/manifoldcf/crawler/connectors/sharepoint/
Date Tue, 10 Jul 2012 10:05:01 GMT
Author: kwright
Date: Tue Jul 10 10:05:00 2012
New Revision: 1359564

URL: http://svn.apache.org/viewvc?rev=1359564&view=rev
Log:
Add XML generator for ordering list items query

Modified:
    manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
    manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/sharepoint/XMLGenTest.java

Modified: manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java?rev=1359564&r1=1359563&r2=1359564&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
(original)
+++ manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
Tue Jul 10 10:05:00 2012
@@ -2047,7 +2047,21 @@ public class SPSProxyHelper {
     return doc.getXMLNoEntityPreamble();
   }
   
-  // MHL to build list query, which has a sort order based on an indexed column such as ID
+  /** Build a query XML object that orders by an indexed column, for paging.
+  */
+  protected static String buildOrderedQuery(String indexedColumn)
+    throws ManifoldCFException
+  {
+    XMLDoc doc = new XMLDoc();
+    Object queryNode = doc.createElement(null,"Query");
+    Object orderByNode = doc.createElement(queryNode,"OrderBy");
+    doc.setAttribute(orderByNode,"Override","TRUE");
+    doc.setAttribute(orderByNode,"UseIndexForOrderBy","TRUE");
+    Object fieldRefNode = doc.createElement(orderByNode,"FieldRef");
+    doc.setAttribute(fieldRefNode,"Ascending","TRUE");
+    doc.setAttribute(fieldRefNode,"Name",indexedColumn);
+    return doc.getXMLNoEntityPreamble();
+  }
   
   /** Build queryOptions XML object that specifies a paging value.
   */

Modified: manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/sharepoint/XMLGenTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/sharepoint/XMLGenTest.java?rev=1359564&r1=1359563&r2=1359564&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/sharepoint/XMLGenTest.java
(original)
+++ manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/sharepoint/XMLGenTest.java
Tue Jul 10 10:05:00 2012
@@ -27,7 +27,15 @@ public class XMLGenTest
 {
 
   @Test
-  public void buildPagingQueryOptions()
+  public void buildOrderedQueryTest()
+    throws Exception
+  {
+    String orderedQuery = SPSProxyHelper.buildOrderedQuery("ID");
+    assertEquals("<Query><OrderBy Override=\"TRUE\" UseIndexForOrderBy=\"TRUE\"><FieldRef
Ascending=\"TRUE\" Name=\"ID\"/></OrderBy></Query>",orderedQuery);
+  }
+  
+  @Test
+  public void buildPagingQueryOptionsTest()
     throws Exception
   {
     String pagingXML = SPSProxyHelper.buildPagingQueryOptions("some next string");



Mime
View raw message