ResourceBundle locale = ResourceBundle.getBundle("labels",
getApplicationSettings().getCurrentLocale());
_title = locale.getString("label.study") + " "
- + String.valueOf(number + 1);
+ + (number + 1);
initializationFullScreenContext(Constants.CREATE_MENU, Constants.NONE,
Constants.OPEN);
*/
public String doCreate() throws InvalidPropertyException,
MissedPropertyException, MultiplyDefinedException {
+ String res = SUCCESS;
String[] input = _projectContext.split(",");
int valid = Integer.valueOf(input[0]);
- String value = ""; // input[1] if exists
-
- Study.Properties sprop = new Study.Properties();
// Check arguments and creation of the study
if (valid == -1) {
.selectType("product");
_contelm = getSimulationContextService()
.selectSimulationContextsWhere(cprop.setType(product));
- return INPUT; // Title empty, simply wait for input without error message
- }
- if (valid == 0) {
- value = input[1].trim();
- if (value.length() == 0) {
- initializationScreenContext(Constants.CREATE_MENU);
- return INPUT; // No need to reinitialize the list of existing products
+ // Title empty, simply wait for input without error message
+ res = INPUT;
+ } else {
+ String value; // input[1] if exists
+ if (valid == 0) {
+ value = input[1].trim();
+ if (value.length() == 0) {
+ initializationScreenContext(Constants.CREATE_MENU);
+ // No need to reinitialize the list of existing products
+ res = INPUT;
+ }
+ } else {
+ value = "";
}
- }
- sprop.setTitle(_title).setManager(getConnectedUser());
- sprop.checkValidity();
- sprop.disableCheck();
- try {
- // Addition of a default scenario
- ResourceBundle locale = ResourceBundle.getBundle("labels",
- getApplicationSettings().getCurrentLocale());
- Scenario.Properties oprop = new Scenario.Properties();
- oprop.setTitle(locale.getString("label.scenario") + " 1");
+ if (SUCCESS.equals(res)) {
+ Study.Properties sprop = new Study.Properties();
- // Addition of the entered project context
- SimulationContext.Properties cprop = new SimulationContext.Properties();
- if (valid == 0) { // Input of new project context
- SimulationContextType product = getSimulationContextService()
- .selectType("product");
-
- SimulationContext testContext = getSimulationContextService().selectSimulationContext(product, value);
-
- if (testContext == null) {
- cprop.setType(
- getSimulationContextService().selectType("product"))
- .setValue(value);
- } else {
- cprop.setIndex(testContext.getIndex());
+ sprop.setTitle(_title).setManager(getConnectedUser());
+ sprop.checkValidity();
+ sprop.disableCheck();
+ try {
+ // Addition of a default scenario
+ ResourceBundle locale = ResourceBundle.getBundle("labels",
+ getApplicationSettings().getCurrentLocale());
+ Scenario.Properties oprop = new Scenario.Properties();
+ oprop.setTitle(locale.getString("label.scenario") + " 1");
+
+ // Addition of the entered project context
+ SimulationContext.Properties cprop = new SimulationContext.Properties();
+ if (valid == 0) { // Input of new project context
+ SimulationContextType product = getSimulationContextService()
+ .selectType("product");
+
+ SimulationContext testContext = getSimulationContextService().selectSimulationContext(product, value);
+
+ if (testContext == null) {
+ cprop.setType(
+ getSimulationContextService().selectType("product"))
+ .setValue(value);
+ } else {
+ cprop.setIndex(testContext.getIndex());
+ }
+ } else { // Selection of existing project context
+ cprop.setIndex(valid);
+ }
+ Study study = getScenarioService().createStudy(sprop, oprop, cprop);
+ // Update of the session
+ number += 1;
+ open(study); // Opens the study,
+
+ initializationFullScreenContext(Constants.STUDY_MENU,
+ Constants.NONE, Constants.OPEN);
+
+ } catch (Exception error) {
+ LOG.error("Unable to save the study, reason:", error);
+ setErrorCode("message.error.newstudy");
+ initializationScreenContext(Constants.NONE);
+ res = ERROR;
}
- } else { // Selection of existing project context
- cprop.setIndex(valid);
}
- Study study = getScenarioService().createStudy(sprop, oprop, cprop);
- // Update of the session
- number += 1;
- open(study); // Opens the study,
-
- initializationFullScreenContext(Constants.STUDY_MENU,
- Constants.NONE, Constants.OPEN);
-
- return SUCCESS;
- } catch (Exception error) {
- LOG.error("Unable to save the study, reason:", error);
- setErrorCode("message.error.newstudy");
- initializationScreenContext(Constants.NONE);
- return ERROR;
}
+ return res;
}
/**
if( LOG.isDebugEnabled() ) {
LOG.debug("--- validate");
}
- com.opensymphony.xwork2.ActionContext context =
- com.opensymphony.xwork2.ActionContext.getContext();
-
if( LOG.isDebugEnabled() ) {
LOG.debug("======> MKA test");
- LOG.debug(context.getName());
+ LOG.debug(com.opensymphony.xwork2.ActionContext.getContext().getName());
}
}