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