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

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


  public void testGetSiteDataWithUtf() throws Exception {
    final GlobalState state = new GlobalState(clientFactory,
        TestConfiguration.googleConnectorWorkDir, FeedType.CONTENT_FEED);
    WebState ws = state.makeWebState(sharepointClientContext,
        TestConfiguration.UTF8SiteUrl);
    final SPDocument document = this.siteData.getSiteData(ws);
    assertNotNull(document);
    // document Type should be null. For Publishing sites it will be ACL.
    assertNull(document.getDocumentType());
    String author = document.getAuthor().toLowerCase();
    String objectType = document.getObjType();
    assertEquals(TestConfiguration.userNameFormat2, author);
    assertEquals("Site", objectType);
  }
View Full Code Here


  public void testGetSiteDataPublishingSite() throws Exception {
    final GlobalState state = new GlobalState(clientFactory,
        TestConfiguration.googleConnectorWorkDir, FeedType.CONTENT_FEED);
    WebState ws = state.makeWebState(sharepointClientContext,
        TestConfiguration.publishingSiteUrl + SPConstants.DEFAULT_SITE_LANDING_PAGE);
    final SPDocument document = this.siteData.getSiteData(ws);
    assertNotNull(document);
    // document Type should be null. For Publishing sites it will be ACL.
    assertEquals(DocumentType.ACL,document.getDocumentType());
    String author = document.getAuthor().toLowerCase();
    String objectType = document.getObjType();
    assertEquals(TestConfiguration.userNameFormat2, author);
    assertEquals("Site", objectType);
  }
View Full Code Here

        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++;
View Full Code Here

    spContext.setFetchACLInBatches(true);
    GlobalState gs = TestConfiguration.initState(spContext);
    WebState ws = gs.lookupWeb(TestConfiguration.Site1_URL, spContext);
    SharepointClient spclient = new SharepointClient(clientFactory, spContext);

    SPDocument doc = new SPDocument("122", TestConfiguration.Site1_List1_URL,
        Calendar.getInstance(), ActionType.ADD);

    doc.setSharepointClientContext(spContext);

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

   * @param gs The global state holding all web states and list states
   * @return The doc list
   */
  private SPDocumentList getDocList(SharepointClientContext spContext,
      GlobalState gs) {
    SPDocument doc = new SPDocument("122", TestConfiguration.Site1_List1_URL,
        Calendar.getInstance(), ActionType.ADD);

    doc.setSharepointClientContext(spContext);

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

        "http://sharepoint.example.com/List2/AllItems.aspx", dummyWebState);
    dummyWebState.AddOrUpdateListStateInWebState(
        list2, Util.calendarToJoda(Calendar.getInstance()));

    List<SPDocument> list1CrawlQueue = new ArrayList<SPDocument>();
    SPDocument correctDocument = new SPDocument(
        "LIST_ITEM_1", "http://sharepoint.example.com/List1/DispForm.aspx?ID=1",
        Calendar.getInstance(), ActionType.ADD);
    correctDocument.setParentList(list1);
    list1CrawlQueue.add(correctDocument);
    SPDocument missingParentDocument = new SPDocument(
        "LIST_ITEM_2_MISSING_PARRENT",
        "http://sharepoint.example.com/List1/DispForm.aspx?ID=2",
        Calendar.getInstance(), ActionType.ADD);
    list1CrawlQueue.add(missingParentDocument);
    SPDocument parentMismatchDocument = new SPDocument(
        "LIST_ITEM_3_MISMATCH",
        "http://sharepoint.example.com/List2/DispForm.aspx?ID=1",
        Calendar.getInstance(), ActionType.ADD);
    parentMismatchDocument.setParentList(list2);
    list1CrawlQueue.add(parentMismatchDocument);
    list1.setCrawlQueue(list1CrawlQueue);

    SPDocumentList docList =
        spClient.handleCrawlQueueForList(globalState, dummyWebState, list1);
View Full Code Here

        "http://sharepoint.example.com/List2/AllItems.aspx", dummyWebState);
    dummyWebState.AddOrUpdateListStateInWebState(
        list2, Util.calendarToJoda(Calendar.getInstance()));

    List<SPDocument> list1CrawlQueue = new ArrayList<SPDocument>();
    SPDocument document0 = new SPDocument(
        "LIST_ITEM_1", "http://sharepoint.example.com/List1/DispForm.aspx?ID=1",
        Calendar.getInstance(), ActionType.ADD);
    document0.setParentList(list1);
    list1CrawlQueue.add(document0);
    SPDocument document1 = new SPDocument(
        "LIST_ITEM_2",
        "http://sharepoint.example.com/List1/DispForm.aspx?ID=2",
        Calendar.getInstance(), ActionType.ADD);
    document1.setParentList(list1);
    list1CrawlQueue.add(document1);
    list1.setCrawlQueue(list1CrawlQueue);

    SPDocument document2 = new SPDocument("LIST_ITEM_1_LIST2",
        "http://sharepoint.example.com/List2/DispForm.aspx?ID=1",
        Calendar.getInstance(), ActionType.ADD);
    document2.setParentList(list2);
    List<SPDocument> list2CrawlQueue = new ArrayList<SPDocument>();
    list2CrawlQueue.add(document2);
    list2.setCrawlQueue(list2CrawlQueue);

    SPDocumentList traversalResult =
View Full Code Here

      LOGGER.warning(
          "Unable to get site data. The call to getSiteData returned null.");
      return null;
    }

    final SPDocument siteDataDocument = new SPDocument(webState.getPrimaryKey()
        + SPConstants.DEFAULT_SITE_LANDING_PAGE + SPConstants.DOC_TOKEN
        + sWebMetadata.value.getWebID(),
        webState.getWebUrl() + SPConstants.DEFAULT_SITE_LANDING_PAGE,
        sWebMetadata.value.getLastModified(),
        sWebMetadata.value.getAuthor(), SPConstants.SITE, webState.getTitle(),
        sharepointClientContext.getFeedType(), webState.getSharePointType());
    String strUrl = Util.encodeURL(siteDataDocument.getUrl());
    HttpMethodBase method = new HeadMethod(strUrl);
    try {
      int responseCode =
          sharepointClientContext.checkConnectivity(strUrl, method);
      if (responseCode != 200) {
        LOGGER.log(Level.INFO, "Possible Publishing website. Marking Url [ "
            + strUrl + " ] with Document Type as ACL");
        siteDataDocument.setDocumentType(DocumentType.ACL);
      }
    } catch (final Exception e) {
      LOGGER.log(Level.WARNING, "Unable to connect [ " + strUrl
          + " ] marking site home page as ACL document", e);
      siteDataDocument.setDocumentType(DocumentType.ACL);
    } finally {
      method.releaseConnection();
    }

    return siteDataDocument;
View Full Code Here

TOP

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

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.