Salome HOME
Actions menu properties are refactored, unnecessary code is removed.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / StartAction.java
index ab2832e0868652e6289411a15d37a3d4d9b77b7c..64a6ed507c4d6b8d7b40f86558982f53ebcf4e99 100644 (file)
@@ -2,9 +2,6 @@ package org.splat.simer;
 
 import java.util.Map;
 
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.struts2.interceptor.ServletRequestAware;
 import org.splat.service.technical.ProjectSettingsService;
 import org.splat.som.ApplicationRights;
 import org.splat.wapp.Constants;
@@ -12,51 +9,16 @@ import org.splat.wapp.Constants;
 /**
  * Start application action.
  */
-public class StartAction extends Action implements ServletRequestAware {
+public class StartAction extends Action {
        /**
         * Serial version ID.
         */
        private static final long serialVersionUID = 5875058140682652964L;
 
-       /**
-        * HTTP request.
-        */
-       private transient HttpServletRequest _request = null;
-
        /**
         * Injected project settings service.
         */
        private ProjectSettingsService _projectSettings;
-       /**
-        * Injected application settings service.
-        */
-       private ApplicationSettings _applicationSettings;
-
-       /**
-        * 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;
-
-       /**
-        * 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.
-        */
-       private String _editDisabledProperty = "false";
-
-       /**
-        * 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;
 
        // ==============================================================================================================================
        // Action execution
@@ -64,12 +26,13 @@ public class StartAction extends Action implements ServletRequestAware {
 
        /**
         * Initialize application.
+        * 
         * @return SUCCESS if succeeded, ERROR - if exception is caught
         */
        public String doInitialize() {
-               StringBuffer wappurl = _request.getRequestURL(); // "http://{server}:{port}/{webapp}/", including the leading '/'
+               StringBuffer wappurl = getServletRequest().getRequestURL(); // "http://{server}:{port}/{webapp}/", including the leading '/'
                String res = SUCCESS;
-               
+
                LOG.info(new StringBuffer("Initializing ").append(wappurl)
                                .append("...").toString());
                try {
@@ -81,11 +44,12 @@ public class StartAction extends Action implements ServletRequestAware {
 
                        // Database configuration
                        project.configure(root
-                                       + ApplicationSettings.getApplicationProperty("wapp.configuration"));
+                                       + ApplicationSettings
+                                                       .getApplicationProperty("wapp.configuration"));
 
                        // Configure menus for the current user
                        wapp.configure();
-                       
+
                        // Initialization of the user session
                        Map<String, Object> session = getSession();
 
@@ -94,19 +58,14 @@ public class StartAction extends Action implements ServletRequestAware {
                        session.put("knowledge.filter", wapp
                                        .getFilter(Constants.KNOWLEDGE_MENU));
 
-                       setMenuProperty(Constants.NONE);
-                       initializationScreenContext(_menuProperty);
-                       
+                       initializationScreenContext(Constants.NONE);
+
                } catch (Exception error) {
                        LOG.fatal("Reason:", error);
 
-                       setMenuProperty(Constants.STUDY_MENU);
-                       setTitleProperty(Constants.STUDY_MENU);
-                       setEditDisabledProperty("true");
-                       setToolProperty(Constants.NONE);
-                       setLeftMenuProperty(Constants.STUDY_MENU);
-                       initializationFullScreenContext(_menuProperty, _titleProperty,
-                                       _editDisabledProperty, _toolProperty, _leftMenuProperty);
+                       initializationFullScreenContext(Constants.STUDY_MENU,
+                                       Constants.STUDY_MENU, Constants.TRUE, Constants.NONE,
+                                       Constants.STUDY_MENU);
 
                        res = ERROR;
                }
@@ -117,15 +76,6 @@ public class StartAction extends Action implements ServletRequestAware {
        // Setter
        // ==============================================================================================================================
 
-       /** 
-        * {@inheritDoc}
-        * @see org.splat.simer.Action#setServletRequest(javax.servlet.http.HttpServletRequest)
-        */
-       @Override
-       public void setServletRequest(final HttpServletRequest request) {
-               this._request = request;
-       }
-
        /**
         * Get project settings.
         * 
@@ -145,121 +95,4 @@ public class StartAction extends Action implements ServletRequestAware {
                        final ProjectSettingsService projectSettingsService) {
                _projectSettings = projectSettingsService;
        }
-
-       /**
-        * Get the applicationSettings.
-        * 
-        * @return the applicationSettings
-        */
-       @Override
-       public ApplicationSettings getApplicationSettings() {
-               return _applicationSettings;
-       }
-
-       /**
-        * Set the applicationSettings.
-        * 
-        * @param applicationSettings
-        *            the applicationSettings to set
-        */
-       @Override
-       public void setApplicationSettings(
-                       final ApplicationSettings applicationSettings) {
-               _applicationSettings = applicationSettings;
-       }
-
-       /**
-        * Get the menuProperty.
-        * 
-        * @return the menuProperty
-        */
-       public String getMenuProperty() {
-               return _menuProperty;
-       }
-
-       /**
-        * Set the menuProperty.
-        * 
-        * @param menuProperty
-        *            the menuProperty to set
-        */
-       public void setMenuProperty(final String menuProperty) {
-               this._menuProperty = menuProperty;
-       }
-
-       /**
-        * Get the _titleProperty.
-        * 
-        * @return the _titleProperty
-        */
-       public String getTitleProperty() {
-               return _titleProperty;
-       }
-
-       /**
-        * Set the titleProperty.
-        * 
-        * @param titleProperty
-        *            the titleProperty to set
-        */
-       public void setTitleProperty(final 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(final String editDisabledProperty) {
-               _editDisabledProperty = editDisabledProperty;
-       }
-
-       /**
-        * Get the toolProperty.
-        * 
-        * @return the toolProperty
-        */
-       public String getToolProperty() {
-               return _toolProperty;
-       }
-
-       /**
-        * 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;
-       }
-
-       /**
-        * Set the leftMenuProperty.
-        * 
-        * @param leftMenuProperty
-        *            the leftMenuProperty to set
-        */
-       public void setLeftMenuProperty(final String leftMenuProperty) {
-               _leftMenuProperty = leftMenuProperty;
-       }
 }
\ No newline at end of file