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