metadata prefix is now defined by the profile of the guidelines

This commit is contained in:
Katerina 2023-07-10 14:11:36 +03:00
parent afc881b443
commit 0dd8743b42
1 changed files with 19 additions and 2 deletions

View File

@ -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")) {