001// license-header java merge-point
002// Generated by: paging/PaginaionResult.java.vsl in andromda-spring-cartridge.
003package org.andromda.spring;
004
005/*
006 * #%L
007 * SIH-Adagio :: Core
008 * $Id:$
009 * $HeadURL:$
010 * %%
011 * Copyright (C) 2012 - 2014 Ifremer
012 * %%
013 * This program is free software: you can redistribute it and/or modify
014 * it under the terms of the GNU Affero General Public License as published by
015 * the Free Software Foundation, either version 3 of the License, or
016 * (at your option) any later version.
017 * 
018 * This program is distributed in the hope that it will be useful,
019 * but WITHOUT ANY WARRANTY; without even the implied warranty of
020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
021 * GNU General Public License for more details.
022 * 
023 * You should have received a copy of the GNU Affero General Public License
024 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
025 * #L%
026 */
027
028import java.io.Serializable;
029
030/**
031 * A class that represents a "paged result" of data out of a larger set, ie.
032 * a list of objects together with info to indicate the starting row and
033 * the full size of the dataset.
034 * Generated by paging/PaginationResult.vsl in andromda-spring cartridge
035 */
036public class PaginationResult
037    implements Serializable
038{
039    private static final long serialVersionUID = 8766771253773009362L;
040
041    private long totalSize;
042    private Object[] data;
043
044    /**
045     * Create an object representing a sublist of a dataset.
046     *
047     * @param dataIn is a list of consecutive objects from the dataset.
048     * @param totalSizeIn is the total number of matching rows available.
049     */
050    public PaginationResult(
051        Object[] dataIn,
052        long totalSizeIn)
053    {
054        this.data = dataIn;
055        this.totalSize = totalSizeIn;
056    }
057
058    /**
059     * Returns the number of items in the entire result.
060     *
061     * @return the total size of items.
062     */
063    public long getTotalSize()
064    {
065        return this.totalSize;
066    }
067
068    /**
069     * Sets the total size of this pagination's complete set.
070     *
071     * @param totalSizeIn the total size of objects contained in the complete set.
072     */
073    public void setTotalSize(long totalSizeIn)
074    {
075        this.totalSize = totalSizeIn;
076    }
077
078    /**
079     * Return the array of objects held by this pagination rules, which
080     * is a continuous subset of the full dataset.
081     * @return this.data
082     */
083    public Object[] getData()
084    {
085        return this.data;
086    }
087
088    /**
089     * Sets the data for this pagination result.
090     *
091     * @param dataIn the subset of paginated data.
092     */
093    public void setData(Object[] dataIn)
094    {
095        this.data = dataIn;
096    }
097}