Allow to query using exact reference

This commit is contained in:
George Kalampokis 2021-04-29 11:58:03 +03:00
parent 8f2e0539d5
commit a28e26e594
8 changed files with 44 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import eu.eudat.data.entities.Funder;
public class FunderCriteria extends Criteria<Funder> {
private String reference;
private String exactReference;
public String getReference() {
return reference;
@ -11,4 +12,12 @@ public class FunderCriteria extends Criteria<Funder> {
public void setReference(String reference) {
this.reference = reference;
}
public String getExactReference() {
return exactReference;
}
public void setExactReference(String exactReference) {
this.exactReference = exactReference;
}
}

View File

@ -13,6 +13,7 @@ public class GrantCriteria extends Criteria<Grant> {
private boolean isPublic;
private String funderId;
private String funderReference;
private String exactReference;
public Date getPeriodStart() {
return periodStart;
@ -62,4 +63,12 @@ public class GrantCriteria extends Criteria<Grant> {
public void setFunderReference(String funderReference) {
this.funderReference = funderReference;
}
public String getExactReference() {
return exactReference;
}
public void setExactReference(String exactReference) {
this.exactReference = exactReference;
}
}

View File

@ -4,6 +4,7 @@ import eu.eudat.data.entities.Project;
public class ProjectCriteria extends Criteria<Project> {
private String reference;
private String exactReference;
public String getReference() {
return reference;
@ -11,4 +12,12 @@ public class ProjectCriteria extends Criteria<Project> {
public void setReference(String reference) {
this.reference = reference;
}
public String getExactReference() {
return exactReference;
}
public void setExactReference(String exactReference) {
this.exactReference = exactReference;
}
}

View File

@ -4,6 +4,7 @@ import eu.eudat.data.entities.Researcher;
public class ResearcherCriteria extends Criteria<Researcher> {
private String name;
private String reference;
public String getName() {
return name;
@ -12,4 +13,12 @@ public class ResearcherCriteria extends Criteria<Researcher> {
public void setName(String name) {
this.name = name;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
}

View File

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

View File

@ -39,6 +39,8 @@ public class GrantDaoImpl extends DatabaseAccess<Grant> implements GrantDao {
query.where((builder, root) -> builder.greaterThan(root.get("startdate"), criteria.getPeriodStart()));
if (criteria.getReference() != null)
query.where((builder, root) -> builder.like(root.get("reference"), "%" + criteria.getReference() + "%"));
if (criteria.getExactReference() != null)
query.where((builder, root) -> builder.like(root.get("reference"), criteria.getExactReference()));
if (criteria.getGrantStateType() != null) {
if (criteria.getGrantStateType().equals(GrantStateType.FINISHED.getValue()))
query.where((builder, root) -> builder.lessThan(root.get("enddate"), new Date()));

View File

@ -28,6 +28,8 @@ public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDa
builder.or(builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%"))));
if (criteria.getReference() != null)
query.where((builder, root) -> builder.like(root.get("reference"), "%" + criteria.getReference() + "%"));
if (criteria.getExactReference() != null)
query.where((builder, root) -> builder.like(root.get("reference"), criteria.getExactReference()));
query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue()));
return query;
}

View File

@ -27,6 +27,8 @@ public class ResearcherDaoImpl extends DatabaseAccess<Researcher> implements Res
query.where((builder, root) ->builder.or(builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%")));
if (criteria.getName() != null && !criteria.getName().isEmpty())
query.where((builder, root) ->builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getName().toUpperCase() + "%")));
if (criteria.getReference() != null && !criteria.getReference().isEmpty())
query.where((builder, root) ->builder.or(builder.like(builder.upper(root.get("reference")), criteria.getReference().toUpperCase())));
return query;
}