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 2013/09/17 14:23:26 UTC
svn commit: r1524005 -
/manifoldcf/branches/CONNECTORS-772/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
Author: kwright
Date: Tue Sep 17 12:23:25 2013
New Revision: 1524005
URL: http://svn.apache.org/r1524005
Log:
Same path revamp, except for Lists
Modified:
manifoldcf/branches/CONNECTORS-772/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
Modified: manifoldcf/branches/CONNECTORS-772/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-772/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java?rev=1524005&r1=1524004&r2=1524005&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-772/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java (original)
+++ manifoldcf/branches/CONNECTORS-772/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java Tue Sep 17 12:23:25 2013
@@ -1233,13 +1233,10 @@ public class SharePointRepository extend
if (Logging.connectors.isDebugEnabled())
Logging.connectors.debug( "SharePoint: Document identifier is a list: '" + siteListPath + "'" );
- // Calculate the start of the path part that would contain the list item name
- int listItemPathIndex = site.length() + 1 + listName.length();
-
String listID = proxy.getListID( encodePath(site), site, listName, fullListPaths );
if (listID != null)
{
- ListItemStream fs = new ListItemStream( activities, listItemPathIndex, spec );
+ ListItemStream fs = new ListItemStream( activities, encodedServerLocation, siteListPath, spec );
boolean success = proxy.getChildren( fs, encodePath(site) , listID, dspStsWorks );
if (!success)
{
@@ -1924,31 +1921,49 @@ public class SharePointRepository extend
protected class ListItemStream implements IFileStream
{
- protected IProcessActivity activities;
- protected int foldersFilePathIndex;
- protected DocumentSpecification spec;
-
- public ListItemStream(IProcessActivity activities, int foldersFilePathIndex, DocumentSpecification spec)
+ protected final IProcessActivity activities;
+ protected final DocumentSpecification spec;
+ protected final String rootPath;
+ protected final String siteListPath;
+
+ public ListItemStream(IProcessActivity activities, String rootPath, String siteListPath, DocumentSpecification spec)
{
this.activities = activities;
- this.foldersFilePathIndex = foldersFilePathIndex;
this.spec = spec;
+ this.rootPath = rootPath;
+ this.siteListPath = siteListPath;
}
public void addFile(String relPath)
throws ManifoldCFException
{
- // First, strip "Lists" from relPath
- if (!relPath.startsWith("/Lists/"))
- throw new ManifoldCFException("Expected path to start with /Lists/");
- relPath = relPath.substring("/Lists".length());
- if ( checkIncludeListItem( relPath, spec ) )
- {
- // Since the processing for a item needs to know the list path, we need a way to signal the cutoff between list and item levels.
- // The way I've chosen to do this is to use a triple slash at that point, as a separator.
- String modifiedPath = relPath.substring(0,foldersFilePathIndex) + "//" + relPath.substring(foldersFilePathIndex);
+ // First, convert the relative path to a full path
+ if ( !relPath.startsWith("/") )
+ {
+ relPath = rootPath + siteListPath + "/" + relPath;
+ }
- activities.addDocumentReference( modifiedPath );
+ // Now, strip away what we don't want - namely, the root path. This makes the path relative to the root.
+ if ( relPath.length() >= rootPath.length() )
+ {
+ relPath = relPath.substring(rootPath.length());
+
+ // Now, strip "Lists" from relPath
+ if (!relPath.startsWith("/Lists/"))
+ throw new ManifoldCFException("Expected path to start with /Lists/");
+ relPath = relPath.substring("/Lists".length());
+ if ( checkIncludeListItem( relPath, spec ) )
+ {
+ // Since the processing for a item needs to know the list path, we need a way to signal the cutoff between list and item levels.
+ // The way I've chosen to do this is to use a triple slash at that point, as a separator.
+ String modifiedPath = relPath.substring(0,siteListPath.length()) + "//" + relPath.substring(siteListPath.length());
+
+ activities.addDocumentReference( modifiedPath );
+ }
+ }
+ else
+ {
+ Logging.connectors.warn("SharePoint: Unexpected relPath structure; path is "+relPath+", but expected to see something beginning with "+rootPath);
}
}