use of org.projectnessie.model.GetMultipleContentsResponse in project nessie by projectnessie.
the class ContentApiImpl method getMultipleContents.
@Override
public GetMultipleContentsResponse getMultipleContents(String namedRef, String hashOnRef, GetMultipleContentsRequest request) throws NessieNotFoundException {
try {
WithHash<NamedRef> ref = namedRefWithHashOrThrow(namedRef, hashOnRef);
List<ContentKey> externalKeys = request.getRequestedKeys();
List<Key> internalKeys = externalKeys.stream().map(ContentApiImpl::toKey).collect(Collectors.toList());
Map<Key, Content> values = getStore().getValues(ref.getHash(), internalKeys);
List<ContentWithKey> output = values.entrySet().stream().map(e -> ContentWithKey.of(toContentKey(e.getKey()), e.getValue())).collect(Collectors.toList());
return ImmutableGetMultipleContentsResponse.builder().contents(output).build();
} catch (ReferenceNotFoundException ex) {
throw new NessieReferenceNotFoundException(ex.getMessage(), ex);
}
}
Aggregations