// Get user roles that match the search criteria.
UserRoleSearchCriteria userRoleSearchCriteria = new UserRoleSearchCriteria();
userRoleSearchCriteria.setSearchString(searchString);
userRoleSearchCriteria.setPageSize(10);
UserRoleRecordSet userRoleRecordSet = userRoleService.getUserRoles(userRoleSearchCriteria);
// Display user role names, IDs, subnetwork IDs, number of assigned users, and
// assigned permissions.
if (userRoleRecordSet.getUserRoles().length > 0) {
for (UserRole userRole: userRoleRecordSet.getUserRoles()) {
System.out.printf("User role with name \"%s\", ID \"%s\", subnetwork ID \"%s\", and " +
"assigned to \"%s\" users was found.%n", userRole.getName(), userRole.getId(),
userRole.getSubnetworkId(), userRole.getTotalAssignedUsers());
if (userRole.getPermissions().length > 0) {
System.out.printf("/tThe above user role has the following permissions:%n");