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