Beispiel #1
0
  /**
   * Wrapper method to get a list of pending invites for a user
   *
   * @param parameters list of query string parameters to pass to API
   * @return Collection<ConnectionEntry>
   * @throws ProfileServiceException
   */
  private Collection<ConnectionEntry> getMyInvites(Map<String, String> parameters)
      throws ProfileServiceException {
    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "getMyInvites", parameters);
    }

    Document data = null;
    Collection<ConnectionEntry> invites = null;
    String url =
        resolveProfileUrl(
            ProfileEntity.NONADMIN.getProfileEntityType(),
            ProfileType.CONNECTIONS.getProfileType());
    data = executeGet(url, parameters, ClientService.FORMAT_XML);
    if (parameters.containsKey("outputType")) {
      if (parameters.get("outputType").equalsIgnoreCase("profile")) {
        invites = Converter.returnConnectionEntries(data, "profile");
      } else invites = Converter.returnConnectionEntries(data, "connection");
    } else {
      invites = Converter.returnConnectionEntries(data, "connection");
    }
    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "getMyInvites");
    }
    return invites;
  }
Beispiel #2
0
  /**
   * Wrapper method to get common colleagues of two users
   *
   * @param sourceId userid or email of first user
   * @param targetId userid or email of second user
   * @return Collection<ConnectionEntry>
   * @throws ProfileServiceException
   */
  private Collection<ConnectionEntry> getColleaguesInCommon(
      String sourceId, String targetId, Map<String, String> parameters)
      throws ProfileServiceException {

    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "checkColleague");
    }
    if (StringUtil.isEmpty(sourceId)) {
      throw new IllegalArgumentException(Messages.InvalidArgument_4);
    }
    if (StringUtil.isEmpty(targetId)) {
      throw new IllegalArgumentException(Messages.InvalidArgument_5);
    }
    Document data = null;
    if (parameters == null) {
      parameters = new HashMap<String, String>();
    }
    String url =
        resolveProfileUrl(
            ProfileEntity.NONADMIN.getProfileEntityType(),
            ProfileType.CONNECTIONS_IN_COMMON.getProfileType());
    if (isEmail(sourceId)) {
      StringBuilder value = new StringBuilder(sourceId);
      value = value.append(",").append(targetId);
      parameters.put(ProfileRequestParams.EMAIL, value.toString());
    } else {

      StringBuilder value = new StringBuilder(sourceId);
      value = value.append(",").append(targetId);
      parameters.put(ProfileRequestParams.USERID, value.toString());
    }
    parameters.put("connectionType", "colleague");

    data = executeGet(url, parameters, ClientService.FORMAT_XML);
    Collection<ConnectionEntry> colleaguesInCommon =
        Converter.returnConnectionEntries(data, "connectionEntry");

    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "getColleagues");
    }
    return colleaguesInCommon;
  }
Beispiel #3
0
  /**
   * Wrapper method to get check if two users are colleagues
   *
   * @param sourceId userid or email of first user
   * @param targetId userid or email of second user
   * @param parameters list of query string parameters to pass to API
   * @return ConnectionEntry
   * @throws ProfileServiceException
   */
  private ConnectionEntry checkColleague(
      String sourceId, String targetId, Map<String, String> parameters)
      throws ProfileServiceException {

    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "checkColleague");
    }
    if (StringUtil.isEmpty(sourceId)) {
      throw new IllegalArgumentException(Messages.InvalidArgument_4);
    }
    if (StringUtil.isEmpty(targetId)) {
      throw new IllegalArgumentException(Messages.InvalidArgument_5);
    }
    Document data = null;
    if (parameters == null) {
      parameters = new HashMap<String, String>();
    }
    String url =
        resolveProfileUrl(
            ProfileEntity.NONADMIN.getProfileEntityType(), ProfileType.CONNECTION.getProfileType());
    if (isEmail(sourceId)) {
      parameters.put(ProfileRequestParams.SOURCEEMAIL, sourceId);
    } else {
      parameters.put(ProfileRequestParams.SOURCEUSERID, sourceId);
    }
    if (isEmail(targetId)) {
      parameters.put(ProfileRequestParams.TARGETEMAIL, targetId);
    } else {
      parameters.put(ProfileRequestParams.TARGETUSERID, targetId);
    }
    parameters.put("connectionType", "colleague");

    data = executeGet(url, parameters, ClientService.FORMAT_XML);
    ConnectionEntry connection =
        Converter.returnConnectionEntries(data, "connectionEntry").iterator().next();

    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "getColleagues");
    }
    return connection;
  }