@Override public Wsdl getWsdl(String externalId) { List<Wsdl> matches = wsdlRepository.findAnyByExternalId(externalId); if (matches.size() > 1) { throw new IllegalStateException("multiple matches found to " + externalId + ": " + matches); } else if (matches.size() == 1) { return matches.iterator().next(); } else { return null; } }