use of org.plos.crepo.exceptions.NotFoundException in project rhino by PLOS.
the class AssetCrudServiceImpl method getArticleItemFile.
@Override
public RepoObjectMetadata getArticleItemFile(ArticleFileIdentifier fileId) {
ArticleItem work = articleCrudService.getArticleItem(fileId.getItemIdentifier());
String fileType = fileId.getFileType();
ArticleFile articleFile = work.getFile(fileType).orElseThrow(() -> new RestClientException("Unrecognized type: " + fileType, HttpStatus.NOT_FOUND));
try {
return contentRepoService.getRepoObjectMetadata(articleFile.getCrepoVersion());
} catch (NotFoundException e) {
throw new RestClientException("Object not found: " + fileId + ". File info: " + articleFile, HttpStatus.NOT_FOUND);
}
}
Aggregations