reference type changes

This commit is contained in:
Efstratios Giannopoulos 2024-02-20 10:11:49 +02:00
parent 9f36710276
commit eb228fa329
8 changed files with 20 additions and 212 deletions

View File

@ -1,17 +0,0 @@
package eu.eudat.configurations.referencetype;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableConfigurationProperties({ReferenceTypeProperties.class})
public class ReferenceTypeConfiguration {
private final ReferenceTypeProperties referenceTypeProperties;
@Autowired
public ReferenceTypeConfiguration(ReferenceTypeProperties referenceTypeProperties) {
this.referenceTypeProperties = referenceTypeProperties;
}
}

View File

@ -1,24 +0,0 @@
package eu.eudat.configurations.referencetype;
public class ReferenceTypeField {
String code;
String dataType;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
}

View File

@ -1,164 +0,0 @@
package eu.eudat.configurations.referencetype;
import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
import eu.eudat.model.referencedefinition.Field;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.bind.ConstructorBinding;
import java.util.List;
import java.util.Map;
@ConfigurationProperties(prefix = "reference-type")
public class ReferenceTypeProperties {
private Map<String, List<ReferenceTypeField>> grant;
private Map<String, List<ReferenceTypeField>> funder;
private Map<String, List<ReferenceTypeField>> researcher;
private Map<String, List<ReferenceTypeField>> service;
private Map<String, List<ReferenceTypeField>> registry;
private Map<String, List<ReferenceTypeField>> project;
private Map<String, List<ReferenceTypeField>> organisation;
private Map<String, List<ReferenceTypeField>> dataset;
private Map<String, List<ReferenceTypeField>> dataRepository;
private Map<String, List<ReferenceTypeField>> pubRepository;
private Map<String, List<ReferenceTypeField>> journal;
private Map<String, List<ReferenceTypeField>> publication;
private Map<String, List<ReferenceTypeField>> licence;
private Map<String, List<ReferenceTypeField>> taxonomy;
@ConstructorBinding
public ReferenceTypeProperties(Map<String, List<ReferenceTypeField>> grant, Map<String, List<ReferenceTypeField>> funder,
Map<String, List<ReferenceTypeField>> researcher, Map<String, List<ReferenceTypeField>> service,
Map<String, List<ReferenceTypeField>> registry, Map<String, List<ReferenceTypeField>> project,
Map<String, List<ReferenceTypeField>> organisation, Map<String, List<ReferenceTypeField>> dataset,
Map<String, List<ReferenceTypeField>> dataRepository, Map<String, List<ReferenceTypeField>> pubRepository,
Map<String, List<ReferenceTypeField>> journal, Map<String, List<ReferenceTypeField>> publication,
Map<String, List<ReferenceTypeField>> licence, Map<String, List<ReferenceTypeField>> taxonomy) {
this.grant = grant;
this.funder = funder;
this.researcher = researcher;
this.service = service;
this.registry = registry;
this.project = project;
this.organisation = organisation;
this.dataset = dataset;
this.dataRepository = dataRepository;
this.pubRepository = pubRepository;
this.journal = journal;
this.publication = publication;
this.licence = licence;
this.taxonomy = taxonomy;
}
public Map<String, List<ReferenceTypeField>> getGrant() {
return grant;
}
public void setGrant(Map<String, List<ReferenceTypeField>> grant) {
this.grant = grant;
}
public Map<String, List<ReferenceTypeField>> getFunder() {
return funder;
}
public void setFunder(Map<String, List<ReferenceTypeField>> funder) {
this.funder = funder;
}
public Map<String, List<ReferenceTypeField>> getResearcher() {
return researcher;
}
public void setResearcher(Map<String, List<ReferenceTypeField>> researcher) {
this.researcher = researcher;
}
public Map<String, List<ReferenceTypeField>> getService() {
return service;
}
public void setService(Map<String, List<ReferenceTypeField>> service) {
this.service = service;
}
public Map<String, List<ReferenceTypeField>> getRegistry() {
return registry;
}
public void setRegistry(Map<String, List<ReferenceTypeField>> registry) {
this.registry = registry;
}
public Map<String, List<ReferenceTypeField>> getProject() {
return project;
}
public void setProject(Map<String, List<ReferenceTypeField>> project) {
this.project = project;
}
public Map<String, List<ReferenceTypeField>> getOrganisation() {
return organisation;
}
public void setOrganisation(Map<String, List<ReferenceTypeField>> organisation) {
this.organisation = organisation;
}
public Map<String, List<ReferenceTypeField>> getDataset() {
return dataset;
}
public void setDataset(Map<String, List<ReferenceTypeField>> dataset) {
this.dataset = dataset;
}
public Map<String, List<ReferenceTypeField>> getDataRepository() {
return dataRepository;
}
public void setDataRepository(Map<String, List<ReferenceTypeField>> dataRepository) {
this.dataRepository = dataRepository;
}
public Map<String, List<ReferenceTypeField>> getPubRepository() {
return pubRepository;
}
public void setPubRepository(Map<String, List<ReferenceTypeField>> pubRepository) {
this.pubRepository = pubRepository;
}
public Map<String, List<ReferenceTypeField>> getJournal() {
return journal;
}
public void setJournal(Map<String, List<ReferenceTypeField>> journal) {
this.journal = journal;
}
public Map<String, List<ReferenceTypeField>> getPublication() {
return publication;
}
public void setPublication(Map<String, List<ReferenceTypeField>> publication) {
this.publication = publication;
}
public Map<String, List<ReferenceTypeField>> getLicence() {
return licence;
}
public void setLicence(Map<String, List<ReferenceTypeField>> licence) {
this.licence = licence;
}
public Map<String, List<ReferenceTypeField>> getTaxonomy() {
return taxonomy;
}
public void setTaxonomy(Map<String, List<ReferenceTypeField>> taxonomy) {
this.taxonomy = taxonomy;
}
}

View File

@ -1,9 +1,11 @@
package eu.eudat.query.lookup; package eu.eudat.query.lookup;
import eu.eudat.model.Reference;
import eu.eudat.query.ReferenceQuery; import eu.eudat.query.ReferenceQuery;
import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.Lookup;
import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.data.query.QueryFactory;
import java.util.List;
import java.util.UUID; import java.util.UUID;
public class ReferenceSearchLookup extends Lookup { public class ReferenceSearchLookup extends Lookup {
@ -14,6 +16,8 @@ public class ReferenceSearchLookup extends Lookup {
private String key; private String key;
private List<Reference> dependencyReferences;
public String getLike() { public String getLike() {
return like; return like;
} }
@ -38,6 +42,14 @@ public class ReferenceSearchLookup extends Lookup {
this.key = key; this.key = key;
} }
public List<Reference> getDependencyReferences() {
return dependencyReferences;
}
public void setDependencyReferences(List<Reference> dependencyReferences) {
this.dependencyReferences = dependencyReferences;
}
public ReferenceQuery enrich(QueryFactory queryFactory) { public ReferenceQuery enrich(QueryFactory queryFactory) {
ReferenceQuery query = queryFactory.query(ReferenceQuery.class); ReferenceQuery query = queryFactory.query(ReferenceQuery.class);
if (this.typeId != null) query.typeIds(this.typeId); if (this.typeId != null) query.typeIds(this.typeId);

View File

@ -175,7 +175,7 @@ public class ReferenceServiceImpl implements ReferenceService {
} else { } else {
like = null; like = null;
} }
ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(like); ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(like, lookup.getDependencyReferences());
ExternalDataResult remoteRepos = this.getReferenceData(data, externalReferenceCriteria, lookup.getKey()); ExternalDataResult remoteRepos = this.getReferenceData(data, externalReferenceCriteria, lookup.getKey());

View File

@ -14,6 +14,11 @@ public class ExternalReferenceCriteria {
private List<Reference> dependencyReferences; private List<Reference> dependencyReferences;
public ExternalReferenceCriteria(String like, List<Reference> dependencyReferences) {
this.like = like;
this.dependencyReferences = dependencyReferences;
}
public String getLike() { public String getLike() {
return like; return like;
} }
@ -51,10 +56,6 @@ public class ExternalReferenceCriteria {
this.host = host; this.host = host;
} }
public ExternalReferenceCriteria(String like) {
this.like = like;
}
public ExternalReferenceCriteria() { public ExternalReferenceCriteria() {
} }

View File

@ -21,7 +21,7 @@ public class ValidationManager {
} }
public Boolean validateIdentifier(String identifier, String type) throws MyNotFoundException { public Boolean validateIdentifier(String identifier, String type) throws MyNotFoundException {
ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(identifier); ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(identifier, null);
// Integer count = this.remoteFetcherService.countEntries(externalReferenceCriteria, type); // Integer count = this.remoteFetcherService.countEntries(externalReferenceCriteria, type);
Integer count = 1; Integer count = 1;
return this.userScope.isSet() && count > 0; return this.userScope.isSet() && count > 0;

View File

@ -20,7 +20,7 @@ public class ExternalValidationService {
} }
public Boolean validateIdentifier(String identifier, String type) throws MyNotFoundException { public Boolean validateIdentifier(String identifier, String type) throws MyNotFoundException {
ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(identifier); ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(identifier, null);
// Integer count = this.remoteFetcherService.countEntries(externalReferenceCriteria, type); // Integer count = this.remoteFetcherService.countEntries(externalReferenceCriteria, type);
Integer count = 1; Integer count = 1;
return userScope.isSet() && count > 0; return userScope.isSet() && count > 0;