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 BadWordPager 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 suggestWord;
48  
49      public String createdBy;
50  
51      public String createdTime;
52  
53      public String versionNo;
54  
55      public void clear() {
56          allRecordCount = 0;
57          allPageCount = 0;
58          existPrePage = false;
59          existNextPage = false;
60          pageSize = getDefaultPageSize();
61          currentPageNumber = getDefaultCurrentPageNumber();
62  
63          id = null;
64          suggestWord = null;
65          createdBy = null;
66          createdTime = null;
67          versionNo = null;
68  
69      }
70  
71      protected int getDefaultCurrentPageNumber() {
72          return DEFAULT_CURRENT_PAGE_NUMBER;
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 getDefaultPageSize() {
138         return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
139     }
140 
141 }