Package com.google.enterprise.connector.sharepoint.spiimpl

Examples of com.google.enterprise.connector.sharepoint.spiimpl.SPDocumentList


    }
   
    // Update crawl queue for list with filtered documents.
    list.setCrawlQueue(newlist);

    final SPDocumentList docList = new SPDocumentList(newlist, globalState);
    // FIXME These could be set in traversal manager just before returning
    // start/resumeTraversal
    if (null != sharepointClientContext) {
      // FIXME These could be set in traversal manager just before
      // returning
      // start/resumeTraversal
      docList.setAliasMap(sharepointClientContext.getAliasMap());
      docList.setFQDNConversion(sharepointClientContext.isFQDNConversion());
      docList.setReWriteDisplayUrlUsingAliasMappingRules(sharepointClientContext.isReWriteDisplayUrlUsingAliasMappingRules());
      docList.setReWriteRecordUrlUsingAliasMappingRules(sharepointClientContext.isReWriteRecordUrlUsingAliasMappingRules());
    } else {
      LOGGER.log(Level.SEVERE, "sharepointClientContext not found!");
    }
    return docList;
  }
View Full Code Here


      LOGGER.warning("global state is null");
      return null;
    }

    noOfVisitedListStates = 0;
    SPDocumentList resultSet = null;
    Iterator<ListState> iter = sendPendingDocs ? webState.getIterator()
        : webState.getCurrentListstateIterator();
    while (iter.hasNext()) {
      final ListState list = iter.next();
      if (list.isSiteDefaultPage()) {
        continue;
      }

      // Mark this list as current list so that the next traversal
      // request starts from here and already scanned lists are not
      // unnecessarily re-scanned.
      webState.setCurrentList(list);
      if (list.getCrawlQueue() == null) {
        continue;
      }

      SPDocumentList resultsList = null;

      try {
        LOGGER.log(Level.FINE, "Handling crawl queue for list URL [ "
            + list.getListURL() + " ]. ");
        resultsList = handleCrawlQueueForList(globalState, webState, list);
        noOfVisitedListStates++;
      } catch (final Exception e) {
        LOGGER.log(Level.WARNING, "Problem in handling crawl queue for list URL [ "
            + list.getListURL() + " ]. ", e);
      }

      if ((resultsList != null) && (resultsList.size() > 0)) {
        LOGGER.log(Level.INFO, resultsList.size()
            + " document(s) to be sent from list URL [ " + list.getListURL()
            + " ]. ");
        if (resultSet == null) {
          resultSet = resultsList;
        } else {
          resultSet.addAll(resultsList);
        }
      } else {
        LOGGER.log(Level.FINE, "No documents to be sent from list URL [ "
            + list.getListURL() + " ]. ");
      }
      if (resultsList != null) {
        sizeSoFar += resultsList.size();
      }

      // Check if the docs added so far meet the batchHint
      if (sizeSoFar >= sharepointClientContext.getBatchHint()) {
        LOGGER.info("Stopping traversal because batch hint "
            + sharepointClientContext.getBatchHint()
            + " has been reached. Processed documents: " + sizeSoFar);
        break;
      }
    }

    ListState listForWeb = webState.lookupList(webState.getPrimaryKey());
    if (listForWeb != null) {
      SPDocumentList resultsList =
          handleCrawlQueueForList(globalState, webState, listForWeb);
      if (resultsList != null) {
        if (resultSet != null) {
          resultSet.addAll(resultsList);
        } else {
View Full Code Here

        if (i == toIndex) {
          LOGGER.log(Level.WARNING, "The start and end index of the List of the documents should not be same");
          continue;
        }
      }
      SPDocumentList docList = new SPDocumentList(
          resultSet.getDocuments().subList(i, toIndex), globalState);

      // Fetch ACL
      if (!fetchACLForDocuments(docList, webState, globalState)) {
        // Return false indicating ACL retrieval has failed and the
View Full Code Here

    // SharePoint document representing site landing page(site)
    final SPDocument spdocument2 = siteData.getSiteData(webState);
    testDocs.add(spdocument2);

    SPDocumentList docList = new SPDocumentList(testDocs, globalState);
    assertNotNull(docList);

    aclHelper = new AclHelper(sharepointClientContext, webState.getWebUrl());
    aclHelper.fetchAclForDocuments(docList, webState);
    for (SPDocument document : docList.getDocuments()) {
      assertNotNull(document);
      assertNotNull(document.getAclUsers());
      assertNotNull(document.getAclGroups());
    }
  }
View Full Code Here

    docsToPass.add(getDocumentForUrl(TestConfiguration.SearchDocID410, "410"));
    docsToPass.add(getDocumentForUrl(TestConfiguration.SearchDocID411, "411"));
    docsToPass.add(getDocumentForUrl(TestConfiguration.SearchDocID412, "412"));
    docsToPass.add(getDocumentForUrl(TestConfiguration.SearchDocID413, "413"));

    SPDocumentList docList = new SPDocumentList(docsToPass, globalState);
    assertNotNull(docList)
    System.out.println("\n...Processing doclist..." + docList);

    aclHelper.fetchAclForDocuments(docList, webState);
    for (SPDocument document : docList.getDocuments()) {
      assertNotNull(document);      
      if (document.getUrl().
          equalsIgnoreCase(TestConfiguration.SearchDocID401)) {
        // Search Doc ID 401 - List item with Inheriting permissions.
        checkInheritPermissions(document, TestConfiguration.SearchDocID410);
View Full Code Here

    System.out.println("Testing [ testTraverse() ]...");
    final int iPageSizeHint = 100;
    this.sharepointClient.updateGlobalState(this.globalState);
    Set<WebState> webStates = this.globalState.getAllWebStateSet();
    WebState curr_webState = webStates.iterator().next();
    SPDocumentList rs = this.sharepointClient.traverse(this.globalState,
        curr_webState, iPageSizeHint, false);
    int numDocs = 0;
    try {
      System.out.println("Documents found - ");
      if (rs != null) {
        SPDocument pm = (SPDocument) rs.nextDocument();
        while (pm != null) {
          System.out.println("<document>");
          final Property lastModProp = pm.findProperty(SpiConstants.PROPNAME_LASTMODIFIED);
          if (lastModProp != null) {
            System.out.println("<lastModify>"
                + lastModProp.nextValue().toString() + "</lastModify>");
          }
          final Property docProp = pm.findProperty(SpiConstants.PROPNAME_DOCID);
          if (lastModProp != null) {
            System.out.println("<docId>" + docProp.nextValue().toString()
                + "</docId>");
          }
          final Property searchUrlProp = pm.findProperty(SpiConstants.PROPNAME_SEARCHURL);
          if (searchUrlProp != null) {
            System.out.println("<searchUrl>"
                + searchUrlProp.nextValue().toString() + "</searchUrl>");
          }
          final Property listGuidProp = pm.findProperty(SPConstants.LIST_GUID);
          if (listGuidProp != null) {
            System.out.println("<listGuid>"
                + listGuidProp.nextValue().toString() + "</listguid>");
          }
          final Property displayUrlProp = pm.findProperty(SpiConstants.PROPNAME_DISPLAYURL);
          if (displayUrlProp != null) {
            System.out.println("<displayUrl>"
                + displayUrlProp.nextValue().toString() + "</displayUrl>");
          }
          final Property authorProp = pm.findProperty(SPConstants.AUTHOR);
          if (authorProp != null) {
            System.out.println("<author>" + authorProp.nextValue().toString()
                + "</author>");
          }
          final Property objTypeProp = pm.findProperty(SPConstants.OBJECT_TYPE);
          if (objTypeProp != null) {
            System.out.println("<" + SPConstants.OBJECT_TYPE + ">"
                + objTypeProp.nextValue().toString() + "<"
                + SPConstants.OBJECT_TYPE + ">");
          }
          final Property isPublicProp = pm.findProperty(SpiConstants.PROPNAME_ISPUBLIC);
          if (isPublicProp != null) {
            System.out.println("<isPublic>"
                + isPublicProp.nextValue().toString() + "</isPublic>");
          }
          System.out.println("</document>");

          pm.dumpAllAttrs();

          // check crawling coverage.. check if paticular document is
          // found
          numDocs++;

          pm = (SPDocument) rs.nextDocument();
        }
      }
    } catch (final RepositoryException e) {
      e.printStackTrace();
    }
View Full Code Here

    doc.setSharepointClientContext(spContext);

    List<SPDocument> list = new ArrayList<SPDocument>();
    list.add(doc);
    SPDocumentList docList = new SPDocumentList(list, gs);

    // Test that whenever 1 document, the batchsize is set to 1 and the
    // method does return and does not run into infinite loop
    boolean result = spclient.fetchACLInBatches(docList, ws, gs, 2);
    assertTrue(result);

    // Negative test case with 0 documents
    List<SPDocument> list2 = new ArrayList<SPDocument>();
    SPDocumentList docList2 = new SPDocumentList(list2, gs);
    assertFalse(spclient.fetchACLInBatches(docList2, ws, gs, 2));
  }
View Full Code Here

    // Test that when feeding ACLs is turned off, you still get true to
    // indicate docs need to be fed to GSA
    assertTrue(spclient.handleACLForDocuments(null, ws, gs, false));

    SPDocumentList docList = getDocList(spContext, gs);
    spContext.setPushAcls(true);

    // Should fetch ACL and return true to indicate success
    assertTrue(spclient.handleACLForDocuments(docList, ws, gs, false));
View Full Code Here

    doc.setSharepointClientContext(spContext);

    List<SPDocument> list = new ArrayList<SPDocument>();
    list.add(doc);
    SPDocumentList docList = new SPDocumentList(list, gs);
    return docList;
  }
View Full Code Here

        Calendar.getInstance(), ActionType.ADD);
    parentMismatchDocument.setParentList(list2);
    list1CrawlQueue.add(parentMismatchDocument);
    list1.setCrawlQueue(list1CrawlQueue);

    SPDocumentList docList =
        spClient.handleCrawlQueueForList(globalState, dummyWebState, list1);
    assertNotNull(docList);
    // verify SPDocumentList does not contain mismatched document
    assertEquals(ImmutableList.of(
        correctDocument, missingParentDocument), docList.getDocuments());
    // verify List crawl queue does not contain mismatched document
    assertEquals(ImmutableList.of(
        correctDocument, missingParentDocument), list1.getCrawlQueue());
    // verify parentlist for missing parent document is set after
    // handleCrawlQueueForList call
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.sharepoint.spiimpl.SPDocumentList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.