Skip to content
Snippets Groups Projects

fix(batch update): [AOU-2006] preserve publication's status when it gets updated by batch

Merged Nicolas.Rod requested to merge rodn-2006-preserve-current-status-during-batch-update into master
1 unresolved thread
Files
4
@@ -528,19 +528,16 @@ public class PublicationService extends AouResourceService<Publication> {
this.contributorService.deleteContributorsIfOrphan(currentContributorsIds);
if (publication.isStatusDirty()) {
switch (publication.getStatus()) {
case UPDATES_VALIDATION, IN_VALIDATION:
this.eventService.createEvent(publication, EventType.PUBLICATION_TO_VALIDATE);
break;
case FEEDBACK_REQUIRED:
this.eventService.createEvent(publication.getLastComment(false), EventType.PUBLICATION_FEEDBACK_REQUIRED);
break;
case COMPLETED:
this.eventService.createEvent(publication, EventType.PUBLICATION_VALIDATED);
break;
case REJECTED:
this.eventService.createEvent(publication, EventType.PUBLICATION_REJECTED);
break;
// Do not create events linked to status update, if the status update is related to a batch update
if (publication.getStatus() == PublicationStatus.UPDATE_IN_BATCH) {
this.eventService.createEvent(publication, EventType.PUBLICATION_UPDATED_IN_BATCH);
Please register or sign in to reply
} else if (!this.statusUpdateIsDueToBatchUpdate(publication.getResId())) {
switch (publication.getStatus()) {
case UPDATES_VALIDATION, IN_VALIDATION -> this.eventService.createEvent(publication, EventType.PUBLICATION_TO_VALIDATE);
case FEEDBACK_REQUIRED -> this.eventService.createEvent(publication.getLastComment(false), EventType.PUBLICATION_FEEDBACK_REQUIRED);
case COMPLETED -> this.eventService.createEvent(publication, EventType.PUBLICATION_VALIDATED);
case REJECTED -> this.eventService.createEvent(publication, EventType.PUBLICATION_REJECTED);
}
}
}
@@ -551,6 +548,10 @@ public class PublicationService extends AouResourceService<Publication> {
return result;
}
private boolean statusUpdateIsDueToBatchUpdate(String publicationId) {
return this.historyService.hasBeenUpdatingMetadataInBatch(publicationId);
}
/**
* Save a publication by calling the repository save() method only (methods beforeValidate(), validate() and beforeSave() are not called)
*
Loading