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.Constants;
22  import org.codelibs.fess.util.ComponentUtil;
23  
24  public class RelatedContentPager implements Serializable {
25      private static final long serialVersionUID = 1L;
26  
27      public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1;
28  
29      private int allRecordCount;
30  
31      private int allPageCount;
32  
33      private boolean existPrePage;
34  
35      private boolean existNextPage;
36  
37      private List<Integer> pageNumberList;
38  
39      private int pageSize;
40  
41      private int currentPageNumber;
42  
43      public String id;
44  
45      public String term;
46  
47      public String content;
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          term = null;
65          content = null;
66          createdBy = null;
67          createdTime = null;
68          versionNo = null;
69  
70      }
71  
72      public int getAllRecordCount() {
73          return allRecordCount;
74      }
75  
76      public void setAllRecordCount(final int allRecordCount) {
77          this.allRecordCount = allRecordCount;
78      }
79  
80      public int getAllPageCount() {
81          return allPageCount;
82      }
83  
84      public void setAllPageCount(final int allPageCount) {
85          this.allPageCount = allPageCount;
86      }
87  
88      public boolean isExistPrePage() {
89          return existPrePage;
90      }
91  
92      public void setExistPrePage(final boolean existPrePage) {
93          this.existPrePage = existPrePage;
94      }
95  
96      public boolean isExistNextPage() {
97          return existNextPage;
98      }
99  
100     public void setExistNextPage(final boolean existNextPage) {
101         this.existNextPage = existNextPage;
102     }
103 
104     public int getPageSize() {
105         if (pageSize <= 0) {
106             pageSize = getDefaultPageSize();
107         }
108         return pageSize;
109     }
110 
111     public void setPageSize(final int pageSize) {
112         this.pageSize = pageSize;
113     }
114 
115     public int getCurrentPageNumber() {
116         if (currentPageNumber <= 0) {
117             currentPageNumber = getDefaultCurrentPageNumber();
118         }
119         return currentPageNumber;
120     }
121 
122     public void setCurrentPageNumber(final int currentPageNumber) {
123         this.currentPageNumber = currentPageNumber;
124     }
125 
126     public List<Integer> getPageNumberList() {
127         return pageNumberList;
128     }
129 
130     public void setPageNumberList(final List<Integer> pageNumberList) {
131         this.pageNumberList = pageNumberList;
132     }
133 
134     protected int getDefaultCurrentPageNumber() {
135         return Constants.DEFAULT_ADMIN_PAGE_NUMBER;
136     }
137 
138     protected int getDefaultPageSize() {
139         return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
140     }
141 
142 }