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 FailureUrlPager implements Serializable {
24  
25      private static final long serialVersionUID = 1L;
26  
27      //@Maxbytelength(maxbytelength = 1000)
28      public String url;
29  
30      //@IntRange(min = 0, max = 2147483647)
31      public String errorCountMin;
32  
33      //@IntRange(min = 0, max = 2147483647)
34      public String errorCountMax;
35  
36      //@Maxbytelength(maxbytelength = 1000)
37      public String errorName;
38  
39      public static final int DEFAULT_PAGE_SIZE = 20;
40  
41      public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1;
42  
43      private int allRecordCount;
44  
45      private int allPageCount;
46  
47      private boolean existPrePage;
48  
49      private boolean existNextPage;
50  
51      private List<Integer> pageNumberList;
52  
53      private int pageSize;
54  
55      private int currentPageNumber;
56  
57      public String id;
58  
59      public String threadName;
60  
61      public String errorCount;
62  
63      public String lastAccessTime;
64  
65      public void clear() {
66          allRecordCount = 0;
67          allPageCount = 0;
68          existPrePage = false;
69          existNextPage = false;
70          pageSize = getDefaultPageSize();
71          currentPageNumber = getDefaultCurrentPageNumber();
72  
73          id = null;
74          url = null;
75          threadName = null;
76          errorCount = null;
77          lastAccessTime = null;
78          errorCountMin = null;
79          errorCountMax = null;
80          errorName = null;
81  
82      }
83  
84      protected int getDefaultCurrentPageNumber() {
85          return DEFAULT_CURRENT_PAGE_NUMBER;
86      }
87  
88      public int getAllRecordCount() {
89          return allRecordCount;
90      }
91  
92      public void setAllRecordCount(final int allRecordCount) {
93          this.allRecordCount = allRecordCount;
94      }
95  
96      public int getAllPageCount() {
97          return allPageCount;
98      }
99  
100     public void setAllPageCount(final int allPageCount) {
101         this.allPageCount = allPageCount;
102     }
103 
104     public boolean isExistPrePage() {
105         return existPrePage;
106     }
107 
108     public void setExistPrePage(final boolean existPrePage) {
109         this.existPrePage = existPrePage;
110     }
111 
112     public boolean isExistNextPage() {
113         return existNextPage;
114     }
115 
116     public void setExistNextPage(final boolean existNextPage) {
117         this.existNextPage = existNextPage;
118     }
119 
120     public int getPageSize() {
121         if (pageSize <= 0) {
122             pageSize = getDefaultPageSize();
123         }
124         return pageSize;
125     }
126 
127     public void setPageSize(final int pageSize) {
128         this.pageSize = pageSize;
129     }
130 
131     public int getCurrentPageNumber() {
132         if (currentPageNumber <= 0) {
133             currentPageNumber = getDefaultCurrentPageNumber();
134         }
135         return currentPageNumber;
136     }
137 
138     public void setCurrentPageNumber(final int currentPageNumber) {
139         this.currentPageNumber = currentPageNumber;
140     }
141 
142     public List<Integer> getPageNumberList() {
143         return pageNumberList;
144     }
145 
146     public void setPageNumberList(final List<Integer> pageNumberList) {
147         this.pageNumberList = pageNumberList;
148     }
149 
150     protected int getDefaultPageSize() {
151         return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
152     }
153 
154 }