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

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


   * @return a {@link Container}
   * @throws MalformedURLException
   */
  private Container getSiteCollectionContainer(String strUrl)
      throws MalformedURLException {
    Container container = new Container();
    container.setType(ContainerType.NA);

    String webapp = Util.getWebApp(strUrl);
    Set<String> siteCollUrlPaths = webappToSiteCollections.get(webapp);
    if (null != siteCollUrlPaths) {
      String path = new URL(strUrl).getPath();
      if (null == path || path.length() == 0) {
        container.setUrl(webapp);
        container.setType(ContainerType.SITE_COLLECTION);
      } else {
        for (String siteCollUrlPath : siteCollUrlPaths) {
          if (path.startsWith(siteCollUrlPath)) {
            container.setUrl(webapp + siteCollUrlPath);
            container.setType(ContainerType.SITE_COLLECTION);
            break;
          }
        }
      }
    }
View Full Code Here


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

    try {
      complexDocId = URLDecoder.decode(complexDocId, "UTF-8");
    } catch (final UnsupportedEncodingException e1) {
      LOGGER.log(Level.WARNING, "Unable to Decode!", e1);
    }
    final Container container = new Container();
    StringTokenizer strTok;
    String URL;
    String DocID = null;
    // In case of meta URL feed, separate list URL from the docID using
    // "?" as a delimiter.
    if (complexDocId.indexOf(SPConstants.EQUAL_TO) != -1) {
      strTok = new StringTokenizer(complexDocId, "?");
      URL = strTok.nextToken();
      String tempDocID = strTok.nextToken();
      // to remove "ID=" from docID.
      DocID = tempDocID.substring(3);
    } else {
      // This change in case of content feed.
      strTok = new StringTokenizer(complexDocId, SPConstants.DOC_TOKEN);
      URL = strTok.nextToken();
      if (strTok.hasMoreElements()) {
        DocID = strTok.nextToken();
      }
    }

    if (URL != null && URL.endsWith(SPConstants.DEFAULT_SITE_LANDING_PAGE)) {
      // 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);
View Full Code Here

TOP

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

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.