Refactors the prefix saved as reference from external sources to always be in lower case letters.

This commit is contained in:
gkolokythas 2019-11-21 18:25:43 +02:00
parent 92a2e546e9
commit 8cb993433c
9 changed files with 9 additions and 21 deletions

View File

@ -28,7 +28,7 @@ public class FunderDaoImpl extends DatabaseAccess<Funder> implements FunderDao {
builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.or(builder.like(builder.upper(root.get("definition")), "%" + criteria.getLike().toUpperCase() + "%"))));
if (criteria.getReference() != null)
query.where((builder, root) -> builder.like(root.get("reference"), "%" + criteria.getReference() + "%"));
query.where((builder, root) -> builder.like(builder.upper(root.get("reference")), "%" + criteria.getReference().toUpperCase() + "%"));
query.where((builder, root) -> builder.notEqual(root.get("status"), Funder.Status.DELETED.getValue()));
return query;
}

View File

@ -106,7 +106,7 @@ public class GrantManager {
return grant;
}*/
public List<eu.eudat.models.data.grant.Grant> getCriteriaWithExternal(GrantCriteriaRequest grantCriteria, Principal principal) throws IllegalAccessException, InstantiationException, HugeResultSet, NoURLFound {
public List<eu.eudat.models.data.grant.Grant> getCriteriaWithExternal(GrantCriteriaRequest grantCriteria, Principal principal) throws HugeResultSet, NoURLFound {
eu.eudat.data.entities.UserInfo userInfo = new eu.eudat.data.entities.UserInfo();
userInfo.setId(principal.getId());
if (grantCriteria.getCriteria().getFunderReference() != null && !grantCriteria.getCriteria().getFunderReference().trim().isEmpty()) {

View File

@ -91,12 +91,9 @@ public class DataRepository implements DataModel<eu.eudat.data.entities.DataRepo
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
entity.setReference(this.reference);
} else {
entity.setReference(this.source + ":" + this.reference);
entity.setReference(this.source.toLowerCase() + ":" + this.reference);
}
}
if (this.reference == null) {
entity.setReference(this.source + ":" + this.label);
}
return entity;
}

View File

@ -95,12 +95,9 @@ public class Registry implements DataModel<eu.eudat.data.entities.Registry, Regi
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
entity.setReference(this.reference);
} else {
entity.setReference(this.source + ":" + this.reference);
entity.setReference(this.source.toLowerCase() + ":" + this.reference);
}
}
if (this.reference == null) {
entity.setReference(this.source + ":" + this.label);
}
entity.setUri(this.uri);
entity.setModified(new Date());
entity.setStatus((short)0);

View File

@ -92,12 +92,9 @@ public class Service implements DataModel<eu.eudat.data.entities.Service, Servic
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
entity.setReference(this.reference);
} else {
entity.setReference(this.source + ":" + this.reference);
entity.setReference(this.source.toLowerCase() + ":" + this.reference);
}
}
if (this.reference == null) {
entity.setReference(this.source + ":" + this.label);
}
entity.setUri(this.uri);
entity.setModified(new Date());
entity.setStatus((short)0);

View File

@ -137,12 +137,9 @@ public class ExternalDatasetListingModel implements DataModel<ExternalDataset, E
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
externalDataset.setReference(this.reference);
} else {
externalDataset.setReference(this.source + ":" + this.reference);
externalDataset.setReference(this.source.toLowerCase() + ":" + this.reference);
}
}
if (this.reference == null) {
externalDataset.setReference(this.source + ":" + this.name);
}
externalDataset.setModified(new Date());
return externalDataset;
}

View File

@ -100,7 +100,7 @@ public class Funder implements DataModel<eu.eudat.data.entities.Funder, Funder>
entity.setId(this.id);
entity.setLabel(this.label);
entity.setType(this.type);
entity.setReference(this.reference == null ? "dmp:" + this.label : this.source + ":" + this.reference);
entity.setReference(this.reference == null ? "dmp:" + this.label : this.source.toLowerCase() + ":" + this.reference);
entity.setDefinition(this.definition);
entity.setCreated(this.created == null ? new Date() : this.created);
entity.setStatus(this.status != null ? this.getStatus() : eu.eudat.data.entities.Grant.Status.ACTIVE.getValue());

View File

@ -189,7 +189,7 @@ public class Grant implements DataModel<eu.eudat.data.entities.Grant, Grant> {
entity.setAbbreviation(this.abbreviation);
entity.setLabel(this.label);
entity.setType(this.type);
entity.setReference(this.reference == null ? "dmp:" + this.label : this.source + ":" + this.reference);
entity.setReference(this.reference == null ? "dmp:" + this.label : this.source.toLowerCase() + ":" + this.reference);
entity.setUri(this.uri);
entity.setDefinition(this.definition);
entity.setStartdate(this.startDate);

View File

@ -176,7 +176,7 @@ public class Project implements DataModel<eu.eudat.data.entities.Project, Projec
entity.setAbbreviation(this.abbreviation);
entity.setLabel(this.label);
entity.setType(this.type);
entity.setReference(this.reference == null ? "dmp:" + this.label : this.source + ":" + this.reference);
entity.setReference(this.reference == null ? "dmp:" + this.label : this.source.toLowerCase() + ":" + this.reference);
entity.setUri(this.uri);
entity.setDefinition(this.definition);
entity.setStartdate(this.startDate);