]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman/src/org/splat/simer/NewStudyAction.java
Salome HOME
Modifications to respect PMD rules.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / NewStudyAction.java
index 94b40177ff329d6b4072841705b0b00ef0367943..40ae3ff3ab8847a85346a025b6a79770e4a520b7 100644 (file)
@@ -7,6 +7,9 @@ import org.splat.dal.bo.som.Scenario;
 import org.splat.dal.bo.som.SimulationContext;
 import org.splat.dal.bo.som.SimulationContextType;
 import org.splat.dal.bo.som.Study;
+import org.splat.kernel.InvalidPropertyException;
+import org.splat.kernel.MissedPropertyException;
+import org.splat.kernel.MultiplyDefinedException;
 import org.splat.service.ScenarioService;
 import org.splat.service.SimulationContextService;
 
@@ -27,15 +30,15 @@ public class NewStudyAction extends Action {
        /**
         * Title of the new study.
         */
-       private String title = null;
+       private String _title = null;
        /**
         * List of available project contexts for selection for the new study.
         */
-       private List<SimulationContext> contelm = null;
+       private transient List<SimulationContext> _contelm = null;
        /**
         * Project context.
         */
-       private String context = null;
+       private String _projectContext = null;
 
        /**
         * Injected simulation context service.
@@ -50,16 +53,14 @@ public class NewStudyAction extends Action {
         * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help.
         */
        private String _menuProperty;
-       
+
        /**
-        * Value of the tool bar property. 
-        * It can be: none, standard, study, back.
+        * 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.
+        * Value of the left menu property. It can be: open, study, knowledge, scenario.
         */
        private String _leftMenuProperty;
 
@@ -75,18 +76,19 @@ public class NewStudyAction extends Action {
        public String doInitialize() {
 
                // get the list of the simulation contexts of the study
-               contelm = getSimulationContextService().getSimulationContextList();
+               _contelm = getSimulationContextService().getSimulationContextList();
 
                // set the default name of the new study
                ResourceBundle locale = ResourceBundle.getBundle("labels",
                                getApplicationSettings().getCurrentLocale());
-               title = locale.getString("label.study") + " "
+               _title = locale.getString("label.study") + " "
                                + String.valueOf(number + 1);
 
                setMenuProperty("create");
                setToolProperty("none");
                setLeftMenuProperty("open");
-               initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty);
+               initializationFullScreenContext(_menuProperty, _toolProperty,
+                               _leftMenuProperty);
 
                return SUCCESS;
        }
@@ -95,11 +97,16 @@ public class NewStudyAction extends Action {
         * Create a new study.
         * 
         * @return SUCCESS if the new study is created, INPUT if project context is not defined, ERROR if failed
-        * @throws Exception
+        * @throws InvalidPropertyException
+        *             if some property has invalid value
+        * @throws MultiplyDefinedException
+        *             if some property is defined several times
+        * @throws MissedPropertyException
         *             if properties of the new study are invalid
         */
-       public String doCreate() throws Exception {
-               String[] input = context.split(",");
+       public String doCreate() throws InvalidPropertyException,
+                       MissedPropertyException, MultiplyDefinedException {
+               String[] input = _projectContext.split(",");
                int valid = Integer.valueOf(input[0]);
                String value = ""; // input[1] if exists
 
@@ -110,7 +117,7 @@ public class NewStudyAction extends Action {
                        SimulationContext.Properties cprop = new SimulationContext.Properties();
                        SimulationContextType product = getSimulationContextService()
                                        .selectType("product");
-                       contelm = getSimulationContextService()
+                       _contelm = getSimulationContextService()
                                        .selectSimulationContextsWhere(cprop.setType(product));
                        return INPUT; // Title empty, simply wait for input without error message
                }
@@ -122,7 +129,7 @@ public class NewStudyAction extends Action {
                                return INPUT; // No need to reinitialize the list of existing products
                        }
                }
-               sprop.setTitle(title).setManager(getConnectedUser());
+               sprop.setTitle(_title).setManager(getConnectedUser());
                sprop.checkValidity();
                sprop.disableCheck();
                try {
@@ -149,7 +156,8 @@ public class NewStudyAction extends Action {
                        setMenuProperty("study");
                        setToolProperty("none");
                        setLeftMenuProperty("open");
-                       initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty);
+                       initializationFullScreenContext(_menuProperty, _toolProperty,
+                                       _leftMenuProperty);
 
                        return SUCCESS;
                } catch (Exception error) {
@@ -166,42 +174,49 @@ public class NewStudyAction extends Action {
 
        /**
         * Get the selected project context for the new study.
+        * 
         * @return the selected project context
         */
        public String getProjectContext() {
-               return context;
+               return _projectContext;
        }
 
        /**
         * Get the list of available project contexts.
+        * 
         * @return the list of context values
         */
        public List<SimulationContext> getProjectContextValues() {
-               return contelm;
+               return _contelm;
        }
 
        /**
         * Get the title of the new study.
+        * 
         * @return the title
         */
        public String getTitle() {
-               return title;
+               return _title;
        }
 
        /**
         * Set the project context for the new study.
-        * @param value the project context value.
+        * 
+        * @param value
+        *            the project context value.
         */
-       public void setProjectContext(String value) {
-               this.context = value;
+       public void setProjectContext(final String value) {
+               this._projectContext = value;
        }
 
        /**
         * Set the title of the new study.
-        * @param value the title to set
+        * 
+        * @param value
+        *            the title to set
         */
-       public void setTitle(String value) {
-               this.title = value;
+       public void setTitle(final String value) {
+               this._title = value;
        }
 
        /**
@@ -220,7 +235,7 @@ public class NewStudyAction extends Action {
         *            the simulationContextService to set
         */
        public void setSimulationContextService(
-                       SimulationContextService simulationContextService) {
+                       final SimulationContextService simulationContextService) {
                _simulationContextService = simulationContextService;
        }
 
@@ -239,7 +254,7 @@ public class NewStudyAction extends Action {
         * @param scenarioService
         *            the scenarioService to set
         */
-       public void setScenarioService(ScenarioService scenarioService) {
+       public void setScenarioService(final ScenarioService scenarioService) {
                _scenarioService = scenarioService;
        }
 
@@ -258,12 +273,13 @@ public class NewStudyAction extends Action {
         * @param menuProperty
         *            the menuProperty to set
         */
-       public void setMenuProperty(String menuProperty) {
+       public void setMenuProperty(final String menuProperty) {
                this._menuProperty = menuProperty;
        }
-       
+
        /**
         * Get the toolProperty.
+        * 
         * @return the toolProperty
         */
        public String getToolProperty() {
@@ -272,14 +288,17 @@ public class NewStudyAction extends Action {
 
        /**
         * Set the toolProperty.
-        * @param toolProperty the toolProperty to set
+        * 
+        * @param toolProperty
+        *            the toolProperty to set
         */
        public void setToolProperty(final String toolProperty) {
                _toolProperty = toolProperty;
        }
-       
+
        /**
         * Get the leftMenuProperty.
+        * 
         * @return the leftMenuProperty
         */
        public String getLeftMenuProperty() {
@@ -288,7 +307,9 @@ public class NewStudyAction extends Action {
 
        /**
         * Set the leftMenuProperty.
-        * @param leftMenuProperty the leftMenuProperty to set
+        * 
+        * @param leftMenuProperty
+        *            the leftMenuProperty to set
         */
        public void setLeftMenuProperty(final String leftMenuProperty) {
                _leftMenuProperty = leftMenuProperty;