X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=Workspace%2FSiman%2Fsrc%2Forg%2Fsplat%2Fsimer%2FEditStudyAction.java;h=73c5c95f364bd76734e69447a4096823aee117e3;hb=eb90d68aafe1fbc1307dd1121500a97ffd940d21;hp=577b185609bd19b907da7e5db11467a6ae96c129;hpb=83f455f08f80e2d2166c1100780913e005c3c4c3;p=tools%2Fsiman.git diff --git a/Workspace/Siman/src/org/splat/simer/EditStudyAction.java b/Workspace/Siman/src/org/splat/simer/EditStudyAction.java index 577b185..73c5c95 100644 --- a/Workspace/Siman/src/org/splat/simer/EditStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditStudyAction.java @@ -9,35 +9,96 @@ public class EditStudyAction extends DisplayStudyStepAction { */ private static final long serialVersionUID = -4865668290514118396L; + /** + * Possible operations on a study. + */ private enum Execute { - publish, promote + /** + * Publish a study. + */ + publish, + /** + * Make published study private. + */ + protect, + /** + * Promote a study to the next state. + */ + promote, + /** + * Demote a study from In-Draft or In-Check to In-Work. + */ + demote } - // ============================================================================================================================== + // ========================================================================= // Action methods - // ============================================================================================================================== + // ========================================================================= + /** + * Perform operation on the selected study. + * + * @return SUCCESS + */ public String doEdition() { - try { - _openStudy = getOpenStudy(); - - Execute todo = Execute.valueOf(_action); - Study study = _openStudy.getStudyObject(); - - if (todo == Execute.publish) { - getStudyService().moveToPublic(study); - } else if (todo == Execute.promote) { - getStudyService().moveToReference(study); - } - _openStudy.getPopup().setContext("study", - _openStudy.getStudyRights()); // The context has changed - - setMenu(); - - return SUCCESS; - } catch (RuntimeException saverror) { - LOG.error("Reason:", saverror); - return ERROR; + _openStudy = getOpenStudy(); + + Execute todo = Execute.valueOf(_action); + Study study = _openStudy.getStudyObject(); + + if (todo == Execute.publish) { + getStudyService().moveToPublic(study); + } else if (todo == Execute.protect) { + getStudyService().moveToPrivate(study); + } else if (todo == Execute.promote) { + getStudyService().promote(study); + } else if (todo == Execute.demote) { + getStudyService().demote(study); } +// _openStudy.getMenu().refreshSelectedItem(); // Updates the menu icon, in case of other documents in approved state + _openStudy.getPopup().setContext("study", _openStudy.getStudyRights()); // The context has changed + + setMenu(); + + _myindex = null; + _selection = _openStudy.getSelection(); // actually, value doesn't matter, it just has to be not null + doOpen(); + return SUCCESS; + } + + /** + * Mark study as reference functionality. + * + * @return SUCCESS + */ + public String doMarkAsReference() { + + _openStudy = getOpenStudy(); + Study study = _openStudy.getStudyObject(); + + getStudyService().markStudyAsReference(study); + + _myindex = null; + _selection = _openStudy.getSelection(); // actually, value doesn't matter, it just has to be not null + doOpen(); + return SUCCESS; + } + + /** + * Remove study as reference functionality. + * + * @return SUCCESS + */ + public String doRemoveAsReference() { + + _openStudy = getOpenStudy(); + Study study = _openStudy.getStudyObject(); + + getStudyService().removeStudyAsReference(study); + + _myindex = null; + _selection = _openStudy.getSelection(); // actually, value doesn't matter, it just has to be not null + doOpen(); + return SUCCESS; } } \ No newline at end of file