use of org.ambraproject.rhino.view.article.ArticleRevisionView in project rhino by PLOS.
the class ArticleListView method serialize.
@Override
public JsonObject serialize(JsonSerializationContext context) {
JsonObject serialized = context.serialize(getIdentity()).getAsJsonObject();
serialized.addProperty("title", articleList.getDisplayName());
if (!excludeArticleMetadata) {
List<ArticleRevisionView> articleViews = Lists.transform(articleList.getArticles(), articleFactory::getLatestRevisionView);
serialized.add("articles", context.serialize(articleViews));
}
return serialized;
}
use of org.ambraproject.rhino.view.article.ArticleRevisionView in project rhino by PLOS.
the class IssueCrudController method readArticlesInIssue.
@Transactional(readOnly = true)
@RequestMapping(value = "/issues/{issueDoi:.+}/contents", method = RequestMethod.GET)
public ResponseEntity<?> readArticlesInIssue(@PathVariable("issueDoi") String issueDoi) throws IOException {
IssueIdentifier issueId = getIssueId(issueDoi);
Issue issue = issueCrudService.readIssue(issueId);
List<ArticleRevisionView> views = issueOutputViewFactory.getIssueArticlesView(issue);
return ServiceResponse.serveView(views).asJsonResponse(entityGson);
}
use of org.ambraproject.rhino.view.article.ArticleRevisionView in project rhino by PLOS.
the class ArticleCrudServiceImpl method serveRevisions.
@Override
public ServiceResponse<List<ArticleRevisionView>> serveRevisions(ArticleIdentifier id) {
Article article = readArticle(id);
List<ArticleRevision> revisions = (List<ArticleRevision>) hibernateTemplate.find("FROM ArticleRevision WHERE ingestion.article = ? ORDER BY revisionNumber", article);
List<ArticleRevisionView> views = Lists.transform(revisions, ArticleRevisionView::getView);
return ServiceResponse.serveView(views);
}
Aggregations