forked from Internet2/grouper
/
VootResponse.java
110 lines (97 loc) · 3.01 KB
/
VootResponse.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*******************************************************************************
* Copyright 2012 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package edu.internet2.middleware.grouperVoot.messages;
/**
* Bean to respresent a valid VOOT response.
*
* @author mchyzer
* @author Andrea Biancini <andrea.biancini@gmail.com>
*/
public abstract class VootResponse {
/** Start index starts with 0 */
protected Integer startIndex;
/** Total number of results */
protected Integer totalResults;
/** Number of items in a page */
protected Integer itemsPerPage;
/**
* Paginate the results ad assign the values to pagination attributes.
*
* @param resultArray the compelte resultset from Grouper
* @param start the index of the first element to be put into result
* @param count the number of elements to be put into result
* @return the new collection containing the right page for the results
*/
public void paginate(Object[] resultArray, int start, int count) {
if (resultArray == null) {
this.startIndex = 0;
this.totalResults = 0;
this.itemsPerPage = 0;
} else {
this.startIndex = start;
this.totalResults = resultArray.length;
this.itemsPerPage = count;
}
}
/**
* Get start index, starts with 0
*
* @return the start index
*/
public Integer getStartIndex() {
return this.startIndex;
}
/**
* Set start index, starts with 0
*
* @param startIndex1 the start index
*/
public void setStartIndex(Integer startIndex1) {
this.startIndex = startIndex1;
}
/**
* Get the total number of results.
*
* @return the total number of results.
*/
public Integer getTotalResults() {
return this.totalResults;
}
/**
* Set the total number of results.
*
* @param totalResults1 the total number of results.
*/
public void setTotalResults(Integer totalResults1) {
this.totalResults = totalResults1;
}
/**
* Get the number of items in a page.
*
* @return the number of items in a page.
*/
public Integer getItemsPerPage() {
return this.itemsPerPage;
}
/**
* Set the number of items in a page.
*
* @param itemsPerPage1 the number of items in a page.
*/
public void setItemsPerPage(Integer itemsPerPage1) {
this.itemsPerPage = itemsPerPage1;
}
}