use of io.gravitee.management.service.exceptions.UserNotFoundException in project gravitee-management-rest-api by gravitee-io.
the class UserServiceImpl method findById.
@Override
public UserEntity findById(String id) {
try {
LOGGER.debug("Find user by ID: {}", id);
Optional<User> optionalUser = userRepository.findById(id);
if (optionalUser.isPresent()) {
return convert(optionalUser.get(), false);
}
// should never happen
throw new UserNotFoundException(id);
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to find user using its ID {}", id, ex);
throw new TechnicalManagementException("An error occurs while trying to find user using its ID " + id, ex);
}
}
use of io.gravitee.management.service.exceptions.UserNotFoundException in project gravitee-management-rest-api by gravitee-io.
the class UserServiceImpl method findByIdWithRoles.
@Override
public UserEntity findByIdWithRoles(String id) {
try {
LOGGER.debug("Find user by ID: {}", id);
Optional<User> optionalUser = userRepository.findById(id);
if (optionalUser.isPresent()) {
return convert(optionalUser.get(), true);
}
// should never happen
throw new UserNotFoundException(id);
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to find user using its ID {}", id, ex);
throw new TechnicalManagementException("An error occurs while trying to find user using its ID " + id, ex);
}
}
Aggregations