Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
a60862f84e
|
@ -194,6 +194,8 @@ public class DescriptionTemplateXmlMigrationService {
|
||||||
data.setId(persist.getId().trim());
|
data.setId(persist.getId().trim());
|
||||||
data.setOrdinal(persist.getOrdinal());
|
data.setOrdinal(persist.getOrdinal());
|
||||||
data.setSemantics(persist.getSchematics());
|
data.setSemantics(persist.getSchematics());
|
||||||
|
// if (persist.getSchematics() != null && persist.getSchematics().stream().anyMatch("rda.dmp.cost"::equalsIgnoreCase)) throw new MyApplicationException("rda.dmp.cost not implemented");
|
||||||
|
// if (persist.getSchematics() != null && persist.getSchematics().stream().anyMatch("rda.dataset.data_quality_assurance"::equalsIgnoreCase)) throw new MyApplicationException("rda.dataset.data_quality_assurance not implemented");
|
||||||
if (persist.getValidations() != null) data.setValidations(persist.getValidations().stream().map(x-> {
|
if (persist.getValidations() != null) data.setValidations(persist.getValidations().stream().map(x-> {
|
||||||
switch (x){
|
switch (x){
|
||||||
case NONE -> {
|
case NONE -> {
|
||||||
|
@ -584,10 +586,20 @@ public class DescriptionTemplateXmlMigrationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReferenceTypeEntity getReferenceTypeEntityByUrl(ReferenceTypeDefinitionEntity definitionEntity, Map<UUID, ReferenceTypeEntity> knownReferenceEntities){
|
private ReferenceTypeEntity getReferenceTypeEntityByUrl(ReferenceTypeDefinitionEntity definitionEntity, Map<UUID, ReferenceTypeEntity> knownReferenceEntities){
|
||||||
if (definitionEntity == null || this.conventionService.isListNullOrEmpty(definitionEntity.getSources()) || definitionEntity.getSources().size() != 1) return null;
|
if (definitionEntity == null || this.conventionService.isListNullOrEmpty(definitionEntity.getSources()) || definitionEntity.getSources().isEmpty()) return null;
|
||||||
ExternalFetcherApiSourceConfigurationEntity externalFetcherApiSourceConfigurationEntity = (ExternalFetcherApiSourceConfigurationEntity)definitionEntity.getSources().getFirst();
|
List<ReferenceTypeEntity> referenceTypeEntities = new ArrayList<>();
|
||||||
|
for (ExternalFetcherBaseSourceConfigurationEntity externalFetcherApiSourceConfigurationEntity : definitionEntity.getSources()){
|
||||||
|
ReferenceTypeEntity referenceTypeEntity = getReferenceTypeEntityForSourceByUrl((ExternalFetcherApiSourceConfigurationEntity)externalFetcherApiSourceConfigurationEntity, knownReferenceEntities);
|
||||||
|
if (referenceTypeEntity == null) return null;
|
||||||
|
if (referenceTypeEntities.stream().noneMatch(x-> x.getId().equals(referenceTypeEntity.getId()))) referenceTypeEntities.add(referenceTypeEntity);
|
||||||
|
}
|
||||||
|
if (referenceTypeEntities.size() == 1) return referenceTypeEntities.getFirst();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ReferenceTypeEntity getReferenceTypeEntityForSourceByUrl(ExternalFetcherApiSourceConfigurationEntity externalFetcherApiSourceConfigurationEntity, Map<UUID, ReferenceTypeEntity> knownReferenceEntities){
|
||||||
if (externalFetcherApiSourceConfigurationEntity == null || this.conventionService.isNullOrEmpty(externalFetcherApiSourceConfigurationEntity.getUrl())) return null;
|
if (externalFetcherApiSourceConfigurationEntity == null || this.conventionService.isNullOrEmpty(externalFetcherApiSourceConfigurationEntity.getUrl())) return null;
|
||||||
|
|
||||||
String url = StringUtils.stripEnd(externalFetcherApiSourceConfigurationEntity.getUrl().trim().toLowerCase(Locale.ROOT).replace(" ", ""), "/");
|
String url = StringUtils.stripEnd(externalFetcherApiSourceConfigurationEntity.getUrl().trim().toLowerCase(Locale.ROOT).replace(" ", ""), "/");
|
||||||
if (url.equals("https://eestore.paas2.uninett.no/api/license".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.License);
|
if (url.equals("https://eestore.paas2.uninett.no/api/license".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.License);
|
||||||
else if (url.equals("https://zenodo.org/api/licenses".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.License);
|
else if (url.equals("https://zenodo.org/api/licenses".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.License);
|
||||||
|
@ -601,7 +613,7 @@ public class DescriptionTemplateXmlMigrationService {
|
||||||
else if (url.equals("https://services.openaire.eu/search/v2/api/resources?query=oaftype exact datasource and {like} and ( datasourcetypeuiid = \"pubsrepository::journal\" or datasourcetypeuiid = \"aggregator::pubsrepository::journals\")&page=0&size=60&format=json".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.Journal);
|
else if (url.equals("https://services.openaire.eu/search/v2/api/resources?query=oaftype exact datasource and {like} and ( datasourcetypeuiid = \"pubsrepository::journal\" or datasourcetypeuiid = \"aggregator::pubsrepository::journals\")&page=0&size=60&format=json".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.Journal);
|
||||||
else if (url.equals("https://eestore.paas2.uninett.no/api/metadataschema".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.Registries);
|
else if (url.equals("https://eestore.paas2.uninett.no/api/metadataschema".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.Registries);
|
||||||
else if (url.equals("https://eestore.paas2.uninett.no/api/taxonomy".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.Taxonomy);
|
else if (url.equals("https://eestore.paas2.uninett.no/api/taxonomy".trim().toLowerCase(Locale.ROOT).replace(" ", ""))) return knownReferenceEntities.get(ReferenceTypeIds.Taxonomy);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue