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;
27 private static final long serialVersionUID = 4964740932426016171L;
29 // ==============================================================================================================================
31 // ==============================================================================================================================
33 public String doInitialize() {
34 // -----------------------------
35 ResourceBundle label = ResourceBundle.getBundle("labels",
36 ApplicationSettings.getCurrentLocale());
37 ResourceBundle custom = ResourceBundle.getBundle("som",
38 ApplicationSettings.getCurrentLocale());
39 SimpleDateFormat datstring = new SimpleDateFormat(
40 custom.getString("date.format")); // Locale date display format
43 mystudy = getOpenStudy();
44 step = mystudy.getSelectedStep();
45 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
46 lasdate = datstring.format(myscenario.getLastModificationDate());
47 subject = label.getString("label.study") + " " + mystudy.getTitle();
52 public String doCheckin() {
53 // --------------------------
54 Session connex = Database.getSession();
55 Transaction transax = connex.beginTransaction();
58 mystudy = getOpenStudy();
59 selection = mystudy.getSelection();
60 step = mystudy.getSelectedStep();
61 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
63 getScenarioService().checkin(myscenario);
66 mystudy.getMenu().refreshGivenStepItem(
67 getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
71 // ==============================================================================================================================
73 // ==============================================================================================================================
75 public User getAuthor() {
76 // ------------------------
77 if (myscenario.isCheckedout())
78 return myscenario.getUser();
80 return myscenario.getAuthor();
83 public String getLastModificationDate() {
84 // ----------------------------------------
88 public StepRights getSelectedStep() {
89 // ------------------------------------
90 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
93 public String getSubject() {
94 // ---------------------------
98 public String getTitle() {
99 // -------------------------
100 return myscenario.getTitle();
103 public boolean isCheckedout() {
104 // ------------------------------
105 return myscenario.isCheckedout();
109 * Get the scenarioService.
111 * @return the scenarioService
113 public ScenarioService getScenarioService() {
114 return _scenarioService;
118 * Set the scenarioService.
120 * @param scenarioService
121 * the scenarioService to set
123 public void setScenarioService(ScenarioService scenarioService) {
124 _scenarioService = scenarioService;
128 * Get the projectElementService.
130 * @return the projectElementService
132 public ProjectElementService getProjectElementService() {
133 return _projectElementService;
137 * Set the projectElementService.
139 * @param projectElementService
140 * the projectElementService to set
142 public void setProjectElementService(
143 ProjectElementService projectElementService) {
144 _projectElementService = projectElementService;