import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.splat.kernel.User;
-import org.splat.som.Database;
-import org.splat.som.Scenario;
+import org.splat.dal.bo.kernel.User;
+import org.splat.dal.dao.som.Database;
+import org.splat.dal.bo.som.Scenario;
+import org.splat.service.ProjectElementService;
+import org.splat.service.ScenarioService;
import org.splat.som.Step;
import org.splat.som.StepRights;
-
public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
- private Scenario myscenario;
- private String lasdate;
- private String subject;
+ private Scenario myscenario;
+ private String lasdate;
+ private String subject;
+ private ScenarioService _scenarioService;
+ private ProjectElementService _projectElementService;
private static final long serialVersionUID = 4964740932426016171L;
-// ==============================================================================================================================
-// Action methods
-// ==============================================================================================================================
-
- public String doInitialize () {
-// -----------------------------
- ResourceBundle label = ResourceBundle.getBundle("labels", ApplicationSettings.getCurrentLocale());
- ResourceBundle custom = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale());
- SimpleDateFormat datstring = new SimpleDateFormat(custom.getString("date.format")); // Locale date display format
- Step step;
-
- mystudy = getOpenStudy();
- step = mystudy.getSelectedStep();
- myscenario = (Scenario)step.getOwner(); // The selected step belong to a scenario
- lasdate = datstring.format(myscenario.getLastModificationDate());
- subject = label.getString("label.study") + " " + mystudy.getTitle();
-
- return SUCCESS;
- }
-
- public String doCheckin () {
-// --------------------------
- Session connex = Database.getSession();
- Transaction transax = connex.beginTransaction();
- Step step;
-
- mystudy = getOpenStudy();
- selection = mystudy.getSelection();
- step = mystudy.getSelectedStep();
- myscenario = (Scenario)step.getOwner(); // The selected step belong to a scenario
-
- myscenario.checkin();
- transax.commit();
-
- mystudy.getMenu().refreshGivenStepItem(myscenario.getFirstStep()); // For updating the scenario icon
- return SUCCESS;
- }
-
-// ==============================================================================================================================
-// Getters
-// ==============================================================================================================================
-
- public User getAuthor () {
-// ------------------------
- if (myscenario.isCheckedout()) return myscenario.getUser();
- else return myscenario.getAuthor();
- }
-
- public String getLastModificationDate () {
-// ----------------------------------------
- return lasdate;
- }
-
- public StepRights getSelectedStep () {
-// ------------------------------------
- return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
- }
-
- public String getSubject () {
-// ---------------------------
- return subject;
- }
- public String getTitle () {
-// -------------------------
- return myscenario.getTitle();
- }
-
- public boolean isCheckedout () {
-// ------------------------------
- return myscenario.isCheckedout();
- }
+ // ==============================================================================================================================
+ // Action methods
+ // ==============================================================================================================================
+
+ public String doInitialize() {
+ // -----------------------------
+ ResourceBundle label = ResourceBundle.getBundle("labels",
+ ApplicationSettings.getCurrentLocale());
+ ResourceBundle custom = ResourceBundle.getBundle("som",
+ ApplicationSettings.getCurrentLocale());
+ SimpleDateFormat datstring = new SimpleDateFormat(
+ custom.getString("date.format")); // Locale date display format
+ Step step;
+
+ mystudy = getOpenStudy();
+ step = mystudy.getSelectedStep();
+ myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
+ lasdate = datstring.format(myscenario.getLastModificationDate());
+ subject = label.getString("label.study") + " " + mystudy.getTitle();
+
+ return SUCCESS;
+ }
+
+ public String doCheckin() {
+ // --------------------------
+ Session connex = Database.getSession();
+ Transaction transax = connex.beginTransaction();
+ Step step;
+
+ mystudy = getOpenStudy();
+ selection = mystudy.getSelection();
+ step = mystudy.getSelectedStep();
+ myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
+
+ getScenarioService().checkin(myscenario);
+ transax.commit();
+
+ mystudy.getMenu().refreshGivenStepItem(
+ getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
+ return SUCCESS;
+ }
+
+ // ==============================================================================================================================
+ // Getters
+ // ==============================================================================================================================
+
+ public User getAuthor() {
+ // ------------------------
+ if (myscenario.isCheckedout())
+ return myscenario.getUser();
+ else
+ return myscenario.getAuthor();
+ }
+
+ public String getLastModificationDate() {
+ // ----------------------------------------
+ return lasdate;
+ }
+
+ public StepRights getSelectedStep() {
+ // ------------------------------------
+ return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
+ }
+
+ public String getSubject() {
+ // ---------------------------
+ return subject;
+ }
+
+ public String getTitle() {
+ // -------------------------
+ return myscenario.getTitle();
+ }
+
+ public boolean isCheckedout() {
+ // ------------------------------
+ return myscenario.isCheckedout();
+ }
+
+ /**
+ * Get the scenarioService.
+ *
+ * @return the scenarioService
+ */
+ public ScenarioService getScenarioService() {
+ return _scenarioService;
+ }
+
+ /**
+ * Set the scenarioService.
+ *
+ * @param scenarioService
+ * the scenarioService to set
+ */
+ public void setScenarioService(ScenarioService scenarioService) {
+ _scenarioService = scenarioService;
+ }
+
+ /**
+ * Get the projectElementService.
+ *
+ * @return the projectElementService
+ */
+ public ProjectElementService getProjectElementService() {
+ return _projectElementService;
+ }
+
+ /**
+ * Set the projectElementService.
+ *
+ * @param projectElementService
+ * the projectElementService to set
+ */
+ public void setProjectElementService(
+ ProjectElementService projectElementService) {
+ _projectElementService = projectElementService;
+ }
}
\ No newline at end of file