Exemple #1
0
 public T create(T toCreate) throws HttpException {
   Response<T> response =
       DefaultRequestHandler.getInstance()
           .doRequest(HttpMethod.POST, getResourcesPath(), toCreate);
   I id = (I) (toCreate.getId() == null ? getCreatedId(response) : toCreate.getId());
   return get(id);
 }
Exemple #2
0
 public T update(T toUpdate) throws HttpException {
   DefaultRequestHandler.getInstance()
       .doRequest(HttpMethod.PUT, getResourcePath((I) toUpdate.getId()), toUpdate);
   return toUpdate;
 }
Exemple #3
0
 public void delete(I id) throws HttpException {
   DefaultRequestHandler.getInstance().doRequest(HttpMethod.DELETE, getResourcePath(id));
 }
Exemple #4
0
 public T get(I id) throws HttpException, ParseToObjectException {
   Response<T> response =
       DefaultRequestHandler.getInstance().doRequest(HttpMethod.GET, getResourcePath(id));
   return response.getBodyAsObject(getObjectClass());
 }