001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: https://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: https://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.file.quota;
029
030import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
031import org.apache.commons.lang3.builder.ToStringStyle;
032
033/**
034 * Information about a folder's size.
035 */
036public class CmsFolderReportEntry {
037
038    /** The total sum of file sizes in the subtree starting at this folder. */
039    long m_treeSize;
040
041    /** The total sum of file sizs in the subtree starting at this folder, but excluding the contents of any other folders requested. */
042    long m_treeSizeExclusive;
043
044    /**
045     * Creates a new entry.
046     *
047     * @param treeSize the total tree size
048     * @param treeSizeExclusive the total tree size without any subtrees corresponding to folders that have also been requested in the report
049     */
050    public CmsFolderReportEntry(long treeSize, long treeSizeExclusive) {
051
052        m_treeSize = treeSize;
053        m_treeSizeExclusive = treeSizeExclusive;
054    }
055
056    /**
057     * Gets the total sum of file sizes in the subtree starting at this folder.
058     *
059     * @return the file size sum
060     */
061    public long getTreeSize() {
062
063        return m_treeSize;
064    }
065
066    /**
067     * Gets the total sum of file sizes in the subtree starting at this folder, but excluding the contents of other requested folders.
068     *
069     * @return the exclusive tree size
070     */
071    public long getTreeSizeExclusive() {
072
073        return m_treeSizeExclusive;
074    }
075
076    /**
077     * @see java.lang.Object#toString()
078     */
079    @Override
080    public String toString() {
081
082        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
083    }
084
085}