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.simer.Action;
11 import org.splat.dal.dao.som.Database;
12 import org.splat.dal.bo.som.Study;
15 public class DatabaseIndexingAction extends Action {
17 private List<ImportedStudy> newstudies;
18 private String indices;
19 private SearchService _searchService;
20 private ImportedStudy _importedStudy;
22 private static final long serialVersionUID = 4194268823457749655L;
24 // ==============================================================================================================================
26 // ==============================================================================================================================
28 public String doInitialize () {
29 // -----------------------------
30 Session connex = Database.getSession();
31 Transaction transax = connex.beginTransaction();
33 newstudies = getImportedStudy().selectAll();
40 public String doIndexing () {
41 // ---------------------------
42 Session connex = Database.getSession();
43 Transaction transax = connex.beginTransaction();
44 String[] ridlist = indices.split(",");
45 @SuppressWarnings("unchecked")
46 Map<String, Object> filter = (Map<String, Object>)getSession().get("study.filter");
48 for (int i=0; i<ridlist.length; i++) {
49 int index = Integer.valueOf(ridlist[i].trim());
50 Study study = Database.selectStudy(index);
51 getSearchService().indexStudy(study);
53 filter.put("owner", "all"); // Just in case of 1st study search
59 // ==============================================================================================================================
60 // Getters and setters
61 // ==============================================================================================================================
63 public List<ImportedStudy> getNewStudies () {
64 // -------------------------------------------
67 public String getIndices () {
68 // ---------------------------
72 public void setIndices (String indices) {
73 // ---------------------------------------
74 this.indices = indices;
78 * Get the searchService.
79 * @return the searchService
81 public SearchService getSearchService() {
82 return _searchService;
86 * Set the searchService.
87 * @param searchService the searchService to set
89 public void setSearchService(SearchService searchService) {
90 _searchService = searchService;
94 * Get the importedStudy.
95 * @return the importedStudy
97 public ImportedStudy getImportedStudy() {
98 return _importedStudy;
102 * Set the importedStudy.
103 * @param importedStudy the importedStudy to set
105 public void setImportedStudy(ImportedStudy importedStudy) {
106 _importedStudy = importedStudy;