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.util.ComponentUtil;
22  
23  public class DataConfigPager implements Serializable {
24  
25      private static final long serialVersionUID = 1L;
26  
27      public static final int DEFAULT_PAGE_SIZE = 20;
28  
29      public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1;
30  
31      private int allRecordCount;
32  
33      private int allPageCount;
34  
35      private boolean existPrePage;
36  
37      private boolean existNextPage;
38  
39      private List<Integer> pageNumberList;
40  
41      private int pageSize;
42  
43      private int currentPageNumber;
44  
45      public String id;
46  
47      public String name;
48  
49      public String handlerName;
50  
51      public String boost;
52  
53      public String available;
54  
55      public String sortOrder;
56  
57      public String createdBy;
58  
59      public String createdTime;
60  
61      public String versionNo;
62  
63      public String description;
64  
65      public void clear() {
66          allRecordCount = 0;
67          allPageCount = 0;
68          existPrePage = false;
69          existNextPage = false;
70          pageSize = getDefaultPageSize();
71          currentPageNumber = getDefaultCurrentPageNumber();
72  
73          id = null;
74          name = null;
75          handlerName = null;
76          boost = null;
77          available = null;
78          sortOrder = null;
79          createdBy = null;
80          createdTime = null;
81          versionNo = null;
82          description = null;
83  
84      }
85  
86      protected int getDefaultCurrentPageNumber() {
87          return DEFAULT_CURRENT_PAGE_NUMBER;
88      }
89  
90      public int getAllRecordCount() {
91          return allRecordCount;
92      }
93  
94      public void setAllRecordCount(final int allRecordCount) {
95          this.allRecordCount = allRecordCount;
96      }
97  
98      public int getAllPageCount() {
99          return allPageCount;
100     }
101 
102     public void setAllPageCount(final int allPageCount) {
103         this.allPageCount = allPageCount;
104     }
105 
106     public boolean isExistPrePage() {
107         return existPrePage;
108     }
109 
110     public void setExistPrePage(final boolean existPrePage) {
111         this.existPrePage = existPrePage;
112     }
113 
114     public boolean isExistNextPage() {
115         return existNextPage;
116     }
117 
118     public void setExistNextPage(final boolean existNextPage) {
119         this.existNextPage = existNextPage;
120     }
121 
122     public int getPageSize() {
123         if (pageSize <= 0) {
124             pageSize = getDefaultPageSize();
125         }
126         return pageSize;
127     }
128 
129     public void setPageSize(final int pageSize) {
130         this.pageSize = pageSize;
131     }
132 
133     public int getCurrentPageNumber() {
134         if (currentPageNumber <= 0) {
135             currentPageNumber = getDefaultCurrentPageNumber();
136         }
137         return currentPageNumber;
138     }
139 
140     public void setCurrentPageNumber(final int currentPageNumber) {
141         this.currentPageNumber = currentPageNumber;
142     }
143 
144     public List<Integer> getPageNumberList() {
145         return pageNumberList;
146     }
147 
148     public void setPageNumberList(final List<Integer> pageNumberList) {
149         this.pageNumberList = pageNumberList;
150     }
151 
152     protected int getDefaultPageSize() {
153         return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
154     }
155 
156 }