1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.cdm.api.service.pager.impl;
|
12
|
|
13
|
import java.util.List;
|
14
|
|
15
|
public class DefaultPagerImpl<T> extends AbstractPagerImpl<T> {
|
16
|
|
17
|
private static final long serialVersionUID = 1L;
|
18
|
|
19
|
/**
|
20
|
* Constructor
|
21
|
*
|
22
|
* @param currentIndex the page of this result set (0-based), can be null
|
23
|
* @param count the total number of results available for this query
|
24
|
* @param pageSize The size of pages (can be null or 0 if all results should be returned if available)
|
25
|
* @param records A list of objects in this page (can be empty if there were no results)
|
26
|
*
|
27
|
* @deprecated This constructor only supports total result counts to {@link Integer#MAX_VALUE} u
|
28
|
* use {@link DefaultPagerImpl(Integer currentIndex, Long count, Integer pageSize, List<T> records, String suggestion)}
|
29
|
* instead
|
30
|
*/
|
31
|
@Deprecated
|
32
|
public DefaultPagerImpl(Integer currentIndex, Integer count, Integer pageSize, List<T> records) {
|
33
|
super(currentIndex, count, pageSize, records);
|
34
|
}
|
35
|
|
36
|
/**
|
37
|
* Constructor
|
38
|
*
|
39
|
* @param currentIndex the page of this result set (0-based), can be null
|
40
|
* @param count the total number of results available for this query
|
41
|
* @param pageSize The size of pages (can be null or 0 if all results should be returned if available)
|
42
|
* @param records A list of objects in this page (can be empty if there were no results)
|
43
|
*/
|
44
|
public DefaultPagerImpl(Integer currentIndex, Long count, Integer pageSize, List<T> records) {
|
45
|
super(currentIndex, count, pageSize, records);
|
46
|
}
|
47
|
|
48
|
/**
|
49
|
* Constructor
|
50
|
*
|
51
|
* @param currentIndex the page of this result set (0-based), can be null
|
52
|
* @param count the total number of results available for this query
|
53
|
* @param pageSize The size of pages (can be null if all results should be returned if available)
|
54
|
* @param records A list of objects in this page (can be empty if there were no results)
|
55
|
* @param suggestion a suggested query that would improve the search (only applicable for free-text / lucene queries)
|
56
|
*
|
57
|
* @deprecated This constructor only supports total result counts to {@link Integer#MAX_VALUE} u
|
58
|
* use {@link DefaultPagerImpl(Integer currentIndex, Integer count, Integer pageSize, List<T> records, String suggestion)}
|
59
|
* instead
|
60
|
*/
|
61
|
@Deprecated
|
62
|
public DefaultPagerImpl(Integer currentIndex, Integer count, Integer pageSize, List<T> records, String suggestion) {
|
63
|
super(currentIndex, count, pageSize, records,suggestion);
|
64
|
}
|
65
|
|
66
|
@Override
|
67
|
protected String createLabel(String s1, String s2) {
|
68
|
return s1 + DefaultPagerImpl.LABEL_DIVIDER + s2;
|
69
|
}
|
70
|
|
71
|
/**
|
72
|
* {@inheritDoc}
|
73
|
*/
|
74
|
@Override
|
75
|
public String toString() {
|
76
|
String result = "DefaultPagerImpl[";
|
77
|
result += "count: " + count;
|
78
|
result += "; pageSize: " + pageSize;
|
79
|
result += "; pageNumbers: " + pageNumbers;
|
80
|
result += "; pagesAvailable: " + pagesAvailable;
|
81
|
result += "; firstRecord: " + firstRecord;
|
82
|
result += "; lastRecord: " + lastRecord;
|
83
|
result += "; suggestion: " + suggestion;
|
84
|
result += "; pagesAvailable: " + pagesAvailable;
|
85
|
result += "\nrecords: " + records;
|
86
|
result += "]";
|
87
|
return result;
|
88
|
}
|
89
|
|
90
|
|
91
|
}
|