From 6bdc6d5c091c89f7f4bac9b003acc308813e5dee Mon Sep 17 00:00:00 2001 From: amentis Date: Wed, 15 May 2024 18:31:30 +0300 Subject: [PATCH] fix dmp version flow --- .../java/org/opencdmp/service/dmp/DmpServiceImpl.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java index 9d8f89acb..4cfb4c263 100644 --- a/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java @@ -1061,10 +1061,10 @@ public class DmpServiceImpl implements DmpService { dmp.setUpdatedAt(Instant.now()); dmp.setFinalizedAt(Instant.now()); - this.entityManager.merge(dmp); - this.entityManager.flush(); - this.updateVersionStatusAndSave(dmp, previousStatus, dmp.getStatus()); + dmp.setVersionStatus(DmpVersionStatus.Current); + + this.entityManager.merge(dmp); this.entityManager.flush(); this.elasticService.persistDmp(dmp); @@ -1086,13 +1086,11 @@ public class DmpServiceImpl implements DmpService { dmp.setStatus(DmpStatus.Draft); dmp.setUpdatedAt(Instant.now()); + dmp.setVersionStatus(DmpVersionStatus.NotFinalized); this.entityManager.merge(dmp); this.entityManager.flush(); - this.updateVersionStatusAndSave(dmp, DmpStatus.Finalized, dmp.getStatus()); - this.entityManager.flush(); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(dmp.getId()); this.sendNotification(dmp); }