]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Fix of study validation cycle when there is no inDraft state (reviewer is null).
authorrkv <rkv@opencascade.com>
Tue, 16 Apr 2013 13:03:29 +0000 (13:03 +0000)
committerrkv <rkv@opencascade.com>
Tue, 16 Apr 2013 13:03:29 +0000 (13:03 +0000)
Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java
Workspace/Siman-Common/src/org/splat/som/StudyRights.java

index ba82388ea79f4743eb3a4493b3312bd957e6efef..2e4079229c690686a26a58012ed64b4bbf722599 100644 (file)
@@ -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);
index 049f88f9835e5e0ea34caab8560864e6ef68b01f..8782dab987bea5869b1380af0bc4f6c62b897cee 100644 (file)
@@ -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;
        }
 
        // ==============================================================================================================================