Package com.google.enterprise.connector.otex.client

Examples of com.google.enterprise.connector.otex.client.ClientValue


    // of candidates looking for something applicable.  However,
    // we cannot do this indefinitely or we will run afoul of the
    // Connector Manager's thread timeout.
    TraversalTimer timer = new TraversalTimer(traversalContext);
    while (timer.isTicking()) {
      ClientValue candidates = getCandidates(checkpoint, batchsz);
      ClientValue deletes = getDeletes(checkpoint, batchsz);
      ClientValue results = null;

      int numInserts = (candidates == null) ? 0 : candidates.size();
      int numDeletes = (deletes == null) ? 0 : deletes.size();

      if ((numInserts + numDeletes) == 0) {
        if (checkpoint.hasChanged()) {
          break;      // Force a new checkpoint.
        } else {
          LOGGER.fine("RESULTSET: no rows.");
          return null// No new documents available.
        }
      }

      // Apply the inclusion, exclusions, and permissions to the
      // candidates.
      if (numInserts > 0) {
        if (LOGGER.isLoggable(Level.FINE))
          LOGGER.fine("CANDIDATES SET: " + numInserts + " rows.");

        // Check for bad results from the candidates query.
        checkCandidatesTimeWarp(candidates, checkpoint);

        // Remember the last insert candidate, so we may advance
        // past all the candidates for the next batch.
        Date highestModifyDate =
            candidates.toDate(numInserts - 1, "ModifyDate");
        checkpoint.setAdvanceCheckpoint(highestModifyDate,
            candidates.toInteger(numInserts - 1, "DataID"));

        StringBuilder buffer = new StringBuilder();
        for (int i = 0; i < numInserts; i++) {
          buffer.append(candidates.toInteger(i, "DataID"));
          buffer.append(',');
        }
        buffer.deleteCharAt(buffer.length() - 1);
        results = getResults(buffer.toString(), highestModifyDate);
        numInserts = (results == null) ? 0 : results.size();
      }

      if ((numInserts + numDeletes) > 0) {
        if (LOGGER.isLoggable(Level.FINE)) {
          LOGGER.fine("RESULTSET: " + numInserts + " rows.  " +
View Full Code Here


      // If there's a SQL WHERE condition, we need to consistently
      // run it against WebNodes. Otherwise, DTree is enough here.
      String sqlWhereCondition = connector.getSqlWhereCondition();
      String view =
          (Strings.isNullOrEmpty(sqlWhereCondition)) ? "DTree" : "WebNodes";
      ClientValue matching = getMatching(candidatesList, highestModifyDate,
          false, view, new String[] { "DataID" }, sysadminClient);
      return (matching.size() == 0)
          ? null : getMatchingDescendants(matching, highestModifyDate);
    }
  }
View Full Code Here

        return doc;
      }
      String view = "(select b.*, "
          + "case when DataSize < 0 then 0 else DataSize end as GoogleDataSize "
          + "from WebNodes b)";
      ClientValue node = traversalClient.ListNodes("DataID = " + docid,
                                                   view, SELECT_LIST);
      if (node == null || node.size() == 0) {
        throw new RepositoryDocumentException("Not found: " + docid);
      }
      doc = new AgingDocument(objid);
      // Collect the recarray-based properties.
      for (int i = 0; i < FIELDS.length; i++) {
        if (FIELDS[i].propertyNames.length > 0) {
          ClientValue value = node.toValue(0, FIELDS[i].fieldName);
          if (value.isDefined()) {
            doc.addProperty(FIELDS[i], value);
          }
        }
      }
      documentCache.put(objid, doc);
View Full Code Here

        ancestorNodes = null;
      } else {
        ancestorNodes = Genealogist.getAncestorNodes(startNodes);
      }

      ClientValue results = sqlQueries.execute(client, "AUTHORIZATION QUERY",
          "LivelinkAuthorizationManager.addAuthorizedDocids",
          /* 0 */ docids,
          /* 1 */ choice(undeleteVolumeId != 0), undeleteVolumeId,
          /* 3 */ choice(workflowVolumeId != 0), -workflowVolumeId,
          /* 5 */ choice(!showHiddenItems), Client.DISPLAYTYPE_HIDDEN,
          /* 7 */ choice(!Strings.isNullOrEmpty(startNodes)), startNodes,
          /* 9 */ ancestorNodes);
      for (int i = 0; i < results.size(); i++)
        authorized.add(creator.fromString(results.toString(i, "DataID")));
    }
  }
View Full Code Here

    return false;
  }

  private int getNodeId(String label, Client client, Object... parameters)
      throws RepositoryException {
    ClientValue results = sqlQueries.execute(client, null,
        "LivelinkAuthorizationManager.getExcludedVolumeId", parameters);
    if (results.size() > 0) {
      int volumeId = results.toInteger(0, "DataID");
      if (LOGGER.isLoggable(Level.FINEST))
        LOGGER.finest("EXCLUDING " + label + " VOLUME: " + volumeId);
      return volumeId;
    } else
      return 0;
View Full Code Here

     *
     * @return the cookie value
     * @throws RepositoryException if the cookie is not set
     */
    private String getLLCookie() throws RepositoryException {
        ClientValue cookies = client.GetCookieInfo();
        for (int i = 0; i < cookies.size(); i++) {
            ClientValue cookie = cookies.toValue(i);
            if ("LLCookie".equalsIgnoreCase(cookie.toString("Name"))) {
                return cookie.toString("Value");
            }
        }
        throw new RepositoryException("Missing LLCookie");
    }
View Full Code Here

  private String getCurrentUsername(Client client) {
    String username = null;
    try {
      int id = client.GetCurrentUserID();
      ClientValue userInfo = client.GetUserOrGroupByIDNoThrow(id);
      if (userInfo != null)
        username = userInfo.toString("Name");
    } catch (RepositoryException e) {
      // Ignore exceptions, which is conservative. Worst case is
      // that we will impersonate the already logged in user
      // and gratuitously check the permissions on all content.
    }
View Full Code Here

    int id = idValue.toInteger();
    if (id == 0)
      return;

    // Check the userName cache (if we recently looked up this user).
    ClientValue userName = userNameCache.get(new Integer(id));
    if (userName == null) {
      // User is not in the cache, get the name from the server.
      ClientValue userInfo = client.GetUserOrGroupByIDNoThrow(id);
      if (userInfo != null)
        userName = userInfo.toValue("Name");
      if (userName == null || !userName.isDefined()) {
        if (LOGGER.isLoggable(Level.WARNING)) {
          LOGGER.warning("No user or group name found for ID " + id);
        }
        return;
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public synchronized ClientValue ListNodes(String query, String view,
      String[] columns) throws RepositoryException {
    ClientValue recArray = listNodesHelper(query, view, columns);
    if (recArray == null)
      throw new LapiException(session, LOGGER);
    return recArray;
  }
View Full Code Here

   * http://code.google.com/p/google-enterprise-connector-otex/issues/detail?id=51
   */
  @Override
  public synchronized ClientValue ListNodesNoThrow(String query, String view,
      String[] columns) throws RepositoryException {
    ClientValue recArray = listNodesHelper(query, view, columns);
    if (recArray == null) {
      // Only log an unexpected error. At FINEST, log the actual
      // error so that we don't miss something.
      if (session.getStatus() != 106601)
        LOGGER.warning(LapiException.buildMessage(session));
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.otex.client.ClientValue

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.