comparison src/main/java/de/mpiwg/gazetteer/utils/FileManager.java @ 49:7c2e1b14b77d

new: load existing full text searching result into searching table
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 26 Jan 2016 11:46:10 +0100
parents 35ed4e650a53
children cf747a960516
comparison
equal deleted inserted replaced
48:13555aff1f88 49:7c2e1b14b77d
57 logger.info("Trying to save file " + absolutePath + fileName + "."); 57 logger.info("Trying to save file " + absolutePath + fileName + ".");
58 58
59 PrintWriter out = new PrintWriter(absolutePath + fileName); 59 PrintWriter out = new PrintWriter(absolutePath + fileName);
60 60
61 String text = new String(); // make it from list 61 String text = new String(); // make it from list
62 text += "Address,LEVEL1,LEVEL2,Name,PERIOD,TimeSpan:begin,TimeSpan:end,Longitude,Latitude,PAGE,SECTION,CONTENT,BOOK_ID,Description\n"; 62 text += "Address,LEVEL1,LEVEL2,Name,DYNASTY,PERIOD,ADMIN_TYPE,TimeSpan:begin,TimeSpan:end,Longitude,Latitude,PAGE,SECTION,CONTENT,BOOK_ID,Description\n";
63 63
64 for (DBContents c : list) { 64 for (DBContents c : list) {
65 65
66 if (c.getSection() != null && !c.isRemoved()){ 66 if (c.getSection() != null && !c.isRemoved()){ // only those are not removed to csv which means to LGMap
67 67
68 DBBook book = c.getSection().getBook(); 68 DBBook book = c.getSection().getBook();
69 69
70 String description = book.getVolume() + "/" + book.getAuthor() + "/" + book.getEdition(); 70 String description = book.getVolume() + "/" + book.getAuthor() + "/" + book.getEdition();
71 71
72 text += c.getCoordinatesBook().getPlace_name() + "," + 72 text += c.getCoordinatesBook().getPlace_name() + "," +
73 book.getLevel1() + "," + 73 book.getLevel1() + "," +
74 book.getLevel2() + "," + 74 book.getLevel2() + "," +
75 book.getName() + "," + 75 book.getName() + "," +
76 book.getDynasty() + "," +
76 book.getPeriod() + "," + 77 book.getPeriod() + "," +
78 book.getAdmin_type() + "," +
77 book.getStart_year() + "," + 79 book.getStart_year() + "," +
78 book.getEnd_year() + "," + 80 book.getEnd_year() + "," +
79 c.getCoordinatesBook().getX() + "," + 81 c.getCoordinatesBook().getX() + "," +
80 c.getCoordinatesBook().getY() + "," + 82 c.getCoordinatesBook().getY() + "," +
81 c.getPage() + "," + 83 c.getPage() + "," +
132 134
133 text += header; 135 text += header;
134 text += "<body>" 136 text += "<body>"
135 + "<div class='subTitel'>Table name: " + file.getFileName() + "<div>" 137 + "<div class='subTitel'>Table name: " + file.getFileName() + "<div>"
136 + "<div class='label'>" + list.size() + " result(s) in the table.</dvi>" 138 + "<div class='label'>" + list.size() + " result(s) in the table.</dvi>"
137 + "<div class='label'>searching by keywords (possibly with filters): " + '"' + "<span id='searchTerm'>" + file.getSearchTerms() + "</span>" + '"' + "</div>" 139 + "<div class='label'>searching by keywords: " + '"' + "<span id='searchTerm'>" + file.getSearchTerms() + "</span>" + '"' + "</div>"
138 + "<div class='label'><a href='" + getLGMapUrl(file) + "' target='_blank'>view on LGMap</a><div>" 140 + "<div class='label'><a href='" + getLGMapUrl(file) + "' target='_blank'>view on LGMap</a><div>"
139 + "<br>" 141 + "<br>"
140 + "<table class='pageTable'>" 142 + "<table class='pageTable'>"
141 + "<tr>" 143 + "<tr>"
142 + "<td class='tableTitle'>#</td>" 144 + "<td class='tableTitle'>#</td>"
143 + "<td class='tableTitle'>book id</td>" 145 + "<td class='tableTitle'>book id</td>"
144 + "<td class='tableTitle'>book name</td>" 146 + "<td class='tableTitle'>book name</td>"
145 + "<td class='tableTitle'>level1</td>" 147 + "<td class='tableTitle'>level1</td>"
146 + "<td class='tableTitle'>level2</td>" 148 + "<td class='tableTitle'>level2</td>"
149 + "<td class='tableTitle'>dynasty</td>"
147 + "<td class='tableTitle'>period</td>" 150 + "<td class='tableTitle'>period</td>"
151 + "<td class='tableTitle'>admin type</td>"
148 + "<td class='tableTitle'>section name</td>" 152 + "<td class='tableTitle'>section name</td>"
149 + "<td class='tableTitle'>page</td>" 153 + "<td class='tableTitle'>page</td>"
150 + "<td class='tableTitle'>content</td>" 154 + "<td class='tableTitle'>content</td>"
155 + "<td class='tableTitle'>content id</td>"
156 + "<td class='tableTitle'>isRemoved</td>"
157
151 + "<tr>"; 158 + "<tr>";
152 for (DBContents c : list) { 159 for (DBContents c : list) {
153 160
154 if ( c.getSection() != null && !c.isRemoved()){ 161 //if ( c.getSection() != null && !c.isRemoved()){
155 162 if ( c.getSection() != null){
163
156 DBBook book = c.getSection().getBook(); 164 DBBook book = c.getSection().getBook();
157 165
158 text += "<tr>" + 166 text += "<tr>" +
159 "<td>" + c.getInx() + "</td>" + 167 "<td>" + c.getInx() + "</td>" +
160 "<td>" + c.getBookId() + "</td>" + 168 "<td>" + c.getBookId() + "</td>" +
161 "<td>" + book.getName() + "</td>" + 169 "<td>" + book.getName() + "</td>" +
162 "<td>" + book.getLevel1() + "</td>" + 170 "<td>" + book.getLevel1() + "</td>" +
163 "<td>" + book.getLevel2() + "</td>" + 171 "<td>" + book.getLevel2() + "</td>" +
172 "<td>" + book.getDynasty() + "</td>" +
164 "<td>" + book.getPeriod() + "</td>" + 173 "<td>" + book.getPeriod() + "</td>" +
174 "<td>" + book.getAdmin_type() + "</td>" +
165 "<td>" + c.getSection().getName() + "</td>" + 175 "<td>" + c.getSection().getName() + "</td>" +
166 "<td>" + c.getPage() + "</td>" + 176 "<td>" + c.getPage() + "</td>" +
167 "<td class='content'>" + c.getContent() + "</td>" + 177 "<td class='content'>" + c.getContent() + "</td>" +
168 "</tr>"; 178 "<td>" + c.getId() + "</td>" +
179 "<td>" + c.isRemoved() + "</td>" +
180 "</tr>";
169 } 181 }
170 } 182 }
171 183
172 text += "</table></body></html>"; 184 text += "</table></body></html>";
173 185