Package org.nuxeo.ecm.quota.size
Class DocumentsSizeUpdater
- java.lang.Object
-
- org.nuxeo.ecm.quota.AbstractQuotaStatsUpdater
-
- org.nuxeo.ecm.quota.size.DocumentsSizeUpdater
-
- All Implemented Interfaces:
QuotaStatsUpdater
public class DocumentsSizeUpdater extends AbstractQuotaStatsUpdater
QuotaStatsUpdatercounting space used by Blobs in document. This implementation does not track the space used by non-Blob properties.- Since:
- 8.3
-
-
Field Summary
Fields Modifier and Type Field Description static StringCLEAR_SCROLL_KEEP_ALIVE_PROPstatic StringCLEAR_SCROLL_SIZE_PROPstatic intDEFAULT_CLEAR_SCROLL_KEEP_ALIVEstatic intDEFAULT_CLEAR_SCROLL_SIZEstatic intDEFAULT_INIT_SCROLL_KEEP_ALIVEstatic intDEFAULT_INIT_SCROLL_SIZEstatic StringDISABLE_QUOTA_CHECK_LISTENERstatic StringINIT_SCROLL_KEEP_ALIVE_PROPstatic StringINIT_SCROLL_SIZE_PROPprotected static intTRANSACTION_TIMEOUT_SECONDSstatic StringUSER_WORKSPACES_ROOT-
Fields inherited from class org.nuxeo.ecm.quota.AbstractQuotaStatsUpdater
descriptionLabel, label, name
-
-
Constructor Summary
Constructors Constructor Description DocumentsSizeUpdater()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckQuota(CoreSession session, DocumentModel doc, long delta)Checks the size delta against the maximum quota specified for this document or an ancestor.protected voidclearQuotas(CoreSession session, String docID)voidcomputeInitialStatistics(CoreSession session, QuotaStatsInitialWork currentWorker, String path)Compute the initial statistics under the given path for thisQuotaStatsUpdater.protected List<Blob>getAllBlobs(DocumentModel doc)Returns the list of blobs for this document.protected longgetBlobsSize(DocumentModel doc)Gets the sum of all blobs sizes for this document.protected longgetVersionsSize(CoreSession session, DocumentModel doc)Gets the sum of all blobs sizes for all the document's versions.protected voidhandleQuotaExceeded(QuotaExceededException e, Event event)protected voidinitDocument(CoreSession session, DocumentModel doc)protected voidinitDocumentFromChildren(DocumentModel doc)protected booleanneedToProcessEventOnDocument(Event event, DocumentModel doc)protected voidprocessDocumentAboutToBeRemoved(CoreSession session, DocumentModel doc)protected voidprocessDocumentBeforeCheckedIn(CoreSession session, DocumentModel doc)protected voidprocessDocumentBeforeCheckedOut(CoreSession session, DocumentModel doc)protected voidprocessDocumentBeforeRestore(CoreSession session, DocumentModel doc)protected voidprocessDocumentBeforeUpdate(CoreSession session, DocumentModel doc)protected voidprocessDocumentCheckedIn(CoreSession session, DocumentModel doc)protected voidprocessDocumentCheckedOut(CoreSession session, DocumentModel doc)protected voidprocessDocumentCopied(CoreSession session, DocumentModel doc)protected voidprocessDocumentCreated(CoreSession session, DocumentModel doc)protected voidprocessDocumentMoved(CoreSession session, DocumentModel doc, DocumentModel sourceParent)protected voidprocessDocumentRestored(CoreSession session, DocumentModel doc)protected voidprocessDocumentTrashOp(CoreSession session, DocumentModel doc, boolean isTrashed)protected voidprocessDocumentUpdated(CoreSession session, DocumentModel doc)protected longscrollAndDo(CoreSession session, String query, int scrollSize, int scrollKeepAlive, BiConsumer<String,Long> consumer)protected voidupdateAncestors(CoreSession session, DocumentModel doc, long deltaTotal, long deltaTrash, long deltaVersions)protected voidupdateDocument(DocumentModel doc, long deltaInner, long deltaTotal, long deltaTrash, long deltaVersions)protected voidupdateDocument(DocumentModel doc, long deltaInner, long deltaTotal, long deltaTrash, long deltaVersions, boolean allowSave)protected voidupdateDocumentAndAncestors(CoreSession session, DocumentModel doc, long deltaInner, long deltaTotal, long deltaTrash, long deltaVersions)-
Methods inherited from class org.nuxeo.ecm.quota.AbstractQuotaStatsUpdater
getAncestors, getDescriptionLabel, getLabel, getName, setDescriptionLabel, setLabel, setName, updateStatistics
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.quota.QuotaStatsUpdater
computeInitialStatistics
-
-
-
-
Field Detail
-
DISABLE_QUOTA_CHECK_LISTENER
public static final String DISABLE_QUOTA_CHECK_LISTENER
- See Also:
- Constant Field Values
-
USER_WORKSPACES_ROOT
public static final String USER_WORKSPACES_ROOT
- See Also:
- Constant Field Values
-
CLEAR_SCROLL_SIZE_PROP
public static final String CLEAR_SCROLL_SIZE_PROP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
DEFAULT_CLEAR_SCROLL_SIZE
public static final int DEFAULT_CLEAR_SCROLL_SIZE
- Since:
- 11.1
- See Also:
- Constant Field Values
-
CLEAR_SCROLL_KEEP_ALIVE_PROP
public static final String CLEAR_SCROLL_KEEP_ALIVE_PROP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
DEFAULT_CLEAR_SCROLL_KEEP_ALIVE
public static final int DEFAULT_CLEAR_SCROLL_KEEP_ALIVE
- Since:
- 11.1
- See Also:
- Constant Field Values
-
INIT_SCROLL_SIZE_PROP
public static final String INIT_SCROLL_SIZE_PROP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
DEFAULT_INIT_SCROLL_SIZE
public static final int DEFAULT_INIT_SCROLL_SIZE
- Since:
- 11.1
- See Also:
- Constant Field Values
-
INIT_SCROLL_KEEP_ALIVE_PROP
public static final String INIT_SCROLL_KEEP_ALIVE_PROP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
DEFAULT_INIT_SCROLL_KEEP_ALIVE
public static final int DEFAULT_INIT_SCROLL_KEEP_ALIVE
- Since:
- 11.1
- See Also:
- Constant Field Values
-
TRANSACTION_TIMEOUT_SECONDS
protected static final int TRANSACTION_TIMEOUT_SECONDS
- Since:
- 2023.17
- See Also:
- Constant Field Values
-
-
Method Detail
-
computeInitialStatistics
public void computeInitialStatistics(CoreSession session, QuotaStatsInitialWork currentWorker, String path)
Description copied from interface:QuotaStatsUpdaterCompute the initial statistics under the given path for thisQuotaStatsUpdater.- Parameters:
session- an unrestrictedCoreSessionto be usedpath- the root of the recomputation, ornullfor the whole repository
-
scrollAndDo
protected long scrollAndDo(CoreSession session, String query, int scrollSize, int scrollKeepAlive, BiConsumer<String,Long> consumer)
-
clearQuotas
protected void clearQuotas(CoreSession session, String docID)
-
initDocument
protected void initDocument(CoreSession session, DocumentModel doc)
-
initDocumentFromChildren
protected void initDocumentFromChildren(DocumentModel doc)
-
handleQuotaExceeded
protected void handleQuotaExceeded(QuotaExceededException e, Event event)
- Specified by:
handleQuotaExceededin classAbstractQuotaStatsUpdater
-
processDocumentCreated
protected void processDocumentCreated(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentCreatedin classAbstractQuotaStatsUpdater
-
processDocumentCheckedIn
protected void processDocumentCheckedIn(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentCheckedInin classAbstractQuotaStatsUpdater
-
processDocumentBeforeCheckedIn
protected void processDocumentBeforeCheckedIn(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentBeforeCheckedInin classAbstractQuotaStatsUpdater
-
processDocumentCheckedOut
protected void processDocumentCheckedOut(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentCheckedOutin classAbstractQuotaStatsUpdater
-
processDocumentBeforeCheckedOut
protected void processDocumentBeforeCheckedOut(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentBeforeCheckedOutin classAbstractQuotaStatsUpdater
-
processDocumentUpdated
protected void processDocumentUpdated(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentUpdatedin classAbstractQuotaStatsUpdater
-
processDocumentBeforeUpdate
protected void processDocumentBeforeUpdate(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentBeforeUpdatein classAbstractQuotaStatsUpdater
-
processDocumentCopied
protected void processDocumentCopied(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentCopiedin classAbstractQuotaStatsUpdater
-
processDocumentMoved
protected void processDocumentMoved(CoreSession session, DocumentModel doc, DocumentModel sourceParent)
- Specified by:
processDocumentMovedin classAbstractQuotaStatsUpdater
-
processDocumentAboutToBeRemoved
protected void processDocumentAboutToBeRemoved(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentAboutToBeRemovedin classAbstractQuotaStatsUpdater
-
processDocumentTrashOp
protected void processDocumentTrashOp(CoreSession session, DocumentModel doc, boolean isTrashed)
- Specified by:
processDocumentTrashOpin classAbstractQuotaStatsUpdater
-
processDocumentBeforeRestore
protected void processDocumentBeforeRestore(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentBeforeRestorein classAbstractQuotaStatsUpdater
-
processDocumentRestored
protected void processDocumentRestored(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentRestoredin classAbstractQuotaStatsUpdater
-
needToProcessEventOnDocument
protected boolean needToProcessEventOnDocument(Event event, DocumentModel doc)
- Specified by:
needToProcessEventOnDocumentin classAbstractQuotaStatsUpdater
-
checkQuota
protected void checkQuota(CoreSession session, DocumentModel doc, long delta)
Checks the size delta against the maximum quota specified for this document or an ancestor.
-
getVersionsSize
protected long getVersionsSize(CoreSession session, DocumentModel doc)
Gets the sum of all blobs sizes for all the document's versions.
-
getBlobsSize
protected long getBlobsSize(DocumentModel doc)
Gets the sum of all blobs sizes for this document.
-
getAllBlobs
protected List<Blob> getAllBlobs(DocumentModel doc)
Returns the list of blobs for this document.
-
updateDocument
protected void updateDocument(DocumentModel doc, long deltaInner, long deltaTotal, long deltaTrash, long deltaVersions)
-
updateDocument
protected void updateDocument(DocumentModel doc, long deltaInner, long deltaTotal, long deltaTrash, long deltaVersions, boolean allowSave)
-
updateAncestors
protected void updateAncestors(CoreSession session, DocumentModel doc, long deltaTotal, long deltaTrash, long deltaVersions)
-
updateDocumentAndAncestors
protected void updateDocumentAndAncestors(CoreSession session, DocumentModel doc, long deltaInner, long deltaTotal, long deltaTrash, long deltaVersions)
-
-