Mercurial > hg > LGServer
annotate src/main/java/de/mpiwg/web/SearchBean.java @ 5:5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
author | "jurzua <jurzua@mpiwg-berlin.mpg.de>" |
---|---|
date | Mon, 16 Mar 2015 11:25:36 +0100 |
parents | 7682c04c63a8 |
children | 5610250d021a |
rev | line source |
---|---|
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
1 package de.mpiwg.web; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
2 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
3 import java.sql.SQLException; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
4 import java.util.ArrayList; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
5 import java.util.HashMap; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
6 import java.util.List; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
7 import java.util.Map; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
8 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
9 import javax.faces.event.ActionEvent; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
10 import javax.faces.event.ValueChangeEvent; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
11 import javax.faces.model.SelectItem; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
12 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
13 import org.apache.commons.lang.StringUtils; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
14 import org.apache.log4j.Logger; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
15 import org.icefaces.ace.event.TextChangeEvent; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
16 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
17 import de.mpiwg.gazetteer.bo.LGBranch; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
18 import de.mpiwg.gazetteer.db.DBSection; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
19 import de.mpiwg.gazetteer.utils.DBService; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
20 import de.mpiwg.gazetteer.utils.DataProvider; |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
21 import de.mpiwg.web.jsf.DataPaginator; |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
22 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
23 public class SearchBean extends AbstractBean{ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
24 |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
25 private static String GOTO_SEARCH_PAGE = "searchPage"; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
26 |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
27 private static Logger logger = Logger.getLogger(SearchBean.class); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
28 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
29 private String term; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
30 private List<SelectItem> sectionSuggestion; |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
31 private List<DBSection> completeSectionList; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
32 private List<DBSection> currentSectionList; |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
33 private String message; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
34 private Map<Long, List<LGBranch>> branchesMap; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
35 |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
36 private transient DataPaginator advancedPaginator = new DataPaginator(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
37 |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
38 public void changeSectionName(TextChangeEvent event){ |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
39 //logger.debug("changeSectionName"); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
40 //logger.debug("key" + event.getKeyCode()); |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
41 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
42 String term = event.getNewValue().toString(); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
43 this.sectionSuggestion = new ArrayList<SelectItem>(); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
44 if(!term.contains(",")){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
45 try { |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
46 List<String> list = DBService.suggestSectionName(term); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
47 for(String s : list){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
48 this.sectionSuggestion.add(new SelectItem(s)); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
49 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
50 } catch (SQLException e) { |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
51 internalError(e); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
52 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
53 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
54 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
55 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
56 public void changeSectionSearch(ValueChangeEvent event){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
57 this.term = (String)event.getNewValue(); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
58 this.search(); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
59 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
60 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
61 public void listenerSearch(ActionEvent event){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
62 this.search(); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
63 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
64 |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
65 |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
66 private void search(){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
67 if(StringUtils.isNotEmpty(this.term)){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
68 this.loadBranches(); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
69 try { |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
70 List<String> terms = splitTerms(); |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
71 this.completeSectionList = DBService.searchSection(terms); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
72 if(completeSectionList.size() > 0){ |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
73 this.message = completeSectionList.size() + " item(s) found for the term(s): " + this.term; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
74 this.advancedPaginator.setCurrentPage(0); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
75 this.advancedPaginator.resetNumberOfPages(completeSectionList.size()); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
76 this.updateCurrentSections(); |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
77 }else{ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
78 this.message = "No items found for the term(s): " + this.term; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
79 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
80 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
81 } catch (Exception e) { |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
82 internalError(e); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
83 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
84 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
85 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
86 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
87 private void loadBranches(){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
88 this.branchesMap = new HashMap<Long, List<LGBranch>>(); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
89 List<LGBranch> list = DataProvider.getInstance().getBranches(getSessionBean().getUser().getId()); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
90 for(LGBranch branch : list){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
91 branch.loadTransientData(); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
92 if(this.branchesMap.get(branch.getSectionId()) == null){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
93 this.branchesMap.put(branch.getSectionId(), new ArrayList<LGBranch>()); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
94 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
95 this.branchesMap.get(branch.getSectionId()).add(branch); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
96 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
97 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
98 |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
99 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
100 private void updateCurrentSections() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
101 this.advancedPaginator.initCount(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
102 int startRecord = this.advancedPaginator.getCurrentPage() |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
103 * this.advancedPaginator.getItemsPerPage(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
104 if((this.advancedPaginator.getCurrentPage() + 1) == this.advancedPaginator.getNumberOfPages()){ |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
105 int mod = this.completeSectionList.size() % advancedPaginator.getItemsPerPage(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
106 if(mod == 0){ |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
107 this.currentSectionList = completeSectionList.subList(startRecord, startRecord + this.advancedPaginator.getItemsPerPage()); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
108 }else{ |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
109 this.currentSectionList = completeSectionList.subList(startRecord, startRecord + mod); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
110 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
111 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
112 }else{ |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
113 this.currentSectionList = completeSectionList.subList(startRecord, startRecord + this.advancedPaginator.getItemsPerPage()); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
114 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
115 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
116 for(DBSection section : this.currentSectionList){ |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
117 try { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
118 section.setBook(DBService.getBook(section.getBookId())); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
119 } catch (SQLException e) { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
120 e.printStackTrace(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
121 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
122 section.setBranches(this.branchesMap.get(section.getId())); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
123 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
124 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
125 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
126 public String advancedFirst() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
127 this.advancedPaginator.first(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
128 this.updateCurrentSections(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
129 return GOTO_SEARCH_PAGE; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
130 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
131 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
132 public String advancedLast() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
133 this.advancedPaginator.last(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
134 this.updateCurrentSections(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
135 return GOTO_SEARCH_PAGE; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
136 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
137 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
138 public String advancedFastForward() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
139 this.advancedPaginator.fastForward(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
140 this.updateCurrentSections(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
141 return GOTO_SEARCH_PAGE; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
142 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
143 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
144 public String advancedFastRewind() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
145 this.advancedPaginator.fastRewind(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
146 this.updateCurrentSections(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
147 return GOTO_SEARCH_PAGE; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
148 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
149 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
150 public String advancedPrevious() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
151 this.advancedPaginator.previous(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
152 this.updateCurrentSections(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
153 return GOTO_SEARCH_PAGE; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
154 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
155 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
156 public String advancedNext() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
157 this.advancedPaginator.next(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
158 this.updateCurrentSections(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
159 return GOTO_SEARCH_PAGE; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
160 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
161 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
162 /* |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
163 public void reset(){ |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
164 this.completeSectionList = new ArrayList<DBSection>(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
165 this.currentSectionList = new ArrayList<DBSection>(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
166 this.message = new String(); |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
167 }*/ |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
168 |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
169 private List<String> splitTerms(){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
170 List<String> rs = new ArrayList<String>(); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
171 String[] array = this.term.split(","); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
172 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
173 for(String tmp : array){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
174 tmp = tmp.replace(" ", ""); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
175 if(StringUtils.isNotEmpty(tmp)){ |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
176 rs.add(tmp); |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
177 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
178 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
179 return rs; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
180 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
181 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
182 public String getTerm() { |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
183 return term; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
184 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
185 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
186 public void setTerm(String term) { |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
187 this.term = term; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
188 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
189 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
190 public List<SelectItem> getSectionSuggestion() { |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
191 return sectionSuggestion; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
192 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
193 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
194 public void setSectionSuggestion(List<SelectItem> sectionSuggestion) { |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
195 this.sectionSuggestion = sectionSuggestion; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
196 } |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
197 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
198 |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
199 |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
200 public List<DBSection> getCompleteSectionList() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
201 return completeSectionList; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
202 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
203 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
204 public void setCompleteSectionList(List<DBSection> completeSectionList) { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
205 this.completeSectionList = completeSectionList; |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
206 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
207 |
5
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
208 public List<DBSection> getCurrentSectionList() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
209 return currentSectionList; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
210 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
211 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
212 public void setCurrentSectionList(List<DBSection> currentSectionList) { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
213 this.currentSectionList = currentSectionList; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
214 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
215 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
216 public DataPaginator getAdvancedPaginator() { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
217 return advancedPaginator; |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
218 } |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
219 |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
220 public void setAdvancedPaginator(DataPaginator advancedPaginator) { |
5316e79f9a27
Implementation of search pagination and lazy loading to display the result set of a search.
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
0
diff
changeset
|
221 this.advancedPaginator = advancedPaginator; |
0
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
222 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
223 |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
224 public String getMessage() { |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
225 return message; |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
226 } |
7682c04c63a8
First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff
changeset
|
227 } |