コード例 #1
0
  @DELETE
  @Path(
      "/{"
          + RodaConstants.API_PATH_PARAM_REPRESENTATION_UUID
          + "}/"
          + RodaConstants.API_DESCRIPTIVE_METADATA
          + "/{"
          + RodaConstants.API_PATH_PARAM_METADATA_ID
          + "}")
  @ApiOperation(
      value = "Delete descriptive metadata",
      notes = "Delete an existing descriptive metadata file",
      response = Void.class)
  @ApiResponses(
      value = {
        @ApiResponse(code = 204, message = "OK", response = Void.class),
        @ApiResponse(code = 404, message = "Not found", response = ApiResponseMessage.class)
      })
  public Response deleteDescriptiveMetadataFromRepresentation(
      @ApiParam(value = "The ID of the existing Representation", required = true)
          @PathParam(RodaConstants.API_PATH_PARAM_REPRESENTATION_UUID)
          String representationId,
      @ApiParam(value = "The ID of the existing metadata file to delete", required = true)
          @PathParam(RodaConstants.API_PATH_PARAM_METADATA_ID)
          String metadataId,
      @ApiParam(
              value = "Choose format in which to get the response",
              allowableValues = RodaConstants.API_DELETE_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
    Browser.deleteRepresentationDescriptiveMetadataFile(user, representationId, metadataId);

    return Response.ok(
            new ApiResponseMessage(ApiResponseMessage.OK, "Descriptive metadata deleted"),
            mediaType)
        .build();
  }