Fixed Bug For Facet Search not applying the right Project State (Active, Finished)

This commit is contained in:
Ioannis Kalyvas 2018-10-09 13:58:36 +03:00
parent 6e69c4b518
commit 99588ef126
9 changed files with 254 additions and 223 deletions

View File

@ -6,8 +6,10 @@ import eu.eudat.data.query.definition.TableQuery;
import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import eu.eudat.types.project.ProjectStateType;
import java.util.Arrays;
import java.util.Date;
import java.util.UUID;
/**
@ -26,8 +28,14 @@ public class DatasetPublicTableRequest extends TableQuery<DatasetPublicCriteria,
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
.where(((builder, root) -> builder.equal(root.get("dmp").get("project").get("status"), this.getCriteria().projectStatus.getValue())));
if (this.getCriteria().projectStatus != null) {
if (this.getCriteria().projectStatus.getValue().equals(ProjectStateType.FINISHED.getValue()))
query.where((builder, root) -> builder.lessThan(root.get("dmp").get("project").get("enddate"), new Date()));
if (this.getCriteria().projectStatus.getValue().equals(ProjectStateType.ONGOING.getValue()))
query.where((builder, root) ->
builder.or(builder.greaterThan(root.get("dmp").get("project").get("enddate"), new Date())
, builder.isNull(root.get("dmp").get("project").get("enddate"))));
}
if (this.getCriteria().datasetProfile != null && !this.getCriteria().datasetProfile.isEmpty()) query
.where(((builder, root) -> root.get("profile").get("id").in(this.getCriteria().datasetProfile)));
if (this.getCriteria().dmpOrganisations != null && !this.getCriteria().dmpOrganisations.isEmpty()) query

View File

@ -13,6 +13,7 @@ import java.util.stream.Collectors;
public class DatasetListingModel implements DataModel<Dataset, DatasetListingModel> {
private String id;
private String label;
private String project;
private String dmp;
private String profile;
private String dataRepositories;
@ -38,6 +39,14 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.label = label;
}
public String getProject() {
return project;
}
public void setProject(String project) {
this.project = project;
}
public String getDmp() {
return dmp;
}
@ -107,6 +116,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.id = entity.getId().toString();
this.label = entity.getLabel();
this.created = entity.getCreated();
this.project = entity.getDmp().getProject().getLabel();
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
this.profile = entity.getProfile() != null ? entity.getProfile().getLabel() : "";
this.description = entity.getDescription();

View File

@ -22,10 +22,10 @@
</ng-container>
<!-- Column Definition: Dmp -->
<ng-container cdkColumnDef="dmp">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' |
<ng-container cdkColumnDef="project">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.PROJECT' |
translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
<mat-cell *matCellDef="let row"> {{row.project}} </mat-cell>
</ng-container>
<!-- Column Definition: Profile -->

View File

@ -27,7 +27,7 @@ export class DatasetPublicListingComponent implements OnInit {
@ViewChild(DatasetCriteriaComponent) criteria: DatasetCriteriaComponent;
dataSource: DatasetDataSource | null;
displayedColumns: String[] = ['label', 'dmp', 'profile', 'status', 'description', 'created'];
displayedColumns: String[] = ['label', 'project', 'profile', 'status', 'description', 'created'];
pageEvent: PageEvent;
titlePrefix: String;
dmpId: string;

View File

@ -10,7 +10,6 @@
<div class="flex-container" *ngIf="this.datasetProfileDefinitionModel">
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="save();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="saveFinalize();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-FINALISE' | translate }}</button>
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
@ -75,7 +74,8 @@
</div>
<div class="col-md-8">
<mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.DATAREPOSITORIES-INFO' | translate}}" type="text" name="info"
[formControl]="suggestion.get('info')">
</mat-form-field>
</div>
<div class="col-md-2">
@ -109,7 +109,8 @@
</div>
<div class="col-md-4">
<mat-form-field>
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASET-INFO' | translate}}" type="text" name="info" [formControl]="suggestion.get('info')">
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.EXTERNAL-DATASET-INFO' | translate}}" type="text" name="info"
[formControl]="suggestion.get('info')">
</mat-form-field>
</div>
@ -138,10 +139,11 @@
</button>
</mat-card-title>
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('registries') && registriesTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.registries"
placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}" [parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc'
[formGroup]="formGroup.get('registries')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
[autoCompleteConfiguration]="registriesAutoCompleteConfiguration" (onItemChange)="registriesOnItemChange($event)">
<app-external-item-listing *ngIf="formGroup.get('registries') && registriesTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.registries" placeholder="{{'DATASET-EDITOR.FIELDS.REGISTRIES' | translate}}"
[parentTemplate]='registriesTemplate' [displayFunction]='registriesDisplayFunc' [formGroup]="formGroup.get('registries')"
[viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="registriesAutoCompleteConfiguration"
(onItemChange)="registriesOnItemChange($event)">
</app-external-item-listing>
<ng-template #registriesTemplate let-suggestion let-i="index" let-callback="function">
@ -167,10 +169,11 @@
</button>
</mat-card-title>
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('services') && servicesTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.services"
placeholder="{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}" [parentTemplate]='servicesTemplate' [displayFunction]='servicesDisplayFunc'
[formGroup]="formGroup.get('services')" [viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc'
[autoCompleteConfiguration]="servicesAutoCompleteConfiguration" (onItemChange)="servicesOnItemChange($event)">
<app-external-item-listing *ngIf="formGroup.get('services') && servicesTemplate && externalSourcesConfiguration"
[options]="externalSourcesConfiguration.services" placeholder="{{'DATASET-EDITOR.FIELDS.SERVICES' | translate}}"
[parentTemplate]='servicesTemplate' [displayFunction]='servicesDisplayFunc' [formGroup]="formGroup.get('services')"
[viewOnly]='viewOnly' [subtitleFunction]='dataRepositoryDisplaySubtitleFunc' [autoCompleteConfiguration]="servicesAutoCompleteConfiguration"
(onItemChange)="servicesOnItemChange($event)">
</app-external-item-listing>
@ -196,8 +199,8 @@
</mat-card-header>
<app-external-item-listing *ngIf="formGroup.get('tags') && tagsTemplate && externalSourcesConfiguration" [options]="externalSourcesConfiguration.tags"
placeholder="{{'DATASET-EDITOR.FIELDS.TAGS' | translate}}" [parentTemplate]='tagsTemplate' [displayFunction]='tagsDisplayFunc'
[formGroup]="formGroup.get('tags')" [viewOnly]='viewOnly' [subtitleFunction]='tagsDisplaySubtitleFunc' [autoCompleteConfiguration]="tagsAutoCompleteConfiguration"
(onItemChange)="tagsOnItemChange($event)">
[formGroup]="formGroup.get('tags')" [viewOnly]='viewOnly' [subtitleFunction]='tagsDisplaySubtitleFunc'
[autoCompleteConfiguration]="tagsAutoCompleteConfiguration" (onItemChange)="tagsOnItemChange($event)">
</app-external-item-listing>
@ -224,8 +227,8 @@
</mat-step>
<mat-step>
<ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template>
<app-dynamic-form class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')"
[dataModel]="datasetWizardModel"></app-dynamic-form>
<app-dynamic-form class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition"
[form]="this.formGroup.get('datasetProfileDefinition')" [dataModel]="datasetWizardModel"></app-dynamic-form>
<div class="navigation-buttons-container">
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK'
| translate}}</button>

View File

@ -15,6 +15,13 @@
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Dmp -->
<ng-container cdkColumnDef="project">
<mat-header-cell *matHeaderCellDef >{{'DATASET-LISTING.COLUMNS.PROJECT' |
translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.project}} </mat-cell>
</ng-container>
<!-- Column Definition: Dmp -->
<ng-container cdkColumnDef="dmp">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' |

View File

@ -35,7 +35,7 @@ export class DatasetListingComponent implements OnInit, IBreadCrumbComponent {
breadCrumbs: Observable<BreadcrumbItem[]>;
dataSource: DatasetDataSource | null;
displayedColumns: String[] = ['label', 'dmp', 'profile', 'status', 'description', 'created', 'actions'];
displayedColumns: String[] = ['label', 'project', 'dmp', 'profile', 'status', 'description', 'created', 'actions'];
pageEvent: PageEvent;
titlePrefix: String;
dmpId: string;

View File

@ -4,6 +4,7 @@ export class DatasetListingModel implements Serializable<DatasetListingModel> {
public id: String;
public label: String;
public dmp: String;
public project: String;
public profile: String;
public dataRepositories: String;
public registries: String;
@ -18,6 +19,7 @@ export class DatasetListingModel implements Serializable<DatasetListingModel> {
this.id = item.id;
this.label = item.label;
this.dmp = item.dmp;
this.project = item.project;
this.profile = item.profile;
this.dataRepositories = item.dataRepositories;
this.registries = item.registries;

View File

@ -110,6 +110,7 @@
"COLUMNS": {
"NAME": "Name",
"REFERNCE": "Reference",
"PROJECT": "Project",
"URI": "Uri",
"STATUS": "Status",
"DESCRIPTION": "Description",