use of org.ambraproject.rhino.identity.VolumeIdentifier in project rhino by PLOS.
the class IssueCrudController method create.
@Transactional(rollbackFor = { Throwable.class })
@RequestMapping(value = "/journals/{journalKey}/volumes/{volumeDoi}/issues", method = RequestMethod.POST)
@ApiImplicitParam(name = "body", paramType = "body", dataType = "IssueInputView", value = "example: {\"doi\": \"10.1371/issue.pbio.v02.i07\", " + "\"displayName\": \"July\", " + "\"imageArticleDoi\": \"10.1371/image.pbio.v02.i07\", " + "\"articleOrder\": [\"10.1371/journal.pbio.0020213\", \"10.1371/journal.pbio.0020214\", " + "\"10.1371/journal.pbio.0020228\"]}")
public ResponseEntity<?> create(HttpServletRequest request, @PathVariable("journalKey") String journalKey, @PathVariable("volumeDoi") String volumeDoi) throws IOException {
// TODO: Validate journalKey
VolumeIdentifier volumeId = VolumeIdentifier.create(DoiEscaping.unescape(volumeDoi));
IssueInputView input = readJsonFromRequest(request, IssueInputView.class);
if (StringUtils.isBlank(input.getDoi())) {
throw new RestClientException("issueUri required", HttpStatus.BAD_REQUEST);
}
Issue issue = issueCrudService.create(volumeId, input);
return ServiceResponse.reportCreated(issueOutputViewFactory.getView(issue)).asJsonResponse(entityGson);
}
Aggregations