Package com.google.enterprise.connector.sharepoint.generated.gsbulkauthorization

Examples of com.google.enterprise.connector.sharepoint.generated.gsbulkauthorization.AuthData


    for (Object docId : docIDs) {
      final String complexDocId = (String) docId;
      if (Strings.isNullOrEmpty(complexDocId)) {
        continue;
      }
      AuthData authData = null;
      try {
        authData = createAuthDataFromComplexDocId(complexDocId);
      } catch (Exception e) {
        LOGGER.log(Level.WARNING, "Parsing failure! Skipping DocId [ "
            + complexDocId + " ] ", e);
        continue;
      }
      if (null == authData) {
        continue;
      }

      final String webApp = Util.getWebApp(authData.getContainer().getUrl());
      Map<Container, Set<AuthData>> siteCollMap = sortedDocuments.get(webApp);
      if (null == siteCollMap) {
        siteCollMap = new HashMap<Container, Set<AuthData>>();
        sortedDocuments.put(webApp, siteCollMap);
      }

      Container siteCollContainer = null;
      try {
        siteCollContainer = getSiteCollectionContainer(authData.getContainer().getUrl());
      } catch (MalformedURLException e) {
        LOGGER.log(Level.WARNING, "Skipping DocId [ "
            + authData.getComplexDocId() + " ] ", e);
        continue;
      }
      Set<AuthData> authDataSet = siteCollMap.get(siteCollContainer);
      if (null == authDataSet) {
        authDataSet = new HashSet<AuthData>();
View Full Code Here


      // If the URL ends with default.aspx, the container type should be SITE.
      container.setType(ContainerType.SITE);
    } else {
      container.setType(ContainerType.LIST);
    }
    final AuthData authData = new AuthData();
    authData.setContainer(container);

    boolean isAttachment = false;

    try {
      Integer.parseInt(DocID);
      authData.setType(EntityType.LISTITEM);
    } catch (final Exception e) {
      if (URL.endsWith(SPConstants.DEFAULT_SITE_LANDING_PAGE)) {
        authData.setType(EntityType.SITE);
      } else {
        if (!URL.endsWith(SPConstants.ASPX)) {
          authData.setType(EntityType.LISTITEM);
        } else {
          authData.setType(EntityType.LIST);
        }
      }
    }

    // Fix me: Get the details of Attachments and Alert URLs in case of
    // Meta and URL feed mode and find away to get required information
    // to authorize.

    if (FeedType.CONTENT_FEED == sharepointClientContext.getFeedType()) {
      final Matcher match = SPConstants.ATTACHMENT_SUFFIX_PATTERN.matcher(URL);
      if (match.find()) {
        URL = match.group(2);
        isAttachment = true;
      } else if (URL.startsWith(SPConstants.ALERT_SUFFIX_IN_DOCID)) {
        URL = URL.substring(SPConstants.ALERT_SUFFIX_IN_DOCID.length());
        if (URL.endsWith("_" + SPConstants.ALERTS_TYPE)) {
          URL = URL.substring(0, URL.length()
              - (1 + SPConstants.ALERTS_TYPE.length()));
        }
        container.setType(ContainerType.SITE);
        authData.setType(EntityType.ALERT);
      }
    } else {
      Matcher match = SPConstants.ATTACHMENT_URL_PATTERN.matcher(URL);
      if (match.find()) {
        isAttachment = true;
        DocID = match.group(2);
        URL = match.group(1) + "/AllItems.aspx";
        container.setType(ContainerType.LIST);
        authData.setType(EntityType.LISTITEM);
      } else if (complexDocId.contains(SPConstants.ALERTS_EQUALTO)) {
        DocID = DocID.substring(4, DocID.indexOf("}"));
        URL = URL.substring(0, URL.indexOf("_layouts"));
        container.setType(ContainerType.SITE);
        authData.setType(EntityType.ALERT);
      }
    }
    container.setUrl(URL);

    if (isAttachment) {
      AttachmentKey attachmentKey = new AttachmentKey(URL, DocID);
      if (attachments.containsKey(attachmentKey)) {
        attachments.get(attachmentKey).add(originalComplexDocId);
        return null;
      } else {
        attachments.put(attachmentKey, new LinkedList<String>());
      }
    }

    authData.setItemId(DocID);
    authData.setComplexDocId(originalComplexDocId);

    return authData;
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.sharepoint.generated.gsbulkauthorization.AuthData

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.