use of io.gravitee.repository.management.model.Audit.AuditProperties.USER in project gravitee-management-rest-api by gravitee-io.
the class UserServiceImpl method findAll.
@Override
public Set<UserEntity> findAll(boolean loadRoles) {
try {
LOGGER.debug("Find all users");
Set<User> users = userRepository.findAll();
return users.stream().map(u -> convert(u, loadRoles)).collect(Collectors.toSet());
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to find all users", ex);
throw new TechnicalManagementException("An error occurs while trying to find all users", ex);
}
}
use of io.gravitee.repository.management.model.Audit.AuditProperties.USER in project gravitee-management-rest-api by gravitee-io.
the class UserServiceImpl method findByIds.
@Override
public Set<UserEntity> findByIds(List<String> ids) {
try {
LOGGER.debug("Find users by ID: {}", ids);
Set<User> users = userRepository.findByIds(ids);
if (!users.isEmpty()) {
return users.stream().map(u -> this.convert(u, false)).collect(Collectors.toSet());
}
Optional<String> idsAsString = ids.stream().reduce((a, b) -> a + '/' + b);
if (idsAsString.isPresent()) {
throw new UserNotFoundException(idsAsString.get());
} else {
throw new UserNotFoundException("?");
}
} catch (TechnicalException ex) {
Optional<String> idsAsString = ids.stream().reduce((a, b) -> a + '/' + b);
LOGGER.error("An error occurs while trying to find users using their ID {}", idsAsString, ex);
throw new TechnicalManagementException("An error occurs while trying to find users using their ID " + idsAsString, ex);
}
}
Aggregations