1 package org.splat.simer;
3 import org.splat.dal.bo.som.Study;
4 import org.splat.service.StudyService;
7 public class EditStudyAction extends DisplayStudyStepAction {
12 private static final long serialVersionUID = -4865668290514118396L;
14 private enum Execute { publish, promote }
16 private StudyService _studyService;
19 * Value of the menu property.
20 * It can be: none, create, open, study, knowledge, sysadmin, help.
22 private String _menuProperty;
25 * Value of the title bar property.
26 * It can be: study, knowledge.
28 private String _titleProperty;
31 * Value of the tool bar property.
32 * It can be: none, standard, study, back.
34 private String _toolProperty;
37 * Value of the left menu property.
38 * It can be: open, study, knowledge, scenario.
40 private String _leftMenuProperty;
43 * Property that indicates whether the current open study is editable or not.
44 * On the screen it looks like pen on the status icon, pop-up menu also can be called.
45 * It is necessary for correct building the title bar.
47 private String _editDisabledProperty = "false";
49 // ==============================================================================================================================
51 // ==============================================================================================================================
53 public String doEdition () {
55 mystudy = getOpenStudy();
57 Execute todo = Execute.valueOf(action);
58 Study study = mystudy.getStudyObject();
60 if (todo == Execute.publish) getStudyService().moveToPublic(study);
61 else if (todo == Execute.promote) getStudyService().moveToReference(study);
62 mystudy.getPopup().setContext("study", mystudy.getStudyRights()); // The context has changed
64 setMenuProperty("study");
65 setTitleProperty("study");
66 if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) {
67 setToolProperty("study");
69 setToolProperty("standard");
71 setLeftMenuProperty("study");
72 initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty);
76 catch (RuntimeException saverror) {
77 LOG.error("Reason:", saverror);
82 * Get the studyService.
84 * @return the studyService
86 public StudyService getStudyService() {
91 * Set the studyService.
94 * the studyService to set
96 public void setStudyService(StudyService studyService) {
97 _studyService = studyService;
101 * Get the menuProperty.
102 * @return the menuProperty
104 public String getMenuProperty() {
105 return _menuProperty;
109 * Set the menuProperty.
110 * @param menuProperty the menuProperty to set
112 public void setMenuProperty(String menuProperty) {
113 this._menuProperty = menuProperty;
117 * Get the _titleProperty.
118 * @return the _titleProperty
120 public String getTitleProperty() {
121 return _titleProperty;
125 * Set the _titleProperty.
126 * @param _titleProperty the titleProperty to set
128 public void setTitleProperty(String titleProperty) {
129 _titleProperty = titleProperty;
132 * Get the editDisabledProperty.
133 * @return the editDisabledProperty
135 public final String getEditDisabledProperty() {
136 return _editDisabledProperty;
139 * Set the editDisabledProperty.
140 * @param editDisabledProperty the editDisabledProperty to set
142 public final void setEditDisabledProperty(String editDisabledProperty) {
143 _editDisabledProperty = editDisabledProperty;
147 * Get the toolProperty.
148 * @return the toolProperty
150 public String getToolProperty() {
151 return _toolProperty;
155 * Set the toolProperty.
156 * @param toolProperty the toolProperty to set
158 public void setToolProperty(final String toolProperty) {
159 _toolProperty = toolProperty;
163 * Get the leftMenuProperty.
164 * @return the leftMenuProperty
166 public String getLeftMenuProperty() {
167 return _leftMenuProperty;
171 * Set the leftMenuProperty.
172 * @param leftMenuProperty the leftMenuProperty to set
174 public void setLeftMenuProperty(final String leftMenuProperty) {
175 _leftMenuProperty = leftMenuProperty;