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 {
21 private static final long serialVersionUID = 4194268823457749655L;
23 private List<ImportedStudy> newstudies;
24 private String indices;
25 private SearchService _searchService;
26 private ImportedStudy _importedStudy;
27 private StudyService _studyService;
29 // ==============================================================================================================================
31 // ==============================================================================================================================
33 public String doInitialize () {
34 // -----------------------------
35 Session connex = Database.getCurSession();
36 Transaction transax = connex.beginTransaction();
38 newstudies = getImportedStudy().selectAll();
45 public String doIndexing () {
46 // ---------------------------
47 Session connex = Database.getCurSession();
48 Transaction transax = connex.beginTransaction();
49 String[] ridlist = indices.split(",");
50 @SuppressWarnings("unchecked")
51 Map<String, Object> filter = (Map<String, Object>)getSession().get("study.filter");
53 for (int i=0; i<ridlist.length; i++) {
54 int index = Integer.valueOf(ridlist[i].trim());
55 Study study = getStudyService().selectStudy(index);
56 getSearchService().indexStudy(study);
58 filter.put("owner", "all"); // Just in case of 1st study search
64 // ==============================================================================================================================
65 // Getters and setters
66 // ==============================================================================================================================
68 public List<ImportedStudy> getNewStudies () {
69 // -------------------------------------------
72 public String getIndices () {
73 // ---------------------------
77 public void setIndices (String indices) {
78 // ---------------------------------------
79 this.indices = indices;
83 * Get the searchService.
84 * @return the searchService
86 public SearchService getSearchService() {
87 return _searchService;
91 * Set the searchService.
92 * @param searchService the searchService to set
94 public void setSearchService(SearchService searchService) {
95 _searchService = searchService;
99 * Get the importedStudy.
100 * @return the importedStudy
102 public ImportedStudy getImportedStudy() {
103 return _importedStudy;
107 * Set the importedStudy.
108 * @param importedStudy the importedStudy to set
110 public void setImportedStudy(ImportedStudy importedStudy) {
111 _importedStudy = importedStudy;
115 * Get the studyService.
117 * @return the studyService
119 public StudyService getStudyService() {
120 return _studyService;
124 * Set the studyService.
126 * @param studyService
127 * the studyService to set
129 public void setStudyService(StudyService studyService) {
130 _studyService = studyService;