Search in sources :

Example 41 with ApiOperation

use of com.wordnik.swagger.annotations.ApiOperation in project rhino by PLOS.

the class ArticleCrudController method syndicate.

@RequestMapping(value = "/articles/{doi}/revisions/{number}/syndications", // Fold into PATCH operation so we can get rid of "?syndicate"?
method = RequestMethod.POST, params = "syndicate")
@ApiOperation(value = "syndicate", notes = "Send a syndication message to the queue for processing. " + "Will create and add a syndication to the database if none exist for current article and target.")
@ApiImplicitParam(name = "body", paramType = "body", dataType = "SyndicationInputView", value = "example: {\"targetQueue\": \"activemq:plos.pmc\"}")
public ResponseEntity<?> syndicate(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 created = syndicationCrudService.syndicate(revisionId, input.getTargetQueue());
    return ServiceResponse.reportCreated(new SyndicationView(created)).asJsonResponse(entityGson);
}
Also used : SyndicationView(org.ambraproject.rhino.view.article.SyndicationView) ArticleRevisionIdentifier(org.ambraproject.rhino.identity.ArticleRevisionIdentifier) SyndicationInputView(org.ambraproject.rhino.view.article.SyndicationInputView) Syndication(org.ambraproject.rhino.model.Syndication) ApiOperation(com.wordnik.swagger.annotations.ApiOperation) ApiImplicitParam(com.wordnik.swagger.annotations.ApiImplicitParam) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ApiOperation (com.wordnik.swagger.annotations.ApiOperation)41 Produces (javax.ws.rs.Produces)30 DefaultValue (javax.ws.rs.DefaultValue)19 HeaderParam (javax.ws.rs.HeaderParam)19 Response (javax.ws.rs.core.Response)19 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)19 EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)19 ListResponse (org.gluu.oxtrust.model.scim2.ListResponse)18 VirtualListViewResponse (org.xdi.ldap.model.VirtualListViewResponse)18 Path (javax.ws.rs.Path)17 URI (java.net.URI)16 GET (javax.ws.rs.GET)13 ApiResponses (com.wordnik.swagger.annotations.ApiResponses)11 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11 POST (javax.ws.rs.POST)10 WebApplicationException (javax.ws.rs.WebApplicationException)10 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)9 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)9 Consumes (javax.ws.rs.Consumes)8 PersonRequiredFieldsException (org.gluu.oxtrust.exception.PersonRequiredFieldsException)8