Class AbstractUsageDAOImpl

  • All Implemented Interfaces:
    UsageDAO
    Direct Known Subclasses:
    UsageDAOImpl

    public abstract class AbstractUsageDAOImpl
    extends java.lang.Object
    implements UsageDAO
    Abstract implementation for Usage DAO.

    This provides basic services such as caching, but defers to the underlying implementation for CRUD operations for: alf_usage_delta

    Since:
    3.4
    Author:
    janv
    • Constructor Detail

      • AbstractUsageDAOImpl

        public AbstractUsageDAOImpl()
    • Method Detail

      • setNodeDAO

        public void setNodeDAO​(NodeDAO nodeDAO)
      • deleteDeltas

        public int deleteDeltas​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Description copied from interface: UsageDAO
        Delete usage deltas for given nodeRef
        Specified by:
        deleteDeltas in interface UsageDAO
        Parameters:
        nodeRef - NodeRef
        Returns:
        int
      • deleteDeltas

        public int deleteDeltas​(long nodeId)
        Description copied from interface: UsageDAO
        Delete usage deltas for given node entity id
        Specified by:
        deleteDeltas in interface UsageDAO
        Parameters:
        nodeId - long
        Returns:
        int
      • getTotalDeltaSize

        public long getTotalDeltaSize​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                      boolean removeDeltas)
        Description copied from interface: UsageDAO
        Get the total delta size for a node.
        Specified by:
        getTotalDeltaSize in interface UsageDAO
        Parameters:
        nodeRef - the node reference
        removeDeltas - true to remove the deltas before returning the result.
        Returns:
        sum of delta sizes (in bytes) - can be +ve or -ve
      • insertDelta

        public void insertDelta​(org.alfresco.service.cmr.repository.NodeRef usageNodeRef,
                                long deltaSize)
        Description copied from interface: UsageDAO
        Create a usage delta entry.
        Specified by:
        insertDelta in interface UsageDAO
        deltaSize - the size change
      • getUsageDeltaNodes

        public java.util.Set<org.alfresco.service.cmr.repository.NodeRef> getUsageDeltaNodes()
        Specified by:
        getUsageDeltaNodes in interface UsageDAO
      • getUserContentSizesForStore

        public void getUserContentSizesForStore​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                UsageDAO.MapHandler resultsCallback)
        Description copied from interface: UsageDAO
        New style content urls - Iterate and sum all content node sizes for user (owner/creator)
        Specified by:
        getUserContentSizesForStore in interface UsageDAO
        Parameters:
        storeRef - the store to search in
        resultsCallback - the callback to use while iterating over the content sizes (one row per user)
      • getUsersWithoutUsage

        public void getUsersWithoutUsage​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                         UsageDAO.MapHandler handler)
        Description copied from interface: UsageDAO
        Iterate over all person nodes to get users without a calculated usage
        Specified by:
        getUsersWithoutUsage in interface UsageDAO
        Parameters:
        storeRef - the store to search in
        handler - the callback to use while iterating over the people
      • getUsersWithUsage

        public void getUsersWithUsage​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                      UsageDAO.MapHandler handler)
        Description copied from interface: UsageDAO
        Iterate over all person nodes to get users with a calculated usage
        Specified by:
        getUsersWithUsage in interface UsageDAO
        Parameters:
        storeRef - the store to search in
        handler - the callback to use while iterating over the people
      • getContentSizeForStoreForUser

        public java.lang.Long getContentSizeForStoreForUser​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                            java.lang.String userName)
        Description copied from interface: UsageDAO
        Get user with a calculated usage
        Specified by:
        getContentSizeForStoreForUser in interface UsageDAO
        Parameters:
        storeRef - the store to search in
        userName - the username
        Returns:
        Returns ussage
      • selectTotalUsageDeltaSize

        protected abstract UsageDeltaEntity selectTotalUsageDeltaSize​(long nodeEntityId)
      • selectUsageDeltaNodes

        protected abstract java.util.List<java.lang.Long> selectUsageDeltaNodes()
      • selectUsersWithoutUsage

        protected abstract void selectUsersWithoutUsage​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                        UsageDAO.MapHandler handler)
      • selectUsersWithUsage

        protected abstract void selectUsersWithUsage​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                     UsageDAO.MapHandler handler)
      • selectUserContentSizesForStore

        protected abstract void selectUserContentSizesForStore​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                               UsageDAO.MapHandler resultsCallback)
      • selectContentSizeForStoreForUser

        protected abstract java.lang.Long selectContentSizeForStoreForUser​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                                           java.lang.String userName)
      • deleteUsageDeltaEntitiesByNodeId

        protected abstract int deleteUsageDeltaEntitiesByNodeId​(long nodeEntityId)