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.kernel.User;
9 import org.splat.som.Database;
10 import org.splat.som.Scenario;
11 import org.splat.som.Step;
12 import org.splat.som.StepRights;
15 public class EditScenarioPropertiesAction extends DisplayStudyStepAction {
17 private Scenario myscenario;
18 private String lasdate;
19 private String subject;
21 private static final long serialVersionUID = 4964740932426016171L;
23 // ==============================================================================================================================
25 // ==============================================================================================================================
27 public String doInitialize () {
28 // -----------------------------
29 ResourceBundle label = ResourceBundle.getBundle("labels", ApplicationSettings.getCurrentLocale());
30 ResourceBundle custom = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale());
31 SimpleDateFormat datstring = new SimpleDateFormat(custom.getString("date.format")); // Locale date display format
34 mystudy = getOpenStudy();
35 step = mystudy.getSelectedStep();
36 myscenario = (Scenario)step.getOwner(); // The selected step belong to a scenario
37 lasdate = datstring.format(myscenario.getLastModificationDate());
38 subject = label.getString("label.study") + " " + mystudy.getTitle();
43 public String doCheckin () {
44 // --------------------------
45 Session connex = Database.getSession();
46 Transaction transax = connex.beginTransaction();
49 mystudy = getOpenStudy();
50 selection = mystudy.getSelection();
51 step = mystudy.getSelectedStep();
52 myscenario = (Scenario)step.getOwner(); // The selected step belong to a scenario
57 mystudy.getMenu().refreshGivenStepItem(myscenario.getFirstStep()); // For updating the scenario icon
61 // ==============================================================================================================================
63 // ==============================================================================================================================
65 public User getAuthor () {
66 // ------------------------
67 if (myscenario.isCheckedout()) return myscenario.getUser();
68 else return myscenario.getAuthor();
71 public String getLastModificationDate () {
72 // ----------------------------------------
76 public StepRights getSelectedStep () {
77 // ------------------------------------
78 return mystudy.getSelectedStepRights(); // Forget about the step as only step enabling is tested
81 public String getSubject () {
82 // ---------------------------
85 public String getTitle () {
86 // -------------------------
87 return myscenario.getTitle();
90 public boolean isCheckedout () {
91 // ------------------------------
92 return myscenario.isCheckedout();