@GET @Path( "/{" + RodaConstants.API_PATH_PARAM_REPRESENTATION_UUID + "}/" + RodaConstants.API_PRESERVATION_METADATA + "/") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, ExtraMediaType.APPLICATION_ZIP}) @ApiOperation( value = "Get representation preservation metadata", notes = "Get representation preservation metadata (JSON info, ZIP file conversion) for a given representation.\nOptional query params of **start** and **limit** defined the returned array.", response = PreservationMetadataList.class) @ApiResponses( value = { @ApiResponse(code = 200, message = "OK", response = PreservationMetadataList.class), @ApiResponse(code = 404, message = "Not found", response = ApiResponseMessage.class) }) public Response retrievePreservationMetadataListFromRepresentation( @ApiParam(value = "The ID of the existing representation", required = true) @PathParam(RodaConstants.API_PATH_PARAM_REPRESENTATION_UUID) String representationId, @ApiParam( value = "Choose format in which to get the metadata", allowableValues = RodaConstants.API_GET_LIST_MEDIA_TYPES, defaultValue = RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_JSON) @QueryParam(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT) String acceptFormat, @ApiParam(value = "Index of the agent element to return", defaultValue = "0") @QueryParam("startAgent") String startAgent, @ApiParam( value = "Maximum number of agents to return", defaultValue = RodaConstants.DEFAULT_PAGINATION_STRING_VALUE) @QueryParam("limitAgent") String limitAgent, @ApiParam(value = "Index of the first event to return", defaultValue = "0") @QueryParam("startEvent") String startEvent, @ApiParam( value = "Maximum number of events to return", defaultValue = RodaConstants.DEFAULT_PAGINATION_STRING_VALUE) @QueryParam("limitEvent") String limitEvent, @ApiParam(value = "Index of the first file to return", defaultValue = "0") @QueryParam("startFile") String startFile, @ApiParam( value = "Maximum number of files to return", defaultValue = RodaConstants.DEFAULT_PAGINATION_STRING_VALUE) @QueryParam("limitFile") String limitFile, @ApiParam( value = "The language for the HTML output", allowableValues = RodaConstants.API_DESCRIPTIVE_METADATA_LANGUAGES, defaultValue = RodaConstants.API_QUERY_VALUE_LANG_DEFAULT) @DefaultValue(RodaConstants.API_QUERY_VALUE_LANG_DEFAULT) @QueryParam(RodaConstants.API_QUERY_KEY_LANG) String language) throws RODAException { try { String mediaType = ApiUtils.getMediaType(acceptFormat, request); // get user User user = UserUtility.getApiUser(request); // delegate action to controller EntityResponse preservationMetadataList = Browser.retrieveAIPRepresentationPreservationMetadata( user, representationId, startAgent, limitAgent, startEvent, limitEvent, startFile, limitFile, acceptFormat, language); if (preservationMetadataList instanceof ObjectResponse) { ObjectResponse<PreservationMetadataList> pmlist = (ObjectResponse<PreservationMetadataList>) preservationMetadataList; return Response.ok(pmlist.getObject(), mediaType).build(); } else { return ApiUtils.okResponse((StreamResponse) preservationMetadataList); } } catch (TransformerException e) { return ApiUtils.errorResponse(e); } catch (IOException e) { return ApiUtils.errorResponse(new TransformerException(e.getMessage())); } }