Esempio n. 1
0
 /**
  * Wrapper method to send Invite to a user to become colleague
  *
  * @param profile profile of the user to whom the invite is to be sent
  * @param inviteMsg Invite message to the other user
  * @return value is true if invite is sent successfully else value is false
  * @throws ProfileServiceException
  */
 public boolean sendInvite(Profile profile, String inviteMsg) throws ProfileServiceException {
   if (logger.isLoggable(Level.FINEST)) {
     logger.entering(sourceClass, "getColleagues", inviteMsg);
   }
   if (profile == null) {
     throw new IllegalArgumentException(StringUtil.format("A null profile was passed"));
   }
   Map<String, String> parameters = new HashMap<String, String>();
   String url =
       resolveProfileUrl(
           ProfileEntity.NONADMIN.getProfileEntityType(),
           ProfileType.CONNECTIONS.getProfileType());
   if (isEmail(profile.getReqId())) {
     parameters.put(ProfileRequestParams.EMAIL, profile.getReqId());
   } else {
     parameters.put(ProfileRequestParams.USERID, profile.getReqId());
   }
   parameters.put("connectionType", "colleague");
   XMLProfilesPayloadBuilder builder = XMLProfilesPayloadBuilder.INSTANCE;
   Object content = builder.generateInviteRequestPayload(inviteMsg);
   // getClientService().post(url, parameters, content);
   boolean result = executePost(url, parameters, null, content, null);
   if (logger.isLoggable(Level.FINEST)) {
     logger.exiting(sourceClass, "getColleagues");
   }
   return result;
 }
Esempio n. 2
0
  /**
   * Wrapper method to accept a Invite
   *
   * @param connectionId unique id of the connection
   * @param title message to the other user
   * @param content message to the other user
   * @return if invite is accepted then return true
   * @throws ProfileServiceException
   */
  public boolean acceptInvite(String connectionId, String title, String content)
      throws ProfileServiceException {
    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "acceptInvite", connectionId);
    }

    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(ProfileRequestParams.CONNECTIONID, connectionId);
    String url =
        resolveProfileUrl(
            ProfileEntity.NONADMIN.getProfileEntityType(), ProfileType.CONNECTION.getProfileType());

    XMLProfilesPayloadBuilder builder = XMLProfilesPayloadBuilder.INSTANCE;
    Object payload = builder.generateAcceptInvitePayload(connectionId, title, content);
    boolean result = executePut(url, parameters, null, payload, null);
    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "acceptInvite");
    }
    return result;
  }