Salome HOME
Actions menu properties are refactored, unnecessary code is removed.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / EditStudyAction.java
index 755ba3faef571bf7a0600e27b80d1413479d5915..577b185609bd19b907da7e5db11467a6ae96c129 100644 (file)
 package org.splat.simer;
 
 import org.splat.dal.bo.som.Study;
-import org.splat.service.StudyService;
-
 
 public class EditStudyAction extends DisplayStudyStepAction {
-    
-       /**
-        * Serial version ID.
-        */
-    private static final long serialVersionUID = -4865668290514118396L;
 
-       private enum Execute { publish, promote }
-
-       private StudyService _studyService;
-       
-       /**
-        * Value of the menu property. 
-        * It can be: none, create, open, study, knowledge, sysadmin, help.
-        */
-       private String _menuProperty;
-       
        /**
-        * Value of the title bar property. 
-        * It can be: study, knowledge.
-        */
-       private String _titleProperty;
-       
-       /**
-        * Value of the tool bar property. 
-        * It can be: none, standard, study, back.
-        */
-       private String _toolProperty;
-       
-       /**
-        * Value of the left menu property. 
-        * It can be: open, study, knowledge, scenario.
-        */
-       private String _leftMenuProperty;
-       
-       /**
-        * Property that indicates whether the current open study is editable or not.
-        * On the screen it looks like pen on the status icon, pop-up menu also can be called.
-        * It is necessary for correct building the title bar.
+        * Serial version ID.
         */
-       private String _editDisabledProperty = "false";
+       private static final long serialVersionUID = -4865668290514118396L;
 
-//  ==============================================================================================================================
-//  Action methods
-//  ==============================================================================================================================
-
-    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
-        
-        setMenuProperty("study");
-        setTitleProperty("study");
-        if ("true".equals(getWriteAccess()) &&  getUserRights().canCreateDocument()) {
-                       setToolProperty("study");
-               } else {
-                       setToolProperty("standard");
-               }
-        setLeftMenuProperty("study");
-               initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty);
-
-        return SUCCESS;
-         }
-      catch (RuntimeException saverror) {
-        LOG.error("Reason:", saverror);
-        return ERROR;
-      }
-    }
-       /**
-        * Get the studyService.
-        * 
-        * @return the studyService
-        */
-       public StudyService getStudyService() {
-               return _studyService;
+       private enum Execute {
+               publish, promote
        }
 
-       /**
-        * Set the studyService.
-        * 
-        * @param studyService
-        *            the studyService to set
-        */
-       public void setStudyService(StudyService studyService) {
-               _studyService = studyService;
-       }
-       
-       /**
-        * Get the menuProperty.
-        * @return the menuProperty
-        */
-       public String getMenuProperty() {
-               return _menuProperty;
-       }
+       // ==============================================================================================================================
+       // Action methods
+       // ==============================================================================================================================
 
-       /**
-        * Set the menuProperty.
-        * @param menuProperty the menuProperty to set
-        */
-       public void setMenuProperty(String menuProperty) {
-               this._menuProperty = menuProperty;
-       }
-       
-       /**
-        * Get the _titleProperty.
-        * @return the _titleProperty
-        */
-       public String getTitleProperty() {
-               return _titleProperty;
-       }
+       public String doEdition() {
+               try {
+                       _openStudy = getOpenStudy();
 
-       /**
-        * Set the _titleProperty.
-        * @param _titleProperty the titleProperty to set
-        */
-       public void setTitleProperty(String titleProperty) {
-               _titleProperty = titleProperty;
-       }
-       /**
-        * Get the editDisabledProperty.
-        * @return the editDisabledProperty
-        */
-       public final String getEditDisabledProperty() {
-               return _editDisabledProperty;
-       }
-       /**
-        * Set the editDisabledProperty.
-        * @param editDisabledProperty the editDisabledProperty to set
-        */
-       public final void setEditDisabledProperty(String editDisabledProperty) {
-               _editDisabledProperty = editDisabledProperty;
-       }
-       
-       /**
-        * Get the toolProperty.
-        * @return the toolProperty
-        */
-       public String getToolProperty() {
-               return _toolProperty;
-       }
+                       Execute todo = Execute.valueOf(_action);
+                       Study study = _openStudy.getStudyObject();
 
-       /**
-        * Set the toolProperty.
-        * @param toolProperty the toolProperty to set
-        */
-       public void setToolProperty(final String toolProperty) {
-               _toolProperty = toolProperty;
-       }
-       
-       /**
-        * Get the leftMenuProperty.
-        * @return the leftMenuProperty
-        */
-       public String getLeftMenuProperty() {
-               return _leftMenuProperty;
-       }
+                       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
 
-       /**
-        * Set the leftMenuProperty.
-        * @param leftMenuProperty the leftMenuProperty to set
-        */
-       public void setLeftMenuProperty(final String leftMenuProperty) {
-               _leftMenuProperty = leftMenuProperty;
-       }
+                       setMenu();
 
+                       return SUCCESS;
+               } catch (RuntimeException saverror) {
+                       LOG.error("Reason:", saverror);
+                       return ERROR;
+               }
+       }
 }
\ No newline at end of file