From a1f4d6cfe65d6c44e212fcc1ca916d2d93cc4f03 Mon Sep 17 00:00:00 2001 From: Ian Allen Date: Fri, 29 Sep 2023 13:21:18 -0300 Subject: [PATCH] Switch getAndCheckMetadataId to getInternalId in recent canViewRecord changes as it supports both uuid and internal id. --- services/src/main/java/org/fao/geonet/api/ApiUtils.java | 4 +--- .../src/main/java/org/fao/geonet/api/records/MetadataApi.java | 2 +- .../org/fao/geonet/api/records/MetadataAssociatedApi.java | 3 --- .../src/main/java/org/fao/geonet/api/related/Related.java | 2 -- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/services/src/main/java/org/fao/geonet/api/ApiUtils.java b/services/src/main/java/org/fao/geonet/api/ApiUtils.java index 2a3f94b2148..6d0c271f433 100644 --- a/services/src/main/java/org/fao/geonet/api/ApiUtils.java +++ b/services/src/main/java/org/fao/geonet/api/ApiUtils.java @@ -23,8 +23,6 @@ package org.fao.geonet.api; -import static org.fao.geonet.api.records.attachments.AbstractStore.getAndCheckMetadataId; - import com.google.common.collect.Sets; import jeeves.constants.Jeeves; import jeeves.server.UserSession; @@ -295,7 +293,7 @@ public static AbstractMetadata canViewRecord(String metadataUuid, boolean approv String metadataId; if (!approved) { // If the record is not approved then we need to get the id of the record. - metadataId = String.valueOf(getAndCheckMetadataId(metadataUuid, approved)); + metadataId = getInternalId(metadataUuid, approved); } else { // Otherwise use the uuid or id that was supplied. metadataId = metadataUuid; diff --git a/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java b/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java index 4082f441007..2323f1439ab 100644 --- a/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/MetadataApi.java @@ -73,7 +73,7 @@ import java.util.stream.Stream; import static org.fao.geonet.api.ApiParams.*; -import static org.fao.geonet.api.records.attachments.AbstractStore.getAndCheckMetadataId; + import static org.fao.geonet.kernel.mef.MEFLib.Version.Constants.MEF_V1_ACCEPT_TYPE; import static org.fao.geonet.kernel.mef.MEFLib.Version.Constants.MEF_V2_ACCEPT_TYPE; diff --git a/services/src/main/java/org/fao/geonet/api/records/MetadataAssociatedApi.java b/services/src/main/java/org/fao/geonet/api/records/MetadataAssociatedApi.java index 1f355fd3267..5859385b99c 100644 --- a/services/src/main/java/org/fao/geonet/api/records/MetadataAssociatedApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/MetadataAssociatedApi.java @@ -52,11 +52,8 @@ import javax.servlet.http.HttpServletRequest; import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; import static org.fao.geonet.api.ApiParams.*; -import static org.fao.geonet.api.records.attachments.AbstractStore.getAndCheckMetadataId; @RequestMapping(value = { "/{portal}/api/records" diff --git a/services/src/main/java/org/fao/geonet/api/related/Related.java b/services/src/main/java/org/fao/geonet/api/related/Related.java index fd1de74d6cd..ae800982a45 100644 --- a/services/src/main/java/org/fao/geonet/api/related/Related.java +++ b/services/src/main/java/org/fao/geonet/api/related/Related.java @@ -58,8 +58,6 @@ import java.util.Locale; import java.util.Map; -import static org.fao.geonet.api.records.attachments.AbstractStore.getAndCheckMetadataId; - @RequestMapping(value = { "/{portal}/api/related" })