use of com.wordnik.swagger.annotations.ApiImplicitParam in project rhino by PLOS.
the class ArticleCrudController method createSyndication.
@RequestMapping(value = "/articles/{doi}/revisions/{number}/syndications", method = RequestMethod.POST)
@ApiImplicitParam(name = "body", paramType = "body", dataType = "SyndicationInputView", value = "example: {\"targetQueue\": \"activemq:plos.pmc\"}")
public ResponseEntity<?> createSyndication(HttpServletRequest request, @PathVariable("doi") String doi, @PathVariable("number") int revisionNumber) throws IOException {
ArticleRevisionIdentifier revisionId = ArticleRevisionIdentifier.create(DoiEscaping.unescape(doi), revisionNumber);
SyndicationInputView input = readJsonFromRequest(request, SyndicationInputView.class);
Syndication syndication = syndicationCrudService.createSyndication(revisionId, input.getTargetQueue());
return ServiceResponse.reportCreated(new SyndicationView(syndication)).asJsonResponse(entityGson);
}
use of com.wordnik.swagger.annotations.ApiImplicitParam in project rhino by PLOS.
the class ArticleListCrudController method update.
@Transactional(rollbackFor = { Throwable.class })
@RequestMapping(value = "/lists/{type}/journals/{journal}/keys/{key}", method = RequestMethod.PATCH)
@ApiImplicitParam(name = "body", paramType = "body", dataType = "ListInputView", value = "example #1: {\"title\": \"New Title\"}<br>" + "example #2: {\"articleDois\": [\"10.1371/journal.pone.0012345\", \"10.1371/journal.pone.0054321\"]}")
public ResponseEntity<?> update(HttpServletRequest request, @PathVariable("type") String type, @PathVariable("journal") String journalKey, @PathVariable("key") String key) throws IOException {
final ListInputView inputView;
try {
inputView = readJsonFromRequest(request, ListInputView.class);
} catch (ListInputView.PartialIdentityException e) {
throw complainAboutListIdentityOnPatch(e);
}
if (inputView.getIdentity().isPresent()) {
throw complainAboutListIdentityOnPatch(null);
}
ArticleListIdentity identity = new ArticleListIdentity(type, journalKey, key);
articleListCrudService.update(identity, inputView.getTitle(), inputView.getArticleIds());
return new ResponseEntity<>(HttpStatus.OK);
}
use of com.wordnik.swagger.annotations.ApiImplicitParam in project rhino by PLOS.
the class VolumeCrudController method update.
@Transactional(rollbackFor = { Throwable.class })
@RequestMapping(value = "/journals/{journalKey}/volumes/{volumeDoi:.+}", method = RequestMethod.PATCH)
@ApiImplicitParam(name = "body", paramType = "body", dataType = "VolumeInputView", value = "example #1: {\"doi\": \"10.1371/volume.pmed.v01\"}<br>" + "example #2: {\"displayName\": \"2004\"}")
public ResponseEntity<?> update(HttpServletRequest request, @PathVariable("journalKey") String journalKey, @PathVariable("volumeDoi") String volumeDoi) throws IOException {
// TODO: Validate journalKey
VolumeIdentifier volumeId = getVolumeId(volumeDoi);
VolumeInputView input = readJsonFromRequest(request, VolumeInputView.class);
Volume updated = volumeCrudService.update(volumeId, input);
VolumeOutputView view = volumeOutputViewFactory.getView(updated);
return ServiceResponse.serveView(view).asJsonResponse(entityGson);
}
use of com.wordnik.swagger.annotations.ApiImplicitParam in project rhino by PLOS.
the class IssueCrudController method update.
@Transactional(rollbackFor = { Throwable.class })
@RequestMapping(value = "/journals/{journalKey}/volumes/{volumeDoi}/issues/{issueDoi:.+}", method = RequestMethod.PATCH)
@ApiImplicitParam(name = "body", paramType = "body", dataType = "IssueInputView", value = "example #1: {\"displayName\": \"July\"}<br>" + "example #2: {\"imageArticleDoi\": \"10.1371/image.pbio.v02.i07\"}<br>" + "example #3: {\"articleOrder\": [\"10.1371/journal.pbio.0020213\", \"10.1371/journal.pbio.0020214\", " + "\"10.1371/journal.pbio.0020228\"]}")
public ResponseEntity<?> update(HttpServletRequest request, @RequestHeader(value = HttpHeaders.IF_MODIFIED_SINCE, required = false) Date ifModifiedSince, @PathVariable("journalKey") String journalKey, @PathVariable("volumeDoi") String volumeDoi, @PathVariable("issueDoi") String issueDoi) throws IOException {
// TODO: Validate journalKey and volumeDoiObj
IssueIdentifier issueId = getIssueId(issueDoi);
IssueInputView input = readJsonFromRequest(request, IssueInputView.class);
issueCrudService.update(issueId, input);
return issueCrudService.serveIssue(issueId).getIfModified(ifModifiedSince).asJsonResponse(entityGson);
}
use of com.wordnik.swagger.annotations.ApiImplicitParam in project rhino by PLOS.
the class CommentCrudController method create.
@RequestMapping(value = "/articles/{articleDoi}/comments", method = RequestMethod.POST)
@ApiImplicitParam(name = "body", paramType = "body", dataType = "CommentInputView", value = "example: {\"creatorUserId\": 10365, " + "\"parentCommentId\": \"10.1371/annotation/0043aae2-f69d-4a05-ab19-4709704eb749\", " + "\"title\": \"no, really watch this\", " + "\"body\": \"http://www.youtube.com/watch?v=iGQdwSAAz9I\", " + "\"highlightedText\": \"whoah...\", " + "\"competingInterestStatement\": \"I'm going for an Emmy\"}")
public ResponseEntity<?> create(HttpServletRequest request, @PathVariable("articleDoi") String articleDoi) throws IOException {
ArticleIdentifier articleId = ArticleIdentifier.create(DoiEscaping.unescape(articleDoi));
CommentInputView input = readJsonFromRequest(request, CommentInputView.class);
// TODO: Pass Optional.empty() if client POSTed to "/comments"?
Optional<ArticleIdentifier> articleIdObj = Optional.of(articleId);
return commentCrudService.createComment(articleIdObj, input).asJsonResponse(entityGson);
}
Aggregations