|
/*** OTHER METADATA ****/ |
|
|
|
@GET |
|
@Path("/{" + RodaConstants.API_PATH_PARAM_FILE_UUID + "}/" + RodaConstants.API_OTHER_METADATA + "/{" |
|
+ RodaConstants.API_PATH_PARAM_OTHER_METADATA_TYPE + "}/{" + RodaConstants.API_PATH_PARAM_OTHER_METADATA_FILE_SUFFIX |
|
+ "}") |
|
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, ExtraMediaType.APPLICATION_ZIP, |
|
ExtraMediaType.APPLICATION_JAVASCRIPT}) |
|
@JSONP(callback = RodaConstants.API_QUERY_DEFAULT_JSONP_CALLBACK, queryParam = RodaConstants.API_QUERY_KEY_JSONP_CALLBACK) |
|
@Operation(summary = "Get other metadata", description = "Gets other metadata (JSON info or ZIP file).\nOptional query params of **start** and **limit** defined the returned query", responses = { |
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OtherMetadataList.class))), |
|
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(implementation = ApiResponseMessage.class)))}) |
|
public Response retrieveOtherMetadata( |
|
@Parameter(description = "The UUID of the existing File", required = true) @PathParam(RodaConstants.API_PATH_PARAM_FILE_UUID) String fileUUID, |
|
@Parameter(description = "The type of the other metadata", required = true) @PathParam(RodaConstants.API_PATH_PARAM_OTHER_METADATA_TYPE) String type, |
|
@Parameter(description = "The file suffix of the other metadata", required = true) @PathParam(RodaConstants.API_PATH_PARAM_OTHER_METADATA_FILE_SUFFIX) String suffix, |
|
@Parameter(description = "Choose format in which to get the metadata", schema = @Schema(implementation = RodaConstants.GetFileMediaTypes.class, defaultValue = RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_JSON)) @QueryParam(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT) String acceptFormat, |
|
@Parameter(description = "JSONP callback name", required = false, schema = @Schema(defaultValue = RodaConstants.API_QUERY_DEFAULT_JSONP_CALLBACK)) @QueryParam(RodaConstants.API_QUERY_KEY_JSONP_CALLBACK) String jsonpCallbackName) |
|
throws RODAException { |
|
String mediaType = ApiUtils.getMediaType(acceptFormat, request); |
|
|
|
// get user |
|
User user = UserUtility.getApiUser(request); |
|
String fileSuffix = suffix; |
|
|
|
if (!fileSuffix.startsWith(".")) { |
|
fileSuffix = '.' + fileSuffix; |
|
} |
|
|
|
// delegate action to controller |
|
EntityResponse otherMetadata = Browser.retrieveOtherMetadata(user, fileUUID, type, fileSuffix, acceptFormat); |
|
|
|
if (otherMetadata instanceof ObjectResponse) { |
|
ObjectResponse<OtherMetadata> om = (ObjectResponse<OtherMetadata>) otherMetadata; |
|
return Response.ok(om.getObject(), mediaType).build(); |
|
} else { |
|
return ApiUtils.okResponse((StreamResponse) otherMetadata); |
|
} |
|
} |
roda/roda-ui/roda-wui/src/main/java/org/roda/wui/api/v1/FilesResource.java
Lines 310 to 348 in 7cf66c2