39
|
1 package de.mpiwg.web.jsp;
|
|
2
|
|
3 import java.util.ArrayList;
|
|
4 import java.util.Collections;
|
|
5 import java.util.HashMap;
|
|
6 import java.util.List;
|
|
7 import java.util.Map;
|
|
8
|
|
9 import javax.servlet.http.HttpServletRequest;
|
|
10 import javax.servlet.http.HttpServletResponse;
|
|
11
|
|
12 import org.apache.commons.lang.StringUtils;
|
|
13 import org.apache.log4j.Logger;
|
|
14
|
|
15 import de.mpiwg.gazetteer.bo.LGBranch;
|
|
16 import de.mpiwg.gazetteer.bo.LGFile;
|
|
17 import de.mpiwg.gazetteer.bo.LGFullTextSearchFile;
|
|
18 import de.mpiwg.gazetteer.dataverse.bo.VDCUser;
|
|
19 import de.mpiwg.gazetteer.db.DBContents;
|
|
20 import de.mpiwg.gazetteer.db.DBSection;
|
|
21 import de.mpiwg.gazetteer.utils.DBService;
|
|
22 import de.mpiwg.gazetteer.utils.DataProvider;
|
|
23 import de.mpiwg.web.fullTextSearch.SortContentByAdminType;
|
|
24 import de.mpiwg.web.fullTextSearch.SortContentByBookId;
|
|
25 import de.mpiwg.web.fullTextSearch.SortContentByBookName;
|
|
26 import de.mpiwg.web.fullTextSearch.SortContentByDynasty;
|
|
27 import de.mpiwg.web.fullTextSearch.SortContentById;
|
|
28 import de.mpiwg.web.fullTextSearch.SortContentByInx;
|
|
29 import de.mpiwg.web.fullTextSearch.SortContentByLevel1;
|
|
30 import de.mpiwg.web.fullTextSearch.SortContentByLevel2;
|
|
31 import de.mpiwg.web.fullTextSearch.SortContentByPeriod;
|
|
32 import de.mpiwg.web.fullTextSearch.SortContentByStartPage;
|
|
33 import de.mpiwg.web.search.SortSectionByAdminType;
|
|
34 import de.mpiwg.web.search.SortSectionByAuthor;
|
|
35 import de.mpiwg.web.search.SortSectionByBookId;
|
|
36 import de.mpiwg.web.search.SortSectionByBookName;
|
|
37 import de.mpiwg.web.search.SortSectionByDynasty;
|
|
38 import de.mpiwg.web.search.SortSectionByEdition;
|
|
39 import de.mpiwg.web.search.SortSectionById;
|
|
40 import de.mpiwg.web.search.SortSectionByLevel1;
|
|
41 import de.mpiwg.web.search.SortSectionByPeriod;
|
|
42 import de.mpiwg.web.search.SortSectionByStartPage;
|
|
43 import de.mpiwg.web.search.SortSectionByVolume;
|
|
44
|
|
45 public class FullTextSearchPage extends AbstractJSPPage{
|
|
46
|
|
47 private static Logger logger = Logger.getLogger(FullTextSearchPage.class);
|
|
48
|
|
49 public static String bean = "fullTextSearchBean";
|
|
50 public static String page = "pages/fullTextSearch.jsp";
|
|
51
|
|
52
|
|
53 private List<DBContents> completeList;
|
|
54 private List<DBContents> filteredList;
|
|
55 private List<DBContents> displayList;
|
|
56
|
|
57 private String searchTerm = new String();
|
|
58
|
|
59 private String dynastyFilter = new String();
|
|
60 private String adminTypeFilter = new String();
|
|
61 private String level1Filter = new String();
|
|
62
|
|
63 private DataPaginator paginator = new DataPaginator();
|
|
64 private String searchMessage;
|
|
65 private String filteringMessage;
|
|
66
|
|
67 private String bookIdFilter = new String();
|
|
68 private String bookNameFilter = new String();
|
|
69 private String level2Filter = new String();
|
|
70 private String periodFilter = new String();
|
|
71 private String sectionNameFilter = new String();
|
|
72
|
|
73
|
|
74 private Map<Long, List<LGFullTextSearchFile>> filesMap;
|
|
75 private List<LGFullTextSearchFile> fileList = null;
|
|
76 private String fileName = new String();
|
|
77
|
|
78 private String focusedContentId = new String();
|
|
79
|
|
80 @Override
|
|
81 public void init(){
|
|
82 super.init();
|
|
83 }
|
|
84
|
|
85 public void loadParameters(HttpServletRequest request, HttpServletResponse response){
|
|
86 this.request = request;
|
|
87 this.response = response;
|
|
88
|
|
89 this.searchTerm = getParameter("searchTerm");
|
|
90
|
|
91 this.bookIdFilter = getParameter("bookIdFilter");
|
|
92 this.bookNameFilter = getParameter("bookNameFilter");
|
|
93
|
|
94 this.dynastyFilter = getParameter("dynastyFilter");
|
|
95 this.adminTypeFilter = getParameter("adminTypeFilter");
|
|
96 this.level1Filter = getParameter("level1Filter");
|
|
97 this.level2Filter = getParameter("level2Filter");
|
|
98
|
|
99 this.periodFilter = getParameter("periodFilter");
|
|
100 this.sectionNameFilter = getParameter("sectionNameFilter");
|
|
101
|
|
102 this.fileName = getParameter("fileName");
|
|
103
|
|
104 this.focusedContentId = getParameter("focusedContentId");
|
|
105
|
|
106 }
|
|
107
|
|
108
|
|
109 public void search(){
|
|
110 logger.debug("Searching: " + this.searchTerm);
|
|
111
|
|
112 this.dynastyFilter = new String();
|
|
113 this.level1Filter = new String();
|
|
114 this.adminTypeFilter = new String();
|
|
115
|
|
116 if(StringUtils.isNotEmpty(this.searchTerm)){
|
|
117 try {
|
|
118 List<String> terms = splitTerms();
|
|
119 System.out.println("Full Text Search: " + terms.toString());
|
|
120
|
|
121 this.completeList = DBService.searchFullText(terms);
|
|
122
|
|
123 if (this.completeList != null ){
|
|
124 Collections.sort(this.completeList);
|
|
125 filter();
|
|
126 }
|
|
127
|
|
128 } catch (Exception e) {
|
|
129 internalError(e);
|
|
130 }
|
|
131 }
|
|
132 }
|
|
133
|
|
134
|
|
135 public void forceLoadFileList(){
|
|
136 logger.debug("forceLoadFileList");
|
|
137 logger.debug(this.getSearchTerm());
|
|
138
|
|
139 if(getSessionBean().getUser() != null){
|
|
140 //logger.debug("userId="+ getSessionBean().getUser().getId());
|
|
141
|
|
142 // set FileList for the user
|
|
143 DataProvider.getInstance().setFullTextSearchFileMap(null); // set fullTextSearchFileMap to null, to force reload
|
|
144 this.setFileList(DataProvider.getInstance().getSearchFileList4User(getSessionBean().getUser().getId()));
|
|
145 }
|
|
146
|
|
147 }
|
|
148
|
|
149
|
|
150
|
|
151 public void save() {
|
|
152 logger.debug("saving table...");
|
|
153 logger.debug(this.getFileName() + ", " + this.getSearchTerm() + ", userId= "+ getSessionBean().getUser().getId());
|
|
154
|
|
155 //logger.debug(this.getFilteredList());
|
|
156
|
|
157 if (StringUtils.equals(this.getFileName(), "") ) {
|
|
158 addMsg("Save failed. Table name cannot be empty.");
|
|
159 return;
|
|
160 }
|
|
161
|
|
162
|
|
163 /* Update db table `LGFullTextSearchFile`: new row with userId, file name, ...*/
|
|
164
|
|
165 Long userId = getSessionBean().getUser().getId();
|
|
166
|
|
167 LGFullTextSearchFile file;
|
|
168 try {
|
|
169 // save only those contents that are not removed
|
|
170 List<DBContents> cleanList = new ArrayList<DBContents>();
|
|
171 for (DBContents t: this.getFilteredList()) {
|
|
172 if (!t.isRemoved()) {
|
|
173 cleanList.add(t);
|
|
174 }
|
|
175 }
|
|
176
|
|
177 file = DataProvider.getInstance().saveLGFullTextSearchFile(cleanList, userId, this.getFileName(), this.getSearchTerm());
|
|
178 addMsg("The table has been saved!");
|
|
179
|
|
180 logger.debug(file.getInfo());
|
|
181
|
|
182 } catch (Exception e) {
|
|
183 addMsg("Saving fails!");
|
|
184 e.printStackTrace();
|
|
185 internalError(e);
|
|
186 }
|
|
187
|
|
188 // update FileList
|
|
189 DataProvider.getInstance().setFullTextSearchFileMap(null); // set fullTextSearchFileMap to null, to force reload
|
|
190 this.setFileList(DataProvider.getInstance().getSearchFileList4User(getSessionBean().getUser().getId()));
|
|
191 }
|
|
192
|
|
193
|
|
194
|
|
195 public void filter(){
|
|
196 this.filteredList = new ArrayList<DBContents>();
|
|
197 for(DBContents content : this.completeList){
|
|
198 if(!this.filteredList.contains(content)){
|
|
199
|
|
200 if( (StringUtils.isEmpty(dynastyFilter) || StringUtils.startsWith(content.getSection().getBook().getDynasty(), dynastyFilter)) &&
|
|
201 (StringUtils.isEmpty(level1Filter) || StringUtils.startsWith(content.getSection().getBook().getLevel1(), level1Filter)) &&
|
|
202 (StringUtils.isEmpty(level2Filter) || StringUtils.startsWith(content.getSection().getBook().getLevel2(), level2Filter)) &&
|
|
203 (StringUtils.isEmpty(adminTypeFilter) || StringUtils.startsWith(content.getSection().getBook().getAdmin_type(), adminTypeFilter)) &&
|
|
204 (StringUtils.isEmpty(bookIdFilter) || StringUtils.startsWith(content.getBookId(), bookIdFilter)) &&
|
|
205 (StringUtils.isEmpty(bookNameFilter) || StringUtils.startsWith(content.getSection().getBook().getName(), bookNameFilter)) &&
|
|
206 (StringUtils.isEmpty(sectionNameFilter) || StringUtils.startsWith(content.getSection().getName(), sectionNameFilter))
|
|
207
|
|
208 ){
|
|
209 this.filteredList.add(content);
|
|
210 }
|
|
211 }
|
|
212 }
|
|
213
|
|
214 if(completeList.size() > 0){
|
|
215 this.searchMessage = completeList.size() + " section(s) found for the term(s): " + this.searchTerm;
|
|
216 this.filteringMessage = this.filteredList.size() + " section(s) listed after the filtering";
|
|
217
|
|
218 this.paginator.setCurrentPage(0);
|
|
219 this.paginator.resetNumberOfPages(filteredList.size());
|
|
220
|
|
221 }else{
|
|
222 this.searchMessage = "No sections found for the term(s): " + this.searchTerm;
|
|
223 this.filteredList = null;
|
|
224 this.filteringMessage = "";
|
|
225
|
|
226 this.paginator.setCurrentPage(0);
|
|
227 this.paginator.resetNumberOfPages(0);
|
|
228 }
|
|
229
|
|
230 this.updateCurrentSections();
|
|
231
|
|
232 }
|
|
233
|
|
234
|
|
235 private void updateCurrentSections() {
|
|
236 /*
|
|
237 this.paginator.initCount();
|
|
238 int startRecord = this.paginator.getCurrentPage()
|
|
239 * this.paginator.getItemsPerPage();
|
|
240 if(this.paginator.getNumberOfPages() == 0){
|
|
241 this.displayList = new ArrayList<DBContents>();
|
|
242 }else if((this.paginator.getCurrentPage() + 1) == this.paginator.getNumberOfPages()){
|
|
243 int mod = this.filteredList.size() % paginator.getItemsPerPage();
|
|
244 if(mod == 0){
|
|
245 this.displayList = filteredList.subList(startRecord, startRecord + this.paginator.getItemsPerPage());
|
|
246 }else{
|
|
247 this.displayList = filteredList.subList(startRecord, startRecord + mod);
|
|
248 }
|
|
249
|
|
250 }else{
|
|
251 this.displayList = filteredList.subList(startRecord, startRecord + this.paginator.getItemsPerPage());
|
|
252 }
|
|
253
|
|
254 for(DBContents content : this.displayList){
|
|
255 //section.setBranches(this.branchesMap.get(section.getId()));
|
|
256 }
|
|
257 */
|
|
258 }
|
|
259
|
|
260
|
|
261 private List<String> splitTerms(){
|
|
262 List<String> rs = new ArrayList<String>();
|
|
263
|
|
264 String[] array = this.searchTerm.split(",");
|
|
265
|
|
266 for(String tmp : array){
|
|
267 tmp = tmp.replace(" ", "");
|
|
268 if(StringUtils.isNotEmpty(tmp)){
|
|
269 rs.add(tmp);
|
|
270 }
|
|
271 }
|
|
272 return rs;
|
|
273 }
|
|
274
|
|
275 public List<String> suggestDynasty(String term, int limit){
|
|
276 List<String> list = new ArrayList<String>();
|
|
277 for(DBContents content : this.completeList){
|
|
278 String dynasty = content.getSection().getBook().getDynasty();
|
|
279 if(!list.contains(dynasty) && dynasty.startsWith(term)){
|
|
280 list.add(dynasty);
|
|
281 }
|
|
282 if(limit == list.size()){
|
|
283 break;
|
|
284 }
|
|
285 }
|
|
286 return list;
|
|
287 }
|
|
288
|
|
289 public List<String> suggestLevel1(String term, int limit){
|
|
290 List<String> list = new ArrayList<String>();
|
|
291 for(DBContents content : this.completeList){
|
|
292 String level1 = content.getSection().getBook().getLevel1();
|
|
293 if(!list.contains(level1) && level1.startsWith(term)){
|
|
294 list.add(level1);
|
|
295 }
|
|
296 if(limit == list.size()){
|
|
297 break;
|
|
298 }
|
|
299 }
|
|
300 return list;
|
|
301 }
|
|
302
|
|
303 public List<String> suggestAdminType(String term, int limit){
|
|
304 List<String> list = new ArrayList<String>();
|
|
305 for(DBContents content : this.completeList){
|
|
306 String adminType = content.getSection().getBook().getAdmin_type();
|
|
307 if(!list.contains(adminType) && adminType.startsWith(term)){
|
|
308 list.add(adminType);
|
|
309 }
|
|
310 if(limit == list.size()){
|
|
311 break;
|
|
312 }
|
|
313 }
|
|
314 return list;
|
|
315 }
|
|
316
|
|
317
|
|
318
|
|
319 public List<LGFullTextSearchFile> getFileList() {
|
|
320 return fileList;
|
|
321 }
|
|
322
|
|
323 public void setFileList(List<LGFullTextSearchFile> fileList) {
|
|
324 this.fileList = fileList;
|
|
325 }
|
|
326
|
|
327
|
|
328
|
|
329 public List<DBContents> getCompleteList() {
|
|
330 return completeList;
|
|
331 }
|
|
332
|
|
333
|
|
334 public Map<Long, List<LGFullTextSearchFile>> getFilesMap() {
|
|
335 return filesMap;
|
|
336 }
|
|
337
|
|
338 public void setFilesMap(Map<Long, List<LGFullTextSearchFile>> filesMap) {
|
|
339 this.filesMap = filesMap;
|
|
340 }
|
|
341
|
|
342 public void setCompleteList(List<DBContents> completeList) {
|
|
343 this.completeList = completeList;
|
|
344 }
|
|
345
|
|
346
|
|
347 public String getSearchTerm() {
|
|
348 return searchTerm;
|
|
349 }
|
|
350
|
|
351
|
|
352 public void setSearchTerm(String searchTerm) {
|
|
353 this.searchTerm = searchTerm;
|
|
354 }
|
|
355
|
|
356 public List<DBContents> getFilteredList() {
|
|
357 return filteredList;
|
|
358 }
|
|
359
|
|
360 public void setFilteredList(List<DBContents> filteredList) {
|
|
361 this.filteredList = filteredList;
|
|
362 }
|
|
363
|
|
364
|
|
365 public List<DBContents> getDisplayList() {
|
|
366 return displayList;
|
|
367 }
|
|
368
|
|
369 public void setDisplayList(List<DBContents> displayList) {
|
|
370 this.displayList = displayList;
|
|
371 }
|
|
372
|
|
373
|
|
374 public DataPaginator getPaginator() {
|
|
375 return paginator;
|
|
376 }
|
|
377
|
|
378 public void setPaginator(DataPaginator paginator) {
|
|
379 this.paginator = paginator;
|
|
380 }
|
|
381
|
|
382 public void firstPage() {
|
|
383 this.paginator.first();
|
|
384 this.updateCurrentSections();
|
|
385 }
|
|
386
|
|
387 public void lastPage() {
|
|
388 this.paginator.last();
|
|
389 this.updateCurrentSections();
|
|
390 }
|
|
391
|
|
392 public void fastForward() {
|
|
393 this.paginator.fastForward();
|
|
394 this.updateCurrentSections();
|
|
395 }
|
|
396
|
|
397 public void fastRewind() {
|
|
398 this.paginator.fastRewind();
|
|
399 this.updateCurrentSections();
|
|
400 }
|
|
401
|
|
402 public void previousPage() {
|
|
403 this.paginator.previous();
|
|
404 this.updateCurrentSections();
|
|
405 }
|
|
406
|
|
407 public void nextPage() {
|
|
408 this.paginator.next();
|
|
409 this.updateCurrentSections();
|
|
410 }
|
|
411
|
|
412 public String getSearchMessage() {
|
|
413 return searchMessage;
|
|
414 }
|
|
415
|
|
416 public void setSearchMessage(String searchMessage) {
|
|
417 this.searchMessage = searchMessage;
|
|
418 }
|
|
419
|
|
420 public String getFilteringMessage() {
|
|
421 return filteringMessage;
|
|
422 }
|
|
423
|
|
424 public void setFilteringMessage(String filteringMessage) {
|
|
425 this.filteringMessage = filteringMessage;
|
|
426 }
|
|
427
|
|
428 public String getFileName() {
|
|
429 return fileName;
|
|
430 }
|
|
431
|
|
432 public void setFileName(String fileName) {
|
|
433 this.fileName = fileName;
|
|
434 }
|
|
435
|
|
436 public String getDynastyFilter() {
|
|
437 return dynastyFilter;
|
|
438 }
|
|
439
|
|
440 public void setDynastyFilter(String dynastyFilter) {
|
|
441 this.dynastyFilter = dynastyFilter;
|
|
442 }
|
|
443
|
|
444 public String getAdminTypeFilter() {
|
|
445 return adminTypeFilter;
|
|
446 }
|
|
447
|
|
448 public void setAdminTypeFilter(String adminTypeFilter) {
|
|
449 this.adminTypeFilter = adminTypeFilter;
|
|
450 }
|
|
451
|
|
452 public String getLevel1Filter() {
|
|
453 return level1Filter;
|
|
454 }
|
|
455
|
|
456 public void setLevel1Filter(String level1Filter) {
|
|
457 this.level1Filter = level1Filter;
|
|
458 }
|
|
459
|
|
460
|
|
461
|
|
462 /////// Sorting
|
|
463
|
|
464 public String getFocusedContentId() {
|
|
465 return focusedContentId;
|
|
466 }
|
|
467
|
|
468 public void setFocusedContentId(String focusedContentId) {
|
|
469 this.focusedContentId = focusedContentId;
|
|
470 }
|
|
471
|
|
472 public String getBookIdFilter() {
|
|
473 return bookIdFilter;
|
|
474 }
|
|
475
|
|
476 public void setBookIdFilter(String bookIdFilter) {
|
|
477 this.bookIdFilter = bookIdFilter;
|
|
478 }
|
|
479
|
|
480 public String getBookNameFilter() {
|
|
481 return bookNameFilter;
|
|
482 }
|
|
483
|
|
484 public void setBookNameFilter(String bookNameFilter) {
|
|
485 this.bookNameFilter = bookNameFilter;
|
|
486 }
|
|
487
|
|
488 public String getLevel2Filter() {
|
|
489 return level2Filter;
|
|
490 }
|
|
491
|
|
492 public void setLevel2Filter(String level2Filter) {
|
|
493 this.level2Filter = level2Filter;
|
|
494 }
|
|
495
|
|
496 public String getPeriodFilter() {
|
|
497 return periodFilter;
|
|
498 }
|
|
499
|
|
500 public void setPeriodFilter(String periodFilter) {
|
|
501 this.periodFilter = periodFilter;
|
|
502 }
|
|
503
|
|
504 public String getSectionNameFilter() {
|
|
505 return sectionNameFilter;
|
|
506 }
|
|
507
|
|
508 public void setSectionNameFilter(String sectionNameFilter) {
|
|
509 this.sectionNameFilter = sectionNameFilter;
|
|
510 }
|
|
511
|
|
512 public void sortByBookNameUp(){
|
|
513 Collections.sort(this.completeList, new SortContentByBookName());
|
|
514 filter();
|
|
515 }
|
|
516
|
|
517 public void sortByBookNameDown(){
|
|
518 Collections.sort(this.completeList, new SortContentByBookName());
|
|
519 Collections.reverse(this.completeList);
|
|
520 filter();
|
|
521 }
|
|
522
|
|
523 public void sortBySectionNameUp(){
|
|
524 Collections.sort(this.completeList);
|
|
525 filter();
|
|
526 }
|
|
527
|
|
528 public void sortBySectionNameDown(){
|
|
529 Collections.sort(this.completeList);
|
|
530 Collections.reverse(this.completeList);
|
|
531 filter();
|
|
532 }
|
|
533
|
|
534
|
|
535
|
|
536 public void sortByPeriodUp(){
|
|
537 Collections.sort(this.completeList, new SortContentByPeriod());
|
|
538 filter();
|
|
539 }
|
|
540
|
|
541 public void sortByPeriodDown(){
|
|
542 Collections.sort(this.completeList, new SortContentByPeriod());
|
|
543 Collections.reverse(this.completeList);
|
|
544 filter();
|
|
545 }
|
|
546
|
|
547
|
|
548
|
|
549 public void sortByIdUp(){
|
|
550 Collections.sort(this.completeList, new SortContentById());
|
|
551 this.filter();
|
|
552 }
|
|
553
|
|
554 public void sortByIdDown(){
|
|
555 Collections.sort(this.completeList, new SortContentById());
|
|
556 Collections.reverse(completeList);
|
|
557 this.filter();
|
|
558 }
|
|
559
|
|
560
|
|
561 public void sortByDynastyUp(){
|
|
562 Collections.sort(this.completeList, new SortContentByDynasty());
|
|
563 filter();
|
|
564 }
|
|
565
|
|
566 public void sortByDynastyDown(){
|
|
567 Collections.sort(this.completeList, new SortContentByDynasty());
|
|
568 Collections.reverse(completeList);
|
|
569 filter();
|
|
570 }
|
|
571
|
|
572 public void sortByBookIdUp(){
|
|
573 Collections.sort(this.completeList, new SortContentByBookId());
|
|
574 filter();
|
|
575 }
|
|
576
|
|
577 public void sortByBookIdDown(){
|
|
578 Collections.sort(this.completeList, new SortContentByBookId());
|
|
579 Collections.reverse(completeList);
|
|
580 filter();
|
|
581 }
|
|
582
|
|
583 public void sortByLevel1Up(){
|
|
584 Collections.sort(this.completeList, new SortContentByLevel1());
|
|
585 filter();
|
|
586 }
|
|
587
|
|
588 public void sortByLevel1Down(){
|
|
589 Collections.sort(this.completeList, new SortContentByLevel1());
|
|
590 Collections.reverse(completeList);
|
|
591 filter();
|
|
592 }
|
|
593 public void sortByLevel2Up(){
|
|
594 Collections.sort(this.completeList, new SortContentByLevel2());
|
|
595 filter();
|
|
596 }
|
|
597
|
|
598 public void sortByLevel2Down(){
|
|
599 Collections.sort(this.completeList, new SortContentByLevel2());
|
|
600 Collections.reverse(completeList);
|
|
601 filter();
|
|
602 }
|
|
603
|
|
604 public void sortByAdminTypeUp(){
|
|
605 Collections.sort(this.completeList, new SortContentByAdminType());
|
|
606 filter();
|
|
607 }
|
|
608
|
|
609 public void sortByAdminTypeDown(){
|
|
610 Collections.sort(this.completeList, new SortContentByAdminType());
|
|
611 Collections.reverse(completeList);
|
|
612 filter();
|
|
613 }
|
|
614
|
|
615 public void sortByStartPageUp(){
|
|
616 Collections.sort(this.completeList, new SortContentByStartPage());
|
|
617 filter();
|
|
618 }
|
|
619
|
|
620 public void sortByStartPageDown(){
|
|
621 Collections.sort(this.completeList, new SortContentByStartPage());
|
|
622 Collections.reverse(completeList);
|
|
623 filter();
|
|
624 }
|
|
625 public void sortByInxUp(){
|
|
626 Collections.sort(this.completeList, new SortContentByInx());
|
|
627 filter();
|
|
628 }
|
|
629
|
|
630 public void sortByInxDown(){
|
|
631 Collections.sort(this.completeList, new SortContentByInx());
|
|
632 Collections.reverse(completeList);
|
|
633 filter();
|
|
634 }
|
|
635
|
|
636 public void removeFocusedContent(boolean status) {
|
|
637
|
|
638 // TODO set isRemove for the content with id=this.focusedContentId
|
|
639 // status is true: remove;
|
|
640 // status is false: recover (unremove)
|
|
641
|
|
642 for (DBContents content: this.completeList) {
|
|
643 if (StringUtils.equals(content.getId().toString(), this.focusedContentId)) {
|
|
644
|
|
645 //if(content.getId().toString() == this.focusedContentId) {
|
|
646 content.setRemoved(status);
|
|
647 logger.debug("set remove content id=" + content.getId().toString());
|
|
648 break;
|
|
649 }
|
|
650 }
|
|
651
|
|
652
|
|
653
|
|
654 Collections.sort(this.completeList);
|
|
655 filter();
|
|
656 }
|
|
657
|
|
658
|
|
659
|
|
660
|
|
661
|
|
662 }
|