示例#1
0
    /**
     * Creates and submits a new request to retrieve the person or group of
     * people selected by the arguments and returns the response from the
     * container as an OpenSocialResponse object.
     *
     * @param  userId OpenSocial ID of the request's target
     * @param  groupId "@self" to fetch the user's profile details or "@friends"
     *         to fetch the user's friend list
     * @throws OpenSocialRequestException if there are any runtime issues with
     *         establishing a RESTful or JSON-RPC connection or parsing the
     *         response that the container returns
     * @throws JSONException
     * @throws OAuthException
     * @throws IOException
     * @throws URISyntaxException
     */
    private OpenSocialResponse fetchPeople(String userId, String groupId)
    {
        if (userId.Equals("") || groupId.Equals(""))
        {
            throw new OpenSocialRequestException("Invalid request parameters");
        }

        OpenSocialRequest r =
            OpenSocialClient.newFetchPeopleRequest(userId, groupId);

        OpenSocialBatch batch = new OpenSocialBatch();

        batch.addRequest(r, "people");

        return(batch.send(this));
    }
示例#2
0
  /**
   * Creates and submits a new request to retrieve the persistent App Data for
   * the person or group of people selected by the arguments for the specified
   * application and returns the response from the container as an
   * OpenSocialResponse object.
   * 
   * @param  userId OpenSocial ID of the request's target
   * @param  groupId "@self" to fetch the user's App Data or "@friends" to
   *         fetch App Data for the user's friends
   * @param  appId The ID of the application to fetch user App Data for
   *         or "@app" for the current application
   * @throws OpenSocialRequestException if there are any runtime issues with
   *         establishing a RESTful or JSON-RPC connection or parsing the
   *         response that the container returns
   * @throws JSONException
   * @throws OAuthException
   * @throws IOException
   * @throws URISyntaxException
   */
  private OpenSocialResponse fetchAppData(
      String userId, String groupId, String appId)
  {

    if (userId.Equals("") || groupId.Equals("") || appId.Equals("")) {
      throw new OpenSocialRequestException("Invalid request parameters");
    }

    OpenSocialRequest r =
        OpenSocialClient.newFetchPersonAppDataRequest(userId, groupId, appId);

    OpenSocialBatch batch = new OpenSocialBatch();
    batch.addRequest(r, "appdata");

    return batch.send(this);
  }