Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 46C20DC96 for ; Tue, 10 Jul 2012 15:54:23 +0000 (UTC) Received: (qmail 83844 invoked by uid 500); 10 Jul 2012 15:54:23 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 83801 invoked by uid 500); 10 Jul 2012 15:54:23 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 83792 invoked by uid 99); 10 Jul 2012 15:54:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jul 2012 15:54:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jul 2012 15:54:21 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3C01A23888E4; Tue, 10 Jul 2012 15:54:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1359739 - /manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java Date: Tue, 10 Jul 2012 15:54:02 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120710155402.3C01A23888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kwright Date: Tue Jul 10 15:54:01 2012 New Revision: 1359739 URL: http://svn.apache.org/viewvc?rev=1359739&view=rev Log: Fix outstanding problems with metadata attribute fetching Modified: manifoldcf/branches/CONNECTORS-470/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.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=1359739&r1=1359738&r2=1359739&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 15:54:01 2012 @@ -542,9 +542,9 @@ public class SPSProxyHelper { QueryResponse resp = call.query( myRequest ); org.apache.axis.message.MessageElement[] list = resp.get_any(); - if (Logging.connectors.isInfoEnabled()) + if (Logging.connectors.isDebugEnabled()) { - Logging.connectors.info("SharePoint: list xml: '" + list[0].toString() + "'"); + Logging.connectors.debug("SharePoint: list xml: '" + list[0].toString() + "'"); } XMLDoc doc = new XMLDoc( list[0].toString() ); @@ -632,8 +632,8 @@ public class SPSProxyHelper { org.apache.axis.message.MessageElement[] list = items.get_any(); - if (Logging.connectors.isInfoEnabled()){ - Logging.connectors.info("SharePoint: getListItems xml response: '" + list[0].toString() + "'"); + if (Logging.connectors.isDebugEnabled()){ + Logging.connectors.debug("SharePoint: getListItems xml response: '" + list[0].toString() + "'"); } ArrayList nodeList = new ArrayList(); @@ -659,8 +659,6 @@ public class SPSProxyHelper { // Get the chunk description nextChunkDescription = doc.getValue(rsData, "ListItemCollectionPositionNext"); - if (nextChunkDescription == null) - throw new ManifoldCFException("Expected rsdata to have attribute 'ListItemCollectionPositionNext'"); int itemCount = Integer.parseInt(doc.getValue(rsData, "ItemCount")); @@ -702,9 +700,7 @@ public class SPSProxyHelper { * Replace ows_ProgId with "/". * E.g. ows_FileRef="1;#Documents/ik_docs" ows_ProgId="1;#" => relPah="/Documents/ik_docs" */ - if (relPath.startsWith(ows_ProgId)) { - relPath = "/" + relPath.substring(ows_ProgId.length()); - } + relPath = "/" + progIDSubstitute(ows_ProgId,relPath); if (!relPath.endsWith(".aspx")) { fileStream.addFile( relPath ); @@ -1665,7 +1661,10 @@ public class SPSProxyHelper { ListsSoapStub stub1 = (ListsSoapStub)lservice.getListsSoapHandler(); GetListItemsQuery q = buildMatchQuery("FileRef","Text",docId); - GetListItemsViewFields viewFields = buildViewFields(fieldNames); + ArrayList newFieldNames = new ArrayList(); + newFieldNames.addAll(fieldNames); + newFieldNames.add("ProgId"); + GetListItemsViewFields viewFields = buildViewFields(newFieldNames); GetListItemsResponseGetListItemsResult items = stub1.getListItems(docLibrary, "", q, viewFields, "1", null, site); if (items == null) @@ -1673,8 +1672,8 @@ public class SPSProxyHelper { MessageElement[] list = items.get_any(); - if (Logging.connectors.isInfoEnabled()){ - Logging.connectors.info("SharePoint: getListItems for '"+docId+"' xml response: '" + list[0].toString() + "'"); + if (Logging.connectors.isDebugEnabled()){ + Logging.connectors.debug("SharePoint: getListItems for '"+docId+"' xml response: '" + list[0].toString() + "'"); } ArrayList nodeList = new ArrayList(); @@ -1714,11 +1713,17 @@ public class SPSProxyHelper { Object o = nodeDocs.get(0); // Look for all the specified attributes in the record + String progID = doc.getValue(o,"ows_ProgId"); + if (progID == null || progID.length() == 0) + throw new ManifoldCFException("Expecting ProgId attribute, not found"); + for (Object attrName : fieldNames) { String attrValue = doc.getValue(o,"ows_"+(String)attrName); if (attrValue != null) - result.put(attrName,attrValue); + { + result.put(attrName,progIDSubstitute(progID,attrValue)); + } } } @@ -2055,6 +2060,14 @@ public class SPSProxyHelper { } } + /** Substitute progid where found */ + protected static String progIDSubstitute(String progID, String value) + { + if (value.startsWith(progID)) + return value.substring(progID.length()); + return value; + } + /** Build viewFields XML for the ListItems call. */ protected static GetListItemsViewFields buildViewFields(ArrayList fieldNames)