1 package org.splat.simer;
3 import java.text.SimpleDateFormat;
4 import java.util.ResourceBundle;
6 import org.hibernate.Session;
7 import org.hibernate.Transaction;
8 import org.splat.dal.bo.kernel.User;
9 import org.splat.dal.dao.som.Database;
10 import org.splat.dal.bo.som.Scenario;
11 import org.splat.service.ProjectElementService;
12 import org.splat.service.ScenarioService;
13 import org.splat.som.Step;
14 import org.splat.som.StepRights;
16 public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
18 private Scenario myscenario;
19 private String lasdate;
20 private String subject;
21 private ScenarioService _scenarioService;
22 private ProjectElementService _projectElementService;
24 private static final long serialVersionUID = 4964740932426016171L;
26 // ==============================================================================================================================
28 // ==============================================================================================================================
30 public String doInitialize() {
31 // -----------------------------
32 ResourceBundle label = ResourceBundle.getBundle("labels",
33 ApplicationSettings.getCurrentLocale());
34 ResourceBundle custom = ResourceBundle.getBundle("som",
35 ApplicationSettings.getCurrentLocale());
36 SimpleDateFormat datstring = new SimpleDateFormat(
37 custom.getString("date.format")); // Locale date display format
40 mystudy = getOpenStudy();
41 step = mystudy.getSelectedStep();
42 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
43 lasdate = datstring.format(myscenario.getLastModificationDate());
44 subject = label.getString("label.study") + " " + mystudy.getTitle();
49 public String doCheckin() {
50 // --------------------------
51 Session connex = Database.getSession();
52 Transaction transax = connex.beginTransaction();
55 mystudy = getOpenStudy();
56 selection = mystudy.getSelection();
57 step = mystudy.getSelectedStep();
58 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
60 getScenarioService().checkin(myscenario);
63 mystudy.getMenu().refreshGivenStepItem(
64 getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
68 // ==============================================================================================================================
70 // ==============================================================================================================================
72 public User getAuthor() {
73 // ------------------------
74 if (myscenario.isCheckedout())
75 return myscenario.getUser();
77 return myscenario.getAuthor();
80 public String getLastModificationDate() {
81 // ----------------------------------------
85 public StepRights getSelectedStep() {
86 // ------------------------------------
87 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
90 public String getSubject() {
91 // ---------------------------
95 public String getTitle() {
96 // -------------------------
97 return myscenario.getTitle();
100 public boolean isCheckedout() {
101 // ------------------------------
102 return myscenario.isCheckedout();
106 * Get the scenarioService.
108 * @return the scenarioService
110 public ScenarioService getScenarioService() {
111 return _scenarioService;
115 * Set the scenarioService.
117 * @param scenarioService
118 * the scenarioService to set
120 public void setScenarioService(ScenarioService scenarioService) {
121 _scenarioService = scenarioService;
125 * Get the projectElementService.
127 * @return the projectElementService
129 public ProjectElementService getProjectElementService() {
130 return _projectElementService;
134 * Set the projectElementService.
136 * @param projectElementService
137 * the projectElementService to set
139 public void setProjectElementService(
140 ProjectElementService projectElementService) {
141 _projectElementService = projectElementService;