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

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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/user
    static 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.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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 tenant
      workspaceId - 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 tenant
      workspaceId - identifier of the workspace
      userId - 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 tenant
      userId - identifier of the suer
      workspaceId - 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 interface com.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 interface com.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 interface com.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 interface com.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 tenant
      workspaceId - identifier of the workspace
      userId - identifier of the user
      forceUpdate - 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 interface com.logicaldoc.core.document.DocumentListener
      Throws:
      com.logicaldoc.core.PersistenceException