1 package org.splat.simer.admin;
3 import java.sql.Connection;
4 import java.sql.ResultSet;
5 import java.sql.SQLException;
6 import java.sql.Statement;
7 import java.util.ArrayList;
10 import org.hibernate.Session;
11 import org.hibernate.jdbc.Work;
12 import org.splat.dal.dao.som.Database;
13 import org.splat.dal.bo.som.Study;
14 import org.splat.service.SearchService;
17 public class ImportedStudy {
19 private SearchService _searchService;
24 protected class SelectStudies implements Work {
25 // ----------------------------------------------------
27 private List<ImportedStudy> table = new ArrayList<ImportedStudy>();
29 protected SelectStudies(SearchService searchService) {
32 public void execute (Connection connex) throws SQLException
34 Statement request = connex.createStatement();
35 String select = "SELECT rid,sid,title FROM study";
36 ResultSet result = request.executeQuery(select);
37 Study.Properties sprop = new Study.Properties();
39 while (result.next()) {
40 int rid = result.getInt("rid");
41 String sid = result.getString("sid");
42 String title = result.getString("title");
45 if (getSearchService().selectStudiesWhere(sprop.setReference(sid)).size() != 0) continue;
46 } catch (Exception error) {
49 table.add( new ImportedStudy(rid, sid, title) );
53 public List<ImportedStudy> getResult ()
59 // ==============================================================================================================================
61 // ==============================================================================================================================
63 public ImportedStudy () {
66 public ImportedStudy (int rid, String sid, String title) {
67 // --------------------------------------------------------
73 // ==============================================================================================================================
74 // Public member functions
75 // ==============================================================================================================================
77 public int getIndex () {
78 // ----------------------
81 public String getReference () {
82 // -----------------------------
85 public String getTitle () {
86 // -------------------------
90 // ==============================================================================================================================
92 // ==============================================================================================================================
94 public List<ImportedStudy> selectAll () {
95 // ----------------------------------------------
96 Session session = Database.getCurSession();
97 SelectStudies query = new SelectStudies(getSearchService());
98 session.doWork(query);
100 return query.getResult();
103 public org.splat.service.SearchService getSearchService() {
104 return _searchService;
107 public void setSearchService(SearchService searchService) {
108 _searchService = searchService;