1 package org.splat.simer.admin;
6 import org.hibernate.Session;
7 import org.hibernate.Transaction;
8 import org.splat.service.SearchService;
9 import org.splat.service.SearchServiceImpl;
10 import org.splat.service.StudyService;
11 import org.splat.simer.Action;
12 import org.splat.dal.dao.som.Database;
13 import org.splat.dal.bo.som.Study;
16 public class DatabaseIndexingAction extends Action {
18 private List<ImportedStudy> newstudies;
19 private String indices;
20 private SearchService _searchService;
21 private ImportedStudy _importedStudy;
22 private StudyService _studyService;
24 private static final long serialVersionUID = 4194268823457749655L;
26 // ==============================================================================================================================
28 // ==============================================================================================================================
30 public String doInitialize () {
31 // -----------------------------
32 Session connex = Database.getSession();
33 Transaction transax = connex.beginTransaction();
35 newstudies = getImportedStudy().selectAll();
42 public String doIndexing () {
43 // ---------------------------
44 Session connex = Database.getSession();
45 Transaction transax = connex.beginTransaction();
46 String[] ridlist = indices.split(",");
47 @SuppressWarnings("unchecked")
48 Map<String, Object> filter = (Map<String, Object>)getSession().get("study.filter");
50 for (int i=0; i<ridlist.length; i++) {
51 int index = Integer.valueOf(ridlist[i].trim());
52 Study study = getStudyService().selectStudy(index);
53 getSearchService().indexStudy(study);
55 filter.put("owner", "all"); // Just in case of 1st study search
61 // ==============================================================================================================================
62 // Getters and setters
63 // ==============================================================================================================================
65 public List<ImportedStudy> getNewStudies () {
66 // -------------------------------------------
69 public String getIndices () {
70 // ---------------------------
74 public void setIndices (String indices) {
75 // ---------------------------------------
76 this.indices = indices;
80 * Get the searchService.
81 * @return the searchService
83 public SearchService getSearchService() {
84 return _searchService;
88 * Set the searchService.
89 * @param searchService the searchService to set
91 public void setSearchService(SearchService searchService) {
92 _searchService = searchService;
96 * Get the importedStudy.
97 * @return the importedStudy
99 public ImportedStudy getImportedStudy() {
100 return _importedStudy;
104 * Set the importedStudy.
105 * @param importedStudy the importedStudy to set
107 public void setImportedStudy(ImportedStudy importedStudy) {
108 _importedStudy = importedStudy;
112 * Get the studyService.
114 * @return the studyService
116 public StudyService getStudyService() {
117 return _studyService;
121 * Set the studyService.
123 * @param studyService
124 * the studyService to set
126 public void setStudyService(StudyService studyService) {
127 _studyService = studyService;