annotate src/main/java/de/mpiwg/web/SearchBean.java @ 10:5610250d021a default tip

SectionsIndex, we added a method to print the setting of the VM
author "jurzua <jurzua@mpiwg-berlin.mpg.de>"
date Thu, 19 Mar 2015 11:46:33 +0100
parents 5316e79f9a27
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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){
10
5610250d021a SectionsIndex, we added a method to print the setting of the VM
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents: 5
diff changeset
117 /*
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
118 try {
10
5610250d021a SectionsIndex, we added a method to print the setting of the VM
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents: 5
diff changeset
119 section.setBook(DBService.getInstance().getBook(section.getBookId()));
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
120 } 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
121 e.printStackTrace();
10
5610250d021a SectionsIndex, we added a method to print the setting of the VM
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents: 5
diff changeset
122 }*/
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
123 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
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
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 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
128 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
129 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
130 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
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
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 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
134 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
135 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
136 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
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
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 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
140 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
141 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
142 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
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
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 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
146 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
147 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
148 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
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
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 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
152 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
153 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
154 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
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
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 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
158 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
159 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
160 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
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 /*
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 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
165 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
166 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
167 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
168 }*/
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
169
0
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
170 private List<String> splitTerms(){
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
171 List<String> rs = new ArrayList<String>();
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
172 String[] array = this.term.split(",");
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
173
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
174 for(String tmp : array){
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
175 tmp = tmp.replace(" ", "");
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
176 if(StringUtils.isNotEmpty(tmp)){
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
177 rs.add(tmp);
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 }
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
180 return rs;
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
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
183 public String getTerm() {
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
184 return term;
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
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
187 public void setTerm(String term) {
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
188 this.term = term;
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
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
191 public List<SelectItem> getSectionSuggestion() {
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
192 return sectionSuggestion;
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
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
195 public void setSectionSuggestion(List<SelectItem> sectionSuggestion) {
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
196 this.sectionSuggestion = sectionSuggestion;
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
197 }
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
198
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
199
0
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
200
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
201 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
202 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
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
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 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
206 this.completeSectionList = completeSectionList;
0
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
207 }
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
208
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
209 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
210 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
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
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 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
214 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
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
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 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
218 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
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
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 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
222 this.advancedPaginator = advancedPaginator;
0
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
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
225 public String getMessage() {
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
226 return message;
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
227 }
7682c04c63a8 First commit of the source code!
"jurzua <jurzua@mpiwg-berlin.mpg.de>"
parents:
diff changeset
228 }