annotate src/main/java/de/mpiwg/gazetteer/db/DBContents.java @ 40:35ed4e650a53

bug fixed: full text search when section not found in section_index table. add paginator
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 07 Dec 2015 17:06:57 +0100
parents 37840afb7b80
children 7c2e1b14b77d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1 package de.mpiwg.gazetteer.db;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
2
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
3 import java.sql.ResultSet;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
4 import java.sql.SQLException;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
5 import java.util.List;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
6
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
7 import de.mpiwg.gazetteer.utils.DBService;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
8
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
9
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
10
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
11 public class DBContents implements Comparable<DBContents>{
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
12
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
13 private Long id;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
14
40
35ed4e650a53 bug fixed: full text search when section not found in section_index table. add paginator
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 39
diff changeset
15 private String bookId = "";
35ed4e650a53 bug fixed: full text search when section not found in section_index table. add paginator
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 39
diff changeset
16 private Integer page = 0;
35ed4e650a53 bug fixed: full text search when section not found in section_index table. add paginator
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 39
diff changeset
17 private String content = "";
39
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
18
40
35ed4e650a53 bug fixed: full text search when section not found in section_index table. add paginator
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 39
diff changeset
19 private DBSection section = null; // section already contain DBBook
39
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
20 private Integer inx = null; // local index for each row
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
21
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
22 private DBCoordinatesBook coordinatesBook = null;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
23
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
24 private boolean isRemoved = false;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
25
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
26
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
27 public DBContents(ResultSet rs) throws SQLException{
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
28
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
29 this.id = rs.getLong("id");
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
30 this.bookId = rs.getString("books_id");
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
31 this.page = rs.getInt("line");
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
32 this.content = rs.getString("content");
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
33
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
34 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
35
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
36
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
37 public Long getId() {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
38 return id;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
39 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
40 public void setId(Long id) {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
41 this.id = id;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
42 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
43
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
44
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
45 public String getBookId() {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
46 return bookId;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
47 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
48
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
49 public void setBookId(String bookId) {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
50 this.bookId = bookId;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
51 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
52
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
53
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
54
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
55 public String getContent() {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
56 return content;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
57 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
58
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
59
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
60 public void setContent(String content) {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
61 this.content = content;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
62 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
63
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
64
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
65 public DBSection getSection() {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
66 return section;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
67 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
68
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
69
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
70 public void setSection(DBSection section) {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
71 this.section = section;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
72 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
73
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
74
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
75
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
76 public Integer getPage() {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
77 return page;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
78 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
79
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
80
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
81 public void setPage(Integer page) {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
82 this.page = page;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
83 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
84
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
85
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
86 public Integer getInx() {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
87 return inx;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
88 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
89
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
90
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
91 public void setInx(Integer inx) {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
92 this.inx = inx;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
93 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
94
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
95
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
96
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
97 public DBCoordinatesBook getCoordinatesBook() {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
98 return coordinatesBook;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
99 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
100
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
101
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
102 public void setCoordinatesBook(DBCoordinatesBook coordinatesBook) {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
103 this.coordinatesBook = coordinatesBook;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
104 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
105
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
106
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
107 public boolean isRemoved() {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
108 return isRemoved;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
109 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
110
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
111
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
112 public void setRemoved(boolean isRemoved) {
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
113 this.isRemoved = isRemoved;
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
114 }
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
115
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
116
40
35ed4e650a53 bug fixed: full text search when section not found in section_index table. add paginator
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 39
diff changeset
117
39
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
118 @Override
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
119 public int compareTo(DBContents o) {
40
35ed4e650a53 bug fixed: full text search when section not found in section_index table. add paginator
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 39
diff changeset
120 return this.getId().compareTo(o.getId());
39
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
121 }
40
35ed4e650a53 bug fixed: full text search when section not found in section_index table. add paginator
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 39
diff changeset
122
39
37840afb7b80 new: full text search
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
123 }