+ // 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 (_projectContextId == 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(_projectContextId);
+ }
+ 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 (BusinessException error) {
+ LOG.error("Unable to save the study, reason:", error);
+ setErrorCode("message.error.newstudy");
+ initializationScreenContext(Constants.NONE);
+ res = ERROR;