001/*
002 * (C) Copyright 2006-2012 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     <a href="mailto:tdelprat@nuxeo.com">Tiry</a>
018 */
019
020package org.nuxeo.ecm.quota.size;
021
022import org.nuxeo.ecm.core.api.DocumentModel;
023
024/**
025 * Interface to manage DocumentModel that supports Quotas
026 *
027 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a>
028 * @since 5.6
029 */
030public interface QuotaAware {
031
032    long getInnerSize();
033
034    long getTotalSize();
035
036    long getTrashSize();
037
038    long getVersionsSize();
039
040    long getMaxQuota();
041
042    void addInnerSize(long additionalSize);
043
044    void addTotalSize(long additionalSize);
045
046    void addTrashSize(long additionalSize);
047
048    void addVersionsSize(long additionalSize);
049
050    void save();
051
052    DocumentModel getDoc();
053
054    void setMaxQuota(long maxSize);
055
056    void setMaxQuota(long maxSize, boolean skipValidation);
057
058    QuotaInfo getQuotaInfo();
059
060    void resetInfos();
061
062    /**
063     * Resets quota info but keeps the user-specified max quota size, if present.
064     *
065     * @since 10.1
066     */
067    void clearInfos();
068
069    /**
070     * Set all quota info.
071     *
072     * @since 10.1
073     */
074    void setAll(long innerSize, long totalSize, long trashSize, long versionsSize);
075
076}