Class NodeDAOImpl

    • Field Detail

      • dictionaryService

        protected org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService
    • Constructor Detail

      • NodeDAOImpl

        public NodeDAOImpl()
    • Method Detail

      • setSqlSessionTemplate

        public void setSqlSessionTemplate​(org.mybatis.spring.SqlSessionTemplate sqlSessionTemplate)
      • setQnameDAO

        public void setQnameDAO​(QNameDAO qnameDAO)
        Overrides:
        setQnameDAO in class AbstractNodeDAOImpl
        Parameters:
        qnameDAO - translates QName IDs into QName instances and vice-versa
      • setDictionaryService

        public void setDictionaryService​(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
        Overrides:
        setDictionaryService in class AbstractNodeDAOImpl
        Parameters:
        dictionaryService - the service help determine cm:auditable characteristics
      • startBatch

        public void startBatch()
        Description copied from interface: BatchingDAO
        Start a batch of insert or update commands
      • executeBatch

        public void executeBatch()
        Description copied from interface: BatchingDAO
        Write a batch of insert or update commands
      • insertTransaction

        protected java.lang.Long insertTransaction​(java.lang.Long serverId,
                                                   java.lang.String changeTxnId,
                                                   java.lang.Long commitTimeMs)
        Specified by:
        insertTransaction in class AbstractNodeDAOImpl
      • updateNodes

        protected int updateNodes​(java.lang.Long txnId,
                                  java.util.List<java.lang.Long> nodeIds)
        Specified by:
        updateNodes in class AbstractNodeDAOImpl
      • getMinNodeId

        public java.lang.Long getMinNodeId()
        Returns:
        Returns the minimum node id or 0 if there are no nodes
      • getMaxNodeId

        public java.lang.Long getMaxNodeId()
        Returns:
        Returns the maximum node id or 0 if there are no nodes
      • getNodeIdsIntervalForType

        public org.alfresco.util.Pair<java.lang.Long,​java.lang.Long> getNodeIdsIntervalForType​(org.alfresco.service.namespace.QName type,
                                                                                                     java.lang.Long startTxnTime,
                                                                                                     java.lang.Long endTxnTime)
        Description copied from interface: NodeDAO
        Returns the [minId, maxId] interval for nodes of a type, with the transaction time in the given window time.
        Parameters:
        type - the node type
        startTxnTime - the starting transaction time, null is allowed, case in which no minimum transaction time is considered
        endTxnTime - the end transaction time, null is allowed, case in which no maximum transaction time is considered
        Returns:
        the interval, as a pair
      • updatePrimaryChildrenSharedAclId

        protected void updatePrimaryChildrenSharedAclId​(java.lang.Long txnId,
                                                        java.lang.Long primaryParentNodeId,
                                                        java.lang.Long optionalOldSharedAlcIdInAdditionToNull,
                                                        java.lang.Long newSharedAlcId)
        Specified by:
        updatePrimaryChildrenSharedAclId in class AbstractNodeDAOImpl
      • selectNodesByUuids

        protected java.util.List<Node> selectNodesByUuids​(java.lang.Long storeId,
                                                          java.util.SortedSet<java.lang.String> uuids)
        Specified by:
        selectNodesByUuids in class AbstractNodeDAOImpl
      • selectNodePropertiesByTypes

        public java.util.List<NodePropertyEntity> selectNodePropertiesByTypes​(java.util.Set<org.alfresco.service.namespace.QName> qnames)
        Description copied from interface: NodeDAO
        Used by the re-encryptor to re-encrypt encryptable properties with a new encryption key.
      • selectNodePropertiesByDataType

        public java.util.List<NodePropertyEntity> selectNodePropertiesByDataType​(org.alfresco.service.namespace.QName dataType,
                                                                                 long minNodeId,
                                                                                 long maxNodeId)
        Description copied from interface: NodeDAO
        Select all node properties that are between two node IDs and of the given actual type
        Parameters:
        dataType - the actual, original type of the property, as given by one of the constants on DataTypeDefinition
        minNodeId - the minimum node ID (inclusive)
        maxNodeId - the maximum node ID (exclusive)
      • deleteNodeAspects

        protected int deleteNodeAspects​(java.lang.Long nodeId,
                                        java.util.Set<java.lang.Long> qnameIds)
        Specified by:
        deleteNodeAspects in class AbstractNodeDAOImpl
      • insertNodeAssoc

        protected java.lang.Long insertNodeAssoc​(java.lang.Long sourceNodeId,
                                                 java.lang.Long targetNodeId,
                                                 java.lang.Long assocTypeQNameId,
                                                 int assocIndex)
        Specified by:
        insertNodeAssoc in class AbstractNodeDAOImpl
      • deleteNodeAssoc

        protected int deleteNodeAssoc​(java.lang.Long sourceNodeId,
                                      java.lang.Long targetNodeId,
                                      java.lang.Long assocTypeQNameId)
        Specified by:
        deleteNodeAssoc in class AbstractNodeDAOImpl
      • updateChildAssocIndex

        protected int updateChildAssocIndex​(java.lang.Long parentNodeId,
                                            java.lang.Long childNodeId,
                                            org.alfresco.service.namespace.QName assocTypeQName,
                                            org.alfresco.service.namespace.QName assocQName,
                                            int index)
        Specified by:
        updateChildAssocIndex in class AbstractNodeDAOImpl
      • selectChildAssoc

        protected java.util.List<ChildAssocEntity> selectChildAssoc​(java.lang.Long parentNodeId,
                                                                    java.lang.Long childNodeId,
                                                                    org.alfresco.service.namespace.QName assocTypeQName,
                                                                    org.alfresco.service.namespace.QName assocQName)
        Specified by:
        selectChildAssoc in class AbstractNodeDAOImpl
      • selectChildAssocs

        protected void selectChildAssocs​(java.lang.Long parentNodeId,
                                         java.lang.Long childNodeId,
                                         org.alfresco.service.namespace.QName assocTypeQName,
                                         org.alfresco.service.namespace.QName assocQName,
                                         java.lang.Boolean isPrimary,
                                         java.lang.Boolean sameStore,
                                         NodeDAO.ChildAssocRefQueryCallback resultsCallback)
        Description copied from class: AbstractNodeDAOImpl
        Parameters are all optional except the parent node ID and the callback
        Specified by:
        selectChildAssocs in class AbstractNodeDAOImpl
      • selectChildAssocsWithoutNodeAssocsOfTypes

        public java.util.List<Node> selectChildAssocsWithoutNodeAssocsOfTypes​(java.lang.Long parentNodeId,
                                                                              java.lang.Long minNodeId,
                                                                              java.lang.Long maxNodeId,
                                                                              java.util.Set<org.alfresco.service.namespace.QName> assocTypeQNames)
        Parameters:
        parentNodeId - the parent node id
        minNodeId - the minimum node ID (inclusive), null for no limitation on the minimum value of the node id
        maxNodeId - the maximum node ID (exclusive), null for no limitation on the maximum value of the node id
        assocTypeQNames - the node associations to exclude, null for no filtering of the associations types
        Returns:
        list of child nodes
      • selectParentAssocs

        protected void selectParentAssocs​(java.lang.Long childNodeId,
                                          org.alfresco.service.namespace.QName assocTypeQName,
                                          org.alfresco.service.namespace.QName assocQName,
                                          java.lang.Boolean isPrimary,
                                          NodeDAO.ChildAssocRefQueryCallback resultsCallback)
        Description copied from class: AbstractNodeDAOImpl
        Parameters are all optional except the parent node ID and the callback
        Specified by:
        selectParentAssocs in class AbstractNodeDAOImpl
      • updatePrimaryParentAssocs

        protected int updatePrimaryParentAssocs​(java.lang.Long childNodeId,
                                                java.lang.Long parentNodeId,
                                                org.alfresco.service.namespace.QName assocTypeQName,
                                                org.alfresco.service.namespace.QName assocQName,
                                                java.lang.String childNodeName)
        Specified by:
        updatePrimaryParentAssocs in class AbstractNodeDAOImpl
      • moveNodeData

        protected void moveNodeData​(java.lang.Long fromNodeId,
                                    java.lang.Long toNodeId)
        Description copied from class: AbstractNodeDAOImpl
        Moves all node-linked data from one node to another. The source node will be left in an orphaned state and without any attached data other than the current transaction.
        Specified by:
        moveNodeData in class AbstractNodeDAOImpl
        Parameters:
        fromNodeId - the source node
        toNodeId - the target node
      • deleteSubscriptions

        protected void deleteSubscriptions​(java.lang.Long nodeId)
        The default implementation relies on ON DELETE CASCADE and the subscriptions avoiding deleted nodes - NoOp.
        Specified by:
        deleteSubscriptions in class AbstractNodeDAOImpl
      • selectTxns

        protected java.util.List<Transaction> selectTxns​(java.lang.Long fromTimeInclusive,
                                                         java.lang.Long toTimeExclusive,
                                                         java.lang.Integer count,
                                                         java.util.List<java.lang.Long> includeTxnIds,
                                                         java.util.List<java.lang.Long> excludeTxnIds,
                                                         java.lang.Long excludeServerId,
                                                         java.lang.Boolean ascending)
        Specified by:
        selectTxns in class AbstractNodeDAOImpl
      • selectTxnsUnused

        protected java.util.List<java.lang.Long> selectTxnsUnused​(java.lang.Long minTxnId,
                                                                  java.lang.Long maxCommitTime,
                                                                  java.lang.Integer count)
        Specified by:
        selectTxnsUnused in class AbstractNodeDAOImpl
      • deleteTxnsUnused

        public int deleteTxnsUnused​(long fromCommitTime,
                                    long toCommitTime)
        Description copied from interface: NodeDAO
        Remove unused transactions from commit time 'fromCommitTime' to commit time 'toCommitTime'
        Parameters:
        fromCommitTime - delete unused transactions from commit time
        toCommitTime - delete unused transactions to commit time
        Returns:
        int
      • countChildAssocsByParent

        public int countChildAssocsByParent​(java.lang.Long parentNodeId,
                                            boolean isPrimary)
        Description copied from interface: NodeDAO
        Counts the number of child associations directly under parentNodeId.
        Parameters:
        parentNodeId - the parent node id
        isPrimary - count just primary associations?
      • selectMinTxInNodeIdRange

        protected java.lang.Long selectMinTxInNodeIdRange​(java.lang.Long fromNodeId,
                                                          java.lang.Long toNodeId)
        Gets the minimum commit time from transactions including a node id in the range [fromNodeId:toNodeId]
        Specified by:
        selectMinTxInNodeIdRange in class AbstractNodeDAOImpl
        Parameters:
        fromNodeId - Initial node id
        toNodeId - Final node id
        Returns:
        minimum commit time
      • selectMaxTxInNodeIdRange

        protected java.lang.Long selectMaxTxInNodeIdRange​(java.lang.Long fromNodeId,
                                                          java.lang.Long toNodeId)
        Gets the maximum commit time from transactions including a node id in the range [fromNodeId:toNodeId]
        Specified by:
        selectMaxTxInNodeIdRange in class AbstractNodeDAOImpl
        Parameters:
        fromNodeId - Initial node id
        toNodeId - Final node id
        Returns:
        maximum commit time
      • selectNextTxCommitTime

        public java.lang.Long selectNextTxCommitTime​(java.lang.Long fromCommitTime)
        Gets the next commit time from [fromCommitTime]
        Specified by:
        selectNextTxCommitTime in class AbstractNodeDAOImpl
        Parameters:
        fromCommitTime - Initial commit time
        Returns:
        next commit time
      • getOneTxnsByCommitTimeDescending

        public java.util.List<Transaction> getOneTxnsByCommitTimeDescending​(java.lang.Long fromTimeInclusive,
                                                                            java.lang.Long toTimeExclusive,
                                                                            boolean remoteOnly)
        Get most recent transaction made in a given commit time range