Fixes various code missteps.

This commit is contained in:
gkolokythas 2019-09-23 12:11:00 +03:00
parent 47f939af81
commit d0c464cb31
3 changed files with 25 additions and 25 deletions

View File

@ -70,14 +70,14 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
query.where((builder, root) -> root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators())); query.where((builder, root) -> root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators()));
} }
if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty()) { if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty()) {
query.where(((builder, root) -> root.join("associatedDmps", JoinType.LEFT).get("id").in(criteria.getDatasetTemplates()))); query.where((builder, root) -> root.join("associatedDmps", JoinType.LEFT).get("id").in(criteria.getDatasetTemplates()));
} }
query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue())); query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()));
return query; return query;
} }
public QueryableList<DMP> getAuthenticated(QueryableList<DMP> query, UUID principal) { public QueryableList<DMP> getAuthenticated(QueryableList<DMP> query, UUID principal) {
query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).join("user").get("id"), principal)); query.where((builder, root) -> builder.equal(root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), principal));
return query; return query;
} }

View File

@ -52,9 +52,9 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
if (criteria.getCollaborators() != null && !criteria.getCollaborators().isEmpty()) if (criteria.getCollaborators() != null && !criteria.getCollaborators().isEmpty())
query.where((builder, root) -> root.join("dmp", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators())); query.where((builder, root) -> root.join("dmp", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators()));
if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty()) if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty())
query.where(((builder, root) -> root.get("profile").get("id").in(criteria.getDatasetTemplates()))); query.where((builder, root) -> root.get("profile").get("id").in(criteria.getDatasetTemplates()));
query.where(((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.DELETED.getValue()))); query.where((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.DELETED.getValue()));
query.where(((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.CANCELED.getValue()))); query.where((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.CANCELED.getValue()));
return query; return query;
} }

View File

@ -1,7 +1,7 @@
import {of as observableOf, Observable } from 'rxjs'; import { of as observableOf, Observable } from 'rxjs';
import {map, catchError, takeUntil } from 'rxjs/operators'; import { map, catchError, takeUntil } from 'rxjs/operators';
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms'; import { FormControl, FormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
@ -231,11 +231,11 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.isNew = false; this.isNew = false;
this.datasetWizardService.getSinglePublic(this.publicId) this.datasetWizardService.getSinglePublic(this.publicId)
.pipe(takeUntil(this._destroyed)).pipe( .pipe(takeUntil(this._destroyed)).pipe(
catchError((error: any) => { catchError((error: any) => {
this.uiNotificationService.snackBarNotification(error.error.message, SnackBarNotificationLevel.Error); this.uiNotificationService.snackBarNotification(error.error.message, SnackBarNotificationLevel.Error);
this.router.navigate(['/explore']); this.router.navigate(['/explore']);
return observableOf(null); return observableOf(null);
})) }))
.subscribe(data => { .subscribe(data => {
if (data) { if (data) {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data); this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
@ -407,17 +407,17 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.datasetWizardService.createDataset(this.formGroup.value) this.datasetWizardService.createDataset(this.formGroup.value)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => { complete => {
this.datasetWizardService.getSingle(complete.id) this.datasetWizardService.getSingle(complete.id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
result => { result => {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result); this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result);
} }
); );
this.onCallbackSuccess(); this.onCallbackSuccess();
}, },
error => this.onCallbackError(error) error => this.onCallbackError(error)
); );
} }
@ -600,8 +600,8 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.datasetWizardService.delete(id) this.datasetWizardService.delete(id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => { this.onCallbackSuccess(); this.router.navigateByUrl('/datasets') }, complete => { this.onCallbackSuccess(); this.router.navigateByUrl('/datasets') },
error => this.onCallbackError(error) error => this.onCallbackError(error)
); );
} }
}); });