Salome HOME
Refactoring continues: UserService is created instead of UserDirectory. Database...
[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 //  Action methods
20 //  ==============================================================================================================================
21
22     public String doEdition () {
23           try {
24         mystudy = getOpenStudy();
25
26         Execute  todo   = Execute.valueOf(action);
27         Study    study  = mystudy.getStudyObject();
28         
29         if      (todo == Execute.publish) getStudyService().moveToPublic(study);
30         else if (todo == Execute.promote) getStudyService().moveToReference(study);
31         mystudy.getPopup().setContext("study", mystudy.getStudyRights());   // The context has changed
32
33         return SUCCESS;
34           }
35       catch (RuntimeException saverror) {
36         logger.error("Reason:", saverror);
37         return ERROR;
38       }
39     }
40         /**
41          * Get the studyService.
42          * 
43          * @return the studyService
44          */
45         public StudyService getStudyService() {
46                 return _studyService;
47         }
48
49         /**
50          * Set the studyService.
51          * 
52          * @param studyService
53          *            the studyService to set
54          */
55         public void setStudyService(StudyService studyService) {
56                 _studyService = studyService;
57         }
58 }