Salome HOME
6126122a39cb38c823bb4934af5a58a6e56bc0c2
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / RemoveStudyAction.java
1 /*****************************************************************************
2  * Company         OPEN CASCADE
3  * Application     SIMAN
4  * File            $Id$ 
5  * Creation date   11.03.2013
6  * @author         $Author$
7  * @version        $Revision$
8  * @copyright      OPEN CASCADE 2012-2014
9  *****************************************************************************/
10
11 package org.splat.simer;
12
13 import org.splat.service.StudyService;
14
15 /**
16  * The action for removing a study.
17  * 
18  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
19  */
20 public class RemoveStudyAction extends Action {
21         /**
22          * Serialization version UID.
23          */
24         private static final long serialVersionUID = -6914581042309013794L;
25         /**
26          * Injected study service.
27          */
28         private StudyService _studyService;
29
30         /**
31          * Remove the selected study.
32          * 
33          * @return SUCCESS
34          */
35         public String doRemove() {
36                 OpenStudy openStudy = getOpenStudy();
37                 if (openStudy != null && openStudy.isOpenForWriting()) {
38                         long id = openStudy.getIndex();
39                         getStudyService().removeStudy(id);
40                 }
41                 closeStudy();
42                 initializationScreenContext("none");
43                 return SUCCESS;
44         }
45
46         /**
47          * Get the studyService.
48          * 
49          * @return the studyService
50          */
51         public StudyService getStudyService() {
52                 return _studyService;
53         }
54
55         /**
56          * Set the studyService.
57          * 
58          * @param studyService
59          *            the studyService to set
60          */
61         public void setStudyService(final StudyService studyService) {
62                 _studyService = studyService;
63         }
64 }