Ejemplo n.º 1
0
  @PUT
  @ApiOperation(
      value = "Update representation",
      notes = "Update existing representation",
      response = Representation.class)
  @ApiResponses(
      value = {
        @ApiResponse(code = 200, message = "OK", response = Representation.class),
        @ApiResponse(code = 404, message = "Not found", response = ApiResponseMessage.class)
      })
  public Response updateRepresentation(
      Representation representation,
      @ApiParam(
              value = "Choose format in which to get the representation",
              allowableValues = RodaConstants.API_POST_PUT_MEDIA_TYPES)
          @QueryParam(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT)
          String acceptFormat)
      throws RODAException {
    String mediaType = ApiUtils.getMediaType(acceptFormat, request);

    // get user
    User user = UserUtility.getApiUser(request);

    // delegate action to controller
    Representation rep = Browser.updateRepresentation(user, representation);
    return Response.ok(rep, mediaType).build();
  }