1 package org.splat.simer;
3 import java.text.SimpleDateFormat;
4 import java.util.ResourceBundle;
6 import org.splat.dal.bo.kernel.User;
7 import org.splat.dal.bo.som.Scenario;
8 import org.splat.service.ProjectElementService;
9 import org.splat.service.ScenarioService;
10 import org.splat.som.Step;
11 import org.splat.som.StepRights;
13 public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
15 private Scenario myscenario;
16 private String lasdate;
17 private String subject;
18 private ScenarioService _scenarioService;
19 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() {
52 mystudy = getOpenStudy();
53 selection = mystudy.getSelection();
54 step = mystudy.getSelectedStep();
55 myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario
57 getScenarioService().checkin(myscenario);
59 mystudy.getMenu().refreshGivenStepItem(
60 getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon
64 // ==============================================================================================================================
66 // ==============================================================================================================================
68 public User getAuthor() {
69 // ------------------------
70 if (myscenario.isCheckedout())
71 return myscenario.getUser();
73 return myscenario.getAuthor();
76 public String getLastModificationDate() {
77 // ----------------------------------------
81 public StepRights getSelectedStep() {
82 // ------------------------------------
83 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
86 public String getSubject() {
87 // ---------------------------
91 public String getTitle() {
92 // -------------------------
93 return myscenario.getTitle();
96 public boolean isCheckedout() {
97 // ------------------------------
98 return myscenario.isCheckedout();
102 * Get the scenarioService.
104 * @return the scenarioService
106 public ScenarioService getScenarioService() {
107 return _scenarioService;
111 * Set the scenarioService.
113 * @param scenarioService
114 * the scenarioService to set
116 public void setScenarioService(ScenarioService scenarioService) {
117 _scenarioService = scenarioService;
121 * Get the projectElementService.
123 * @return the projectElementService
125 public ProjectElementService getProjectElementService() {
126 return _projectElementService;
130 * Set the projectElementService.
132 * @param projectElementService
133 * the projectElementService to set
135 public void setProjectElementService(
136 ProjectElementService projectElementService) {
137 _projectElementService = projectElementService;