Package com.ibm.sbt.services.client

Examples of com.ibm.sbt.services.client.Response


    parameters.put(OUTPUT, VCARD);
    parameters.put(FORMAT, FULL);
    String id = profile.getUserid();
    Object updateProfilePayload = constructUpdateRequestBody(profile);
    String updateUrl = ProfileUrls.ADMIN_PROFILE_ENTRY.format(this, ProfileParams.userId.get(id));
    Response response = updateData(updateUrl, parameters,updateProfilePayload, ProfileParams.userId.getParamName(profile.getAsString("uid")));
    checkResponseCode(response, HTTPCode.OK);
    profile.clearFieldsMap();
  }
View Full Code Here


     * @throws BssException
     */
    public void suspendCustomer(String customerId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_CUSTOMER_CUSTOMERID.format(this, BssUrls.customerId(customerId));
        Response response = createData(serviceUrl, (Map<String, String>)null, SuspendCustomerHeader, (Object)null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error suspending customer {0}", customerId);
        }
    } catch (Exception e) {
      throw new BssException(e, "Error suspending customer {0} caused by {1}", customerId, e.getMessage());     
View Full Code Here

     * @throws BssException
     */
    public void unsuspendCustomer(String customerId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_CUSTOMER_CUSTOMERID.format(this, BssUrls.customerId(customerId));
        Response response = createData(serviceUrl, (Map<String, String>)null, UnsuspendCustomerHeader, (Object)null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error suspending customer {0}", customerId);
        }
    } catch (Exception e) {
      throw new BssException(e, "Error unsuspending customer {0} caused by {1}", customerId, e.getMessage());     
View Full Code Here

     * @throws IOException
     */
    public JsonJavaObject registerCustomer(JsonJavaObject customerObject) throws BssException {
    try {
        String serviceUrl = BssUrls.API_RESOURCE_CUSTOMER.format(this);
      Response serverResponse = createData(serviceUrl, null, JsonHeader, customerObject, ClientService.FORMAT_JSON);
      return (JsonJavaObject)serverResponse.getData();
    } catch (Exception e) {
      throw new BssException(e, "Error registering customer {0} caused by {1}", customerObject, e.getMessage());
    }
    }
View Full Code Here

     * @throws BssException
     */
    public String[] getRoles(String loginName) throws BssException {
      try {
      String serviceUrl = BssUrls.API_AUTHORIZATION_GETROLELIST.format(this, new NamedUrlPart("loginName", loginName));
      Response serverResponse = createData(serviceUrl, null, null, null, ClientService.FORMAT_JSON);
     
      JsonJavaObject rolesObject = (JsonJavaObject)serverResponse.getData();
      List<Object> roles = rolesObject.getAsList(PROPERTY_LIST);
      return (String[])roles.toArray(new String[roles.size()]);
    } catch (Exception e) {   
      throw new BssException(e, "Error retrieving role list for {0} caused by {1}", loginName, e.getMessage());
    }
View Full Code Here

     */
    public void assignRole(String loginName, String role) throws BssException {
      try {
      String serviceUrl = BssUrls.API_AUTHORIZATION_ASSIGNROLE.format(this,
          new NamedUrlPart("loginName", loginName), new NamedUrlPart("role", role));
      Response response = createData(serviceUrl, null, null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error assigning role {0} to {1}", role, loginName);
        }
    } catch (Exception e) {   
      throw new BssException(e, "Error assigning role {0} to {1} caused by {2}", role, loginName, e.getMessage());     
View Full Code Here

     */
    public void unassignRole(String loginName, String role) throws BssException {
      try {
      String serviceUrl = BssUrls.API_AUTHORIZATION_UNASSIGNROLE.format(this,
          new NamedUrlPart("loginName", loginName), new NamedUrlPart("role", role));
      Response response = createData(serviceUrl, null, null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
          throw new BssException(response, "Error unassigning role {0} to {1}", role, loginName);
        }
    } catch (Exception e) {   
      throw new BssException(e, "Error unassigning role {0} to {1} caused by {2}", role, loginName, e.getMessage());     
View Full Code Here

        Content contentFile = getContentObject(title, stream, length);
        String accessType = AccessType.AUTHENTICATED.getText();
        String requestUri = FileUrls.MYUSERLIBRARY_FEED.format(this, FileUrlParts.accessType.get(accessType));
        Map<String, String> headers = new HashMap<String, String>();
        headers.put(FileConstants.X_UPDATE_NONCE, getNonce()); // It is not clearly documented which Content Type requires Nonce, thus adding nonce in header for all upload requests.
        Response response = createData(requestUri, p, headers, contentFile);
        checkResponseCode(response, HTTPCode.CREATED);

        return getFileFeedHandler().createEntity(response);
    }
View Full Code Here

        String requestUri = FileUrls.COLLECTION_FEED.format(this, FileUrlParts.accessType.get(accessType),
                FileUrlParts.folderId.get(folderId));
        Map<String, String> headers = new HashMap<String, String>();
        headers.put(Headers.ContentType, Headers.ATOM);
        String payload = new EntityIdSerializer(listOfFileIds).fileIdListPayload();
        Response response = createData(requestUri, params, headers, payload);
        checkResponseCode(response, HTTPCode.NO_CONTENT);
        return getFileFeedHandler().createEntityList(response);
    }
View Full Code Here

        headers.put(Headers.ContentType, Headers.ATOM);
        headers.put(Headers.ContentLanguage, Headers.UTF);

        params = (null == params) ? new HashMap<String, String>() : params;
        String payload = new EntityIdSerializer(folderIds,FileConstants.CATEGORY_COLLECTION).fileIdListPayload();
        Response response = createData(requestUri, params, headers, payload);
        checkResponseCode(response, HTTPCode.NO_CONTENT);
    }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.client.Response

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.