fix dmp version flow

This commit is contained in:
amentis 2024-05-15 18:31:30 +03:00
parent 811a1dde01
commit 6bdc6d5c09
1 changed files with 4 additions and 6 deletions

View File

@ -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);
}