use of com.willshex.blogwt.shared.api.blog.call.GetPropertiesResponse in project blogwt by billy1380.
the class BlogService method getProperties.
public Request getProperties(GetPropertiesRequest input, AsyncSuccess<GetPropertiesRequest, GetPropertiesResponse> onSuccess, AsyncFailure<GetPropertiesRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(BlogMethodGetProperties, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
GetPropertiesResponse outputParameter = new GetPropertiesResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(BlogService.this, BlogMethodGetProperties, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodGetProperties, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodGetProperties, input, exception);
}
});
onCallStart(BlogService.this, BlogMethodGetProperties, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodGetProperties, input, exception);
}
return handle;
}
use of com.willshex.blogwt.shared.api.blog.call.GetPropertiesResponse in project blogwt by billy1380.
the class PropertyController method fetchProperties.
private void fetchProperties() {
final GetPropertiesRequest input = ApiHelper.setAccessCode(new GetPropertiesRequest());
input.pager = pager;
input.session = SessionController.get().sessionForApiCall();
if (getPropertiesRequest != null) {
getPropertiesRequest.cancel();
}
getPropertiesRequest = ApiHelper.createBlogClient().getProperties(input, new AsyncCallback<GetPropertiesResponse>() {
@Override
public void onSuccess(GetPropertiesResponse output) {
getPropertiesRequest = null;
if (output.status == StatusType.StatusTypeSuccess) {
if (output.properties != null && output.properties.size() > 0) {
pager = output.pager;
JsonArray propertyArray = new JsonArray();
for (Property p : output.properties) {
propertyArray.add(p.toJson());
}
Window.get().setProperties(propertyArray.toString());
}
}
DefaultEventBus.get().fireEventFromSource(new GetPropertiesSuccess(input, output), PropertyController.this);
}
@Override
public void onFailure(Throwable caught) {
getPropertiesRequest = null;
DefaultEventBus.get().fireEventFromSource(new GetPropertiesFailure(input, caught), PropertyController.this);
}
});
}
Aggregations