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
QuotaStatsUpdater
counting 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 String
CLEAR_SCROLL_KEEP_ALIVE_PROP
static String
CLEAR_SCROLL_SIZE_PROP
static int
DEFAULT_CLEAR_SCROLL_KEEP_ALIVE
static int
DEFAULT_CLEAR_SCROLL_SIZE
static int
DEFAULT_INIT_SCROLL_KEEP_ALIVE
static int
DEFAULT_INIT_SCROLL_SIZE
static String
DISABLE_QUOTA_CHECK_LISTENER
static String
INIT_SCROLL_KEEP_ALIVE_PROP
static String
INIT_SCROLL_SIZE_PROP
protected static int
TRANSACTION_TIMEOUT_SECONDS
static String
USER_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 void
checkQuota(CoreSession session, DocumentModel doc, long delta)
Checks the size delta against the maximum quota specified for this document or an ancestor.protected void
clearQuotas(CoreSession session, String docID)
void
computeInitialStatistics(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 long
getBlobsSize(DocumentModel doc)
Gets the sum of all blobs sizes for this document.protected long
getVersionsSize(CoreSession session, DocumentModel doc)
Gets the sum of all blobs sizes for all the document's versions.protected void
handleQuotaExceeded(QuotaExceededException e, Event event)
protected void
initDocument(CoreSession session, DocumentModel doc)
protected void
initDocumentFromChildren(DocumentModel doc)
protected boolean
needToProcessEventOnDocument(Event event, DocumentModel doc)
protected void
processDocumentAboutToBeRemoved(CoreSession session, DocumentModel doc)
protected void
processDocumentBeforeCheckedIn(CoreSession session, DocumentModel doc)
protected void
processDocumentBeforeCheckedOut(CoreSession session, DocumentModel doc)
protected void
processDocumentBeforeRestore(CoreSession session, DocumentModel doc)
protected void
processDocumentBeforeUpdate(CoreSession session, DocumentModel doc)
protected void
processDocumentCheckedIn(CoreSession session, DocumentModel doc)
protected void
processDocumentCheckedOut(CoreSession session, DocumentModel doc)
protected void
processDocumentCopied(CoreSession session, DocumentModel doc)
protected void
processDocumentCreated(CoreSession session, DocumentModel doc)
protected void
processDocumentMoved(CoreSession session, DocumentModel doc, DocumentModel sourceParent)
protected void
processDocumentRestored(CoreSession session, DocumentModel doc)
protected void
processDocumentTrashOp(CoreSession session, DocumentModel doc, boolean isTrashed)
protected void
processDocumentUpdated(CoreSession session, DocumentModel doc)
protected long
scrollAndDo(CoreSession session, String query, int scrollSize, int scrollKeepAlive, BiConsumer<String,Long> consumer)
protected void
updateAncestors(CoreSession session, DocumentModel doc, long deltaTotal, long deltaTrash, long deltaVersions)
protected void
updateDocument(DocumentModel doc, long deltaInner, long deltaTotal, long deltaTrash, long deltaVersions)
protected void
updateDocument(DocumentModel doc, long deltaInner, long deltaTotal, long deltaTrash, long deltaVersions, boolean allowSave)
protected void
updateDocumentAndAncestors(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:QuotaStatsUpdater
Compute the initial statistics under the given path for thisQuotaStatsUpdater
.- Parameters:
session
- an unrestrictedCoreSession
to be usedpath
- the root of the recomputation, ornull
for 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:
handleQuotaExceeded
in classAbstractQuotaStatsUpdater
-
processDocumentCreated
protected void processDocumentCreated(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentCreated
in classAbstractQuotaStatsUpdater
-
processDocumentCheckedIn
protected void processDocumentCheckedIn(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentCheckedIn
in classAbstractQuotaStatsUpdater
-
processDocumentBeforeCheckedIn
protected void processDocumentBeforeCheckedIn(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentBeforeCheckedIn
in classAbstractQuotaStatsUpdater
-
processDocumentCheckedOut
protected void processDocumentCheckedOut(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentCheckedOut
in classAbstractQuotaStatsUpdater
-
processDocumentBeforeCheckedOut
protected void processDocumentBeforeCheckedOut(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentBeforeCheckedOut
in classAbstractQuotaStatsUpdater
-
processDocumentUpdated
protected void processDocumentUpdated(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentUpdated
in classAbstractQuotaStatsUpdater
-
processDocumentBeforeUpdate
protected void processDocumentBeforeUpdate(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentBeforeUpdate
in classAbstractQuotaStatsUpdater
-
processDocumentCopied
protected void processDocumentCopied(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentCopied
in classAbstractQuotaStatsUpdater
-
processDocumentMoved
protected void processDocumentMoved(CoreSession session, DocumentModel doc, DocumentModel sourceParent)
- Specified by:
processDocumentMoved
in classAbstractQuotaStatsUpdater
-
processDocumentAboutToBeRemoved
protected void processDocumentAboutToBeRemoved(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentAboutToBeRemoved
in classAbstractQuotaStatsUpdater
-
processDocumentTrashOp
protected void processDocumentTrashOp(CoreSession session, DocumentModel doc, boolean isTrashed)
- Specified by:
processDocumentTrashOp
in classAbstractQuotaStatsUpdater
-
processDocumentBeforeRestore
protected void processDocumentBeforeRestore(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentBeforeRestore
in classAbstractQuotaStatsUpdater
-
processDocumentRestored
protected void processDocumentRestored(CoreSession session, DocumentModel doc)
- Specified by:
processDocumentRestored
in classAbstractQuotaStatsUpdater
-
needToProcessEventOnDocument
protected boolean needToProcessEventOnDocument(Event event, DocumentModel doc)
- Specified by:
needToProcessEventOnDocument
in 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)
-
-