Salome HOME
Fixes:
authorrkv <rkv@opencascade.com>
Tue, 16 Apr 2013 10:52:28 +0000 (10:52 +0000)
committerrkv <rkv@opencascade.com>
Tue, 16 Apr 2013 10:52:28 +0000 (10:52 +0000)
1. Exclude validation cycle members from candidates;
2. Take into account study final result documents for enabling study menu items.

Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java
Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java
Workspace/Siman/src/org/splat/simer/UploadAction.java

index 86863e9829f107c5e9f56ea976c906ceb4ff4cac..ba82388ea79f4743eb3a4493b3312bd957e6efef 100644 (file)
@@ -1858,7 +1858,13 @@ public class StudyServiceImpl implements StudyService {
        @Override
        @Transactional(readOnly = true)
        public boolean canBePromoted(final Study study) {
-               return resultDocsAtLeast(study, ProgressState.inDRAFT);
+               boolean res;
+               if (study.getProgressState().compareTo(ProgressState.inDRAFT) < 0) {
+                       res = resultDocsAtLeast(study, ProgressState.inDRAFT);
+               } else {
+                       res = canBeReviewed(study);
+               }
+               return res;
        }
 
        /**
@@ -1887,7 +1893,7 @@ public class StudyServiceImpl implements StudyService {
                // Check that all study result documents have the state APPROVED or more.
                for (Publication pub : getProjectElementService().getLastStep(study)
                                .getResultDocuments()) {
-                       res = pub.getProgressState().compareTo(ProgressState.APPROVED) >= 0;
+                       res = pub.getProgressState().compareTo(state) >= 0;
                        if (!res) {
                                break;
                        }
index b29f239c3fd79709a221b5f287f1351a34e41dc2..f6f6d9c643619d4456ce73f9513ce8e531a20a04 100644 (file)
@@ -1,6 +1,7 @@
 package org.splat.simer;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -269,6 +270,8 @@ public class StudyPropertiesAction extends DisplayStudyStepAction {
                } catch (InvalidParameterException e) {
                        LOG.error(e.getMessage(), e);
                }
+               
+               removeValidCycleFromStaff();
                setActionType("edibutor");
                return SUCCESS;
        }
@@ -298,10 +301,24 @@ public class StudyPropertiesAction extends DisplayStudyStepAction {
                }
                _staff.removeAll(readers);
 
+               removeValidCycleFromStaff();
                setActionType("editReaders");
 
                return SUCCESS;
        }
+       
+       /**
+        * Remove validation cycle members from potential readers or contributors.
+        */
+       private void removeValidCycleFromStaff() {
+               if(_staff != null) {
+                       for(DocumentType type : _documentTypeService.selectAllTypes()) {
+                               User[] users = getStudyService()
+                                               .getValidationCycleOf(getOpenStudy().getStudyObject(), type).getAllActors();
+                               _staff.removeAll(Arrays.asList(users));
+                       }
+               }
+       }
 
        /**
         * Add or edit a document validation cycle for the selected study.
index 95b5b3874f74a086e691303a0277d101776271b2..81b0fa6a65835db7d718c575fb74898da348fa20 100644 (file)
@@ -78,9 +78,10 @@ public class UploadAction extends Action {
 
                return SUCCESS;
        }
-       
+
        /**
         * Prepare form for the upload users action.
+        * 
         * @return SUCCESS
         */
        public String doInitializeSysAdmin() {
@@ -167,6 +168,7 @@ public class UploadAction extends Action {
 
        /**
         * Get fileName with url special symbols canceled for usage in struts.xml.
+        * 
         * @return the encoded uploaded file name.
         */
        public String getCanceledFileName() {
@@ -178,7 +180,7 @@ public class UploadAction extends Action {
                }
                return res;
        }
-       
+
        /**
         * Get the action to which the uploaded file is passed.
         * 
@@ -189,9 +191,10 @@ public class UploadAction extends Action {
        }
 
        /**
-        * Cancel the uploading.
+        * Set the flag to cancel the uploading.
         * 
         * @param back
+        *            not used parameter
         */
        public void setCancel(final boolean back) {
                this._action = ToDo.cancel;
@@ -201,6 +204,7 @@ public class UploadAction extends Action {
         * Set the flag to perform uploading.
         * 
         * @param upload
+        *            not used parameter
         */
        public void setDoIt(final boolean upload) {
                this._action = ToDo.upload;