View Javadoc
1   /*
2    * Copyright 2012-2017 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 void clear() {
64          allRecordCount = 0;
65          allPageCount = 0;
66          existPrePage = false;
67          existNextPage = false;
68          pageSize = getDefaultPageSize();
69          currentPageNumber = getDefaultCurrentPageNumber();
70  
71          id = null;
72          name = null;
73          handlerName = null;
74          boost = null;
75          available = null;
76          sortOrder = null;
77          createdBy = null;
78          createdTime = null;
79          versionNo = null;
80  
81      }
82  
83      protected int getDefaultCurrentPageNumber() {
84          return DEFAULT_CURRENT_PAGE_NUMBER;
85      }
86  
87      public int getAllRecordCount() {
88          return allRecordCount;
89      }
90  
91      public void setAllRecordCount(final int allRecordCount) {
92          this.allRecordCount = allRecordCount;
93      }
94  
95      public int getAllPageCount() {
96          return allPageCount;
97      }
98  
99      public void setAllPageCount(final int allPageCount) {
100         this.allPageCount = allPageCount;
101     }
102 
103     public boolean isExistPrePage() {
104         return existPrePage;
105     }
106 
107     public void setExistPrePage(final boolean existPrePage) {
108         this.existPrePage = existPrePage;
109     }
110 
111     public boolean isExistNextPage() {
112         return existNextPage;
113     }
114 
115     public void setExistNextPage(final boolean existNextPage) {
116         this.existNextPage = existNextPage;
117     }
118 
119     public int getPageSize() {
120         if (pageSize <= 0) {
121             pageSize = getDefaultPageSize();
122         }
123         return pageSize;
124     }
125 
126     public void setPageSize(final int pageSize) {
127         this.pageSize = pageSize;
128     }
129 
130     public int getCurrentPageNumber() {
131         if (currentPageNumber <= 0) {
132             currentPageNumber = getDefaultCurrentPageNumber();
133         }
134         return currentPageNumber;
135     }
136 
137     public void setCurrentPageNumber(final int currentPageNumber) {
138         this.currentPageNumber = currentPageNumber;
139     }
140 
141     public List<Integer> getPageNumberList() {
142         return pageNumberList;
143     }
144 
145     public void setPageNumberList(final List<Integer> pageNumberList) {
146         this.pageNumberList = pageNumberList;
147     }
148 
149     protected int getDefaultPageSize() {
150         return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
151     }
152 
153 }