Fixed Certain Bugs Converning search across DMPs Projects and Datasets

This commit is contained in:
Ioannis Kalyvas 2018-10-09 11:14:29 +03:00
parent f26c574285
commit 623180d1c0
21 changed files with 64 additions and 25 deletions

View File

@ -30,7 +30,9 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
public QueryableList<DMP> getWithCriteria(DataManagementPlanCriteria criteria) { public QueryableList<DMP> getWithCriteria(DataManagementPlanCriteria criteria) {
QueryableList<DMP> query = getDatabaseService().getQueryable(DMP.getHints(), DMP.class); QueryableList<DMP> query = getDatabaseService().getQueryable(DMP.getHints(), DMP.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty()) if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%")); query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%")));
if (criteria.getPeriodEnd() != null) if (criteria.getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd())); query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
if (criteria.getPeriodStart() != null) if (criteria.getPeriodStart() != null)

View File

@ -61,7 +61,7 @@ public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMP
public QueryableList<DMPProfile> getWithCriteria(DataManagementPlanProfileCriteria criteria) { public QueryableList<DMPProfile> getWithCriteria(DataManagementPlanProfileCriteria criteria) {
QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class); QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty()) if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%")); query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
return query; return query;
} }
} }

View File

@ -28,7 +28,9 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) { public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) {
QueryableList<Dataset> query = getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class); QueryableList<Dataset> query = getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty()) if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%")); query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%")));
if (criteria.getStatus() != null) if (criteria.getStatus() != null)
query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus())); query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus()));
if (criteria.getPeriodEnd() != null) if (criteria.getPeriodEnd() != null)

View File

@ -24,7 +24,7 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implem
public QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria) { public QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria) {
QueryableList<DatasetProfile> query = getDatabaseService().getQueryable(DatasetProfile.class); QueryableList<DatasetProfile> query = getDatabaseService().getQueryable(DatasetProfile.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty()) if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%")); query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
return query; return query;
} }

View File

@ -25,7 +25,7 @@ public class ExternalDatasetDaoImpl extends DatabaseAccess<ExternalDataset> impl
public QueryableList<ExternalDataset> getWithCriteria(ExternalDatasetCriteria criteria) { public QueryableList<ExternalDataset> getWithCriteria(ExternalDatasetCriteria criteria) {
QueryableList<ExternalDataset> query = this.getDatabaseService().getQueryable(ExternalDataset.class); QueryableList<ExternalDataset> query = this.getDatabaseService().getQueryable(ExternalDataset.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty()) if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%")); query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
return query; return query;
} }

View File

@ -28,7 +28,9 @@ public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDa
public QueryableList<Project> getWithCriteria(ProjectCriteria criteria) { public QueryableList<Project> getWithCriteria(ProjectCriteria criteria) {
QueryableList<Project> query = getDatabaseService().getQueryable(Project.class); QueryableList<Project> query = getDatabaseService().getQueryable(Project.class);
if (criteria.getLike() != null && !criteria.getLike().isEmpty()) if (criteria.getLike() != null && !criteria.getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + criteria.getLike() + "%")); query.where((builder, root) ->
builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
builder.or(builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%"))));
if (criteria.getPeriodEnd() != null) if (criteria.getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("enddate"), criteria.getPeriodEnd())); query.where((builder, root) -> builder.lessThan(root.get("enddate"), criteria.getPeriodEnd()));
if (criteria.getPeriodStart() != null) if (criteria.getPeriodStart() != null)

View File

@ -26,7 +26,7 @@ public class UserInfoDaoImpl extends DatabaseAccess<UserInfo> implements UserInf
if (criteria.getAppRoles() != null && !criteria.getAppRoles().isEmpty()) if (criteria.getAppRoles() != null && !criteria.getAppRoles().isEmpty())
users.where((builder, root) -> root.join("userRoles").get("role").in(criteria.getAppRoles())); users.where((builder, root) -> root.join("userRoles").get("role").in(criteria.getAppRoles()));
if (criteria.getLike() != null) if (criteria.getLike() != null)
users.where((builder, root) -> builder.or(builder.like(root.get("name"), "%" + criteria.getLike() + "%"), builder.like(root.get("email"), "%" + criteria.getLike() + "%"))); users.where((builder, root) -> builder.or(builder.like(builder.upper(root.get("name")), "%" + criteria.getLike().toUpperCase() + "%"), builder.like(root.get("email"), "%" + criteria.getLike() + "%")));
if (criteria.getEmail() != null) if (criteria.getEmail() != null)
users.where((builder, root) -> builder.equal(root.get("email"), criteria.getEmail())); users.where((builder, root) -> builder.equal(root.get("email"), criteria.getEmail()));
return users; return users;

View File

@ -13,7 +13,7 @@ public class DatasetWizardAutocompleteRequest extends Query<DatasetWizardUserDmp
public QueryableList<DMP> applyCriteria() { public QueryableList<DMP> applyCriteria() {
QueryableList<DMP> query = this.getQuery().where((builder, root) -> builder.or(builder.equal(root.get("creator"), this.getCriteria().getUserInfo()), builder.isMember(this.getCriteria().getUserInfo(), root.get("users")))); QueryableList<DMP> query = this.getQuery().where((builder, root) -> builder.or(builder.equal(root.get("creator"), this.getCriteria().getUserInfo()), builder.isMember(this.getCriteria().getUserInfo(), root.get("users"))));
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) { if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) {
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
} }
return query; return query;
} }

View File

@ -12,7 +12,7 @@ public class DatasetProfileAutocompleteRequest extends Query<DatasetProfileCrite
public QueryableList<DatasetProfile> applyCriteria() { public QueryableList<DatasetProfile> applyCriteria() {
QueryableList<DatasetProfile> query = this.getQuery(); QueryableList<DatasetProfile> query = this.getQuery();
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
return query; return query;
} }
} }

View File

@ -16,7 +16,9 @@ public class DataManagementPlanCriteriaRequest extends Query<DataManagementPlanC
public QueryableList<DMP> applyCriteria() { public QueryableList<DMP> applyCriteria() {
QueryableList<DMP> query = this.getQuery(); QueryableList<DMP> query = this.getQuery();
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
if (this.getCriteria().getPeriodEnd() != null) if (this.getCriteria().getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd())); query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd()));
if (this.getCriteria().getPeriodStart() != null) if (this.getCriteria().getPeriodStart() != null)

View File

@ -13,7 +13,7 @@ public class DataManagementPlanProfileCriteriaRequest extends Query<DataManageme
public QueryableList<DMPProfile> applyCriteria() { public QueryableList<DMPProfile> applyCriteria() {
QueryableList<DMPProfile> query = this.getQuery(); QueryableList<DMPProfile> query = this.getQuery();
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
return query; return query;
} }
} }

View File

@ -5,9 +5,7 @@ import eu.eudat.data.entities.Project;
import eu.eudat.data.query.definition.Query; import eu.eudat.data.query.definition.Query;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import java.util.UUID; public class ProjectCriteriaRequest extends Query<ProjectCriteria, Project> {
public class ProjectCriteriaRequest extends Query<ProjectCriteria,Project> {
private Integer length; private Integer length;
public Integer getLength() { public Integer getLength() {
@ -25,7 +23,9 @@ public class ProjectCriteriaRequest extends Query<ProjectCriteria,Project> {
public QueryableList<Project> applyCriteria() { public QueryableList<Project> applyCriteria() {
QueryableList<Project> query = this.getQuery(); QueryableList<Project> query = this.getQuery();
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
if (this.getCriteria().getPeriodEnd() != null) if (this.getCriteria().getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd())); query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd()));
if (this.getCriteria().getPeriodStart() != null) if (this.getCriteria().getPeriodStart() != null)

View File

@ -13,7 +13,7 @@ public class UserInfoRequestItem extends Query<UserInfoCriteria, UserInfo> {
if (this.getCriteria().getAppRoles() != null && !this.getCriteria().getAppRoles().isEmpty()) if (this.getCriteria().getAppRoles() != null && !this.getCriteria().getAppRoles().isEmpty())
users.where((builder, root) -> root.join("userRoles").get("role").in(this.getCriteria().getAppRoles())); users.where((builder, root) -> root.join("userRoles").get("role").in(this.getCriteria().getAppRoles()));
if (this.getCriteria().getLike() != null) if (this.getCriteria().getLike() != null)
users.where((builder, root) -> builder.or(builder.like(root.get("name"), "%" + this.getCriteria().getLike() + "%"), builder.like(root.get("email"), "%" + this.getCriteria().getLike() + "%"))); users.where((builder, root) -> builder.or(builder.like(builder.upper(root.get("name")), "%" + this.getCriteria().getLike().toUpperCase() + "%"), builder.like(root.get("email"), "%" + this.getCriteria().getLike() + "%")));
if (this.getCriteria().getEmail() != null) if (this.getCriteria().getEmail() != null)
users.where((builder, root) -> builder.equal(root.get("email"), this.getCriteria().getEmail())); users.where((builder, root) -> builder.equal(root.get("email"), this.getCriteria().getEmail()));
return users; return users;

View File

@ -21,14 +21,16 @@ public class DatasetPublicTableRequest extends TableQuery<DatasetPublicCriteria,
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")), query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")),
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class))); Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
if (this.getCriteria().projects != null && !this.getCriteria().projects.isEmpty()) if (this.getCriteria().projects != null && !this.getCriteria().projects.isEmpty())
query.where(((builder, root) -> root.get("dmp").get("project").get("id").in(this.getCriteria().projects))); query.where(((builder, root) -> root.get("dmp").get("project").get("id").in(this.getCriteria().projects)));
if (this.getCriteria().projectStatus != null) query if (this.getCriteria().projectStatus != null) query
.where(((builder, root) -> builder.equal(root.get("dmp").get("project").get("status"), this.getCriteria().projectStatus.getValue()))); .where(((builder, root) -> builder.equal(root.get("dmp").get("project").get("status"), this.getCriteria().projectStatus.getValue())));
if (this.getCriteria().datasetProfile != null && !this.getCriteria().datasetProfile.isEmpty()) query if (this.getCriteria().datasetProfile != null && !this.getCriteria().datasetProfile.isEmpty()) query
.where(((builder, root) -> root.get("profile").get("id").in(this.getCriteria().datasetProfile))); .where(((builder, root) -> root.get("profile").get("id").in(this.getCriteria().datasetProfile)));
if(this.getCriteria().dmpOrganisations != null && !this.getCriteria().dmpOrganisations.isEmpty())query if (this.getCriteria().dmpOrganisations != null && !this.getCriteria().dmpOrganisations.isEmpty()) query
.where(((builder, root) -> root.join("dmp").join("organisations").get("reference").in(this.getCriteria().dmpOrganisations))); .where(((builder, root) -> root.join("dmp").join("organisations").get("reference").in(this.getCriteria().dmpOrganisations)));
return query; return query;
} }

View File

@ -10,12 +10,14 @@ import eu.eudat.queryable.types.SelectionField;
import java.util.Arrays; import java.util.Arrays;
import java.util.UUID; import java.util.UUID;
public class DatasetTableRequest extends TableQuery<DatasetCriteria, eu.eudat.data.entities.Dataset,UUID> { public class DatasetTableRequest extends TableQuery<DatasetCriteria, eu.eudat.data.entities.Dataset, UUID> {
@Override @Override
public QueryableList<Dataset> applyCriteria() { public QueryableList<Dataset> applyCriteria() {
QueryableList<Dataset> query = this.getQuery(); QueryableList<Dataset> query = this.getQuery();
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
if (this.getCriteria().getStatus() != null) if (this.getCriteria().getStatus() != null)
query.where((builder, root) -> builder.equal(root.get("status"), this.getCriteria().getStatus())); query.where((builder, root) -> builder.equal(root.get("status"), this.getCriteria().getStatus()));
if (this.getCriteria().getPeriodEnd() != null) if (this.getCriteria().getPeriodEnd() != null)

View File

@ -12,7 +12,7 @@ public class DatasetProfileTableRequestItem extends TableQuery<DatasetProfileCri
public QueryableList<DatasetProfile> applyCriteria() { public QueryableList<DatasetProfile> applyCriteria() {
QueryableList<DatasetProfile> query = this.getQuery(); QueryableList<DatasetProfile> query = this.getQuery();
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
return query; return query;
} }

View File

@ -16,7 +16,9 @@ public class DataManagementPlanTableRequest extends TableQuery<DataManagementPla
public QueryableList<DMP> applyCriteria() { public QueryableList<DMP> applyCriteria() {
QueryableList<DMP> query = this.getQuery(); QueryableList<DMP> query = this.getQuery();
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
if (this.getCriteria().getPeriodEnd() != null) if (this.getCriteria().getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd())); query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd()));
if (this.getCriteria().getPeriodStart() != null) if (this.getCriteria().getPeriodStart() != null)

View File

@ -13,7 +13,7 @@ public class ExternalDatasetTableRequest extends TableQuery<ExternalDatasetCrite
public QueryableList<ExternalDataset> applyCriteria() { public QueryableList<ExternalDataset> applyCriteria() {
QueryableList<ExternalDataset> query = this.getQuery(); QueryableList<ExternalDataset> query = this.getQuery();
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
return query; return query;
} }

View File

@ -13,7 +13,9 @@ public class ProjectTableRequest extends TableQuery<ProjectCriteria,Project,UUID
public QueryableList<Project> applyCriteria() { public QueryableList<Project> applyCriteria() {
QueryableList<Project> query = this.getQuery(); QueryableList<Project> query = this.getQuery();
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%")); query.where((builder, root) -> builder.or(
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
if (this.getCriteria().getPeriodEnd() != null) if (this.getCriteria().getPeriodEnd() != null)
query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd())); query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd()));
if (this.getCriteria().getPeriodStart() != null) if (this.getCriteria().getPeriodStart() != null)

View File

@ -16,7 +16,7 @@ public class UserInfoTableRequestItem extends TableQuery<UserInfoCriteria, UserI
if (this.getCriteria().getAppRoles() != null && !this.getCriteria().getAppRoles().isEmpty()) if (this.getCriteria().getAppRoles() != null && !this.getCriteria().getAppRoles().isEmpty())
users.where((builder, root) -> root.join("userRoles").get("role").in(this.getCriteria().getAppRoles())); users.where((builder, root) -> root.join("userRoles").get("role").in(this.getCriteria().getAppRoles()));
if (this.getCriteria().getLike() != null) if (this.getCriteria().getLike() != null)
users.where((builder, root) -> builder.or(builder.like(root.get("name"), "%" + this.getCriteria().getLike() + "%"), builder.like(root.get("email"), "%" + this.getCriteria().getLike() + "%"))); users.where((builder, root) -> builder.or(builder.like(builder.upper(root.get("name")), "%" + this.getCriteria().getLike().toUpperCase() + "%"), builder.like(root.get("email"), "%" + this.getCriteria().getLike() + "%")));
if (this.getCriteria().getEmail() != null) if (this.getCriteria().getEmail() != null)
users.where((builder, root) -> builder.equal(root.get("email"), this.getCriteria().getEmail())); users.where((builder, root) -> builder.equal(root.get("email"), this.getCriteria().getEmail()));
return users; return users;

View File

@ -317,6 +317,29 @@ public class DataManagementPlanManager {
Document xmlDoc = XmlBuilder.getDocument(); Document xmlDoc = XmlBuilder.getDocument();
Element root = xmlDoc.createElement("root"); Element root = xmlDoc.createElement("root");
Element dmpElement = xmlDoc.createElement("dmp"); Element dmpElement = xmlDoc.createElement("dmp");
Element dmpName = xmlDoc.createElement("dmpName");
dmpName.setTextContent(dmp.getLabel());
dmpElement.appendChild(dmpName);
Element projectName = xmlDoc.createElement("projectName");
projectName.setTextContent(dmp.getProject().getLabel());
dmpElement.appendChild(projectName);
Element organisationsElement = xmlDoc.createElement("organisations");
for(Organisation organisation : dmp.getOrganisations()){
Element organisationElement = xmlDoc.createElement("organisation");
organisationElement.setAttribute("name", organisation.getLabel());
organisationElement.setAttribute("reference", organisation.getReference());
organisationsElement.appendChild(organisationElement);
}
dmpElement.appendChild(organisationsElement);
Element researchersElement = xmlDoc.createElement("researchers");
for(Researcher researcher : dmp.getResearchers()){
Element researcherElement = xmlDoc.createElement("organisation");
researcherElement.setAttribute("name", researcher.getLabel());
researcherElement.setAttribute("reference", researcher.getReference());
organisationsElement.appendChild(researcherElement);
}
dmpElement.appendChild(researchersElement);
Element datasetsElement = xmlDoc.createElement("datasets"); Element datasetsElement = xmlDoc.createElement("datasets");
for (Dataset dataset : datasets) { for (Dataset dataset : datasets) {