From 0dd8743b42257bdfaaf42a96e61a60712502d8fe Mon Sep 17 00:00:00 2001 From: Katerina Date: Mon, 10 Jul 2023 14:11:36 +0300 Subject: [PATCH] metadata prefix is now defined by the profile of the guidelines --- .../controllers/ValidationController.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/dnetlib/validatorapi/controllers/ValidationController.java b/src/main/java/eu/dnetlib/validatorapi/controllers/ValidationController.java index 95a40b2..d440224 100644 --- a/src/main/java/eu/dnetlib/validatorapi/controllers/ValidationController.java +++ b/src/main/java/eu/dnetlib/validatorapi/controllers/ValidationController.java @@ -186,11 +186,13 @@ public class ValidationController { public void validateWithApacheCamel(@RequestParam(name = "guidelines") String guidelinesProfileName, @RequestParam(name = "baseUrl", defaultValue = "http://repositorium.sdum.uminho.pt/oai/request") String baseURL, //not in use now @RequestParam(name="numberOfRecords", defaultValue = "10") int numberOfRecords, - @RequestParam(name="set", required = false) String set, //not in use now - @RequestParam(name="metadataPrefix", defaultValue = "oai_dc") String metadataPrefix) { + @RequestParam(name="set", required = false) String set//, //not in use now + //@RequestParam(name="metadataPrefix", defaultValue = "oai_dc") String metadataPrefix + ) { AbstractOpenAireProfile profile = initializeOpenAireProfile(guidelinesProfileName); AbstractOpenAireProfile fairProfile = initializeFairProfile(guidelinesProfileName); + String metadataPrefix = initializeMetadataPrefix(guidelinesProfileName); if (profile == null && fairProfile == null) { log.error("Exception: No valid guidelines " + guidelinesProfileName + "."); @@ -370,6 +372,21 @@ public class ValidationController { return null; } + private String initializeMetadataPrefix(String guidelinesProfileName) { + + if (guidelinesProfileName.equals("dataArchiveGuidelinesV2Profile")) { + return "oai_openaire"; + + } else if (guidelinesProfileName.equals("literatureGuidelinesV3Profile")) { + return "oai_dc"; + + } else if (guidelinesProfileName.equals("literatureGuidelinesV4Profile")) { + return "oai_openaire"; + } + + return null; + } + private AbstractOpenAireProfile initializeFairProfile(String guidelinesProfileName) { if (guidelinesProfileName.equals("dataArchiveGuidelinesV2Profile")) {