private Connection getConnectionOrFail(String connectionId) throws ServiceException { final Connection connection = connectionRepo.findByConnectionId(connectionId); if (connection == null) { throw createInvalidParameterServiceException("connectionId"); } return connection; }
private void validateConnectionId(String connectionId) throws ServiceException { if (StringUtils.hasText(connectionId)) { if (connectionRepo.findByConnectionId(connectionId) != null) { log.warn("ConnectionId {} was not unique", connectionId); throw createAlreadyExistsServiceException("connectionId"); } } else { log.warn("ConnectionId was empty", connectionId); throw createInvalidParameterServiceException("connectionId"); } }