Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-05-14 14:32:50 +03:00
commit ee611ed7e0
2 changed files with 9 additions and 9 deletions

View File

@ -335,19 +335,19 @@ public class DmpServiceImpl implements DmpService {
EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).types(EntityType.DMP).entityIds(data.getId());
if (entityDoiQuery.count() > 0) throw new MyApplicationException("DMP is deposited can not deleted");
DmpEntity previousFinalized = null;
if (data.getVersionStatus().equals(DmpVersionStatus.Current)){
DmpEntity previousDmp = null;
if (!data.getVersionStatus().equals(DmpVersionStatus.Previous)){
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class)
.statuses(DmpStatus.Finalized)
.excludedIds(data.getId())
.isActive(IsActive.Active)
.groupIds(data.getGroupId());
dmpQuery.setOrder(new Ordering().addDescending(Dmp._version));
previousFinalized = dmpQuery.first();
if (previousFinalized != null){
previousFinalized.setVersionStatus(DmpVersionStatus.Current);
this.entityManager.merge(previousFinalized);
previousDmp = dmpQuery.first();
if (previousDmp != null){
if (previousDmp.getStatus().equals(DmpStatus.Finalized)) previousDmp.setVersionStatus(DmpVersionStatus.Current);
else previousDmp.setVersionStatus(DmpVersionStatus.NotFinalized);
this.entityManager.merge(previousDmp);
}
data.setVersionStatus(DmpVersionStatus.NotFinalized);
this.entityManager.merge(data);
@ -355,7 +355,7 @@ public class DmpServiceImpl implements DmpService {
}
this.deleterFactory.deleter(DmpDeleter.class).deleteAndSaveByIds(List.of(id), false);
if (previousFinalized != null) this.elasticService.persistDmp(previousFinalized);
if (previousDmp != null) this.elasticService.persistDmp(previousDmp);
this.annotationEntityRemovalIntegrationEventHandler.handleDmp(data.getId());
}

View File

@ -409,7 +409,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
}
onUpdateCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Error);
this.uiNotificationService.snackBarNotification(error.error.error ? error.error.error : this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Error);
}
downloadXml(id: string) {