From 27b229619cb30f706f67d26fdd1e3a78c379385c Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Wed, 27 Oct 2021 13:57:36 -0400 Subject: [PATCH] remove variable metadata API endpoints Both of these have been removed: - /api/access/variable/{varId}/metadata/ddi: - /api/meta/variable/{varId}: See https://github.com/IQSS/dataverse-security/issues/43 --- .../edu/harvard/iq/dataverse/api/Access.java | 28 ------------------ .../edu/harvard/iq/dataverse/api/Meta.java | 29 ------------------- 2 files changed, 57 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Access.java b/src/main/java/edu/harvard/iq/dataverse/api/Access.java index 71a4443ecc9..081c2105b1a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Access.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Access.java @@ -509,35 +509,7 @@ public String tabularDatafileMetadataDDI(@PathParam("fileId") String fileId, @Q return retValue; } - - @Path("variable/{varId}/metadata/ddi") - @GET - @Produces({ "application/xml" }) - - public String dataVariableMetadataDDI(@PathParam("varId") Long varId, @QueryParam("fileMetadataId") Long fileMetadataId, @QueryParam("exclude") String exclude, @QueryParam("include") String include, @Context HttpHeaders header, @Context HttpServletResponse response) /*throws NotFoundException, ServiceUnavailableException, PermissionDeniedException, AuthorizationRequiredException*/ { - String retValue = ""; - - ByteArrayOutputStream outStream = null; - try { - outStream = new ByteArrayOutputStream(); - - ddiExportService.exportDataVariable( - varId, - outStream, - exclude, - include, - fileMetadataId); - } catch (Exception e) { - // For whatever reason we've failed to generate a partial - // metadata record requested. We simply return an empty string. - return retValue; - } - retValue = outStream.toString(); - - return retValue; - } - /* * GET method for retrieving various auxiliary files associated with * a tabular datafile. diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Meta.java b/src/main/java/edu/harvard/iq/dataverse/api/Meta.java index 99e2c773b30..1ca97f2ec69 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Meta.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Meta.java @@ -68,35 +68,6 @@ public class Meta { @EJB DatasetServiceBean datasetService; - @Deprecated - @Path("variable/{varId}") - @GET - @Produces({ "application/xml" }) - - public String variable(@PathParam("varId") Long varId, @QueryParam("fileMetadataId") Long fileMetadataId, @QueryParam("exclude") String exclude, @QueryParam("include") String include, @Context HttpHeaders header, @Context HttpServletResponse response) /*throws NotFoundException, ServiceUnavailableException, PermissionDeniedException, AuthorizationRequiredException*/ { - String retValue = ""; - - ByteArrayOutputStream outStream = null; - try { - outStream = new ByteArrayOutputStream(); - - ddiExportService.exportDataVariable( - varId, - outStream, - exclude, - include, - fileMetadataId); - } catch (Exception e) { - // For whatever reason we've failed to generate a partial - // metadata record requested. We simply return an empty string. - return retValue; - } - - retValue = outStream.toString(); - - return retValue; - } - // Because this API is deprecated, we prefer to continue letting it operate on fileId rather adding support for persistent identifiers. @Deprecated @Path("datafile/{fileId}")