]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java
Salome HOME
Reindex of studies is fixed.
[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.simer.Action;
8
9 /**
10  * Action for updating lucene index.
11  *
12  * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
13  */
14 public class DatabaseIndexingAction extends Action {
15
16         /**
17          * Serial version ID.
18          */
19         private static final long serialVersionUID = 4194268823457749655L;
20
21         private List<ImportedStudy> newstudies;
22         private String indices;
23         private ImportedStudy _importedStudy;
24         /**
25          * Injected search service.
26          */
27         private SearchService _searchService;
28
29         // ==============================================================================================================================
30         // Action methods
31         // ==============================================================================================================================
32
33         /**
34          * Initialize the action.
35          * @return SUCCESS
36          */
37         public String doInitialize() {
38                 newstudies = getImportedStudy().selectAll();
39                 indices = "";
40                 return SUCCESS;
41         }
42
43         /**
44          * Reindex studies.
45          * @return SUCCESS
46          */
47         public String doIndexing() {
48                 String[] ridlist = indices.split(",");
49                 @SuppressWarnings("unchecked")
50                 Map<String, Object> filter = (Map<String, Object>) getSession().get(
51                                 "study.filter");
52                 getSearchService().reindexStudies(ridlist);
53                 filter.put("owner", "all"); // Just in case of 1st study search
54
55                 return SUCCESS;
56         }
57
58         // ==============================================================================================================================
59         // Getters and setters
60         // ==============================================================================================================================
61
62         /**
63          * Get the new studies.
64          * 
65          * @return the new studies
66          */
67         public List<ImportedStudy> getNewStudies() {
68                 // -------------------------------------------
69                 return newstudies;
70         }
71
72         /**
73          * Get the importedStudy.
74          * 
75          * @return the importedStudy
76          */
77         public ImportedStudy getImportedStudy() {
78                 return _importedStudy;
79         }
80
81         /**
82          * Set the importedStudy.
83          * 
84          * @param importedStudy
85          *            the importedStudy to set
86          */
87         public void setImportedStudy(ImportedStudy importedStudy) {
88                 _importedStudy = importedStudy;
89         }
90
91         /**
92          * Get the indices.
93          * @return the indices
94          */
95         public String getIndices() {
96                 return indices;
97         }
98
99         /**
100          * Set the indices.
101          * @param indices the indices to set
102          */
103         public void setIndices(String indices) {
104                 this.indices = indices;
105         }
106
107         /**
108          * Get the searchService.
109          * 
110          * @return the searchService
111          */
112         public SearchService getSearchService() {
113                 return _searchService;
114         }
115
116         /**
117          * Set the searchService.
118          * 
119          * @param searchService
120          *            the searchService to set
121          */
122         public void setSearchService(SearchService searchService) {
123                 _searchService = searchService;
124         }
125 }