manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1855661 - in /manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf: crawler/connectors/csws/CswsConnector.java csws/CswsSession.java
Date Sat, 16 Mar 2019 15:17:01 GMT
Author: kwright
Date: Sat Mar 16 15:17:01 2019
New Revision: 1855661

URL: http://svn.apache.org/viewvc?rev=1855661&view=rev
Log:
More work

Modified:
    manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
    manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java

Modified: manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java?rev=1855661&r1=1855660&r2=1855661&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/csws/CswsConnector.java
Sat Mar 16 15:17:01 2019
@@ -48,6 +48,8 @@ import com.opentext.livelink.service.doc
 import com.opentext.livelink.service.docman.NodeRight;
 import com.opentext.livelink.service.memberservice.User;
 import com.opentext.livelink.service.memberservice.Member;
+import com.opentext.livelink.service.searchservices.SGraph;
+import com.opentext.livelink.service.searchservices.SNode;
 
 import org.apache.manifoldcf.csws.*;
 
@@ -1122,26 +1124,28 @@ public class CswsConnector extends org.a
           Logging.connectors.debug("Csws: Processing folder "+vol+":"+objID);
         }
         
-        final ListObjectsThread t = new ListObjectsThread(objID, filterString);
+        final ListObjectsThread t = new ListObjectsThread(objID, new String[]{"OTDataID",
"OTSubTypeString", "OTName"}, filterString, "OTDataID");
         t.start();
-        final List<? extends Node> childrenDocs = t.finishUp();
-        for (final Node childDoc : childrenDocs)
+        final List<? extends SGraph> childrenDocs = t.finishUp();
+        for (final SGraph childDoc : childrenDocs)
         {
-          final long childID = childDoc.getID();
-
+          // Decode results
+          final long childID = childDoc.???;
+          final String subtype = childDoc.???;
+          final String name = childDoc.???;
+          
           if (Logging.connectors.isDebugEnabled())
           {
             Logging.connectors.debug("Csws: Found a child of folder "+vol+":"+objID+" : ID="+childID);
           }
           
           // All we need to know is whether the child is a container or not, and there is
a way to do that directly from the node
-          final String subtype = childDoc.getType();
           final boolean childIsFolder = subType.equals("Folder") || subType.equals("Project")
|| subType.equals("CompoundDocument");
           
           // If it's a folder, we just let it through for now
           if (!childIsFolder)
           {
-            if (checkInclude(childDoc.getName(), spec) == false)
+            if (checkInclude(name, spec) == false)
             {
               if (Logging.connectors.isDebugEnabled()) {
                 Logging.connectors.debug("Csws: Child identifier "+childID+" was excluded
by inclusion criteria");
@@ -1310,30 +1314,34 @@ public class CswsConnector extends org.a
   }
 
   /**
-   * Thread that reads child objects that have a specified filter criteria, given a volume
ID and object ID.
+   * Thread that reads child objects that have a specified filter criteria, given an object
ID.
    */
   protected class ListObjectsThread extends Thread
   {
     protected final long objID;
+    protected final String[] outputColumns;
     protected final String filterString;
+    protected final String orderingColumn;
     protected Throwable exception = null;
-    protected List<? extends Node> rval = null;
+    protected List<? extends SGraph> rval = null;
 
-    public ListObjectsThread(long objID, String filterString)
+    public ListObjectsThread(final long objID, final String[] outputColumns, final String
filterString, final String orderingColumn)
     {
       super();
       setDaemon(true);
       this.objID = objID;
+      this.outputColumns = outputColumns;
       this.filterString = filterString;
+      this.orderingColumn = orderingColumn;
     }
 
     public void run()
     {
       try
       {
-        //         int status = LLDocs.ListObjects(vol, objID, null, filterString, LAPI_DOCUMENTS.PERM_SEECONTENTS,
childrenDocs);
-        // No filter support!!! TBD
-        rval = cswsSession.getChildren(objID);
+        // Worry about paging later.  Since these are all children of a specific node, we
are unlikely to have a problem in any case.
+        // TBD
+        rval = cswsSession.searchFor(objID, outputColumns, filterString, orderingColumn,
0, 100000); 
       }
       catch (Throwable e)
       {
@@ -1341,7 +1349,7 @@ public class CswsConnector extends org.a
       }
     }
 
-    public List<? extends Node> finishUp()
+    public List<? extends SGraph> finishUp()
       throws ManifoldCFException, ServiceInterruption, InterruptedException
     {
       join();
@@ -3090,21 +3098,19 @@ public class CswsConnector extends org.a
     if (vid == null)
       return null;
 
-    String filterString = "(SubType="+ LAPI_DOCUMENTS.FOLDERSUBTYPE + " or SubType=" + LAPI_DOCUMENTS.PROJECTSUBTYPE
+
-      " or SubType=" + LAPI_DOCUMENTS.COMPOUNDDOCUMENTSUBTYPE + ")";
+    final String filterString = "where1=(\"OTSubType\":0 OR \"OTSubType\":202 OR \"OTSubType\":136)";
 
-    final ListObjectsThread t = new ListObjectsThread(vid.getPathId(), filterString);
+    final ListObjectsThread t = new ListObjectsThread(vid.getPathId(), new String[]{"OTName"},
filterString, "OTName");
     try
     {
       t.start();
-      final List<? extends Node> children = t.finishUp();
+      final List<? extends SGraph> children = t.finishUp();
 
       final String[] rval = new String[children.size()];
       int j = 0;
-      for (final Node node : children)
+      for (final SGraph node : children)
       {
-        rval[j] = node.getName();
-        j++;
+        rval[j++] = node.???;
       }
       return rval;
     }
@@ -3132,20 +3138,19 @@ public class CswsConnector extends org.a
       return null;
 
     // We want only folders that are children of the current object and which match the specified
subfolder
-    String filterString = "SubType="+ LAPI_DOCUMENTS.CATEGORYSUBTYPE;
+    String filterString = "\"OTSubType\":131";
 
-    final ListObjectsThread t = new ListObjectsThread(vid.getPathId(), filterString);
+    final ListObjectsThread t = new ListObjectsThread(vid.getPathId(), new String[]{"OTName"},
filterString, "OTName");
     try
     {
       t.start();
-      final List<? extends String> children = t.finishUp();
+      final List<? extends SGraph> children = t.finishUp();
 
       final String[] rval = new String[children.size()];
       int j = 0;
-      while (j < children.size())
+      while (final SGraph sg : children)
       {
-        rval[j] = children.get(j).getName();
-        j++;
+        rval[j++] = sg.???;
       }
       return rval;
     }
@@ -3869,14 +3874,13 @@ public class CswsConnector extends org.a
 
         final String subFolder = currentTokenBuffer.toString();
         // We want only folders that are children of the current object and which match the
specified subfolder
-        String filterString = "(SubType="+ LAPI_DOCUMENTS.FOLDERSUBTYPE + " or SubType="
+ LAPI_DOCUMENTS.PROJECTSUBTYPE +
-          " or SubType=" + LAPI_DOCUMENTS.COMPOUNDDOCUMENTSUBTYPE + ") and Name='" + subFolder
+ "'";
+        final String filterString = "(\"OTSubType\":0 OR \"OTSubType\":202 OR \"OTSubType\":136)
AND \"OTName\":\""+subFolder+"\"";
 
-        final ListObjectsThread t = new ListObjectsThread(obj, filterString);
+        final ListObjectsThread t = new ListObjectsThread(obj, new String[]{"OTDataID", "OTSubTypeName"},
filterString, "OTDataID");
         try
         {
           t.start();
-          final List<? extends Node> children = t.finishUp();
+          final List<? extends SGraph> children = t.finishUp();
 
           if (children == null) {
             return null;
@@ -3885,14 +3889,14 @@ public class CswsConnector extends org.a
           // If there is one child, then we are okay.
           if (children.size() == 1)
           {
-            // New starting point is the one we found.
-            final Node child = children.get(0);
-            obj = child.getID();
-            final String subtype = child.getType();
-            if (subtype.equals("Project"))
-            {
-              vol = obj;
-              obj = -obj;
+            for (final SGraph child : children) {
+              obj = child.???getID();
+              final String subtype = child.???getType();
+              if (subtype.equals("Project"))
+              {
+                vol = obj;
+                obj = -obj;
+              }
             }
           }
           else
@@ -3970,19 +3974,19 @@ public class CswsConnector extends org.a
         String filterString;
 
         // We want only folders that are children of the current object and which match the
specified subfolder
-        if (charindex < startPath.length())
-          filterString = "(SubType="+ LAPI_DOCUMENTS.FOLDERSUBTYPE + " or SubType=" + LAPI_DOCUMENTS.PROJECTSUBTYPE
+
-          " or SubType=" + LAPI_DOCUMENTS.COMPOUNDDOCUMENTSUBTYPE + ")";
-        else
-          filterString = "SubType="+LAPI_DOCUMENTS.CATEGORYSUBTYPE;
-
-        filterString += " and Name='" + subFolder + "'";
+        if (charindex < startPath.length()) {
+          filterString = "(\"OTSubType\":0 OR \"OTSubType\":202 OR \"OTSubType\":136)";
+        } else {
+          filterString = "\"OTSubType\":131";
+        }
+        
+        filterString += " AND \"OTName:\"" + subFolder + "\"";
 
-        final ListObjectsThread t = new ListObjectsThread(obj, filterString);
+        final ListObjectsThread t = new ListObjectsThread(obj, new String[]{"OTDataID", "OTSubTypeName"},
filterString, "OTDataID");
         try
         {
           t.start();
-          final List<? extends Node> children = t.finishUp();
+          final List<? extends SGraph> children = t.finishUp();
           if (children == null) {
             return -1;
           }
@@ -3990,14 +3994,15 @@ public class CswsConnector extends org.a
           // If there is one child, then we are okay.
           if (children.size() == 1)
           {
-            // New starting point is the one we found.
-            final Node child = children.get(0);
-            obj = child.getID();
-            final String subtype = child.getType();
-            if (subtype.equals("Project"))
-            {
-              vol = obj;
-              obj = -obj;
+            for (final SGraph child : children) {
+              // New starting point is the one we found.
+              obj = child.???getID();
+              final String subtype = child.???getType();
+              if (subtype.equals("Project"))
+              {
+                vol = obj;
+                obj = -obj;
+              }
             }
           }
           else

Modified: manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java?rev=1855661&r1=1855660&r2=1855661&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
(original)
+++ manifoldcf/branches/CONNECTORS-1566/connectors/csws/connector/src/main/java/org/apache/manifoldcf/csws/CswsSession.java
Sat Mar 16 15:17:01 2019
@@ -322,7 +322,13 @@ public class CswsSession
   
   /**
   * Return a set of IDs matching the specification.
-  * @param searchSpec is the search specification, e.g. "where1=(\"OTSubType\":0 OR \"OTSubType\":1
OR \"OTSubType\":144) AND \"OTParentID\":2000 AND \"OTModifyDate\":<20190312"
+  * @param parentID is the parent ID.
+  * @param returnColumns is an array of return column names.
+  * For reference:
+  * OTDataID
+  * OTSubTypeName
+  * OTName
+  * @param searchSpec is the search specification, e.g. "\"OTSubType\":0 OR \"OTSubType\":1
OR \"OTSubType\":144) AND \"OTModifyDate\":<20190312"
   *  For reference:
   * OTSubType Details 
   * 0 - Folder 
@@ -336,12 +342,13 @@ public class CswsSession
   * 207 - Channel 
   * 215 - Discussion 
   * 299 - LiveReport
-  * @param sortOrderSpec is the sort order specification, or null, e.g. "sortByRegion=OTName&sortDirection=ascending"
+  * @param orderingColumn is the column name to order the result by
   * @param start is the ID of the result to return (0-based)
   * @param count is the maximum number of IDs to return
   * @return an array of IDs corresponding to documents or categories requested
   */
-  public long[] searchFor(final String searchSpec, final String sortOrderSpec, final int
start, final int count)
+  public List<? extends SGraph> searchFor(final long parentID,
+    final String[] returnColumns, final String searchSpec, final String orderingColumn, final
int start, final int count)
     throws ManifoldCFException, ServiceInterruption {
     try {
       final SingleSearchRequest singleSrchReq = new SingleSearchRequest();
@@ -349,12 +356,13 @@ public class CswsSession
       singleSrchReq.setQueryLanguage("Livelink Search API V1"); //Search Query Language API
       singleSrchReq.setFirstResultToRetrieve(start + 1);
       singleSrchReq.setNumResultsToRetrieve(count);
-      if (sortOrderSpec != null) {
-        singleSrchReq.setResultOrderSpec(sortOrderSpec);
+      if (orderingColumn != null) {
+        singleSrchReq.setResultOrderSpec("sortByRegion="+orderingColumn+"&sortDirection=ascending");
+      }
+      singleSrchReq.setResultSetSpec("where1=(\"OTParentID\":"+parentID+" AND ("+searchSpec+")");
+      for (final String returnColumn : returnColumns) {
+        singleSrchReq.getResultTransformationSpec().add(returnColumn);
       }
-      singleSrchReq.setResultSetSpec(searchSpec);
-      // We only ever want to get IDs back
-      singleSrchReq.getResultTransformationSpec().add("OTDataID");
       // Fire off the query
       final SingleSearchResponse results = getSearchServiceHandle().search(singleSrchReq,
"", getOTAuthentication());
       if (results == null) {
@@ -366,24 +374,7 @@ public class CswsSession
         return null;
       }
       // Get the list of actual result rows (?)
-      final List<? extends SGraph> items = srp.getItem();
-      if (items == null) {
-        return null;
-      }
-      // Create the output array
-      final long[] rval = new long[items.size()];
-      int i = 0;
-      for (final SGraph sg : items) {
-        // Get the SNodes for the graph element; there should be exactly one because that's
what we asked for
-        final List<? extends SNode> nodes = sg.getN();
-        if (nodes == null || nodes.size() != 1) {
-          throw new ManifoldCFException("Unexpected result row size back from search: "+(nodes
== null)?"null":nodes.size());
-        }
-        final SNode node = nodes.get(0);
-        // I have no idea what field I ought to get from the node for OTDataID.  String?
 Integer??  And these come back as lists too!!  Please clarify.
-        // MHL
-        rval[i++] = new Long(node.getI().get(0)).longValue();
-      }
+      return srp.getItem();
     } catch (SOAPFaultException e) {
       processSOAPFault(e);
     }



Mime
View raw message