comparison src/main/java/de/mpiwg/web/jsp/TopicPage.java @ 70:315a6360ea1b

add dynasty filter in missing books on topicPage
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 10 Aug 2016 17:28:09 +0200
parents 13555aff1f88
children 92ede90bc611
comparison
equal deleted inserted replaced
69:dd2fcc5f5deb 70:315a6360ea1b
62 62
63 private String bookNameFilter = new String(); 63 private String bookNameFilter = new String();
64 private String bookIdFilter = new String(); 64 private String bookIdFilter = new String();
65 private String periodFilter = new String(); 65 private String periodFilter = new String();
66 private String sectionNameFilter = new String(); 66 private String sectionNameFilter = new String();
67
68
69 private String dynastyFilterMissingBooks = new String();
67 70
68 private DataPaginator paginator = new DataPaginator(); 71 private DataPaginator paginator = new DataPaginator();
69 private String filteringMessage; 72 private String filteringMessage;
70 73
71 private Map<Long, List<LGBranch>> branchesMap; 74 private Map<Long, List<LGBranch>> branchesMap;
72 75
73 private Map<String, DBBook> booksMap; 76 private Map<String, DBBook> booksMap;
74 77
75 private List<DBBook> pendingBookList; 78 private List<DBBook> pendingBookList;
79
80 private List<DBBook> filteredSectionListMissingBooks;
76 81
77 82
78 public void loadParameters(HttpServletRequest request, HttpServletResponse response){ 83 public void loadParameters(HttpServletRequest request, HttpServletResponse response){
79 84
80 this.request = request; 85 this.request = request;
89 this.periodFilter = getParameter("periodFilter"); 94 this.periodFilter = getParameter("periodFilter");
90 this.sectionNameFilter = getParameter("sectionNameFilter"); 95 this.sectionNameFilter = getParameter("sectionNameFilter");
91 this.bookIdFilter = getParameter("bookIdFilter"); 96 this.bookIdFilter = getParameter("bookIdFilter");
92 this.bookNameFilter = getParameter("bookNameFilter"); 97 this.bookNameFilter = getParameter("bookNameFilter");
93 98
99
100 this.dynastyFilterMissingBooks = getParameter("dynastyFilterMissingBooks");
94 } 101 }
95 102
96 103
97 104
98 public void forceLoadTopicSectionRelation() { 105 public void forceLoadTopicSectionRelation() {
192 internalError(e); 199 internalError(e);
193 } 200 }
194 201
195 202
196 } 203 }
197 this.filter();
198 204
199 205
200 // pendingBookList 206 // pendingBookList
201 for(DBSection section :this.completeSectionList) { 207 for(DBSection section :this.completeSectionList) {
202 String bookId = section.getBookId(); 208 String bookId = section.getBookId();
208 } 214 }
209 215
210 this.pendingBookList = new ArrayList<DBBook>(); 216 this.pendingBookList = new ArrayList<DBBook>();
211 this.pendingBookList.addAll(this.booksMap.values()); 217 this.pendingBookList.addAll(this.booksMap.values());
212 218
219 this.filter();
220
213 } 221 }
214 222
215 223
216 224
217 public void updateDescription() { 225 public void updateDescription() {
291 299
292 this.paginator.setCurrentPage(0); 300 this.paginator.setCurrentPage(0);
293 this.paginator.resetNumberOfPages(0); 301 this.paginator.resetNumberOfPages(0);
294 } 302 }
295 303
304
305 // filter on pendingBookList TODO complete filters for each field in Missing Books table
306 if (this.pendingBookList != null) {
307
308
309 this.filteredSectionListMissingBooks = new ArrayList<DBBook>();
310 for(DBBook book : this.pendingBookList){
311 if(!this.filteredSectionListMissingBooks.contains(book)){
312
313 if( (StringUtils.isEmpty(dynastyFilterMissingBooks) || StringUtils.startsWith(book.getDynasty(), dynastyFilterMissingBooks))
314
315 ){
316
317 this.filteredSectionListMissingBooks.add(book);
318 }
319
320 }
321 }
322 }
323
296 324
297 } 325 }
298 326
299 327
300 private void updateCurrentSections() { 328 private void updateCurrentSections() {
470 public void setDynastyFilter(String dynastyFilter) { 498 public void setDynastyFilter(String dynastyFilter) {
471 this.dynastyFilter = dynastyFilter; 499 this.dynastyFilter = dynastyFilter;
472 } 500 }
473 501
474 502
475
476 public String getAdminTypeFilter() { 503 public String getAdminTypeFilter() {
477 return adminTypeFilter; 504 return adminTypeFilter;
478 } 505 }
479 506
480 507
612 this.sectionNameFilter = sectionNameFilter; 639 this.sectionNameFilter = sectionNameFilter;
613 } 640 }
614 641
615 642
616 643
644 public String getDynastyFilterMissingBooks() {
645 return dynastyFilterMissingBooks;
646 }
647
648
649
650 public void setDynastyFilterMissingBooks(String dynastyFilterMissingBooks) {
651 this.dynastyFilterMissingBooks = dynastyFilterMissingBooks;
652 }
617 653
618 654
619 public List<DBBook> getPendingBookList() { 655 public List<DBBook> getPendingBookList() {
620 return pendingBookList; 656 return pendingBookList;
621 } 657 }
635 public void setCompleteSectionList(List<DBSection> completeSectionList) { 671 public void setCompleteSectionList(List<DBSection> completeSectionList) {
636 this.completeSectionList = completeSectionList; 672 this.completeSectionList = completeSectionList;
637 } 673 }
638 674
639 675
640 676
677 public List<DBBook> getFilteredSectionListMissingBooks() {
678 return filteredSectionListMissingBooks;
679 }
680
681
682
683 public void setFilteredSectionListMissingBooks(
684 List<DBBook> filteredSectionListMissingBooks) {
685 this.filteredSectionListMissingBooks = filteredSectionListMissingBooks;
686 }
687
688
641 689
642 690
643 691
644 692
645 /////// Sorting 693 /////// Sorting