Fixes bug on showing deleted Dataset Descriptions and fixes language on Dataset Description Template version update.

This commit is contained in:
gkolokythas 2019-07-26 11:37:26 +03:00
parent 74779d8054
commit 39b0ca0140
4 changed files with 29 additions and 17 deletions

View File

@ -65,12 +65,14 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
@Override
public Dataset find(UUID id) {
return getDatabaseService().getQueryable(Dataset.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
return getDatabaseService().getQueryable(Dataset.class)
.where((builder, root) -> builder.and(builder.notEqual(root.get("status"),Dataset.Status.DELETED.getValue()), builder.notEqual(root.get("status"),Dataset.Status.CANCELED.getValue()), builder.equal((root.get("id")), id))).getSingle();
}
@Override
public Dataset find(UUID id, String hint) {
return getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class).withHint(hint).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle();
return getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class).withHint(hint)
.where((builder, root) -> builder.and(builder.notEqual(root.get("status"),Dataset.Status.DELETED.getValue()), builder.notEqual(root.get("status"),Dataset.Status.CANCELED.getValue()), builder.equal((root.get("id")), id))).getSingle();
}
@Override

View File

@ -71,6 +71,7 @@ public class DatasetWizardController extends BaseController {
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<AssociatedProfile>>().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlans));
}
@Transactional
@RequestMapping(method = RequestMethod.GET, value = {"{id}"}, produces = "application/json")
public @ResponseBody
ResponseEntity getSingle(@PathVariable String id, @RequestHeader("Content-Type") String contentType, @ClaimedAuthorities(claims = {ANONYMOUS}) Principal principal) throws IllegalAccessException, IOException, InstantiationException {

View File

@ -135,6 +135,11 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
if (this.formGroup.get('dmp').value.status == DmpStatus.Draft && this.formGroup.get('status').value == DatasetStatus.Finalized) {
this.hasReversableStatus = true;
}
},
error => {
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-WIZARD.MESSAGES.DATAESET-NOT-FOUND'), SnackBarNotificationLevel.Error);
this.router.navigate(['/plans']);
return Observable.of(null);
});
} else if (dmpId != null) {
this.isNew = true;
@ -383,7 +388,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
public isSemiFormValid(formGroup: FormGroup): boolean {
var isValid: boolean = true;
Object.keys(formGroup.controls).forEach( controlName => {
Object.keys(formGroup.controls).forEach(controlName => {
if (controlName != 'datasetProfileDefinition' && formGroup.get(controlName).invalid) {
isValid = false;
}
@ -395,17 +400,17 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.datasetWizardService.createDataset(this.formGroup.value)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.datasetWizardService.getSingle(complete.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
result => {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result);
}
);
this.onCallbackSuccess();
},
error => this.onCallbackError(error)
complete => {
this.datasetWizardService.getSingle(complete.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
result => {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result);
}
);
this.onCallbackSuccess();
},
error => this.onCallbackError(error)
);
}
@ -588,8 +593,8 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
this.datasetWizardService.delete(id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => { this.onCallbackSuccess(); this.router.navigateByUrl('/datasets') },
error => this.onCallbackError(error)
complete => { this.onCallbackSuccess(); this.router.navigateByUrl('/datasets') },
error => this.onCallbackError(error)
);
}
});
@ -639,7 +644,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.profileUpdateId = this.itemId;
this.uiNotificationService.snackBarNotification("Profile changed, WOW!", SnackBarNotificationLevel.Success);
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-WIZARD.MESSAGES.SUCCESS-UPDATE-DATASET-PROFILE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/datasets/profileupdate/' + this.profileUpdateId]);
}
});

View File

@ -367,6 +367,10 @@
"COPY-DATASET": "Copy Dataset Description",
"UPDATE-DATASET-PROFILE": "Update Template"
},
"MESSAGES": {
"DATAESET-NOT-FOUND": "Dataset Description does not exist",
"SUCCESS-UPDATE-DATASET-PROFILE": "Dataset Template updated successfully"
},
"UPLOAD": {
"UPLOAD-XML": "Import",
"UPLOAD-XML-FILE-TITLE": "Import Dataset Template",