Salome HOME
3fce95321c9f620a95edd04b150512d0aa98e170
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / EditStudyAction.java
1 package org.splat.simer;
2
3 import org.splat.dal.bo.som.Study;
4 import org.splat.service.StudyService;
5
6
7 public class EditStudyAction extends DisplayStudyStepAction {
8     
9         /**
10          * Serial version ID.
11          */
12     private static final long serialVersionUID = -4865668290514118396L;
13
14         private enum Execute { publish, promote }
15
16         private StudyService _studyService;
17         
18         /**
19          * Value of the menu property. 
20          * It can be: none, create, open, study, knowledge, sysadmin, help.
21          */
22         private String _menuProperty;
23
24 //  ==============================================================================================================================
25 //  Action methods
26 //  ==============================================================================================================================
27
28     public String doEdition () {
29           try {
30         mystudy = getOpenStudy();
31
32         Execute  todo   = Execute.valueOf(action);
33         Study    study  = mystudy.getStudyObject();
34         
35         if      (todo == Execute.publish) getStudyService().moveToPublic(study);
36         else if (todo == Execute.promote) getStudyService().moveToReference(study);
37         mystudy.getPopup().setContext("study", mystudy.getStudyRights());   // The context has changed
38         
39         setMenuProperty("study");
40                 initializationScreenContext(_menuProperty);
41
42         return SUCCESS;
43           }
44       catch (RuntimeException saverror) {
45         logger.error("Reason:", saverror);
46         return ERROR;
47       }
48     }
49         /**
50          * Get the studyService.
51          * 
52          * @return the studyService
53          */
54         public StudyService getStudyService() {
55                 return _studyService;
56         }
57
58         /**
59          * Set the studyService.
60          * 
61          * @param studyService
62          *            the studyService to set
63          */
64         public void setStudyService(StudyService studyService) {
65                 _studyService = studyService;
66         }
67         
68         /**
69          * Get the menuProperty.
70          * @return the menuProperty
71          */
72         public String getMenuProperty() {
73                 return _menuProperty;
74         }
75
76         /**
77          * Set the menuProperty.
78          * @param menuProperty the menuProperty to set
79          */
80         public void setMenuProperty(String menuProperty) {
81                 this._menuProperty = menuProperty;
82         }
83 }