Salome HOME
Create new scenario from existing one is improved
[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
5 public class EditStudyAction extends DisplayStudyStepAction {
6
7         /**
8          * Serial version ID.
9          */
10         private static final long serialVersionUID = -4865668290514118396L;
11
12         private enum Execute {
13                 publish, protect, promote
14         }
15
16         // ==============================================================================================================================
17         // Action methods
18         // ==============================================================================================================================
19
20         public String doEdition() {
21                 _openStudy = getOpenStudy();
22
23                 Execute todo = Execute.valueOf(_action);
24                 Study study = _openStudy.getStudyObject();
25
26                 if (todo == Execute.publish) {
27                         getStudyService().moveToPublic(study);
28                 } else if (todo == Execute.protect) {
29                         getStudyService().moveToPrivate(study);
30                 } else if (todo == Execute.promote) {
31                         getStudyService().moveToReference(study);
32                 }
33                 _openStudy.getPopup().setContext("study", _openStudy.getStudyRights()); // The context has changed
34
35                 setMenu();
36
37                 _myindex = null;
38                 _selection = _openStudy.getSelection(); //actually, value doesn't matter, it just has to be not null
39                 doOpen();
40                 return SUCCESS;
41         }
42         
43         /**
44          * Mark study as reference functionality.
45          * @return SUCCESS
46          */
47         public String doMarkAsReference() {
48                 
49                 _openStudy = getOpenStudy();
50                 Study study = _openStudy.getStudyObject();
51                 
52                 getStudyService().markStudyAsReference(study);
53
54                 _myindex = null;
55                 _selection = _openStudy.getSelection(); //actually, value doesn't matter, it just has to be not null
56                 doOpen();
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                 getStudyService().removeStudyAsReference(study);
70
71                 _myindex = null;
72                 _selection = _openStudy.getSelection(); //actually, value doesn't matter, it just has to be not null
73                 doOpen();
74                 return SUCCESS;
75         }
76 }