001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.asset.model;
016    
017    import com.liferay.portal.kernel.json.JSON;
018    
019    import java.io.Serializable;
020    
021    import java.util.List;
022    
023    /**
024     * @author Igor Spasic
025     */
026    public class AssetCategoryDisplay implements Serializable {
027    
028            public AssetCategoryDisplay() {
029            }
030    
031            public AssetCategoryDisplay(
032                    List<AssetCategory> categories, int total, int start, int end) {
033    
034                    _categories = categories;
035                    _total = total;
036                    _start = start;
037                    _end = end;
038            }
039    
040            public List<AssetCategory> getCategories() {
041                    return _categories;
042            }
043    
044            public int getEnd() {
045                    return _end;
046            }
047    
048            public int getPage() {
049                    if ((_end > 0) && (_start >= 0)) {
050                            return _end / (_end - _start);
051                    }
052    
053                    return 0;
054            }
055    
056            public int getStart() {
057                    return _start;
058            }
059    
060            public int getTotal() {
061                    return _total;
062            }
063    
064            public void setCategories(List<AssetCategory> categories) {
065                    _categories = categories;
066            }
067    
068            public void setEnd(int end) {
069                    _end = end;
070            }
071    
072            public void setStart(int start) {
073                    _start = start;
074            }
075    
076            public void setTotal(int total) {
077                    _total = total;
078            }
079    
080            @JSON
081            private List<AssetCategory> _categories;
082    
083            private int _end;
084            private int _start;
085            private int _total;
086    
087    }