예제 #1
0
 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));
   }
 }
예제 #2
0
  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;
  }