use of com.redhat.cloud.notifications.recipients.itservice.pojo.request.ITUserRequest in project notifications-backend by RedHatInsights.
the class RbacRecipientUsersProvider method getUsers.
@CacheResult(cacheName = "rbac-recipient-users-provider-get-users")
public List<User> getUsers(String accountId, String orgId, boolean adminsOnly) {
Timer.Sample getUsersTotalTimer = Timer.start(meterRegistry);
List<User> users;
List<ITUserResponse> usersPaging;
List<ITUserResponse> usersTotal = new ArrayList<>();
int firstResult = 0;
do {
ITUserRequest request = new ITUserRequest(accountId, orgId, useOrgId, adminsOnly, firstResult, maxResultsPerPage);
usersPaging = retryOnItError(() -> itUserService.getUsers(request));
usersTotal.addAll(usersPaging);
firstResult += maxResultsPerPage;
} while (usersPaging.size() == maxResultsPerPage);
LOGGER.info("usersTotal: " + usersTotal);
users = transformToUser(usersTotal);
// Micrometer doesn't like when tags are null and throws a NPE.
String accountIdTag = accountId == null ? "" : accountId;
getUsersTotalTimer.stop(meterRegistry.timer("rbac.get-users.total", "accountId", accountIdTag, "users", String.valueOf(users.size())));
rbacUsers.set(users.size());
return users;
}
Aggregations