use of com.willshex.blogwt.client.api.user.event.GetRolesEventHandler.GetRolesFailure in project blogwt by billy1380.
the class RoleController method fetchRoles.
private void fetchRoles() {
final GetRolesRequest input = ApiHelper.setAccessCode(new GetRolesRequest());
input.pager = pager;
input.session = SessionController.get().sessionForApiCall();
if (getRolesRequest != null) {
getRolesRequest.cancel();
}
getRolesRequest = ApiHelper.createUserClient().getRoles(input, new AsyncCallback<GetRolesResponse>() {
@Override
public void onSuccess(GetRolesResponse output) {
getRolesRequest = null;
if (output.status == StatusType.StatusTypeSuccess) {
if (output.roles != null && output.roles.size() > 0) {
pager = output.pager;
updateRowCount(input.pager.count == null ? 0 : input.pager.count.intValue(), input.pager.count == null || input.pager.count.intValue() == 0);
updateRowData(input.pager.start.intValue(), output.roles);
} else {
updateRowCount(input.pager.start.intValue(), true);
updateRowData(input.pager.start.intValue(), Collections.<Role>emptyList());
}
}
DefaultEventBus.get().fireEventFromSource(new GetRolesSuccess(input, output), RoleController.this);
}
@Override
public void onFailure(Throwable caught) {
getRolesRequest = null;
DefaultEventBus.get().fireEventFromSource(new GetRolesFailure(input, caught), RoleController.this);
}
});
}
Aggregations