Check offset value have or not

offset-is-not-working
Nishan Sangeeth 1 year ago
parent 6344fc1469
commit 6973d7aa11

@ -697,26 +697,29 @@ public class UserManagementServiceImpl implements UserManagementService {
user.setLastname(getClaimValue(username, Constants.USER_CLAIM_LAST_NAME));
userList.add(user);
}
int toIndex = offset + limit;
int listSize = userList.size();
int lastIndex = listSize - 1;
List<UserInfo> offsetList;
if (offset <= lastIndex) {
if (toIndex <= listSize) {
offsetList = userList.subList(offset, toIndex);
if (offset==0) {
return Response.status(Response.Status.OK).entity(userList).build();
} else {
int toIndex = offset + limit;
int listSize = userList.size();
int lastIndex = listSize - 1;
List<UserInfo> offsetList;
if (offset <= lastIndex) {
if (toIndex <= listSize) {
offsetList = userList.subList(offset, toIndex);
} else {
offsetList = userList.subList(offset, listSize);
}
} else {
offsetList = userList.subList(offset, listSize);
offsetList = new ArrayList<>();
}
} else {
offsetList = new ArrayList<>();
}
UserInfoList result = new UserInfoList();
result.setList(offsetList);
result.setCount(userList.size());
UserInfoList result = new UserInfoList();
result.setList(offsetList);
result.setCount(userList.size());
return Response.status(Response.Status.OK).entity(result).build();
return Response.status(Response.Status.OK).entity(result).build();
}
} catch (UserStoreException e) {
String msg = "Error occurred while retrieving the list of users using the filter : " + filter;
log.error(msg, e);

Loading…
Cancel
Save