use of com.willshex.blogwt.shared.api.blog.call.UpdateResourceResponse in project blogwt by billy1380.
the class ResourceController method updateResource.
public void updateResource(Resource resource) {
final UpdateResourceRequest input = SessionController.get().setSession(ApiHelper.setAccessCode(new UpdateResourceRequest())).resource(resource);
ApiHelper.createBlogClient().updateResource(input, new AsyncCallback<UpdateResourceResponse>() {
@Override
public void onSuccess(UpdateResourceResponse output) {
if (output.status == StatusType.StatusTypeSuccess) {
if (input.resource != null) {
}
}
DefaultEventBus.get().fireEventFromSource(new UpdateResourceSuccess(input, output), ResourceController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new UpdateResourceFailure(input, caught), ResourceController.this);
}
});
}
use of com.willshex.blogwt.shared.api.blog.call.UpdateResourceResponse in project blogwt by billy1380.
the class BlogService method updateResource.
public Request updateResource(UpdateResourceRequest input, AsyncSuccess<UpdateResourceRequest, UpdateResourceResponse> onSuccess, AsyncFailure<UpdateResourceRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(BlogMethodUpdateResource, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
UpdateResourceResponse outputParameter = new UpdateResourceResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(BlogService.this, BlogMethodUpdateResource, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodUpdateResource, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodUpdateResource, input, exception);
}
});
onCallStart(BlogService.this, BlogMethodUpdateResource, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodUpdateResource, input, exception);
}
return handle;
}
Aggregations