]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/src/org/splat/simer/EditStudyAction.java
Salome HOME
Rename the scenario functionality is implemented
[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 public class EditStudyAction extends DisplayStudyStepAction {
7
8         /**
9          * Serial version ID.
10          */
11         private static final long serialVersionUID = -4865668290514118396L;
12         
13         /**
14          * Injected study service.
15          */
16         private StudyService _studyService;
17
18         private enum Execute {
19                 publish, protect, promote
20         }
21
22         // ==============================================================================================================================
23         // Action methods
24         // ==============================================================================================================================
25
26         public String doEdition() {
27                 _openStudy = getOpenStudy();
28
29                 Execute todo = Execute.valueOf(_action);
30                 Study study = _openStudy.getStudyObject();
31
32                 if (todo == Execute.publish) {
33                         getStudyService().moveToPublic(study);
34                 } else if (todo == Execute.protect) {
35                         getStudyService().moveToPrivate(study);
36                 } else if (todo == Execute.promote) {
37                         getStudyService().moveToReference(study);
38                 }
39                 _openStudy.getPopup().setContext("study", _openStudy.getStudyRights()); // The context has changed
40
41                 setMenu();
42
43                 return SUCCESS;
44         }
45         
46         /**
47          * Mark study as reference functionality.
48          * @return SUCCESS
49          */
50         public String doMarkAsReference() {
51                 
52                 _openStudy = getOpenStudy();
53                 Study study = _openStudy.getStudyObject();
54                 
55                 _studyService.markStudyAsReference(study);
56                 
57                 return SUCCESS;
58         }
59         
60         /**
61          * Remove study as reference functionality.
62          * @return SUCCESS
63          */
64         public String doRemoveAsReference() {
65                 
66                 _openStudy = getOpenStudy();
67                 Study study = _openStudy.getStudyObject();
68                 
69                 _studyService.removeStudyAsReference(study);
70                 
71                 return SUCCESS;
72         }
73         
74         /**
75          * Get the studyService.
76          * 
77          * @return the studyService
78          */
79         @Override
80         public StudyService getStudyService() {
81                 return _studyService;
82         }
83
84         /**
85          * Set the studyService.
86          * 
87          * @param studyService
88          *            the studyService to set
89          */
90         @Override
91         public void setStudyService(final StudyService studyService) {
92                 _studyService = studyService;
93         }
94
95 }