Search in sources :

Example 1 with CategoryAssignmentView

use of org.ambraproject.rhino.view.article.CategoryAssignmentView in project rhino by PLOS.

the class ArticleCrudServiceImpl method serveCategories.

/**
   * {@inheritDoc}
   *
   * @param articleId
   */
@Override
public ServiceResponse<Collection<CategoryAssignmentView>> serveCategories(final ArticleIdentifier articleId) throws IOException {
    Article article = readArticle(articleId);
    Collection<ArticleCategoryAssignment> categoryAssignments = taxonomyService.getAssignmentsForArticle(article);
    Collection<CategoryAssignmentView> views = categoryAssignments.stream().map(CategoryAssignmentView::new).collect(Collectors.toList());
    return ServiceResponse.serveView(views);
}
Also used : ArticleCategoryAssignment(org.ambraproject.rhino.model.ArticleCategoryAssignment) CategoryAssignmentView(org.ambraproject.rhino.view.article.CategoryAssignmentView) Article(org.ambraproject.rhino.model.Article)

Aggregations

Article (org.ambraproject.rhino.model.Article)1 ArticleCategoryAssignment (org.ambraproject.rhino.model.ArticleCategoryAssignment)1 CategoryAssignmentView (org.ambraproject.rhino.view.article.CategoryAssignmentView)1