You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2012/12/07 11:34:49 UTC

svn commit: r1418263 - /manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java

Author: kwright
Date: Fri Dec  7 10:34:47 2012
New Revision: 1418263

URL: http://svn.apache.org/viewvc?rev=1418263&view=rev
Log:
Still more consolidation

Modified:
    manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java

Modified: manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java?rev=1418263&r1=1418262&r2=1418263&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-578/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java Fri Dec  7 10:34:47 2012
@@ -4825,7 +4825,50 @@ public class LivelinkConnector extends o
     {
       return getObjectValue() != null;
     }
-    
+
+    /** Get the complete path for the current object.
+    */
+    public String getObjectPath()
+      throws ManifoldCFException, ServiceInterruption
+    {
+      ObjectInformation currentObject = this;
+      String path = null;
+      while (true)
+      {
+        if (currentObject.objectID == LLCATWK_ID)
+          return CATEGORY_NAME + ":" + path;
+        else if (currentObject.objectID == LLENTWK_ID)
+          return ENTWKSPACE_NAME + ":" + path;
+
+        LLValue x = currentObject.getObjectValue();
+        if (x == null)
+        {
+          // The document identifier describes a path that does not exist.
+          // This is unexpected, but an exception would terminate the job, and we don't want that.
+          Logging.connectors.warn("Livelink: Bad identifier found? "+Integer.toString(currentObject.objectID)+" apparently does not exist, but need to look up its path");
+          return null;
+        }
+
+        // Get the name attribute
+        String name = x.toString("Name");
+        if (path == null)
+          path = name;
+        else
+          path = name + "/" + path;
+
+        // Get the parentID attribute
+        int parentID = x.toInteger("ParentID");
+        if (parentID == -1)
+        {
+          // Oops, hit the top of the path without finding the workspace we're in.
+          // No idea where it lives; note this condition and exit.
+          Logging.connectors.warn("Livelink: Object ID "+Integer.toString(currentObject.objectID)+" doesn't seem to live in enterprise or category workspace!  Path I got was '"+path+"'");
+          return null;
+        }
+        currentObject = new ObjectInformation(0,parentID);
+      }
+    }
+
     /**
     * Returns the object ID specified by the path name.
     * @param startPath is the folder name (a string with dots as separators)
@@ -5375,50 +5418,6 @@ public class LivelinkConnector extends o
     return actualAcls;
   }
 
-  /** Get an object's standard path, given its ID.
-  */
-  protected String getObjectPath(int id)
-    throws ManifoldCFException, ServiceInterruption
-  {
-    int objectId = id;
-    String path = null;
-    while (true)
-    {
-      // Load the object. I'm told I can use zero for a volume ID safely.
-      LLValue x = getObjectInfo(0,objectId);
-      if (x == null)
-      {
-        // The document identifier describes a path that does not exist.
-        // This is unexpected, but an exception would terminate the job, and we don't want that.
-        Logging.connectors.warn("Livelink: Bad identifier found? "+Integer.toString(id)+" apparently does not exist, but need to look up its path");
-        return null;
-      }
-
-      if (objectId == LLCATWK_ID)
-        return CATEGORY_NAME + ":" + path;
-      else if (objectId == LLENTWK_ID)
-        return ENTWKSPACE_NAME + ":" + path;
-
-      // Get the name attribute
-      String name = x.toString("Name");
-      if (path == null)
-        path = name;
-      else
-        path = name + "/" + path;
-
-      // Get the parentID attribute
-      int parentID = x.toInteger("ParentID");
-      if (parentID == -1)
-      {
-        // Oops, hit the top of the path without finding the workspace we're in.
-        // No idea where it lives; note this condition and exit.
-        Logging.connectors.warn("Livelink: Object ID "+Integer.toString(id)+" doesn't seem to live in enterprise or category workspace!  Path I got was '"+path+"'");
-        return null;
-      }
-      objectId = parentID;
-    }
-  }
-
   protected class GetObjectCategoryIDsThread extends Thread
   {
     protected int vol;
@@ -6188,7 +6187,7 @@ public class LivelinkConnector extends o
     protected String findPath(int catID)
       throws ManifoldCFException, ServiceInterruption
     {
-      return getObjectPath(catID);
+      return new ObjectInformation(0,catID).getObjectPath();
     }
 
     /** Find a set of attributes given a category ID */