incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1067886 - in /incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet: implementation/src/main/java/org/apache/manifoldcf/crawler/common/filenet/ interface/src/main/java/org/apache/manifoldcf/crawler/common/filenet/
Date Mon, 07 Feb 2011 09:05:05 GMT
Author: kwright
Date: Mon Feb  7 09:05:05 2011
New Revision: 1067886

URL: http://svn.apache.org/viewvc?rev=1067886&view=rev
Log:
Add method to retrieve child folders given a path.

Modified:
    incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/implementation/src/main/java/org/apache/manifoldcf/crawler/common/filenet/FilenetImpl.java
    incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/interface/src/main/java/org/apache/manifoldcf/crawler/common/filenet/IFilenet.java

Modified: incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/implementation/src/main/java/org/apache/manifoldcf/crawler/common/filenet/FilenetImpl.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/implementation/src/main/java/org/apache/manifoldcf/crawler/common/filenet/FilenetImpl.java?rev=1067886&r1=1067885&r2=1067886&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/implementation/src/main/java/org/apache/manifoldcf/crawler/common/filenet/FilenetImpl.java
(original)
+++ incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/implementation/src/main/java/org/apache/manifoldcf/crawler/common/filenet/FilenetImpl.java
Mon Feb  7 09:05:05 2011
@@ -146,6 +146,54 @@ public class FilenetImpl extends Unicast
     // Establishing a working session is enough to test connectivity
   }
 
+  /** Get the set of folder names that are children of the specified folder path. */
+  public String[] getChildFolders(String[] parentFolderPath)
+    throws FilenetException, RemoteException
+  {
+    setConnectionCredentials();
+    // Start at root.
+    Folder currentFolder = os.get_RootFolder();
+    // Work our way down through the path.  If the path turns out to be invalid,
+    // we return null.
+    int i = 0;
+    while (i < parentFolderPath.length)
+    {
+      // For each path segment, find the matching child folder
+      FolderSet folderSet = currentFolder.get_SubFolders();
+      currentFolder = null;
+      Iterator fldrIter = folderSet.iterator();
+      while (fldrIter.hasNext())
+      {
+        Folder folder = (Folder)fldrIter.next();
+        if (folder.get_FolderName().equals(parentFolderPath[i]))
+        {
+          currentFolder = folder;
+          break;
+        }
+      }
+      
+      // Found no folder object with the correct name; the setup must have changed.
+      if (currentFolder == null)
+        return null;
+      
+      i++;
+    }
+    
+    // We've located the correct parent folder object.  Construct a list of children to return.
+    ArrayList rval = new ArrayList();
+    FolderSet children = currentFolder.get_SubFolders();
+    Iterator childFolderIterator = children.iterator();
+    while (childFolderIterator.hasNext())
+    {
+      Folder child = (Folder)childFolderIterator.next();
+      rval.add(child.get_FolderName());
+    }
+    
+    String[] rvalArray = new String[rval.size()];
+    rval.toArray(rvalArray);
+    return rvalArray;
+  }
+  
   /** Get the set of available document classes. */
   public DocumentClassDefinition[] getDocumentClassesDetails()
     throws FilenetException, RemoteException

Modified: incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/interface/src/main/java/org/apache/manifoldcf/crawler/common/filenet/IFilenet.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/interface/src/main/java/org/apache/manifoldcf/crawler/common/filenet/IFilenet.java?rev=1067886&r1=1067885&r2=1067886&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/interface/src/main/java/org/apache/manifoldcf/crawler/common/filenet/IFilenet.java
(original)
+++ incubator/lcf/branches/CONNECTORS-151-branch/connectors/filenet/interface/src/main/java/org/apache/manifoldcf/crawler/common/filenet/IFilenet.java
Mon Feb  7 09:05:05 2011
@@ -54,6 +54,10 @@ public interface IFilenet extends Remote
   public void checkConnection()
     throws FilenetException, RemoteException;
 
+  /** Get the set of folder names that are children of the specified folder path. */
+  public String[] getChildFolders(String[] parentFolderPath)
+    throws FilenetException, RemoteException;
+
   /** Get the set of available document classes
   */
   public DocumentClassDefinition[] getDocumentClassesDetails()



Mime
View raw message