use of org.ambraproject.rhino.model.Issue in project rhino by PLOS.
the class DoiController method findDoiTarget.
private ResolvedDoiView findDoiTarget(Doi doi) throws IOException {
// Look for the DOI in the corpus of articles
Optional<ResolvedDoiView> itemOverview = articleCrudService.getItemOverview(doi);
if (itemOverview.isPresent()) {
return itemOverview.get();
}
// Not found as an Article or ArticleItem. Check other object types that use DOIs.
Optional<Comment> comment = commentCrudService.getComment(CommentIdentifier.create(doi));
if (comment.isPresent()) {
ArticleOverview article = articleCrudService.buildOverview(comment.get().getArticle());
return ResolvedDoiView.createForArticle(doi, ResolvedDoiView.DoiWorkType.COMMENT, article);
}
Optional<Issue> issue = issueCrudService.getIssue(IssueIdentifier.create(doi));
if (issue.isPresent()) {
Journal journal = issueCrudService.getJournalOf(issue.get());
return ResolvedDoiView.create(doi, ResolvedDoiView.DoiWorkType.ISSUE, journal);
}
Optional<Volume> volume = volumeCrudService.getVolume(VolumeIdentifier.create(doi));
if (volume.isPresent()) {
Journal journal = volumeCrudService.getJournalOf(volume.get());
return ResolvedDoiView.create(doi, ResolvedDoiView.DoiWorkType.VOLUME, journal);
}
throw new RestClientException("DOI not found: " + doi.getName(), HttpStatus.NOT_FOUND);
}
use of org.ambraproject.rhino.model.Issue in project rhino by PLOS.
the class IssueCrudServiceImpl method update.
@Override
public void update(IssueIdentifier issueId, IssueInputView input) {
Preconditions.checkNotNull(input);
Issue issue = readIssue(issueId);
issue = applyInput(issue, input);
hibernateTemplate.update(issue);
}
use of org.ambraproject.rhino.model.Issue in project rhino by PLOS.
the class JournalCrudServiceImpl method applyInput.
private Journal applyInput(Journal journal, JournalInputView input) {
String currentIssueDoi = input.getCurrentIssueDoi();
if (currentIssueDoi != null) {
Issue currentIssue = issueCrudService.readIssue(IssueIdentifier.create(currentIssueDoi));
validateIssueInJournal(currentIssue, journal);
journal.setCurrentIssue(currentIssue);
}
return journal;
}
Aggregations