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 * Quadrige3 Core :: Client API 8 * %% 9 * Copyright (C) 2017 - 2024 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 import java.io.Serializable; 26 27 /** 28 * A class that represents a "paged result" of data out of a larger set, ie. 29 * a list of objects together with info to indicate the starting row and 30 * the full size of the dataset. 31 * Generated by paging/PaginationResult.vsl in andromda-spring cartridge 32 */ 33 public class PaginationResult 34 implements Serializable 35 { 36 private static final long serialVersionUID = 8766771253773009362L; 37 38 private long totalSize; 39 private Object[] data; 40 41 /** 42 * Create an object representing a sublist of a dataset. 43 * 44 * @param dataIn is a list of consecutive objects from the dataset. 45 * @param totalSizeIn is the total number of matching rows available. 46 */ 47 public PaginationResult( 48 Object[] dataIn, 49 long totalSizeIn) 50 { 51 this.data = dataIn; 52 this.totalSize = totalSizeIn; 53 } 54 55 /** 56 * Returns the number of items in the entire result. 57 * 58 * @return the total size of items. 59 */ 60 public long getTotalSize() 61 { 62 return this.totalSize; 63 } 64 65 /** 66 * Sets the total size of this pagination's complete set. 67 * 68 * @param totalSizeIn the total size of objects contained in the complete set. 69 */ 70 public void setTotalSize(long totalSizeIn) 71 { 72 this.totalSize = totalSizeIn; 73 } 74 75 /** 76 * Return the array of objects held by this pagination rules, which 77 * is a continuous subset of the full dataset. 78 * @return this.data 79 */ 80 public Object[] getData() 81 { 82 return this.data; 83 } 84 85 /** 86 * Sets the data for this pagination result. 87 * 88 * @param dataIn the subset of paginated data. 89 */ 90 public void setData(Object[] dataIn) 91 { 92 this.data = dataIn; 93 } 94 }