use of nl.knaw.huygens.timbuctoo.remote.rs.discover.LinkList in project timbuctoo by HuygensING.
the class ResultView method init.
private void init(Result<?> result, Interpreter interpreter) {
uri = result.getUri().toString();
ordinal = result.getOrdinal();
statusCode = result.getStatusCode();
contentType = result.getContent().map(o -> o.getClass().getSimpleName()).orElse("(no content)");
Object content = result.getContent().orElse(null);
if (content != null) {
if (content instanceof LinkList) {
LinkList linkList = (LinkList) content;
childCount = linkList.getValidUris().size();
} else if (content instanceof RsRoot) {
RsRoot<?, ?> rsRoot = (RsRoot) content;
childCount = rsRoot.getItemList().size();
Optional<Capability> optionalCapa = rsRoot.getCapability();
if (optionalCapa.isPresent()) {
capability = optionalCapa.get().xmlValue;
}
} else if (content instanceof Description) {
description = new DescriptionView((Result<Description>) result, interpreter);
}
}
if (result.getDescriptionResult().isPresent()) {
describedBy = new ResultView(result.getDescriptionResult().get(), interpreter);
}
errorList = result.getErrors().stream().map(throwable -> new ErrorView(throwable, interpreter)).collect(Collectors.toList());
invalidUris = result.getInvalidUris();
}
Aggregations