use of org.wso2.carbon.identity.role.mgt.core.IdentityRoleManagementException in project identity-inbound-provisioning-scim2 by wso2-extensions.
the class SCIMRoleManager method listRoles.
/**
* Method to list roles.
*
* @param startIndex Starting index of the results.
* @param count Results count value.
* @param sortBy SortBy.
* @param sortOrder Sorting order.
* @return List of roles.
* @throws CharonException Error while listing users
*/
private List<Object> listRoles(Integer count, Integer startIndex, String sortBy, String sortOrder) throws CharonException, BadRequestException {
List<Object> rolesList = new ArrayList<>();
try {
// 0th index is to store total number of results.
rolesList.add(0);
List<RoleBasicInfo> roles = roleManagementService.getRoles(count, startIndex, sortBy, sortOrder, tenantDomain);
List<Object> scimRoles = getScimRolesList(roles);
// Set total number of results to 0th index.
rolesList.set(0, scimRoles.size());
// Add the results list.
rolesList.addAll(scimRoles);
} catch (IdentityRoleManagementException e) {
throw new CharonException("Error occurred while listing roles.", e);
}
return rolesList;
}
Aggregations