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

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


    for (int i = 0; i < groupMembers.size(); i++) {
      String memberName = groupMembers.toString(i, "Name");
      int memberType = groupMembers.toInteger(i, "Type");
      LOGGER.log(Level.FINER, "Member name: {0} ; Member Type: {1}",
          new Object[] {memberName, memberType});
      ClientValue memberUserData = groupMembers.toValue(i, "UserData");
      String memberNamespace = identityUtils.getNamespace(memberUserData);
      if (memberType == Client.USER) {
        memberPrincipals.add(new UserPrincipal(memberName, memberNamespace));
      } else if (memberType == Client.GROUP) {
        memberPrincipals.add(new GroupPrincipal(memberName, memberNamespace));
View Full Code Here


  private Map<GroupPrincipal, List<Principal>> getLivelinkGroups()
      throws RepositoryException {
    Map<GroupPrincipal, List<Principal>> groups =
        new LinkedHashMap<GroupPrincipal, List<Principal>>();

    ClientValue groupsValue = client.ListGroups();
    for (int i = 0; i < groupsValue.size(); i++) {
      String groupName = groupsValue.toString(i, "Name");
      LOGGER.log(Level.FINER, "Fetching group members for group name: {0}",
          groupName);
      ClientValue groupUserData = groupsValue.toValue(i, "UserData");
      String groupNamespace = identityUtils.getNamespace(groupUserData);
      GroupPrincipal groupPrincipal =
          new GroupPrincipal(groupName, groupNamespace);

      ClientValue groupMembers = client.ListMembers(groupName);
      List<Principal> memberPrincipals = getMemberPrincipalList(groupMembers);
      groups.put(groupPrincipal, memberPrincipals);
      LOGGER.log(Level.FINER, "Group principal: {0} ; Member principals: {1}",
          new Object[] {groupPrincipal, memberPrincipals});
    }
View Full Code Here

    // because of the added "a" range variable on the join expression.
    // The "b" range variable is only for clarity. N.B.: The minus
    // sign must be on the correlated column (a.DataID) and not
    // b.DataID, or Oracle will avoid using an index.
    queryCount++;
    ClientValue parents = sqlQueries.execute(client, null,
        "HybridGenealogist.getParents", objectIds);
    return new Parents(parents);
  }
View Full Code Here

    // which specifies the kind of object being looked up
    // (there's only one legal value currently) and
    // Version, which specifies which version of the
    // object to use (the default is the current
    // version).
    ClientValue objIdAssoc = valueFactory.createAssoc();
    objIdAssoc.add("ID", objectId);
    ClientValue categoryIds = client.ListObjectCategoryIDs(objIdAssoc);

    // Loop over the categories.
    int numCategories = categoryIds.size();
    for (int i = 0; i < numCategories; i++) {
      ClientValue categoryId = categoryIds.toValue(i);

      // If this Category is not in the included list, or it is
      // explicitly mentioned in the excluded list, then skip it.
      Integer id = new Integer(categoryId.toInteger("ID"));
      if (((includedCategories != null) &&
              !includedCategories.contains(id)) ||
          ((excludedCategories != null) &&
              excludedCategories.contains(id)))
        continue;

      // Make sure we know what type of categoryId
      // object we have. There are also Workflow
      // category attributes which can't be read here.
      int categoryType = categoryId.toInteger("Type");
      if (Client.CATEGORY_TYPE_LIBRARY != categoryType) {
        if (LOGGER.isLoggable(Level.FINER)) {
          LOGGER.finer("Unknown category implementation type " +
              categoryType + "; skipping");
        }
        continue;
      }

      if (includeCategoryNames) {
        // XXX: This is the only property name that is
        // hard-coded here like this. I think that's OK,
        // because the recarray fields are just hard-coded
        // someplace else. "Category" is an ObjectInfo
        // attribute name that is unused in Livelink 9.0 or
        // later.
        ClientValue name = categoryId.toValue("DisplayName");
        if (name.hasValue())
          props.addProperty("Category", name);
      }

      ClientValue categoryVersion =
          client.GetObjectAttributesEx(objIdAssoc, categoryId);
      ClientValue attrNames =
          client.AttrListNames(categoryVersion, null);

      // Loop over the attributes for this category.
      int numAttributes = attrNames.size();
      for (int j = 0; j < numAttributes; j++) {
        String attrName = attrNames.toString(j);
        ClientValue attrInfo =
            client.AttrGetInfo(categoryVersion, attrName, null);
        int attrType = attrInfo.toInteger("Type");
        if (Client.ATTR_TYPE_SET == attrType) {
          getAttributeSetValues(nameHandler, props, id, categoryVersion,
              attrName);
        } else {
          getAttributeValue(nameHandler, props, id, categoryVersion,
View Full Code Here

  private void getAttributeSetValues(UserNameHandler nameHandler,
      LivelinkDocument props, Integer id, ClientValue categoryVersion,
      String attrName) throws RepositoryException {
    // The "path" indicates the set attribute name to look
    // inside of in other methods like AttrListNames.
    ClientValue attrSetPath = valueFactory.createList();
    attrSetPath.add(attrName);

    // Get a list of the names of the attributes in the
    // set. Look up and store the types to avoid repeating
    // the type lookup when there's more than one instance of
    // the attribute set.
    ClientValue attrSetNames =
        client.AttrListNames(categoryVersion, attrSetPath);

    ClientValue[] attrInfo = new ClientValue[attrSetNames.size()];
    for (int i = 0; i < attrSetNames.size(); i++) {
      String name = attrSetNames.toString(i);
      attrInfo[i] = client.AttrGetInfo(categoryVersion, name, attrSetPath);
    }

    // List the values for the set attribute itself. There
    // may be multiple instances of the set.
    ClientValue setValues =
        client.AttrGetValues(categoryVersion, attrName, null);

    // Update the path to hold index of the set instance.
    attrSetPath.setSize(2);
    int numSets = setValues.size();
    for (int i = 0; i < numSets; i++) {
      attrSetPath.setInteger(1, i);
      // For each instance (row) of the attribute set, loop
      // over the attribute names.
      for (int j = 0; j < attrSetNames.size(); j++) {
View Full Code Here

      }
    }

    //System.out.println("getAttributeValue: attrName = " + attrName);

    ClientValue attrValues =
        client.AttrGetValues(categoryVersion, attrName, attrSetPath);

    // Even a simple attribute type can have multiple values
    // (displayed as rows in the Livelink UI).
    int numValues = attrValues.size();
    if (numValues == 0)
      return;

    // System.out.println("getAttributeValue: numValues = " +
    // numValues);

    for (int k = 0; k < numValues; k++) {
      ClientValue value = attrValues.toValue(k);
      // Avoid errors if the attribute hasn't been set.
      if (!value.hasValue())
        continue;
      // System.out.println("getAttributeValue: k = " + k +
      // " ; value = " + value.toString2());
      if (Client.ATTR_TYPE_USER == attrType)
        nameHandler.addUserByName(attrName, value, props);
View Full Code Here

    // parent of the related node (with a negated object ID) in the
    // case of volumes such as projects. The query can return 0, 1, or
    // 2 results, since we are asking for the parents of two nodes,
    // one or both of which might not exist.
    queryCount++;
    ClientValue parent = sqlQueries.execute(client, null,
        "Genealogist.getParent", objectId, -objectId);
    switch (parent.size()) {
      case 0:
        // The nodes do not exist.
        logOrphans(matchingId, objectId);
        return null;
      case 1:
        // The usual case.
        return parent.toInteger(0, "ParentID");
      case 2:
        // Both nodes exist, so one is a volume with a parent of -1.
        // Return the other one.
        if (parent.toInteger(0, "ParentID") != -1) {
          return parent.toInteger(0, "ParentID");
        } else {
          return parent.toInteger(1, "ParentID");
        }
      default:
        throw new AssertionError(String.valueOf(parent.size()));
    }
  }
View Full Code Here

            // Verify connectivity by calling GetServerInfo, just like
            // LivelinkConnector.login does.
            // TODO: We will want to use GetCookieInfo when we need to
            // return the client data. Until then, GetServerInfo is
            // faster.
            ClientValue serverInfo = client.GetServerInfo();
            if (LOGGER.isLoggable(Level.FINE))
              LOGGER.fine("AUTHENTICATED: " + username + ": " +
                serverInfo.hasValue());
            return new AuthenticationResponse(serverInfo.hasValue(), null);
        } catch (RepositoryException e) {
            LOGGER.warning("Authentication failed for " +
                username + "; " + e.getMessage());
            throw e;
        }
View Full Code Here

    if (servtype == null) {
      // Autodetection of the database type. First, ferret out
      // generic errors when connecting or using ListNodes.
      String view = "DTree";
      String[] columns = { "DataID" };
      ClientValue results = client.ListNodes("0=1", view, columns);

      // Then check an Oracle-specific query.
      // We use ListNodesNoThrow() to avoid logging our expected error.
      LOGGER.finest("Testing an Oracle-specific SQL query...");
      results = client.ListNodesNoThrow("0=1 and rownum=1", view, columns);
View Full Code Here

   * to give a false positive. Also, this method does not select
   * PermID, or even use the DTree table at all.
   */
  private void validateDTreeAncestors(Client client)
      throws RepositoryException {
    ClientValue ancestors = sqlQueries.execute(client, null,
        "LivelinkConnector.validateDTreeAncestors");
    if (ancestors.size() > 0) {
      LOGGER.finest("The Livelink DTreeAncestors table is not empty");
    } else {
      throw new LivelinkException(
          "The Livelink DTreeAncestors table is empty. Please make " +
          "sure that the Livelink Recommender agent is enabled.",
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.