From: rkv Date: Tue, 16 Apr 2013 13:03:29 +0000 (+0000) Subject: Fix of study validation cycle when there is no inDraft state (reviewer is null). X-Git-Tag: Root_Delivery2_2013_04_22~28 X-Git-Url: http://git.salome-platform.org/gitweb/?p=tools%2Fsiman.git;a=commitdiff_plain;h=acd06fb2d835d2fbceffb054a547e014172fc9c9 Fix of study validation cycle when there is no inDraft state (reviewer is null). --- diff --git a/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java index ba82388..2e40792 100644 --- a/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java @@ -507,10 +507,17 @@ public class StudyServiceImpl implements StudyService { @Transactional public boolean promote(final Study aStudy) { boolean res = true; + ValidationCycle cycle = getValidationCycleOf(aStudy, + getStudyResultType(aStudy)); + if (aStudy.getProgressState() == ProgressState.inWORK + && cycle.enables(ValidationStep.REVIEW) && canBePromoted(aStudy)) { aStudy.setProgressState(ProgressState.inDRAFT); - } else if (aStudy.getProgressState() == ProgressState.inDRAFT + } else if (((!cycle.enables(ValidationStep.REVIEW) && ((aStudy + .getProgressState() == ProgressState.inWORK) || (aStudy + .getProgressState() == ProgressState.inDRAFT))) || (cycle + .enables(ValidationStep.REVIEW) && (aStudy.getProgressState() == ProgressState.inDRAFT))) && canBeReviewed(aStudy)) { aStudy.setProgressState(ProgressState.inCHECK); Revision myvers = new Revision(aStudy.getVersion()); @@ -542,6 +549,7 @@ public class StudyServiceImpl implements StudyService { @Transactional public boolean demote(final Study aStudy) { boolean res; + if (aStudy.getProgressState() == ProgressState.inCHECK || aStudy.getProgressState() == ProgressState.inDRAFT) { aStudy.setProgressState(ProgressState.inWORK); diff --git a/Workspace/Siman-Common/src/org/splat/som/StudyRights.java b/Workspace/Siman-Common/src/org/splat/som/StudyRights.java index 049f88f..8782dab 100644 --- a/Workspace/Siman-Common/src/org/splat/som/StudyRights.java +++ b/Workspace/Siman-Common/src/org/splat/som/StudyRights.java @@ -280,15 +280,15 @@ public class StudyRights { */ public boolean canReview() { User reviewer = _cycle.getActor(ValidationStep.REVIEW); // May be null if not reviewable + boolean res = false; - if (!_user.equals(reviewer)) { - return false; - } - if (_operand.getProgressState() != ProgressState.inDRAFT) { - return false; + if (((reviewer == null) && ((_operand.getProgressState() == ProgressState.inWORK) || (_operand + .getProgressState() == ProgressState.inDRAFT))) + || (_user.equals(reviewer) && (_operand.getProgressState() == ProgressState.inDRAFT))) { + res = getStudyService().canBeReviewed(_operand); } - return getStudyService().canBeReviewed(_operand); + return res; } // ==============================================================================================================================