cris repository registration functionality

This commit is contained in:
Konstantinos Spyrou 2022-04-20 10:26:28 +00:00
parent 982d299b2d
commit bd31f55685
2 changed files with 39 additions and 16 deletions

View File

@ -116,22 +116,28 @@ public class RepositoryServiceImpl implements RepositoryService {
LOGGER.debug("Initialization method of repository api!"); LOGGER.debug("Initialization method of repository api!");
LOGGER.debug("Updated version!"); LOGGER.debug("Updated version!");
dataSourceClass.put("opendoar", Arrays.asList("pubsrepository::institutional", "pubsrepository::thematic", "pubsrepository::unknown", "pubsrepository::mock")); for (String key : this.getVocabulary("dnet:datasource_typologies").getAsMap().keySet()) {
dataSourceClass.put("re3data", Collections.singletonList("datarepository::unknown")); if (key.contains("aggregator")) {
dataSourceClass.put("journal", Collections.singletonList("pubsrepository::journal")); dataSourceClass.putIfAbsent("aggregator", new ArrayList<>());
dataSourceClass.put("aggregator", Arrays.asList("aggregator::pubsrepository::institutional", "aggregator::pubsrepository::journals", "aggregator::datarepository", "aggregator::pubsrepository::unknown")); dataSourceClass.get("aggregator").add(key);
} else if (key.contains("crissystem")) {
invertedDataSourceClass.put("pubsrepository::institutional", "opendoar"); dataSourceClass.putIfAbsent("cris", new ArrayList<>());
invertedDataSourceClass.put("pubsrepository::thematic", "opendoar"); dataSourceClass.get("cris").add(key);
invertedDataSourceClass.put("pubsrepository::unknown", "opendoar"); } else if (key.contains("pubsrepository::journal")) { // do not change order -->
invertedDataSourceClass.put("pubsrepository::mock", "opendoar"); dataSourceClass.putIfAbsent("journal", Collections.singletonList("pubsrepository::journal"));
invertedDataSourceClass.put("datarepository::unknown", "re3data"); } else if (key.contains("pubsrepository")) { // do not change order <--
invertedDataSourceClass.put("pubsrepository::journal", "journal"); dataSourceClass.putIfAbsent("opendoar", new ArrayList<>());
invertedDataSourceClass.put("aggregator::pubsrepository::institutional", "aggregator"); dataSourceClass.get("opendoar").add(key);
invertedDataSourceClass.put("aggregator::pubsrepository::journals", "aggregator"); } else if (key.contains("datarepository")) {
invertedDataSourceClass.put("aggregator::datarepository", "aggregator"); dataSourceClass.putIfAbsent("re3data", Collections.singletonList("datarepository::unknown"));
invertedDataSourceClass.put("aggregator::pubsrepository::unknown", "aggregator"); } else if (key.contains("pubsrepository::journal")) {
dataSourceClass.putIfAbsent("journal", Collections.singletonList("pubsrepository::journal"));
}
}
for (Map.Entry<String, List<String>> entry : dataSourceClass.entrySet()) {
entry.getValue().forEach(v -> invertedDataSourceClass.put(v, entry.getKey()));
}
httpHeaders = new HttpHeaders(); httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8); httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
@ -245,6 +251,8 @@ public class RepositoryServiceImpl implements RepositoryService {
filterKey = "openaire____::opendoar"; filterKey = "openaire____::opendoar";
else if (mode.equalsIgnoreCase("re3data")) else if (mode.equalsIgnoreCase("re3data"))
filterKey = "openaire____::re3data"; filterKey = "openaire____::re3data";
else if (mode.equalsIgnoreCase("cris"))
filterKey = "eurocrisdris::dris";
LOGGER.debug("Country code equals : " + country); LOGGER.debug("Country code equals : " + country);
@ -804,6 +812,9 @@ LOGGER.debug("json: " + jsonArray);
} else if (mode.equalsIgnoreCase("re3data")) { } else if (mode.equalsIgnoreCase("re3data")) {
if (entry.getKey().contains("datarepository")) if (entry.getKey().contains("datarepository"))
resultSet.add(entry.getValue()); resultSet.add(entry.getValue());
} else if (mode.equalsIgnoreCase("cris")) {
if (entry.getKey().contains("crissystem"))
resultSet.add(entry.getValue());
} }
} }
@ -836,6 +847,12 @@ LOGGER.debug("json: " + jsonArray);
retMap.put(entry.getKey(), entry.getValue()); retMap.put(entry.getKey(), entry.getValue());
foundData = true; foundData = true;
} }
}
else if (mode.equalsIgnoreCase("cris")) {
if (entry.getKey().contains("openaire-cris")) {
retMap.put(entry.getKey(), entry.getValue());
foundData = true;
}
} else { } else {
if (entry.getKey().matches("^openaire[1-9].0$") || entry.getKey().equals("driver")) if (entry.getKey().matches("^openaire[1-9].0$") || entry.getKey().equals("driver"))
retMap.put(entry.getKey(), entry.getValue()); retMap.put(entry.getKey(), entry.getValue());
@ -869,6 +886,9 @@ LOGGER.debug("json: " + jsonArray);
} else if (mode.equalsIgnoreCase("re3data")) { } else if (mode.equalsIgnoreCase("re3data")) {
if (entry.getKey().contains("datarepository")) if (entry.getKey().contains("datarepository"))
retMap.put(entry.getKey(), entry.getValue()); retMap.put(entry.getKey(), entry.getValue());
} else if (mode.equalsIgnoreCase("cris")) {
if (entry.getKey().contains("crissystem"))
retMap.put(entry.getKey(), entry.getValue());
} }
} }
return filterResults(retMap, mode); return filterResults(retMap, mode);
@ -909,6 +929,8 @@ LOGGER.debug("json: " + jsonArray);
public Map<String, String> getListLatestUpdate(String mode) throws JSONException { public Map<String, String> getListLatestUpdate(String mode) throws JSONException {
if (mode.equals("opendoar")) if (mode.equals("opendoar"))
return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::" + mode).get(0).getLastCollectionDate()); return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::" + mode).get(0).getLastCollectionDate());
else if (mode.equals("cris"))
return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("eurocrisdris::dris").get(0).getLastCollectionDate());
else else
/* /*
* first api of re3data has null value on collection date * first api of re3data has null value on collection date

View File

@ -140,7 +140,8 @@ public class ValidatorServiceImpl implements ValidatorService {
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly // // FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
if (jobForValidation.getSelectedContentRules()!=null && jobForValidation.getSelectedContentRules().size() == 1 && if (jobForValidation.getSelectedContentRules()!=null && jobForValidation.getSelectedContentRules().size() == 1 &&
jobForValidation.getSelectedContentRules().contains(-1000)) { jobForValidation.getSelectedContentRules().contains(-1000)
|| jobForValidation.getDesiredCompatibilityLevel().matches("openaire-cris_1.1")) {
crisValidatorExecutor.submit(jobForValidation.getBaseUrl(), jobForValidation.getUserEmail()); crisValidatorExecutor.submit(jobForValidation.getBaseUrl(), jobForValidation.getUserEmail());
} else { } else {
this.getValidationService().submitValidationJob(jobForValidation); this.getValidationService().submitValidationJob(jobForValidation);