use of com.willshex.blogwt.client.api.user.event.GetPermissionsEventHandler.GetPermissionsSuccess in project blogwt by billy1380.
the class PermissionController method fetchPermissions.
private void fetchPermissions() {
final GetPermissionsRequest input = ApiHelper.setAccessCode(new GetPermissionsRequest());
input.pager = pager;
input.session = SessionController.get().sessionForApiCall();
if (getPermissionsRequest != null) {
getPermissionsRequest.cancel();
}
getPermissionsRequest = ApiHelper.createUserClient().getPermissions(input, new AsyncCallback<GetPermissionsResponse>() {
@Override
public void onSuccess(GetPermissionsResponse output) {
getPermissionsRequest = null;
if (output.status == StatusType.StatusTypeSuccess) {
if (output.permissions != null && output.permissions.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.permissions);
} else {
updateRowCount(input.pager.start.intValue(), true);
updateRowData(input.pager.start.intValue(), Collections.<Permission>emptyList());
}
}
DefaultEventBus.get().fireEventFromSource(new GetPermissionsSuccess(input, output), PermissionController.this);
}
@Override
public void onFailure(Throwable caught) {
getPermissionsRequest = null;
DefaultEventBus.get().fireEventFromSource(new GetPermissionsFailure(input, caught), PermissionController.this);
}
});
}
Aggregations