private void removeItemFromEquivSet(boolean status, LookupEntry lookupEntry) { if (!status) { String lookupEntryUri = lookupEntry.uri(); lookupEntry .directEquivalents() .stream() .map(LookupRef::uri) .filter(lookupRefUri -> !lookupRefUri.equals(lookupEntryUri)) .forEach(lookupRefUri -> equivalenceBreaker.removeFromSet(lookupEntryUri, lookupRefUri)); } }
private Optional<Identified> resolveContent(LookupEntry lookupEntry) { Optional<Identified> identified = Optional.ofNullable( contentResolver .findByCanonicalUris(Lists.newArrayList(lookupEntry.uri())) .getFirstValue() .valueOrNull()); // we throw lots of exceptions defensively if (!identified.isPresent()) { throw new NoSuchElementException( String.format( "Unable to resolve Item from ID %d, URI %s", lookupEntry.id(), lookupEntry.uri())); } return identified; }