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