From: rkv Date: Tue, 5 Feb 2013 05:25:06 +0000 (+0000) Subject: Fix for mantis #0022079: Problem in lifecycle of documents: For two steps cycles... X-Git-Tag: Root_Delivery2_2013_04_22~151 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c52b422b6884a46eb30428da1422723e9d711a44;p=tools%2Fsiman.git Fix for mantis #0022079: Problem in lifecycle of documents: For two steps cycles documents from inCheck status must be demoted into inWork status instead of inDraft. --- diff --git a/Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java index 21ad088..31cf6a0 100644 --- a/Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java @@ -382,15 +382,23 @@ public class PublicationServiceImpl implements PublicationService { @Transactional public boolean invalidate(final Publication aPublication) { boolean res = false; - if ((aPublication.value().getProgressState() == ProgressState.inCHECK) - && getDocumentService().demote(aPublication.value())) { + if ((aPublication.value().getProgressState() == ProgressState.inCHECK)) { DocumentType type = aPublication.value().getType(); Study owner = aPublication.getOwnerStudy(); - if (getDocumentService().isStudyResult(type) - && owner.getProgressState() == ProgressState.inCHECK) { - getStudyService().demote(owner); + + ValidationCycle cycle = getStudyService().getValidationCycleOf( + owner, type); + // Check if the validation cycle allows the review step + if (cycle.enables(ValidationStep.REVIEW)) { + if (getDocumentService().demote(aPublication.value()) + && getDocumentService().isStudyResult(type) + && owner.getProgressState() == ProgressState.inCHECK) { + getStudyService().demote(owner); + } + res = true; + } else { // If the validation cycle has no inDraft step + res = demote(aPublication); } - res = true; } return res; } @@ -501,7 +509,8 @@ public class PublicationServiceImpl implements PublicationService { "Cannot save a Publication object refering an undefined Document"); } if (!aPublication.value().getSourceFile().exists()) { - throw new FileNotFoundException(aPublication.value().getSourceFile().asFile().getAbsolutePath()); + throw new FileNotFoundException(aPublication.value() + .getSourceFile().asFile().getAbsolutePath()); } if (state == ProgressState.inWORK || state == ProgressState.EXTERN) {