cris repository registration functionality
This commit is contained in:
parent
982d299b2d
commit
bd31f55685
|
@ -116,22 +116,28 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
LOGGER.debug("Initialization method of repository api!");
|
||||
LOGGER.debug("Updated version!");
|
||||
|
||||
dataSourceClass.put("opendoar", Arrays.asList("pubsrepository::institutional", "pubsrepository::thematic", "pubsrepository::unknown", "pubsrepository::mock"));
|
||||
dataSourceClass.put("re3data", Collections.singletonList("datarepository::unknown"));
|
||||
dataSourceClass.put("journal", Collections.singletonList("pubsrepository::journal"));
|
||||
dataSourceClass.put("aggregator", Arrays.asList("aggregator::pubsrepository::institutional", "aggregator::pubsrepository::journals", "aggregator::datarepository", "aggregator::pubsrepository::unknown"));
|
||||
|
||||
invertedDataSourceClass.put("pubsrepository::institutional", "opendoar");
|
||||
invertedDataSourceClass.put("pubsrepository::thematic", "opendoar");
|
||||
invertedDataSourceClass.put("pubsrepository::unknown", "opendoar");
|
||||
invertedDataSourceClass.put("pubsrepository::mock", "opendoar");
|
||||
invertedDataSourceClass.put("datarepository::unknown", "re3data");
|
||||
invertedDataSourceClass.put("pubsrepository::journal", "journal");
|
||||
invertedDataSourceClass.put("aggregator::pubsrepository::institutional", "aggregator");
|
||||
invertedDataSourceClass.put("aggregator::pubsrepository::journals", "aggregator");
|
||||
invertedDataSourceClass.put("aggregator::datarepository", "aggregator");
|
||||
invertedDataSourceClass.put("aggregator::pubsrepository::unknown", "aggregator");
|
||||
for (String key : this.getVocabulary("dnet:datasource_typologies").getAsMap().keySet()) {
|
||||
if (key.contains("aggregator")) {
|
||||
dataSourceClass.putIfAbsent("aggregator", new ArrayList<>());
|
||||
dataSourceClass.get("aggregator").add(key);
|
||||
} else if (key.contains("crissystem")) {
|
||||
dataSourceClass.putIfAbsent("cris", new ArrayList<>());
|
||||
dataSourceClass.get("cris").add(key);
|
||||
} else if (key.contains("pubsrepository::journal")) { // do not change order -->
|
||||
dataSourceClass.putIfAbsent("journal", Collections.singletonList("pubsrepository::journal"));
|
||||
} else if (key.contains("pubsrepository")) { // do not change order <--
|
||||
dataSourceClass.putIfAbsent("opendoar", new ArrayList<>());
|
||||
dataSourceClass.get("opendoar").add(key);
|
||||
} else if (key.contains("datarepository")) {
|
||||
dataSourceClass.putIfAbsent("re3data", Collections.singletonList("datarepository::unknown"));
|
||||
} 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.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
|
@ -245,6 +251,8 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
filterKey = "openaire____::opendoar";
|
||||
else if (mode.equalsIgnoreCase("re3data"))
|
||||
filterKey = "openaire____::re3data";
|
||||
else if (mode.equalsIgnoreCase("cris"))
|
||||
filterKey = "eurocrisdris::dris";
|
||||
|
||||
|
||||
LOGGER.debug("Country code equals : " + country);
|
||||
|
@ -804,6 +812,9 @@ LOGGER.debug("json: " + jsonArray);
|
|||
} else if (mode.equalsIgnoreCase("re3data")) {
|
||||
if (entry.getKey().contains("datarepository"))
|
||||
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());
|
||||
foundData = true;
|
||||
}
|
||||
}
|
||||
else if (mode.equalsIgnoreCase("cris")) {
|
||||
if (entry.getKey().contains("openaire-cris")) {
|
||||
retMap.put(entry.getKey(), entry.getValue());
|
||||
foundData = true;
|
||||
}
|
||||
} else {
|
||||
if (entry.getKey().matches("^openaire[1-9].0$") || entry.getKey().equals("driver"))
|
||||
retMap.put(entry.getKey(), entry.getValue());
|
||||
|
@ -869,6 +886,9 @@ LOGGER.debug("json: " + jsonArray);
|
|||
} else if (mode.equalsIgnoreCase("re3data")) {
|
||||
if (entry.getKey().contains("datarepository"))
|
||||
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);
|
||||
|
@ -909,6 +929,8 @@ LOGGER.debug("json: " + jsonArray);
|
|||
public Map<String, String> getListLatestUpdate(String mode) throws JSONException {
|
||||
if (mode.equals("opendoar"))
|
||||
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
|
||||
/*
|
||||
* first api of re3data has null value on collection date
|
||||
|
|
|
@ -140,7 +140,8 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
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());
|
||||
} else {
|
||||
this.getValidationService().submitValidationJob(jobForValidation);
|
||||
|
|
Loading…
Reference in New Issue