From 2b57ad5d0e29d1df7040a5458f2be349c7e0c447 Mon Sep 17 00:00:00 2001 From: rkv Date: Tue, 16 Apr 2013 10:52:28 +0000 Subject: [PATCH] Fixes: 1. Exclude validation cycle members from candidates; 2. Take into account study final result documents for enabling study menu items. --- .../src/org/splat/service/StudyServiceImpl.java | 10 ++++++++-- .../org/splat/simer/StudyPropertiesAction.java | 17 +++++++++++++++++ .../Siman/src/org/splat/simer/UploadAction.java | 10 +++++++--- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java b/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java index 86863e9..ba82388 100644 --- a/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java +++ b/Workspace/Siman-Common/src/org/splat/service/StudyServiceImpl.java @@ -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; } diff --git a/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java b/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java index b29f239..f6f6d9c 100644 --- a/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java +++ b/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java @@ -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. diff --git a/Workspace/Siman/src/org/splat/simer/UploadAction.java b/Workspace/Siman/src/org/splat/simer/UploadAction.java index 95b5b38..81b0fa6 100644 --- a/Workspace/Siman/src/org/splat/simer/UploadAction.java +++ b/Workspace/Siman/src/org/splat/simer/UploadAction.java @@ -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; -- 2.39.2