Package com.logicaldoc.enterprise
Class DocumentCounter
java.lang.Object
com.logicaldoc.enterprise.DocumentCounter
- All Implemented Interfaces:
com.logicaldoc.core.document.DocumentListener
public class DocumentCounter
extends Object
implements com.logicaldoc.core.document.DocumentListener
Listener that takes care about increasing/decreasing the documents counters
- Since:
- 6.9
- Author:
- Marco Meschieri - LogicalDOC
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterCheckin
(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction, Map<String, Object> dictionary) void
afterSaveHistory
(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory event, Map<String, Object> dictionary) void
afterStore
(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction, Map<String, Object> dictionary) void
beforeCheckin
(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction, Map<String, Object> dictionary) void
beforeStore
(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction, Map<String, Object> dictionary) static void
updateStatistics
(long tenantId, Long workspaceId, Long userId, boolean forceUpdate) Updates the quota statistics.static void
validateDocumentsQuota
(long tenantId, long userId, long workspaceId) Validates the respect of all the quotas(both docs number and store size) for tenant/workspace/userstatic void
validateMaxDocuments
(long tenantId, long workspaceId) Validate the max number of documents admissible for the given tenant/workspace.static void
validateMaxSize
(long tenantId, long workspaceId, long userId) Validate the max size admissible for the given tenant/workspace/user.
-
Field Details
-
WSDOCS
- See Also:
-
WSSIZE
- See Also:
-
REPODOCS
- See Also:
-
REPOSIZE
- See Also:
-
USERQUOTA
- See Also:
-
-
Constructor Details
-
DocumentCounter
public DocumentCounter()
-
-
Method Details
-
validateMaxDocuments
public static void validateMaxDocuments(long tenantId, long workspaceId) throws com.logicaldoc.core.PersistenceException Validate the max number of documents admissible for the given tenant/workspace. The whole system must be valid also.- Parameters:
tenantId
- identifier of the tenantworkspaceId
- identifier of the workspace- Throws:
com.logicaldoc.core.PersistenceException
- count over the maximum admitted by the license/quota
-
validateMaxSize
public static void validateMaxSize(long tenantId, long workspaceId, long userId) throws com.logicaldoc.core.PersistenceException Validate the max size admissible for the given tenant/workspace/user. The whole system must be valid also- Parameters:
tenantId
- identifier of the tenantworkspaceId
- identifier of the workspaceuserId
- identifier of the suer- Throws:
com.logicaldoc.core.PersistenceException
- count over the maximum admitted by the license/quota
-
validateDocumentsQuota
public static void validateDocumentsQuota(long tenantId, long userId, long workspaceId) throws com.logicaldoc.core.PersistenceException Validates the respect of all the quotas(both docs number and store size) for tenant/workspace/user- Parameters:
tenantId
- identifier of the tenantuserId
- identifier of the suerworkspaceId
- identifier of the workspace- Throws:
com.logicaldoc.core.PersistenceException
- count over the maximum admitted by the license/quota
-
afterCheckin
public void afterCheckin(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction, Map<String, Object> dictionary) throws com.logicaldoc.core.PersistenceException- Specified by:
afterCheckin
in interfacecom.logicaldoc.core.document.DocumentListener
- Throws:
com.logicaldoc.core.PersistenceException
-
afterStore
public void afterStore(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction, Map<String, Object> dictionary) throws com.logicaldoc.core.PersistenceException- Specified by:
afterStore
in interfacecom.logicaldoc.core.document.DocumentListener
- Throws:
com.logicaldoc.core.PersistenceException
-
beforeCheckin
public void beforeCheckin(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction, Map<String, Object> dictionary) throws com.logicaldoc.core.PersistenceException- Specified by:
beforeCheckin
in interfacecom.logicaldoc.core.document.DocumentListener
- Throws:
com.logicaldoc.core.PersistenceException
-
beforeStore
public void beforeStore(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction, Map<String, Object> dictionary) throws com.logicaldoc.core.PersistenceException- Specified by:
beforeStore
in interfacecom.logicaldoc.core.document.DocumentListener
- Throws:
com.logicaldoc.core.PersistenceException
-
updateStatistics
public static void updateStatistics(long tenantId, Long workspaceId, Long userId, boolean forceUpdate) Updates the quota statistics. The computation is done only if the last computation occurred after count.ttl hours after the actual date- Parameters:
tenantId
- identifier of the tenantworkspaceId
- identifier of the workspaceuserId
- identifier of the userforceUpdate
- if true the statistics are computed anyways
-
afterSaveHistory
public void afterSaveHistory(com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory event, Map<String, Object> dictionary) throws com.logicaldoc.core.PersistenceException- Specified by:
afterSaveHistory
in interfacecom.logicaldoc.core.document.DocumentListener
- Throws:
com.logicaldoc.core.PersistenceException
-