use of org.ambraproject.rhino.identity.ArticleFileIdentifier in project rhino by PLOS.
the class ArticleCrudServiceImpl method getManuscriptMetadata.
@Override
public RepoObjectMetadata getManuscriptMetadata(ArticleIngestion ingestion) {
Doi articleDoi = Doi.create(ingestion.getArticle().getDoi());
ArticleIngestionIdentifier ingestionId = ArticleIngestionIdentifier.create(articleDoi, ingestion.getIngestionNumber());
ArticleItemIdentifier articleItemId = ingestionId.getItemFor();
ArticleFileIdentifier manuscriptId = ArticleFileIdentifier.create(articleItemId, "manuscript");
RepoObjectMetadata objectMetadata = assetCrudService.getArticleItemFile(manuscriptId);
return objectMetadata;
}
use of org.ambraproject.rhino.identity.ArticleFileIdentifier in project rhino by PLOS.
the class AssetFileCrudController method serveFile.
@Transactional(readOnly = true)
@RequestMapping(value = "/articles/{articleDoi}/ingestions/{number}/items/{itemDoi}/files/{filetype}", params = "download", method = RequestMethod.GET)
public void serveFile(HttpServletRequest request, HttpServletResponse response, @PathVariable("articleDoi") String articleDoi, @PathVariable("number") int ingestionNumber, @PathVariable("itemDoi") String itemDoi, @PathVariable("filetype") String fileType) throws IOException {
ArticleFileIdentifier fileId = ArticleFileIdentifier.create(DoiEscaping.unescape(itemDoi), ingestionNumber, fileType);
// TODO: Validate that articleDoi belongs to item's parent
RepoObjectMetadata objectMetadata = assetCrudService.getArticleItemFile(fileId);
serve(request, response, objectMetadata);
}
Aggregations