Class 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
    • Constructor Detail

      • DocumentCounter

        public DocumentCounter()
    • Method Detail

      • validateMaxDocuments

        public static void validateMaxDocuments​(long tenantId,
                                                long workspaceId)
                                         throws Exception
        Validate the max number of documents admissible for the given tenant/workspace/tenant. The whole system must be valid also.
        Parameters:
        tenantId - identifier of the tenant
        workspaceId - identifier of the workspace
        Throws:
        Exception - count over the maximum admitted by the license/quota
      • validateMaxSize

        public static void validateMaxSize​(long tenantId,
                                           long workspaceId,
                                           long userId)
                                    throws Exception
        Validate the max size admissible for the given tenant/workspace/user. The whole system must be valid also
        Parameters:
        tenantId - identifier of the tenant
        workspaceId - identifier of the workspace
        userId - identifier of the suer
        Throws:
        Exception - count over the maximum admitted by the license/quota
      • validateDocumentsQuota

        public static void validateDocumentsQuota​(long tenantId,
                                                  long userId,
                                                  long workspaceId)
                                           throws Exception
        Validates the respect of all the quotas(both docs number and storage size) for tenant/workspace/user
        Parameters:
        tenantId - identifier of the tenant
        workspaceId - identifier of the workspace
        userId - identifier of the suer
        Throws:
        Exception - 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 Exception
        Specified by:
        afterCheckin in interface com.logicaldoc.core.document.DocumentListener
        Throws:
        Exception
      • afterStore

        public void afterStore​(com.logicaldoc.core.document.Document document,
                               com.logicaldoc.core.document.DocumentHistory transaction,
                               Map<String,​Object> dictionary)
                        throws Exception
        Specified by:
        afterStore in interface com.logicaldoc.core.document.DocumentListener
        Throws:
        Exception
      • beforeCheckin

        public void beforeCheckin​(com.logicaldoc.core.document.Document document,
                                  com.logicaldoc.core.document.DocumentHistory transaction,
                                  Map<String,​Object> dictionary)
                           throws Exception
        Specified by:
        beforeCheckin in interface com.logicaldoc.core.document.DocumentListener
        Throws:
        Exception
      • beforeStore

        public void beforeStore​(com.logicaldoc.core.document.Document document,
                                com.logicaldoc.core.document.DocumentHistory transaction,
                                Map<String,​Object> dictionary)
                         throws Exception
        Specified by:
        beforeStore in interface com.logicaldoc.core.document.DocumentListener
        Throws:
        Exception
      • 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 tenant
        workspaceId - identifier of the workspace
        userId - identifier of the user
        forceUpdate - if true the statistics are computed anyways