Package org.exoplatform.social.client.api.service

Examples of org.exoplatform.social.client.api.service.ServiceException


      String BASE_URL = SocialHttpClientSupport.buildCommonRestPathFromContext(true);
      String requestURL = BASE_URL + "restActivity/" + this.getActivityId() + ".json";
      HttpResponse response = SocialHttpClientSupport.executeGet(requestURL, POLICY.BASIC_AUTH);
      restActivity = SocialJSONDecodingSupport.parser(RestActivity.class, response);
    } catch (IOException e) {
      throw new ServiceException(RestComment.class, "IOException when reads Json Content.", e);
    } catch (ParseException e) {
      throw new ServiceException(RestComment.class, "ParseException when reads Json Content.", e);
    }
    return restActivity;
  }
View Full Code Here


      String BASE_URL = SocialHttpClientSupport.buildCommonRestPathFromContext(true);
      String requestURL = BASE_URL + "restIdentity/" + this.getIdentityId() + ".json";
      HttpResponse response = SocialHttpClientSupport.executeGet(requestURL, POLICY.BASIC_AUTH);
      restIdentity = SocialJSONDecodingSupport.parser(RestIdentity.class, response);
    } catch (IOException e) {
      throw new ServiceException(RestComment.class, "IOException when reads Json Content.", e);
    } catch (ParseException e) {
      throw new ServiceException(RestComment.class, "ParseException when reads Json Content.", e);
    }
    return restIdentity;
  }
View Full Code Here

        handleError(response);
        String responseContent = getContent(response);
        RestActivity restActivity = SocialJSONDecodingSupport.parser(RestActivity.class, responseContent);
        return restActivity;
      } catch (SocialHttpClientException e) {
        throw new ServiceException(ActivityServiceImplV1Alpha1.class,e.getMessage(),null);
      } catch (ParseException e) {
        throw new ServiceException(ActivityServiceImplV1Alpha1.class,e.getMessage(),null);
      } catch (SocialClientLibException e) {
        if(e.getCause() instanceof NotFoundException){
          throw new ServiceException(ActivityServiceImplV1Alpha1.class,e.getMessage(),null);
        } else {
          throw e;
        }
      }
  }
View Full Code Here

        handleError(response);
        String responseContent = getContent(response);
        RestActivity restActivity = SocialJSONDecodingSupport.parser(RestActivity.class, responseContent);
        return restActivity;
      } catch (SocialHttpClientException e) {
        throw new ServiceException(ActivityServiceImplV1Alpha1.class,e.getMessage(),null);
      } catch (ParseException e) {
        throw new ServiceException(ActivityServiceImplV1Alpha1.class,e.getMessage(),null);
      }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public RestActivity update(RestActivity existingInstance) throws SocialClientLibException {
    throw new ServiceException(ActivityServiceImplV1Alpha1.class,"Do Not Support",null);
  }
View Full Code Here

      handleError(response);
      String responseContent = getContent(response);
      RestActivity restActivity = SocialJSONDecodingSupport.parser(RestActivity.class, responseContent);
      return restActivity;
    } catch (SocialHttpClientException e) {
      throw new ServiceException(ActivityServiceImplV1Alpha1.class,e.getMessage(),null);
    } catch (ParseException e) {
      throw new ServiceException(ActivityServiceImplV1Alpha1.class,e.getMessage(),null);
    }
  }
View Full Code Here

        handleError(response);
        String responseContent = getContent(response);
        RestComment restComment = SocialJSONDecodingSupport.parser(RestComment.class, responseContent);
        return restComment;
      } catch (SocialHttpClientException e) {
        throw new ServiceException(ActivityServiceImplV1Alpha1.class,e.getMessage(),null);
      } catch (ParseException e) {
        throw new ServiceException(ActivityServiceImplV1Alpha1.class,e.getMessage(),null);
      }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public RestComment getComment(String commentId) throws SocialClientLibException {
    throw new ServiceException(ActivityServiceImplV1Alpha1.class, "Not Supported",null);
//    final String GET_ACTIVITY_REQUEST_URL = BASE_URL+commentId+".json";
//    try {
//      HttpResponse response = SocialHttpClientSupport.executeGet(GET_ACTIVITY_REQUEST_URL,POLICY.BASIC_AUTH);
//      int statusCode = response.getStatusLine().getStatusCode();
//      if(statusCode != ServiceException.HTTP_OK){
View Full Code Here

      handleError(response);
      String responseContent = getContent(response);
      RestComment restComment = SocialJSONDecodingSupport.parser(RestComment.class, responseContent);
      return restComment;
    } catch (SocialHttpClientException e) {
      throw new ServiceException(ActivityServiceImplV1Alpha1.class,"invalid response",null);
    } catch (ParseException e) {
      throw new ServiceException(ActivityServiceImplV1Alpha1.class,"invalid response",null);
    }
  }
View Full Code Here

      JSONObject responseJson = (JSONObject)JSONValue.parse(responseContent);
      if((Boolean) responseJson.get("like")){
        return new RestLike(existingRestActivity.getId(), null);
      } else {
        throw new ServiceException(ActivityServiceImplV1Alpha1.class,"invalid response",null);
      }
    } catch (IOException e) {
      throw new ServiceException(ActivityServiceImplV1Alpha1.class,"invalid response",null);
    }
  }
View Full Code Here

TOP

Related Classes of org.exoplatform.social.client.api.service.ServiceException

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.