Package com.google.enterprise.connector.dctm.dfcwrap

Examples of com.google.enterprise.connector.dctm.dfcwrap.ICollection


          "select r_type_name from dmi_type_info where any r_supertype = '"
          + rootType + "'";
      logger.config("queryString: " + queryString);
      que.setDQL(queryString);

      ICollection collec = que.execute(sess, IQuery.EXECUTE_READ_QUERY);
      while (collec.next()) {
        types.add(collec.getString("r_type_name"));
      }

      try {
        if (collec.getState() != ICollection.DF_CLOSED_STATE) {
          collec.close();
          logger.fine("collection closed");
        }
      } catch (RepositoryException re1) {
        logger.severe("Error while closing " + re1);
      }
View Full Code Here


        DmInitialize.included_meta, sessionManager);

    query = dctmClientX.getQuery();
    query.setDQL("select i_chronicle_id, r_object_id, r_modify_date from "
        + "dm_sysobject where folder('/test_docs/GoogleDemo',descend)");
    ICollection collec = query.execute(session, IQuery.READ_QUERY);
    documentList = new DctmDocumentList(traversalManager, session, collec,
        collec, new Checkpoint(Collections.<String>emptyList()));
  }
View Full Code Here

    ISession session = sessionManager.getSession(DmInitialize.DM_DOCBASE);
    try {
      Assert.assertNotNull(query);
      Assert.assertTrue(query instanceof DmQuery);
      query.setDQL(DmInitialize.DM_QUERY_STRING_ENABLE);
      ICollection collec = query.execute(session, IQuery.READ_QUERY);
      Assert.assertNotNull(collec);
    } finally {
      sessionManager.release(session);
    }
  }
View Full Code Here

  private List<AuthorizationResponse> getAuthorizedDocids(
      Collection<String> docids, IQuery query, ISession sessionUser)
      throws RepositoryException {
    List<AuthorizationResponse> authorized;
    ICollection collec = query.execute(sessionUser, IQuery.READ_QUERY);
    try {
      ArrayList<String> object_id = new ArrayList<String>(docids.size());
      while (collec.next()) {
        object_id.add(collec.getString("i_chronicle_id"));
      }
      authorized = new ArrayList<AuthorizationResponse>(docids.size());
      for (String id : docids) {
        boolean isAuthorized = object_id.contains(id);
        logger.info("id " + id + " hasRight? " + isAuthorized);
        authorized.add(new AuthorizationResponse(isAuthorized, id));
      }
    } finally {
      collec.close();
      logger.finest("after collec.close");
    }
    return authorized;
  }
View Full Code Here

          }

          // If we are deleting the last version of a document, remove it
          // from the index.  If we may be deleting the latest version of
          // the document, force the new latest version to be re-indexed.
          ICollection versions = null;
          try {
            versions = getCurrentVersion(chronicleId);
            if (versions != null && versions.next()) {
              ITime lastModify = versions.getTime("r_modify_date");
              if (lastModify.getDate().before(deleteDate.getDate())) {
                // We may have deleted the latest version, so refeed the
                // current latest version.
                dctmSysobjectDocument = new DctmSysobjectDocument(
                    traversalManager, session,
                    versions.getString("r_object_id"), chronicleId,
                    lastModify, SpiConstants.ActionType.ADD, checkpoint);
                logger.fine("Creation of a new dctmSysobjectDocument to "
                            + "resubmit newest version of deleted item: "
                            + chronicleId);
              } else {
                // Skip this doc.
                logger.fine("Skipping delete of old version: " + chronicleId);
                continue;
              }
            } else {
              // No more versions of the document remain.
              // Delete the document from the index.
              dctmSysobjectDocument = new DctmSysobjectDocument(
                  traversalManager, session,
                  collectionToDel.getString("audited_obj_id"), chronicleId,
                  deleteDate, SpiConstants.ActionType.DELETE, checkpoint);
              logger.fine("Creation of a new dctmSysobjectDocument to delete: "
                          + chronicleId);
            }
          } finally {
            if (versions != null) {
              versions.close();
            }
          }
          // Handled this version in this batch.
          deletedIds.add(chronicleId);
          retDoc = dctmSysobjectDocument;
View Full Code Here

      }
      queryBuff.append("'");

      IQuery query = clientX.getQuery();
      query.setDQL(queryBuff.toString());
      ICollection users = query.execute(session, IQuery.EXECUTE_READ_QUERY);
      try {
        // The DQL query can only confirm partial matches, and not
        // exact matches. For brevity, we loop over all the users in
        // case we want to log them, and we check domainName.isEmpty()
        // on each iteration.
        ArrayList<String> matches = new ArrayList<String>();
        while (users.next()) {
          String userLdapDn = users.getString("user_ldap_dn");
          if (domainName.isEmpty()
              || domainMatchesUser(domainName, userLdapDn)) {
            matches.add(users.getString("user_name"));
          } else if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("Rejecting non-matching domain " + domainName
                + " for user " + userLdapDn);
          }
        }
        if (matches.size() == 1) {
          return matches.get(0);
        } else {
          LOGGER.log(Level.FINER, "No users or multiple users found: {0}",
              matches);
          return null;
        }
      } finally {
        users.close();
      }
    } finally {
      sessionManager.release(session);
    }
  }
View Full Code Here

      String queryStr =
          "select group_name from dm_group where any i_all_users_names = '"
          + username + "'";
      IQuery query = clientX.getQuery();
      query.setDQL(queryStr);
      ICollection collecGroups = query.execute(session,
          IQuery.EXECUTE_READ_QUERY);
      try {
        while (collecGroups.next()) {
          String groupName = collecGroups.getString("group_name");
          String groupNamespace = getGroupNamespace(session, groupName);
          if (groupNamespace != null) {
            listGroups.add(new Principal(PrincipalType.UNKNOWN, groupNamespace,
                    groupName, CaseSensitivityType.EVERYTHING_CASE_SENSITIVE));
          } else {
            LOGGER.warning("Skipping group " + groupName
                + " with null namespace");
          }
        }
        // process special group dm_world
        listGroups.add(new Principal(PrincipalType.UNKNOWN,
                connector.getGoogleLocalNamespace(), "dm_world",
                CaseSensitivityType.EVERYTHING_CASE_SENSITIVE));
      } finally {
        collecGroups.close();
      }
    } finally {
      sessionManager.release(session);
    }
View Full Code Here

    dql.append(" ENABLE (row_based)");

    IQuery query = traversalManager.getClientX().getQuery();
    query.setDQL(dql.toString());
    try {
      ICollection collec = query.execute(session, IQuery.READ_QUERY);
      try {
        while (collec.next()) {
          values.add(
              Value.getStringValue(collec.getString("r_folder_path")));
        }
      } finally {
        collec.close();
      }
    } catch (RepositoryException e) {
      // Note that we're catching RepositoryException here, because
      // we're using ICollection and not ISysObject.
      logger.warning("RepositoryException thrown: " + e
View Full Code Here

      IQuery query = dctmClientX.getQuery();
      Assert.assertNotNull(query);
      Assert.assertTrue(query instanceof DmQuery);
      query.setDQL(DmInitialize.DM_QUERY_STRING_ENABLE);
      ICollection collec = query.execute(session, IQuery.READ_QUERY);
      Assert.assertNotNull(collec);
    } finally {
      if (session != null)
        sessionManager.release(session);
    }
View Full Code Here

   * @return DocumentList of traversal results.
   * @throws RepositoryException
   */
  /* @VisibleForTesting */
  DocumentList execQuery(Checkpoint checkpoint) throws RepositoryException {
    ICollection collecAclToAdd = null;
    ICollection collecToAdd = null;
    ICollection collecToDel = null;
    ICollection collecAclToModify = null;
    ISession session = null;

    DocumentList documentList = null;

    try {
      session = sessionManager.getSession(docbase);

      if (checkpoint.getInsertIndex() == -1) {
        logger.fine("Processing Acls");
        IQuery queryAclToAdd = buildACLQuery(checkpoint);
        collecAclToAdd = queryAclToAdd.execute(session,
            IQuery.EXECUTE_READ_QUERY);
        logger.fine("execution of the query returns a collection of ACLs"
            + " to add");

        IQuery queryAclToModify = buildAclModifyQuery(checkpoint);
        collecAclToModify = queryAclToModify.execute(session,
            IQuery.EXECUTE_READ_QUERY);
        logger.fine("execution of the query returns a collection of ACLs"
            + " to modify");

        if ((collecAclToAdd != null && collecAclToAdd.hasNext())
            || (collecAclToModify != null && collecAclToModify.hasNext())) {
          documentList = new DctmAclList(this, session, collecAclToAdd,
              collecAclToModify, checkpoint);
        }
      } else {
        logger.fine("Processing Documents");
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.dctm.dfcwrap.ICollection

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.