Salome HOME
Simulation context type selection is fixed in study search. Lucene is no more used...
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / admin / DatabaseIndexingAction.java
1 package org.splat.simer.admin;
2
3 import java.util.List;
4 import java.util.Map;
5
6 import org.splat.service.SearchService;
7 import org.splat.service.dto.ImportedStudyDTO;
8 import org.splat.simer.Action;
9
10 /**
11  * Action for updating lucene index.
12  *
13  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
14  */
15 @Deprecated
16 public class DatabaseIndexingAction extends Action {
17
18         /**
19          * Serial version ID.
20          */
21         private static final long serialVersionUID = 4194268823457749655L;
22
23         /**
24          * New studies which are not yet indexed by lucene.
25          */
26         private transient List<ImportedStudyDTO> _newstudies;
27         /**
28          * Id's of studies to reindex.
29          */
30         private String _indices;
31         /**
32          * Injected search service.
33          */
34         private SearchService _searchService;
35         
36         // ==============================================================================================================================
37         // Action methods
38         // ==============================================================================================================================
39
40         /**
41          * Initialize the action.
42          * @return SUCCESS
43          */
44         public String doInitialize() {
45                 _newstudies = getSearchService().selectStudies();
46                 _indices = "";
47                 
48                 initializationFullScreenContext("sysadmin", "none", "open");
49                 
50                 return SUCCESS;
51         }
52
53         /**
54          * Reindex studies.
55          * @return SUCCESS
56          */
57         public String doIndexing() {
58                 String[] ridlist = _indices.split(",");
59                 @SuppressWarnings("unchecked")
60                 Map<String, Object> filter = (Map<String, Object>) getSession().get(
61                                 "study.filter");
62                 getSearchService().reindexStudies(ridlist);
63                 filter.put("owner", "all"); // Just in case of 1st study search
64
65                 return SUCCESS;
66         }
67
68         // ==============================================================================================================================
69         // Getters and setters
70         // ==============================================================================================================================
71
72         /**
73          * Get the new studies.
74          * 
75          * @return the new studies
76          */
77         public List<ImportedStudyDTO> getNewStudies() {
78                 return _newstudies;
79         }
80
81         /**
82          * Get the indices.
83          * @return the indices
84          */
85         public String getIndices() {
86                 return _indices;
87         }
88
89         /**
90          * Set the indices.
91          * @param indices the indices to set
92          */
93         public void setIndices(final String indices) {
94                 this._indices = indices;
95         }
96
97         /**
98          * Get the searchService.
99          * 
100          * @return the searchService
101          */
102         public SearchService getSearchService() {
103                 return _searchService;
104         }
105
106         /**
107          * Set the searchService.
108          * 
109          * @param searchService
110          *            the searchService to set
111          */
112         public void setSearchService(final SearchService searchService) {
113                 _searchService = searchService;
114         }
115 }