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;
/**
* 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.
* 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;
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;
}
* 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
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
}
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 {
setMenuProperty("study");
setToolProperty("none");
setLeftMenuProperty("open");
- initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty);
+ initializationFullScreenContext(_menuProperty, _toolProperty,
+ _leftMenuProperty);
return SUCCESS;
} catch (Exception error) {
/**
* 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;
}
/**
* the simulationContextService to set
*/
public void setSimulationContextService(
- SimulationContextService simulationContextService) {
+ final SimulationContextService simulationContextService) {
_simulationContextService = simulationContextService;
}
* @param scenarioService
* the scenarioService to set
*/
- public void setScenarioService(ScenarioService scenarioService) {
+ public void setScenarioService(final ScenarioService scenarioService) {
_scenarioService = scenarioService;
}
* @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() {
/**
* 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() {
/**
* Set the leftMenuProperty.
- * @param leftMenuProperty the leftMenuProperty to set
+ *
+ * @param leftMenuProperty
+ * the leftMenuProperty to set
*/
public void setLeftMenuProperty(final String leftMenuProperty) {
_leftMenuProperty = leftMenuProperty;