1 // license-header java merge-point
2 // Generated by: paging/PaginaionResult.java.vsl in andromda-spring-cartridge.
3 package org.andromda.spring;
4
5 /*-
6 * #%L
7 * Quadrige2 Core :: Server API
8 * %%
9 * Copyright (C) 2017 Ifremer
10 * %%
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Affero General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU Affero General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * #L%
24 */
25
26 import java.io.Serializable;
27
28 /**
29 * A class that represents a "paged result" of data out of a larger set, ie.
30 * a list of objects together with info to indicate the starting row and
31 * the full size of the dataset.
32 * Generated by paging/PaginationResult.vsl in andromda-spring cartridge
33 */
34 public class PaginationResult
35 implements Serializable
36 {
37 private static final long serialVersionUID = 8766771253773009362L;
38
39 private long totalSize;
40 private Object[] data;
41
42 /**
43 * Create an object representing a sublist of a dataset.
44 *
45 * @param dataIn is a list of consecutive objects from the dataset.
46 * @param totalSizeIn is the total number of matching rows available.
47 */
48 public PaginationResult(
49 Object[] dataIn,
50 long totalSizeIn)
51 {
52 this.data = dataIn;
53 this.totalSize = totalSizeIn;
54 }
55
56 /**
57 * Returns the number of items in the entire result.
58 *
59 * @return the total size of items.
60 */
61 public long getTotalSize()
62 {
63 return this.totalSize;
64 }
65
66 /**
67 * Sets the total size of this pagination's complete set.
68 *
69 * @param totalSizeIn the total size of objects contained in the complete set.
70 */
71 public void setTotalSize(long totalSizeIn)
72 {
73 this.totalSize = totalSizeIn;
74 }
75
76 /**
77 * Return the array of objects held by this pagination rules, which
78 * is a continuous subset of the full dataset.
79 * @return this.data
80 */
81 public Object[] getData()
82 {
83 return this.data;
84 }
85
86 /**
87 * Sets the data for this pagination result.
88 *
89 * @param dataIn the subset of paginated data.
90 */
91 public void setData(Object[] dataIn)
92 {
93 this.data = dataIn;
94 }
95 }