Fixed Certain Bugs Converning search across DMPs Projects and Datasets
This commit is contained in:
parent
f26c574285
commit
623180d1c0
|
@ -30,7 +30,9 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
|
|||
public QueryableList<DMP> getWithCriteria(DataManagementPlanCriteria criteria) {
|
||||
QueryableList<DMP> query = getDatabaseService().getQueryable(DMP.getHints(), DMP.class);
|
||||
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)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("created"), criteria.getPeriodEnd()));
|
||||
if (criteria.getPeriodStart() != null)
|
||||
|
|
|
@ -61,7 +61,7 @@ public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMP
|
|||
public QueryableList<DMPProfile> getWithCriteria(DataManagementPlanProfileCriteria criteria) {
|
||||
QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,9 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
|||
public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) {
|
||||
QueryableList<Dataset> query = getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class);
|
||||
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)
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), criteria.getStatus()));
|
||||
if (criteria.getPeriodEnd() != null)
|
||||
|
|
|
@ -24,7 +24,7 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implem
|
|||
public QueryableList<DatasetProfile> getWithCriteria(DatasetProfileCriteria criteria) {
|
||||
QueryableList<DatasetProfile> query = getDatabaseService().getQueryable(DatasetProfile.class);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ExternalDatasetDaoImpl extends DatabaseAccess<ExternalDataset> impl
|
|||
public QueryableList<ExternalDataset> getWithCriteria(ExternalDatasetCriteria criteria) {
|
||||
QueryableList<ExternalDataset> query = this.getDatabaseService().getQueryable(ExternalDataset.class);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,9 @@ public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDa
|
|||
public QueryableList<Project> getWithCriteria(ProjectCriteria criteria) {
|
||||
QueryableList<Project> query = getDatabaseService().getQueryable(Project.class);
|
||||
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)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("enddate"), criteria.getPeriodEnd()));
|
||||
if (criteria.getPeriodStart() != null)
|
||||
|
|
|
@ -26,7 +26,7 @@ public class UserInfoDaoImpl extends DatabaseAccess<UserInfo> implements UserInf
|
|||
if (criteria.getAppRoles() != null && !criteria.getAppRoles().isEmpty())
|
||||
users.where((builder, root) -> root.join("userRoles").get("role").in(criteria.getAppRoles()));
|
||||
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)
|
||||
users.where((builder, root) -> builder.equal(root.get("email"), criteria.getEmail()));
|
||||
return users;
|
||||
|
|
|
@ -13,7 +13,7 @@ public class DatasetWizardAutocompleteRequest extends Query<DatasetWizardUserDmp
|
|||
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"))));
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public class DatasetProfileAutocompleteRequest extends Query<DatasetProfileCrite
|
|||
public QueryableList<DatasetProfile> applyCriteria() {
|
||||
QueryableList<DatasetProfile> query = this.getQuery();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,9 @@ public class DataManagementPlanCriteriaRequest extends Query<DataManagementPlanC
|
|||
public QueryableList<DMP> applyCriteria() {
|
||||
QueryableList<DMP> query = this.getQuery();
|
||||
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)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
|
|
|
@ -13,7 +13,7 @@ public class DataManagementPlanProfileCriteriaRequest extends Query<DataManageme
|
|||
public QueryableList<DMPProfile> applyCriteria() {
|
||||
QueryableList<DMPProfile> query = this.getQuery();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@ import eu.eudat.data.entities.Project;
|
|||
import eu.eudat.data.query.definition.Query;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProjectCriteriaRequest extends Query<ProjectCriteria, Project> {
|
||||
private Integer length;
|
||||
|
||||
|
@ -25,7 +23,9 @@ public class ProjectCriteriaRequest extends Query<ProjectCriteria,Project> {
|
|||
public QueryableList<Project> applyCriteria() {
|
||||
QueryableList<Project> query = this.getQuery();
|
||||
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)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
|
|
|
@ -13,7 +13,7 @@ public class UserInfoRequestItem extends Query<UserInfoCriteria, UserInfo> {
|
|||
if (this.getCriteria().getAppRoles() != null && !this.getCriteria().getAppRoles().isEmpty())
|
||||
users.where((builder, root) -> root.join("userRoles").get("role").in(this.getCriteria().getAppRoles()));
|
||||
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)
|
||||
users.where((builder, root) -> builder.equal(root.get("email"), this.getCriteria().getEmail()));
|
||||
return users;
|
||||
|
|
|
@ -21,7 +21,9 @@ public class DatasetPublicTableRequest extends TableQuery<DatasetPublicCriteria,
|
|||
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)));
|
||||
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())
|
||||
query.where(((builder, root) -> root.get("dmp").get("project").get("id").in(this.getCriteria().projects)));
|
||||
if (this.getCriteria().projectStatus != null) query
|
||||
|
|
|
@ -15,7 +15,9 @@ public class DatasetTableRequest extends TableQuery<DatasetCriteria, eu.eudat.da
|
|||
public QueryableList<Dataset> applyCriteria() {
|
||||
QueryableList<Dataset> query = this.getQuery();
|
||||
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)
|
||||
query.where((builder, root) -> builder.equal(root.get("status"), this.getCriteria().getStatus()));
|
||||
if (this.getCriteria().getPeriodEnd() != null)
|
||||
|
|
|
@ -12,7 +12,7 @@ public class DatasetProfileTableRequestItem extends TableQuery<DatasetProfileCri
|
|||
public QueryableList<DatasetProfile> applyCriteria() {
|
||||
QueryableList<DatasetProfile> query = this.getQuery();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,9 @@ public class DataManagementPlanTableRequest extends TableQuery<DataManagementPla
|
|||
public QueryableList<DMP> applyCriteria() {
|
||||
QueryableList<DMP> query = this.getQuery();
|
||||
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)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
|
|
|
@ -13,7 +13,7 @@ public class ExternalDatasetTableRequest extends TableQuery<ExternalDatasetCrite
|
|||
public QueryableList<ExternalDataset> applyCriteria() {
|
||||
QueryableList<ExternalDataset> query = this.getQuery();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,9 @@ public class ProjectTableRequest extends TableQuery<ProjectCriteria,Project,UUID
|
|||
public QueryableList<Project> applyCriteria() {
|
||||
QueryableList<Project> query = this.getQuery();
|
||||
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)
|
||||
query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd()));
|
||||
if (this.getCriteria().getPeriodStart() != null)
|
||||
|
|
|
@ -16,7 +16,7 @@ public class UserInfoTableRequestItem extends TableQuery<UserInfoCriteria, UserI
|
|||
if (this.getCriteria().getAppRoles() != null && !this.getCriteria().getAppRoles().isEmpty())
|
||||
users.where((builder, root) -> root.join("userRoles").get("role").in(this.getCriteria().getAppRoles()));
|
||||
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)
|
||||
users.where((builder, root) -> builder.equal(root.get("email"), this.getCriteria().getEmail()));
|
||||
return users;
|
||||
|
|
|
@ -317,6 +317,29 @@ public class DataManagementPlanManager {
|
|||
Document xmlDoc = XmlBuilder.getDocument();
|
||||
Element root = xmlDoc.createElement("root");
|
||||
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");
|
||||
|
||||
for (Dataset dataset : datasets) {
|
||||
|
|
Loading…
Reference in New Issue