View Javadoc
1   /*
2    * Copyright 2012-2021 CodeLibs Project and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.codelibs.fess.app.pager;
17  
18  import java.io.Serializable;
19  import java.util.List;
20  
21  import org.codelibs.fess.Constants;
22  import org.codelibs.fess.util.ComponentUtil;
23  
24  public class BoostDocPager implements Serializable {
25      private static final long serialVersionUID = 1L;
26  
27      public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1;
28  
29      private int allRecordCount;
30  
31      private int allPageCount;
32  
33      private boolean existPrePage;
34  
35      private boolean existNextPage;
36  
37      private List<Integer> pageNumberList;
38  
39      private int pageSize;
40  
41      private int currentPageNumber;
42  
43      public String id;
44  
45      public String urlExpr;
46  
47      public String boostExpr;
48  
49      public String sortOrder;
50  
51      public String createdBy;
52  
53      public String createdTime;
54  
55      public String versionNo;
56  
57      public void clear() {
58          allRecordCount = 0;
59          allPageCount = 0;
60          existPrePage = false;
61          existNextPage = false;
62          pageSize = getDefaultPageSize();
63          currentPageNumber = getDefaultCurrentPageNumber();
64  
65          id = null;
66          urlExpr = null;
67          boostExpr = null;
68          sortOrder = null;
69          createdBy = null;
70          createdTime = null;
71          versionNo = null;
72  
73      }
74  
75      public int getAllRecordCount() {
76          return allRecordCount;
77      }
78  
79      public void setAllRecordCount(final int allRecordCount) {
80          this.allRecordCount = allRecordCount;
81      }
82  
83      public int getAllPageCount() {
84          return allPageCount;
85      }
86  
87      public void setAllPageCount(final int allPageCount) {
88          this.allPageCount = allPageCount;
89      }
90  
91      public boolean isExistPrePage() {
92          return existPrePage;
93      }
94  
95      public void setExistPrePage(final boolean existPrePage) {
96          this.existPrePage = existPrePage;
97      }
98  
99      public boolean isExistNextPage() {
100         return existNextPage;
101     }
102 
103     public void setExistNextPage(final boolean existNextPage) {
104         this.existNextPage = existNextPage;
105     }
106 
107     public int getPageSize() {
108         if (pageSize <= 0) {
109             pageSize = getDefaultPageSize();
110         }
111         return pageSize;
112     }
113 
114     public void setPageSize(final int pageSize) {
115         this.pageSize = pageSize;
116     }
117 
118     public int getCurrentPageNumber() {
119         if (currentPageNumber <= 0) {
120             currentPageNumber = getDefaultCurrentPageNumber();
121         }
122         return currentPageNumber;
123     }
124 
125     public void setCurrentPageNumber(final int currentPageNumber) {
126         this.currentPageNumber = currentPageNumber;
127     }
128 
129     public List<Integer> getPageNumberList() {
130         return pageNumberList;
131     }
132 
133     public void setPageNumberList(final List<Integer> pageNumberList) {
134         this.pageNumberList = pageNumberList;
135     }
136 
137     protected int getDefaultCurrentPageNumber() {
138         return Constants.DEFAULT_ADMIN_PAGE_NUMBER;
139     }
140 
141     protected int getDefaultPageSize() {
142         return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
143     }
144 
145 }