Class AbstractNodeDAOImpl

  • All Implemented Interfaces:
    BatchingDAO, NodeDAO, NodeBulkLoader
    Direct Known Subclasses:
    NodeDAOImpl

    public abstract class AbstractNodeDAOImpl
    extends java.lang.Object
    implements NodeDAO, BatchingDAO
    Abstract implementation for Node DAO.

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

    Since:
    3.4
    Author:
    Derek Hulley
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean isDebugEnabled  
      protected org.apache.commons.logging.Log logger  
      static java.lang.Long LONG_ZERO  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addNodeAspects​(java.lang.Long nodeId, java.util.Set<org.alfresco.service.namespace.QName> aspectQNames)  
      boolean addNodeProperties​(java.lang.Long nodeId, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties)  
      boolean addNodeProperty​(java.lang.Long nodeId, org.alfresco.service.namespace.QName qname, java.io.Serializable value)  
      void cacheNodes​(java.util.List<org.alfresco.service.cmr.repository.NodeRef> nodeRefs)
      Pre-cache data relevant to the given nodes.
      void cacheNodesById​(java.util.List<java.lang.Long> nodeIds)
      Pre-cache data relevant to the given nodes.
      void clear()
      FOR TESTING ONLY: Clears out node cache data
      void cycleCheck​(java.lang.Long nodeId)
      Potentially cheaper than evaluating all of a node's paths to check for child association cycles
      void deleteChildAssoc​(java.lang.Long assocId)  
      protected abstract int deleteChildAssocs​(java.util.List<java.lang.Long> ids)  
      void deleteNode​(java.lang.Long nodeId)
      Deletes the node and all entities.
      protected abstract int deleteNodeAspects​(java.lang.Long nodeId, java.util.Set<java.lang.Long> qnameIds)  
      protected abstract int deleteNodeAssoc​(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, java.lang.Long assocTypeQNameId)  
      protected abstract int deleteNodeAssocs​(java.util.List<java.lang.Long> ids)  
      protected abstract int deleteNodeById​(java.lang.Long nodeId)  
      protected abstract int deleteNodeProperties​(java.lang.Long nodeId, java.util.List<NodePropertyKey> propKeys)  
      protected abstract int deleteNodeProperties​(java.lang.Long nodeId, java.util.Set<java.lang.Long> qnameIds)  
      protected abstract int deleteNodesByCommitTime​(long fromTxnCommitTimeMs, long toTxnCommitTimeMs)  
      protected abstract void deleteSubscriptions​(java.lang.Long nodeId)  
      protected abstract int deleteTransaction​(java.lang.Long txnId)  
      boolean exists​(java.lang.Long nodeId)
      Find out if a node exists.
      boolean exists​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Find out if a node exists.
      boolean exists​(org.alfresco.service.cmr.repository.StoreRef storeRef)
      Find out if a store exists or not
      java.util.Set<org.alfresco.service.cmr.repository.NodeRef> getAllRootNodes​(org.alfresco.service.cmr.repository.StoreRef storeRef)  
      java.util.Set<java.lang.Long> getCachedAncestors​(java.util.List<java.lang.Long> nodeIds)
      Gets the current set of cached ancestors of the given list of nodes.
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssoc​(java.lang.Long assocId)
      Get a specific association
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssoc​(java.lang.Long parentNodeId, java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)
      Get a specific child association given all the determining data.
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssoc​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, java.lang.String childName)
      Checks a cache and then queries.
      void getChildAssocs​(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)
      Get the child associations of a given parent node, optionally filtering on association QName and association type QName.
      void getChildAssocs​(java.lang.Long parentNodeId, java.util.Set<org.alfresco.service.namespace.QName> assocTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      Get the child associations of a given parent node, optionally filtering on type QName.
      void getChildAssocs​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, java.util.Collection<java.lang.String> childNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      Get the child associations of a given parent node, filtering on type QName and the cm:name of the child nodes.
      void getChildAssocs​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, int maxResults, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      Gets the first n child associations of a given parent node, optionally filtering on association QName and association type QName.
      void getChildAssocsByChildTypes​(java.lang.Long parentNodeId, java.util.Set<org.alfresco.service.namespace.QName> childNodeTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)  
      void getChildAssocsByPropertyValue​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName propertyQName, java.io.Serializable value, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      Select children by property values
      void getChildAssocsWithoutParentAssocsOfType​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      Gets the set of child associations of a certain parent node without parent associations of a certain type to other nodes with the same parent! In effect the 'orphans' with respect to a certain association type.
      java.lang.Long getCurrentTransactionId​(boolean ensureNew)  
      java.lang.Long getMaxTxnCommitTime()  
      java.lang.Long getMaxTxnId()  
      java.lang.Long getMaxTxnIdByCommitTime​(long maxCommitTime)
      Retrieves the maximum transaction ID for which the commit time is less than the given time.
      java.lang.Long getMinTxnCommitTime()  
      java.lang.Long getMinTxnCommitTimeForDeletedNodes()  
      java.lang.Long getMinTxnId()  
      java.lang.Long getMinUnusedTxnCommitTime()  
      java.lang.Long getNodeAclId​(java.lang.Long nodeId)  
      java.util.Set<org.alfresco.service.namespace.QName> getNodeAspects​(java.lang.Long nodeId)  
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef> getNodeAssoc​(java.lang.Long assocId)  
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef> getNodeAssocOrNull​(java.lang.Long assocId)  
      java.util.Collection<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef>> getNodeAssocsToAndFrom​(java.lang.Long nodeId)  
      org.alfresco.service.cmr.repository.NodeRef.Status getNodeIdStatus​(java.lang.Long nodeId)
      Get the current status of the node, including deleted nodes.
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> getNodePair​(java.lang.Long nodeId)  
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> getNodePair​(org.alfresco.service.cmr.repository.NodeRef nodeRef)  
      java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> getNodeProperties​(java.lang.Long nodeId)  
      java.io.Serializable getNodeProperty​(java.lang.Long nodeId, org.alfresco.service.namespace.QName propertyQName)  
      org.alfresco.service.cmr.repository.NodeRef.Status getNodeRefStatus​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Get the current status of the node, including deleted nodes.
      void getNodesWithAspects​(java.util.Set<org.alfresco.service.namespace.QName> aspectQNames, java.lang.Long minNodeId, java.lang.Long maxNodeId, NodeDAO.NodeRefQueryCallback resultsCallback)
      Get nodes with aspects between the given ranges
      org.alfresco.service.namespace.QName getNodeType​(java.lang.Long nodeId)  
      void getParentAssocs​(java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, java.lang.Boolean isPrimary, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      Get the parent association of a given parent node, optionally filtering on association QName and association type QName.
      java.util.List<org.alfresco.service.cmr.repository.Path> getPaths​(org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> nodePair, boolean primaryOnly)
      Build the paths for a node.
      java.util.List<NodeIdAndAclId> getPrimaryChildrenAcls​(java.lang.Long nodeId)
      Fetch all primary child node IDs and corresponding ACL IDs.
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> getPrimaryParentAssoc​(java.lang.Long childNodeId)
      Finds the association between the node's primary parent and the node itself
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> getRootNode​(org.alfresco.service.cmr.repository.StoreRef storeRef)  
      protected java.lang.Long getServerId()
      Get the ID of the current server, or null if there is no ID for the current server and one can't be created.
      java.util.Collection<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef>> getSourceNodeAssocs​(java.lang.Long targetNodeId, org.alfresco.service.namespace.QName typeQName)  
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.StoreRef> getStore​(org.alfresco.service.cmr.repository.StoreRef storeRef)
      Get the ID-ref pair for a store
      java.util.List<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.StoreRef>> getStores()
      Fetch a list of all stores in the repository
      java.util.Collection<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef>> getTargetAssocsByPropertyValue​(java.lang.Long sourceNodeId, org.alfresco.service.namespace.QName typeQName, org.alfresco.service.namespace.QName propertyQName, java.io.Serializable propertyValue)
      Get target associations by type of the association, property name and value.
      java.util.Collection<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef>> getTargetNodeAssocs​(java.lang.Long sourceNodeId, org.alfresco.service.namespace.QName typeQName)  
      int getTransactionCount()  
      Transaction getTxnById​(java.lang.Long txnId)
      Retrieves a specific transaction.
      java.util.List<org.alfresco.service.cmr.repository.NodeRef.Status> getTxnChanges​(java.lang.Long txnId)  
      java.util.List<org.alfresco.service.cmr.repository.NodeRef.Status> getTxnChangesForStore​(org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.Long txnId)  
      java.util.List<Transaction> getTxnsByCommitTimeAscending​(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, int count, java.util.List<java.lang.Long> excludeTxnIds, boolean remoteOnly)
      Get all transactions in a given time range.
      java.util.List<Transaction> getTxnsByCommitTimeAscending​(java.util.List<java.lang.Long> includeTxnIds)
      Get a specific list of transactions ordered by commit time.
      java.util.List<Transaction> getTxnsByCommitTimeDescending​(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, int count, java.util.List<java.lang.Long> excludeTxnIds, boolean remoteOnly)
      Get all transactions in a given time range.
      java.util.List<java.lang.Long> getTxnsUnused​(java.lang.Long minTxnId, long maxCommitTime, int count)  
      boolean hasNodeAspect​(java.lang.Long nodeId, org.alfresco.service.namespace.QName aspectQName)  
      void init()  
      protected abstract java.lang.Long insertChildAssoc​(ChildAssocEntity assoc)  
      protected abstract java.lang.Long insertNode​(NodeEntity node)  
      protected abstract void insertNodeAspect​(java.lang.Long nodeId, java.lang.Long qnameId)  
      protected abstract java.lang.Long insertNodeAssoc​(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, java.lang.Long assocTypeQNameId, int assocIndex)  
      protected abstract void insertNodeProperties​(java.lang.Long nodeId, java.util.Map<NodePropertyKey,​NodePropertyValue> persistableProps)  
      protected abstract java.lang.Long insertServer​(java.lang.String ipAddress)  
      protected abstract java.lang.Long insertStore​(StoreEntity store)  
      protected abstract java.lang.Long insertTransaction​(java.lang.Long serverId, java.lang.String changeTxnId, java.lang.Long commit_time_ms)  
      boolean isInCurrentTxn​(java.lang.Long nodeId)  
      org.alfresco.util.Pair<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef>,​org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef>> moveNode​(java.lang.Long childNodeId, java.lang.Long newParentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)
      Update a node's primary association, giving it a new parent and new association parameters.
      protected abstract void moveNodeData​(java.lang.Long fromNodeId, java.lang.Long toNodeId)
      Moves all node-linked data from one node to another.
      void moveStore​(org.alfresco.service.cmr.repository.StoreRef oldStoreRef, org.alfresco.service.cmr.repository.StoreRef newStoreRef)
      Changes the old store reference to the new store reference.
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> newChildAssoc​(java.lang.Long parentNodeId, java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, java.lang.String childNodeName)
      Create a new child association.
      protected java.lang.Long newChildAssocInsert​(ChildAssocEntity assoc, org.alfresco.service.namespace.QName assocTypeQName, java.lang.String childNodeName)  
      protected java.lang.Long newChildAssocInsertImpl​(ChildAssocEntity assoc, org.alfresco.service.namespace.QName assocTypeQName, java.lang.String childNodeName)  
      ChildAssocEntity newNode​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.String uuid, org.alfresco.service.namespace.QName nodeTypeQName, java.util.Locale nodeLocale, java.lang.String childNodeName, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> auditableProperties)
      Create a new node.
      java.lang.Long newNodeAssoc​(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, org.alfresco.service.namespace.QName assocTypeQName, int assocIndex)
      Create a new association
      protected java.lang.Long newNodeImplInsert​(NodeEntity node)  
      org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> newStore​(org.alfresco.service.cmr.repository.StoreRef storeRef)
      Creates a unique store for the given protocol and identifier combination.
      int purgeNodes​(long fromTxnCommitTimeMs, long toTxnCommitTimeMs)
      Purge deleted nodes where their participating transactions are in-between the given time interval.
      void purgeTxn​(java.lang.Long txnId)  
      boolean removeNodeAspects​(java.lang.Long nodeId)  
      boolean removeNodeAspects​(java.lang.Long nodeId, java.util.Set<org.alfresco.service.namespace.QName> aspectQNames)  
      int removeNodeAssoc​(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, org.alfresco.service.namespace.QName assocTypeQName)
      Remove a specific node association
      int removeNodeAssocs​(java.util.List<java.lang.Long> ids)
      Remove all node associations of given IDs
      boolean removeNodeProperties​(java.lang.Long nodeId, java.util.Set<org.alfresco.service.namespace.QName> propertyQNames)  
      protected abstract java.util.List<StoreEntity> selectAllStores()  
      protected abstract ChildAssocEntity selectChildAssoc​(java.lang.Long assocId)  
      protected abstract 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)  
      protected abstract ChildAssocEntity selectChildAssoc​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, java.lang.String childName)  
      protected abstract 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)
      Parameters are all optional except the parent node ID and the callback
      protected abstract void selectChildAssocs​(java.lang.Long parentNodeId, java.util.Set<org.alfresco.service.namespace.QName> assocTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)  
      protected abstract void selectChildAssocs​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, java.util.Collection<java.lang.String> childNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)  
      protected abstract void selectChildAssocs​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, int maxResults, NodeDAO.ChildAssocRefQueryCallback resultsCallback)  
      protected abstract void selectChildAssocsByChildTypes​(java.lang.Long parentNodeId, java.util.Set<org.alfresco.service.namespace.QName> childNodeTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)  
      protected abstract void selectChildAssocsByPropertyValue​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName propertyQName, NodePropertyValue nodeValue, NodeDAO.ChildAssocRefQueryCallback resultsCallback)  
      protected abstract void selectChildAssocsWithoutParentAssocsOfType​(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, NodeDAO.ChildAssocRefQueryCallback resultsCallback)  
      protected abstract java.util.List<ChildAssocEntity> selectChildNodeIds​(java.lang.Long nodeId, java.lang.Boolean isPrimary, java.lang.Long minAssocIdInclusive, int maxResults)  
      protected abstract Transaction selectLastTxnBeforeCommitTime​(java.lang.Long maxCommitTime)  
      protected abstract java.lang.Long selectMaxTxnCommitTime()  
      protected abstract java.lang.Long selectMaxTxnId()  
      protected abstract java.lang.Long selectMinTxnCommitTime()  
      protected abstract java.lang.Long selectMinTxnCommitTimeForDeletedNodes()  
      protected abstract java.lang.Long selectMinTxnId()  
      protected abstract java.lang.Long selectMinUnusedTxnCommitTime()  
      protected abstract java.util.Map<NodeVersionKey,​java.util.Set<org.alfresco.service.namespace.QName>> selectNodeAspects​(java.util.Set<java.lang.Long> nodeIds)  
      protected abstract NodeAssocEntity selectNodeAssocById​(java.lang.Long assocId)  
      protected abstract int selectNodeAssocMaxIndex​(java.lang.Long sourceNodeId, java.lang.Long assocTypeQNameId)  
      protected abstract java.util.List<NodeAssocEntity> selectNodeAssocs​(java.lang.Long nodeId)  
      protected abstract java.util.List<NodeAssocEntity> selectNodeAssocsBySource​(java.lang.Long sourceNodeId, java.lang.Long typeQNameId)  
      protected abstract java.util.List<NodeAssocEntity> selectNodeAssocsBySourceAndPropertyValue​(java.lang.Long sourceNodeId, java.lang.Long typeQNameId, java.lang.Long propertyQNameId, NodePropertyValue nodeValue)  
      protected abstract java.util.List<NodeAssocEntity> selectNodeAssocsByTarget​(java.lang.Long targetNodeId, java.lang.Long typeQNameId)  
      protected abstract NodeEntity selectNodeById​(java.lang.Long id)  
      protected abstract NodeEntity selectNodeByNodeRef​(org.alfresco.service.cmr.repository.NodeRef nodeRef)  
      protected abstract java.util.Map<NodeVersionKey,​java.util.Map<NodePropertyKey,​NodePropertyValue>> selectNodeProperties​(java.lang.Long nodeId)  
      protected abstract java.util.Map<NodeVersionKey,​java.util.Map<NodePropertyKey,​NodePropertyValue>> selectNodeProperties​(java.lang.Long nodeId, java.util.Set<java.lang.Long> qnameIds)  
      protected abstract java.util.Map<NodeVersionKey,​java.util.Map<NodePropertyKey,​NodePropertyValue>> selectNodeProperties​(java.util.Set<java.lang.Long> nodeIds)  
      protected abstract java.util.List<Node> selectNodesByIds​(java.util.SortedSet<java.lang.Long> ids)  
      protected abstract java.util.List<Node> selectNodesByUuids​(java.lang.Long storeId, java.util.SortedSet<java.lang.String> uuids)  
      protected abstract void selectNodesWithAspects​(java.util.List<java.lang.Long> qnameIds, java.lang.Long minNodeId, java.lang.Long maxNodeId, NodeDAO.NodeRefQueryCallback resultsCallback)  
      protected abstract java.util.List<ChildAssocEntity> selectParentAssocs​(java.lang.Long childNodeId)  
      protected abstract 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)
      Parameters are all optional except the parent node ID and the callback
      protected abstract java.util.List<NodeIdAndAclId> selectPrimaryChildAcls​(java.lang.Long nodeId)  
      protected abstract java.util.List<ChildAssocEntity> selectPrimaryParentAssocs​(java.lang.Long childNodeId)
      No DB constraint, so multiple returned
      protected abstract ServerEntity selectServer​(java.lang.String ipAddress)  
      protected abstract StoreEntity selectStore​(org.alfresco.service.cmr.repository.StoreRef storeRef)  
      protected abstract NodeEntity selectStoreRootNode​(org.alfresco.service.cmr.repository.StoreRef storeRef)  
      protected abstract int selectTransactionCount()  
      protected abstract Transaction selectTxnById​(java.lang.Long txnId)  
      protected abstract java.util.List<NodeEntity> selectTxnChanges​(java.lang.Long txnId, java.lang.Long storeId)  
      protected abstract 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)  
      protected abstract java.util.List<java.lang.Long> selectTxnsUnused​(java.lang.Long minTxnId, java.lang.Long maxCommitTime, java.lang.Integer count)  
      void setAccessControlListDAO​(AccessControlListDAO accessControlListDAO)  
      void setAclDAO​(AclDAO aclDAO)  
      void setAllRootNodesCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.service.cmr.repository.StoreRef,​java.util.Set<org.alfresco.service.cmr.repository.NodeRef>> allRootNodesCache)
      Set the cache that maintains the extended Store root node data
      void setAspectsCache​(org.alfresco.repo.cache.SimpleCache<NodeVersionKey,​java.util.Set<org.alfresco.service.namespace.QName>> aspectsCache)
      Set the cache that maintains the Node QName IDs
      void setCachingThreshold​(int cachingThreshold)  
      void setCheckNodeConsistency()
      Transaction-scope setting to make the Node loader to guarantee the validity of all caches: some cache data will be reloaded; some cache data will be considered safe.
      int setChildAssocIndex​(java.lang.Long parentNodeId, java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, int index)
      Sets the association index ordering.
      void setChildAssocsUniqueName​(java.lang.Long childNodeId, java.lang.String childName)
      TODO: See about pulling automatic cm:name update logic into this DAO
      protected int setChildAssocsUniqueNameImpl​(java.lang.Long childNodeId, java.lang.String childName)  
      void setChildByNameCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.repo.domain.node.ChildByNameKey,​ChildAssocEntity> childByNameCache)
      Set the cache that maintains lookups by child cm:name
      void setContentDataDAO​(ContentDataDAO contentDataDAO)  
      void setControlDAO​(ControlDAO controlDAO)  
      void setDictionaryService​(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)  
      void setLocaleDAO​(LocaleDAO localeDAO)  
      boolean setModifiedDate​(java.lang.Long nodeId, java.util.Date modifiedDate)
      Pull the cm:modified up to the current time without changing any other cm:auditable properties.
      boolean setModifiedProperties​(java.lang.Long nodeId, java.util.Date modifiedDate, java.lang.String modifiedBy)
      Pull the cm:modified up to the current time without changing any other cm:auditable properties.
      void setNodeAclId​(java.lang.Long nodeId, java.lang.Long aclId)  
      void setNodeAssocIndex​(java.lang.Long id, int assocIndex)
      Update an existing assoc's index.
      boolean setNodeProperties​(java.lang.Long nodeId, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties)  
      void setNodesCache​(org.alfresco.repo.cache.SimpleCache<java.io.Serializable,​java.io.Serializable> cache)
      Set the cache that maintains node ID-NodeRef cross referencing data
      void setParentAssocsCacheLimitFactor​(int parentAssocsCacheLimitFactor)
      Sets the average number of parents expected per cache entry.
      void setParentAssocsCacheSize​(int parentAssocsCacheSize)
      Sets the maximum capacity of the parent assocs cache
      void setPolicyBehaviourFilter​(BehaviourFilter policyBehaviourFilter)  
      void setPrimaryChildrenSharedAclId​(java.lang.Long primaryParentNodeId, java.lang.Long optionalOldSharedAlcIdInAdditionToNull, java.lang.Long newSharedAclId)  
      void setPropertiesCache​(org.alfresco.repo.cache.SimpleCache<NodeVersionKey,​java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable>> propertiesCache)
      Set the cache that maintains the Node property values
      void setQnameDAO​(QNameDAO qnameDAO)  
      void setRootNodesCache​(org.alfresco.repo.cache.SimpleCache<java.io.Serializable,​java.io.Serializable> cache)
      Set the cache that maintains the Store root node data
      void setTransactionService​(TransactionService transactionService)  
      void setUsageDAO​(UsageDAO usageDAO)  
      int touchNodes​(java.lang.Long txnId, java.util.List<java.lang.Long> nodeIds)
      Update the transaction associated with a lust of nodes
      protected abstract int updateChildAssocIndex​(java.lang.Long parentNodeId, java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, int index)  
      protected abstract int updateChildAssocUniqueName​(java.lang.Long assocId, java.lang.String name)  
      protected int updateChildAssocUniqueNameImpl​(java.lang.Long childNodeId, java.lang.String childName)  
      boolean updateNode​(java.lang.Long nodeId, org.alfresco.service.namespace.QName nodeTypeQName, java.util.Locale nodeLocale)  
      protected abstract int updateNode​(NodeUpdateEntity nodeUpdate)  
      protected abstract int updateNodeAssoc​(java.lang.Long id, int assocIndex)  
      protected abstract int updateNodes​(java.lang.Long txnId, java.util.List<java.lang.Long> nodeIds)  
      protected abstract int updateNodesInStore​(java.lang.Long txnId, java.lang.Long storeId)  
      protected abstract void updatePrimaryChildrenSharedAclId​(java.lang.Long txnId, java.lang.Long primaryParentNodeId, java.lang.Long optionalOldSharedAlcIdInAdditionToNull, java.lang.Long newSharedAlcId)  
      protected abstract 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)  
      protected void updatePrimaryParentAssocs​(ChildAssocEntity primaryParentAssoc, Node newParentNode, Node childNode, java.lang.Long newChildNodeId, java.lang.String childNodeName, java.lang.Long oldParentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)  
      protected int updatePrimaryParentAssocsImpl​(ChildAssocEntity primaryParentAssoc, Node newParentNode, Node childNode, java.lang.Long newChildNodeId, java.lang.String childNodeName, java.lang.Long oldParentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)  
      protected abstract int updateStore​(StoreEntity store)  
      protected abstract int updateStoreRoot​(StoreEntity store)  
      protected abstract int updateTransaction​(java.lang.Long txnId, java.lang.Long commit_time_ms)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        protected org.apache.commons.logging.Log logger
      • isDebugEnabled

        protected final boolean isDebugEnabled
      • LONG_ZERO

        public static final java.lang.Long LONG_ZERO
    • Constructor Detail

      • AbstractNodeDAOImpl

        public AbstractNodeDAOImpl()
        Constructor. Set up various instance-specific members such as caches and locks.
    • Method Detail

      • setTransactionService

        public void setTransactionService​(TransactionService transactionService)
        Parameters:
        transactionService - the service to start post-txn processes
      • setDictionaryService

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

        public void setCachingThreshold​(int cachingThreshold)
      • setPolicyBehaviourFilter

        public void setPolicyBehaviourFilter​(BehaviourFilter policyBehaviourFilter)
        Parameters:
        policyBehaviourFilter - the service to determine the behaviour for cm:auditable and other inherent capabilities.
      • setAclDAO

        public void setAclDAO​(AclDAO aclDAO)
        Parameters:
        aclDAO - used to update permissions during certain operations
      • setAccessControlListDAO

        public void setAccessControlListDAO​(AccessControlListDAO accessControlListDAO)
        Parameters:
        accessControlListDAO - used to update ACL inheritance during node moves
      • setControlDAO

        public void setControlDAO​(ControlDAO controlDAO)
        Parameters:
        controlDAO - create Savepoints
      • setQnameDAO

        public void setQnameDAO​(QNameDAO qnameDAO)
        Parameters:
        qnameDAO - translates QName IDs into QName instances and vice-versa
      • setContentDataDAO

        public void setContentDataDAO​(ContentDataDAO contentDataDAO)
        Parameters:
        contentDataDAO - used to create and delete content references
      • setLocaleDAO

        public void setLocaleDAO​(LocaleDAO localeDAO)
        Parameters:
        localeDAO - used to handle MLText properties
      • setUsageDAO

        public void setUsageDAO​(UsageDAO usageDAO)
        Parameters:
        usageDAO - used to keep content usage calculations in line
      • setRootNodesCache

        public void setRootNodesCache​(org.alfresco.repo.cache.SimpleCache<java.io.Serializable,​java.io.Serializable> cache)
        Set the cache that maintains the Store root node data
        Parameters:
        cache - the cache
      • setAllRootNodesCache

        public void setAllRootNodesCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.service.cmr.repository.StoreRef,​java.util.Set<org.alfresco.service.cmr.repository.NodeRef>> allRootNodesCache)
        Set the cache that maintains the extended Store root node data
        Parameters:
        allRootNodesCache - the cache
      • setNodesCache

        public void setNodesCache​(org.alfresco.repo.cache.SimpleCache<java.io.Serializable,​java.io.Serializable> cache)
        Set the cache that maintains node ID-NodeRef cross referencing data
        Parameters:
        cache - the cache
      • setAspectsCache

        public void setAspectsCache​(org.alfresco.repo.cache.SimpleCache<NodeVersionKey,​java.util.Set<org.alfresco.service.namespace.QName>> aspectsCache)
        Set the cache that maintains the Node QName IDs
        Parameters:
        aspectsCache - the cache
      • setPropertiesCache

        public void setPropertiesCache​(org.alfresco.repo.cache.SimpleCache<NodeVersionKey,​java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable>> propertiesCache)
        Set the cache that maintains the Node property values
        Parameters:
        propertiesCache - the cache
      • setParentAssocsCacheSize

        public void setParentAssocsCacheSize​(int parentAssocsCacheSize)
        Sets the maximum capacity of the parent assocs cache
        Parameters:
        parentAssocsCacheSize - the cache size
      • setParentAssocsCacheLimitFactor

        public void setParentAssocsCacheLimitFactor​(int parentAssocsCacheLimitFactor)
        Sets the average number of parents expected per cache entry. This parameter is multiplied by the setParentAssocsCacheSize(int) parameter to compute a limit on the total number of cached parents, which will be proportional to the cache's memory usage. The cache will be pruned when this limit is exceeded to avoid excessive memory usage.
        Parameters:
        parentAssocsCacheLimitFactor - the parentAssocsCacheLimitFactor to set
      • setChildByNameCache

        public void setChildByNameCache​(org.alfresco.repo.cache.SimpleCache<org.alfresco.repo.domain.node.ChildByNameKey,​ChildAssocEntity> childByNameCache)
        Set the cache that maintains lookups by child cm:name
        Parameters:
        childByNameCache - the cache
      • init

        public void init()
      • getServerId

        protected java.lang.Long getServerId()
        Get the ID of the current server, or null if there is no ID for the current server and one can't be created.
      • getCurrentTransactionId

        public java.lang.Long getCurrentTransactionId​(boolean ensureNew)
        Specified by:
        getCurrentTransactionId in interface NodeDAO
        Parameters:
        ensureNew - true to ensure that a new transaction entry is created if the current transaction does not have one.
        Returns:
        Returns the ID of the current transaction entry or null if there have not been any modifications to nodes registered in the transaction and forceNew is false
      • getStore

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.StoreRef> getStore​(org.alfresco.service.cmr.repository.StoreRef storeRef)
        Description copied from interface: NodeDAO
        Get the ID-ref pair for a store
        Specified by:
        getStore in interface NodeDAO
        Returns:
        Returns the ID-reference pair for the store or null if it doesn't exist
      • getStores

        public java.util.List<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.StoreRef>> getStores()
        Description copied from interface: NodeDAO
        Fetch a list of all stores in the repository
        Specified by:
        getStores in interface NodeDAO
        Returns:
        Returns a list of stores
      • exists

        public boolean exists​(org.alfresco.service.cmr.repository.StoreRef storeRef)
        Description copied from interface: NodeDAO
        Find out if a store exists or not
        Specified by:
        exists in interface NodeDAO
        Parameters:
        storeRef - the store
        Returns:
        Returns true if the store exists otherwise false
      • getRootNode

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> getRootNode​(org.alfresco.service.cmr.repository.StoreRef storeRef)
        Specified by:
        getRootNode in interface NodeDAO
      • getAllRootNodes

        public java.util.Set<org.alfresco.service.cmr.repository.NodeRef> getAllRootNodes​(org.alfresco.service.cmr.repository.StoreRef storeRef)
        Specified by:
        getAllRootNodes in interface NodeDAO
      • newStore

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> newStore​(org.alfresco.service.cmr.repository.StoreRef storeRef)
        Description copied from interface: NodeDAO
        Creates a unique store for the given protocol and identifier combination. The root node is created with the "root" aspect.
        Specified by:
        newStore in interface NodeDAO
        Returns:
        Returns the root node, which is added automatically.
      • moveStore

        public void moveStore​(org.alfresco.service.cmr.repository.StoreRef oldStoreRef,
                              org.alfresco.service.cmr.repository.StoreRef newStoreRef)
        Description copied from interface: NodeDAO
        Changes the old store reference to the new store reference.
        Specified by:
        moveStore in interface NodeDAO
        Parameters:
        oldStoreRef - the existing store
        newStoreRef - the new store
      • exists

        public boolean exists​(java.lang.Long nodeId)
        Description copied from interface: NodeDAO
        Find out if a node exists. Unpurged deleted nodes do not count as they are the DAO's concern only.
        Specified by:
        exists in interface NodeDAO
        Parameters:
        nodeId - the potentially valid node ID
        Returns:
        Returns true if the node is present and undeleted
      • exists

        public boolean exists​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Description copied from interface: NodeDAO
        Find out if a node exists. Unpurged deleted nodes do not count as they are the DAO's concern only.
        Specified by:
        exists in interface NodeDAO
        Parameters:
        nodeRef - the potentially valid node reference
        Returns:
        Returns true if the node is present and undeleted
      • isInCurrentTxn

        public boolean isInCurrentTxn​(java.lang.Long nodeId)
        Specified by:
        isInCurrentTxn in interface NodeDAO
        Returns:
        Returns true if the node was last modified in the current transaction, otherwise false.
      • getNodeRefStatus

        public org.alfresco.service.cmr.repository.NodeRef.Status getNodeRefStatus​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Description copied from interface: NodeDAO
        Get the current status of the node, including deleted nodes.
        Specified by:
        getNodeRefStatus in interface NodeDAO
        Parameters:
        nodeRef - the node reference
        Returns:
        Returns the current status of the reference. This will only be null if the node never existed or has been purged following deletion.
      • getNodeIdStatus

        public org.alfresco.service.cmr.repository.NodeRef.Status getNodeIdStatus​(java.lang.Long nodeId)
        Description copied from interface: NodeDAO
        Get the current status of the node, including deleted nodes.
        Specified by:
        getNodeIdStatus in interface NodeDAO
        Parameters:
        nodeId - the node id
        Returns:
        Returns the current status of the reference. This will only be null if the node never existed or has been purged following deletion.
      • getNodePair

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> getNodePair​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Specified by:
        getNodePair in interface NodeDAO
      • getNodePair

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> getNodePair​(java.lang.Long nodeId)
        Specified by:
        getNodePair in interface NodeDAO
      • getNodeType

        public org.alfresco.service.namespace.QName getNodeType​(java.lang.Long nodeId)
        Specified by:
        getNodeType in interface NodeDAO
      • getNodeAclId

        public java.lang.Long getNodeAclId​(java.lang.Long nodeId)
        Specified by:
        getNodeAclId in interface NodeDAO
      • newNode

        public ChildAssocEntity newNode​(java.lang.Long parentNodeId,
                                        org.alfresco.service.namespace.QName assocTypeQName,
                                        org.alfresco.service.namespace.QName assocQName,
                                        org.alfresco.service.cmr.repository.StoreRef storeRef,
                                        java.lang.String uuid,
                                        org.alfresco.service.namespace.QName nodeTypeQName,
                                        java.util.Locale nodeLocale,
                                        java.lang.String childNodeName,
                                        java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> auditableProperties)
                                 throws org.alfresco.service.cmr.dictionary.InvalidTypeException
        Description copied from interface: NodeDAO
        Create a new node. Note that allowing the uuid to be assigned by passing in a null is more efficient.
        Specified by:
        newNode in interface NodeDAO
        Parameters:
        parentNodeId - the ID of the parent node (may not be null)
        assocTypeQName - the primary association (may not be null)
        assocQName - the association path (may not be null)
        storeRef - the store to which the node must belong
        uuid - the node store-unique identifier, or null to assign a GUID
        nodeTypeQName - the type of the node
        nodeLocale - the locale of the node
        childNodeName - the cm:name of the child node or null to use the node's UUID
        auditableProperties - a map containing any cm:auditable properties for the node
        Returns:
        Returns the details of the child association created
        Throws:
        org.alfresco.service.cmr.dictionary.InvalidTypeException - if the node type is invalid or if the node type is not a valid real node
      • newNodeImplInsert

        protected java.lang.Long newNodeImplInsert​(NodeEntity node)
      • moveNode

        public org.alfresco.util.Pair<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef>,​org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef>> moveNode​(java.lang.Long childNodeId,
                                                                                                                                                                                                                                                    java.lang.Long newParentNodeId,
                                                                                                                                                                                                                                                    org.alfresco.service.namespace.QName assocTypeQName,
                                                                                                                                                                                                                                                    org.alfresco.service.namespace.QName assocQName)
        Description copied from interface: NodeDAO
        Update a node's primary association, giving it a new parent and new association parameters.

        **NEW**: If the parent node's store differs from the child node's store, then a new child node's is created.

        Specified by:
        moveNode in interface NodeDAO
        Parameters:
        childNodeId - the child node that is moving
        newParentNodeId - the new parent node (may not be null)
        assocTypeQName - the new association type or null to keep the existing type
        assocQName - the new association qname or null to keep the existing name
        Returns:
        Returns the (first) new association reference and new child reference (second)
      • updatePrimaryParentAssocs

        protected void updatePrimaryParentAssocs​(ChildAssocEntity primaryParentAssoc,
                                                 Node newParentNode,
                                                 Node childNode,
                                                 java.lang.Long newChildNodeId,
                                                 java.lang.String childNodeName,
                                                 java.lang.Long oldParentNodeId,
                                                 org.alfresco.service.namespace.QName assocTypeQName,
                                                 org.alfresco.service.namespace.QName assocQName)
      • updatePrimaryParentAssocsImpl

        protected int updatePrimaryParentAssocsImpl​(ChildAssocEntity primaryParentAssoc,
                                                    Node newParentNode,
                                                    Node childNode,
                                                    java.lang.Long newChildNodeId,
                                                    java.lang.String childNodeName,
                                                    java.lang.Long oldParentNodeId,
                                                    org.alfresco.service.namespace.QName assocTypeQName,
                                                    org.alfresco.service.namespace.QName assocQName)
      • updateNode

        public boolean updateNode​(java.lang.Long nodeId,
                                  org.alfresco.service.namespace.QName nodeTypeQName,
                                  java.util.Locale nodeLocale)
        Specified by:
        updateNode in interface NodeDAO
        nodeTypeQName - the new type QName for the node or null to keep the existing one
        nodeLocale - the new locale for the node or null to keep the existing one
        Returns:
        true if any changes were made
      • touchNodes

        public int touchNodes​(java.lang.Long txnId,
                              java.util.List<java.lang.Long> nodeIds)
        Description copied from interface: NodeDAO
        Update the transaction associated with a lust of nodes
        Specified by:
        touchNodes in interface NodeDAO
        Parameters:
        txnId - - the tx id to set
        nodeIds - - the nodes to update
        Returns:
        the number of nodes touched
      • setNodeAclId

        public void setNodeAclId​(java.lang.Long nodeId,
                                 java.lang.Long aclId)
        Specified by:
        setNodeAclId in interface NodeDAO
      • setPrimaryChildrenSharedAclId

        public void setPrimaryChildrenSharedAclId​(java.lang.Long primaryParentNodeId,
                                                  java.lang.Long optionalOldSharedAlcIdInAdditionToNull,
                                                  java.lang.Long newSharedAclId)
        Specified by:
        setPrimaryChildrenSharedAclId in interface NodeDAO
      • deleteNode

        public void deleteNode​(java.lang.Long nodeId)
        Description copied from interface: NodeDAO
        Deletes the node and all entities. Note that the node entry will still exist and be associated with a live transaction.
        Specified by:
        deleteNode in interface NodeDAO
      • purgeNodes

        public int purgeNodes​(long fromTxnCommitTimeMs,
                              long toTxnCommitTimeMs)
        Description copied from interface: NodeDAO
        Purge deleted nodes where their participating transactions are in-between the given time interval.
        Specified by:
        purgeNodes in interface NodeDAO
        Parameters:
        fromTxnCommitTimeMs - from commit time
        toTxnCommitTimeMs - to commit time
        Returns:
        Returns the number of deleted nodes purged
      • getNodeProperties

        public java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> getNodeProperties​(java.lang.Long nodeId)
        Specified by:
        getNodeProperties in interface NodeDAO
      • getNodeProperty

        public java.io.Serializable getNodeProperty​(java.lang.Long nodeId,
                                                    org.alfresco.service.namespace.QName propertyQName)
        Specified by:
        getNodeProperty in interface NodeDAO
      • setNodeProperties

        public boolean setNodeProperties​(java.lang.Long nodeId,
                                         java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties)
        Specified by:
        setNodeProperties in interface NodeDAO
      • addNodeProperty

        public boolean addNodeProperty​(java.lang.Long nodeId,
                                       org.alfresco.service.namespace.QName qname,
                                       java.io.Serializable value)
        Specified by:
        addNodeProperty in interface NodeDAO
      • addNodeProperties

        public boolean addNodeProperties​(java.lang.Long nodeId,
                                         java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> properties)
        Specified by:
        addNodeProperties in interface NodeDAO
      • removeNodeProperties

        public boolean removeNodeProperties​(java.lang.Long nodeId,
                                            java.util.Set<org.alfresco.service.namespace.QName> propertyQNames)
        Specified by:
        removeNodeProperties in interface NodeDAO
      • setModifiedDate

        public boolean setModifiedDate​(java.lang.Long nodeId,
                                       java.util.Date modifiedDate)
        Description copied from interface: NodeDAO
        Pull the cm:modified up to the current time without changing any other cm:auditable properties. The change may be done in the current transaction or in a later transaction.
        Specified by:
        setModifiedDate in interface NodeDAO
        Parameters:
        nodeId - the node to change
        modifiedDate - the date to set for cm:modified
        Returns:
        Returns true if the cm:modified property was actually set
      • setModifiedProperties

        public boolean setModifiedProperties​(java.lang.Long nodeId,
                                             java.util.Date modifiedDate,
                                             java.lang.String modifiedBy)
        Description copied from interface: NodeDAO
        Pull the cm:modified up to the current time without changing any other cm:auditable properties. The change may be done in the current transaction or in a later transaction.
        Specified by:
        setModifiedProperties in interface NodeDAO
        Parameters:
        nodeId - the node to change
        modifiedDate - the date to set for cm:modified
        modifiedBy - the name to set for cm:modifier
        Returns:
        Returns true if the cm:modified and cm:modifier properties were actually set
      • getNodeAspects

        public java.util.Set<org.alfresco.service.namespace.QName> getNodeAspects​(java.lang.Long nodeId)
        Specified by:
        getNodeAspects in interface NodeDAO
      • hasNodeAspect

        public boolean hasNodeAspect​(java.lang.Long nodeId,
                                     org.alfresco.service.namespace.QName aspectQName)
        Specified by:
        hasNodeAspect in interface NodeDAO
      • addNodeAspects

        public boolean addNodeAspects​(java.lang.Long nodeId,
                                      java.util.Set<org.alfresco.service.namespace.QName> aspectQNames)
        Specified by:
        addNodeAspects in interface NodeDAO
      • removeNodeAspects

        public boolean removeNodeAspects​(java.lang.Long nodeId)
        Specified by:
        removeNodeAspects in interface NodeDAO
      • removeNodeAspects

        public boolean removeNodeAspects​(java.lang.Long nodeId,
                                         java.util.Set<org.alfresco.service.namespace.QName> aspectQNames)
        Specified by:
        removeNodeAspects in interface NodeDAO
      • getNodesWithAspects

        public void getNodesWithAspects​(java.util.Set<org.alfresco.service.namespace.QName> aspectQNames,
                                        java.lang.Long minNodeId,
                                        java.lang.Long maxNodeId,
                                        NodeDAO.NodeRefQueryCallback resultsCallback)
        Description copied from interface: NodeDAO
        Get nodes with aspects between the given ranges
        Specified by:
        getNodesWithAspects in interface NodeDAO
        Parameters:
        aspectQNames - the aspects that must be on the nodes
        minNodeId - the minimum node ID (inclusive)
        maxNodeId - the maximum node ID (exclusive)
        resultsCallback - callback to process results
      • newNodeAssoc

        public java.lang.Long newNodeAssoc​(java.lang.Long sourceNodeId,
                                           java.lang.Long targetNodeId,
                                           org.alfresco.service.namespace.QName assocTypeQName,
                                           int assocIndex)
        Description copied from interface: NodeDAO
        Create a new association
        Specified by:
        newNodeAssoc in interface NodeDAO
        Parameters:
        sourceNodeId - the association source
        targetNodeId - the association target
        assocTypeQName - the type of the association (will be resolved to an ID)
        assocIndex - the index of the new association (-1 indicates next value)
      • setNodeAssocIndex

        public void setNodeAssocIndex​(java.lang.Long id,
                                      int assocIndex)
        Description copied from interface: NodeDAO
        Update an existing assoc's index.
        Specified by:
        setNodeAssocIndex in interface NodeDAO
        Parameters:
        id - the association ID
        assocIndex - the new index (greater than 0)
      • removeNodeAssoc

        public int removeNodeAssoc​(java.lang.Long sourceNodeId,
                                   java.lang.Long targetNodeId,
                                   org.alfresco.service.namespace.QName assocTypeQName)
        Description copied from interface: NodeDAO
        Remove a specific node association
        Specified by:
        removeNodeAssoc in interface NodeDAO
        Parameters:
        sourceNodeId - the source node ID
        targetNodeId - the target node id
        assocTypeQName - the node association QName
        Returns:
        Returns the number of associations removed
      • removeNodeAssocs

        public int removeNodeAssocs​(java.util.List<java.lang.Long> ids)
        Description copied from interface: NodeDAO
        Remove all node associations of given IDs
        Specified by:
        removeNodeAssocs in interface NodeDAO
        Parameters:
        ids - the IDs of the associations to remove
        Returns:
        Returns the number of associations removed
      • getNodeAssocsToAndFrom

        public java.util.Collection<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef>> getNodeAssocsToAndFrom​(java.lang.Long nodeId)
        Specified by:
        getNodeAssocsToAndFrom in interface NodeDAO
        Parameters:
        nodeId - the source or target of the associations
        Returns:
        Returns all the node associations where the node is the source or target
      • getSourceNodeAssocs

        public java.util.Collection<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef>> getSourceNodeAssocs​(java.lang.Long targetNodeId,
                                                                                                                                                         org.alfresco.service.namespace.QName typeQName)
        Specified by:
        getSourceNodeAssocs in interface NodeDAO
        Parameters:
        targetNodeId - the target of the association
        typeQName - the type of the association (optional)
        Returns:
        Returns all the node associations where the node is the target
      • getTargetNodeAssocs

        public java.util.Collection<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef>> getTargetNodeAssocs​(java.lang.Long sourceNodeId,
                                                                                                                                                         org.alfresco.service.namespace.QName typeQName)
        Specified by:
        getTargetNodeAssocs in interface NodeDAO
        Parameters:
        sourceNodeId - the source of the association
        typeQName - the type of the association (optional)
        Returns:
        Returns all the node associations where the node is the source
      • getTargetAssocsByPropertyValue

        public java.util.Collection<org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef>> getTargetAssocsByPropertyValue​(java.lang.Long sourceNodeId,
                                                                                                                                                                    org.alfresco.service.namespace.QName typeQName,
                                                                                                                                                                    org.alfresco.service.namespace.QName propertyQName,
                                                                                                                                                                    java.io.Serializable propertyValue)
        Description copied from interface: NodeDAO
        Get target associations by type of the association, property name and value.
        Specified by:
        getTargetAssocsByPropertyValue in interface NodeDAO
        Parameters:
        sourceNodeId - the source of the association
        typeQName - the type of the association (null allowed)
        propertyQName - property QName (null allowed)
        propertyValue - property value (null allowed only if the propertyQName is null)
        Returns:
        Returns all the node associations where the node is the source.
      • getNodeAssocOrNull

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef> getNodeAssocOrNull​(java.lang.Long assocId)
        Specified by:
        getNodeAssocOrNull in interface NodeDAO
        Returns:
        Returns a specific node association with the given ID or null if it doesn't exist
      • getNodeAssoc

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.AssociationRef> getNodeAssoc​(java.lang.Long assocId)
        Specified by:
        getNodeAssoc in interface NodeDAO
        Returns:
        Returns a specific node association with the given ID
      • newChildAssocInsert

        protected java.lang.Long newChildAssocInsert​(ChildAssocEntity assoc,
                                                     org.alfresco.service.namespace.QName assocTypeQName,
                                                     java.lang.String childNodeName)
      • newChildAssocInsertImpl

        protected java.lang.Long newChildAssocInsertImpl​(ChildAssocEntity assoc,
                                                         org.alfresco.service.namespace.QName assocTypeQName,
                                                         java.lang.String childNodeName)
      • newChildAssoc

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> newChildAssoc​(java.lang.Long parentNodeId,
                                                                                                                                  java.lang.Long childNodeId,
                                                                                                                                  org.alfresco.service.namespace.QName assocTypeQName,
                                                                                                                                  org.alfresco.service.namespace.QName assocQName,
                                                                                                                                  java.lang.String childNodeName)
        Description copied from interface: NodeDAO
        Create a new child association. The unique enforcement for cm:name will be done as part of the association creation i.e. there is no need to update it after the fact.
        Specified by:
        newChildAssoc in interface NodeDAO
        childNodeName - the cm:name to apply to the association
        Returns:
        Returns the persisted and filled association's ID
      • deleteChildAssoc

        public void deleteChildAssoc​(java.lang.Long assocId)
        Specified by:
        deleteChildAssoc in interface NodeDAO
        Parameters:
        assocId - the ID of the child association to delete
      • setChildAssocIndex

        public int setChildAssocIndex​(java.lang.Long parentNodeId,
                                      java.lang.Long childNodeId,
                                      org.alfresco.service.namespace.QName assocTypeQName,
                                      org.alfresco.service.namespace.QName assocQName,
                                      int index)
        Description copied from interface: NodeDAO
        Sets the association index ordering.
        Specified by:
        setChildAssocIndex in interface NodeDAO
        Parameters:
        parentNodeId - the parent node ID
        childNodeId - the child node ID
        assocTypeQName - the association type
        assocQName - the association path qualified name
        index - the new index
        Returns:
        Returns the number of associations modified
      • setChildAssocsUniqueName

        public void setChildAssocsUniqueName​(java.lang.Long childNodeId,
                                             java.lang.String childName)
        TODO: See about pulling automatic cm:name update logic into this DAO
        Specified by:
        setChildAssocsUniqueName in interface NodeDAO
        Parameters:
        childNodeId - the child node who's name is changing
        childName - the new cm:name value
      • setChildAssocsUniqueNameImpl

        protected int setChildAssocsUniqueNameImpl​(java.lang.Long childNodeId,
                                                   java.lang.String childName)
      • updateChildAssocUniqueNameImpl

        protected int updateChildAssocUniqueNameImpl​(java.lang.Long childNodeId,
                                                     java.lang.String childName)
      • getChildAssoc

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssoc​(java.lang.Long assocId)
        Description copied from interface: NodeDAO
        Get a specific association
        Specified by:
        getChildAssoc in interface NodeDAO
        Parameters:
        assocId - the ID of the association
        Returns:
        Returns the association reference or null if it doesn't exist
      • getPrimaryChildrenAcls

        public java.util.List<NodeIdAndAclId> getPrimaryChildrenAcls​(java.lang.Long nodeId)
        Description copied from interface: NodeDAO
        Fetch all primary child node IDs and corresponding ACL IDs.
        Specified by:
        getPrimaryChildrenAcls in interface NodeDAO
        Parameters:
        nodeId - the parent node ID
        Returns:
        Returns a list of Node ID - ACL ID pairs
      • getChildAssoc

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssoc​(java.lang.Long parentNodeId,
                                                                                                                                  java.lang.Long childNodeId,
                                                                                                                                  org.alfresco.service.namespace.QName assocTypeQName,
                                                                                                                                  org.alfresco.service.namespace.QName assocQName)
        Description copied from interface: NodeDAO
        Get a specific child association given all the determining data.

        The implementation may find multiple entries (there is no constraint to prevent it) although the cm:name constraint will normally prevent the association from being created twice. The lowest ID association will always be returned and the others will be cleaned up if the transaction is read-write.

        Specified by:
        getChildAssoc in interface NodeDAO
        Returns:
        Returns a matching association or null if one was not found.
      • getChildAssocs

        public void getChildAssocs​(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 interface: NodeDAO
        Get the child associations of a given parent node, optionally filtering on association QName and association type QName.

        This is an efficient query for node paths.

        Specified by:
        getChildAssocs in interface NodeDAO
        Parameters:
        parentNodeId - the parent node ID
        childNodeId - the child node ID to filter on; null for no filtering
        assocTypeQName - the association type qname to filter on; null for no filtering
        assocQName - the association qname to filter on; null for no filtering
        isPrimary - filter for primary (true) or secondary associations; null for no filtering.
        sameStore - null to ignore, true to only get children that are in the same store as the parent, or false to only get children that are in a different store from the parent.
        resultsCallback - the callback that will be called with the results
      • getChildAssocs

        public void getChildAssocs​(java.lang.Long parentNodeId,
                                   org.alfresco.service.namespace.QName assocTypeQName,
                                   org.alfresco.service.namespace.QName assocQName,
                                   int maxResults,
                                   NodeDAO.ChildAssocRefQueryCallback resultsCallback)
        Description copied from interface: NodeDAO
        Gets the first n child associations of a given parent node, optionally filtering on association QName and association type QName.

        This is an efficient query for node paths.

        Specified by:
        getChildAssocs in interface NodeDAO
        Parameters:
        parentNodeId - the parent node ID
        assocTypeQName - the association type qname to filter on; null for no filtering
        assocQName - the association qname to filter on; null for no filtering
        maxResults - the maximum number of results to return. The query will be terminated efficiently after that number of results
        resultsCallback - the callback that will be called with the results
      • getChildAssocs

        public void getChildAssocs​(java.lang.Long parentNodeId,
                                   java.util.Set<org.alfresco.service.namespace.QName> assocTypeQNames,
                                   NodeDAO.ChildAssocRefQueryCallback resultsCallback)
        Description copied from interface: NodeDAO
        Get the child associations of a given parent node, optionally filtering on type QName.
        Specified by:
        getChildAssocs in interface NodeDAO
        Parameters:
        parentNodeId - the parent node ID
        assocTypeQNames - the association type qnames to filter on; null for no filtering
        resultsCallback - the callback that will be called with the results
      • getChildAssoc

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssoc​(java.lang.Long parentNodeId,
                                                                                                                                  org.alfresco.service.namespace.QName assocTypeQName,
                                                                                                                                  java.lang.String childName)
        Checks a cache and then queries.

        Note: If we were to cach misses, then we would have to ensure that the cache is kept up to date whenever any affection association is changed. This is actually not possible without forcing the cache to be fully clustered. So to avoid clustering the cache, we instead watch the node child version, which relies on a cache that is already clustered.

        Specified by:
        getChildAssoc in interface NodeDAO
        Parameters:
        parentNodeId - the parent Node ID
        assocTypeQName - the association type to filter on
        childName - the cm:name value to filter on
        Returns:
        Returns an association matching the given parent, type and child name (cm:name) - or null if not found
      • getChildAssocs

        public void getChildAssocs​(java.lang.Long parentNodeId,
                                   org.alfresco.service.namespace.QName assocTypeQName,
                                   java.util.Collection<java.lang.String> childNames,
                                   NodeDAO.ChildAssocRefQueryCallback resultsCallback)
        Description copied from interface: NodeDAO
        Get the child associations of a given parent node, filtering on type QName and the cm:name of the child nodes.

        NOTE: This method only works if the association type fundamentally supports unique-name enforcement.

        Specified by:
        getChildAssocs in interface NodeDAO
        Parameters:
        parentNodeId - the parent node
        assocTypeQName - the type of the association to check; or null for no filtering. If the association type is not specified, then the same child node may be included several times.
        childNames - the names of the child nodes (cm:name). These will be matched exactly.
        resultsCallback - the callback that will be called with the results
      • getChildAssocsByPropertyValue

        public void getChildAssocsByPropertyValue​(java.lang.Long parentNodeId,
                                                  org.alfresco.service.namespace.QName propertyQName,
                                                  java.io.Serializable value,
                                                  NodeDAO.ChildAssocRefQueryCallback resultsCallback)
        Description copied from interface: NodeDAO
        Select children by property values
        Specified by:
        getChildAssocsByPropertyValue in interface NodeDAO
      • getChildAssocsWithoutParentAssocsOfType

        public void getChildAssocsWithoutParentAssocsOfType​(java.lang.Long parentNodeId,
                                                            org.alfresco.service.namespace.QName assocTypeQName,
                                                            NodeDAO.ChildAssocRefQueryCallback resultsCallback)
        Description copied from interface: NodeDAO
        Gets the set of child associations of a certain parent node without parent associations of a certain type to other nodes with the same parent! In effect the 'orphans' with respect to a certain association type.
        Specified by:
        getChildAssocsWithoutParentAssocsOfType in interface NodeDAO
        Parameters:
        parentNodeId - the parent node ID
        assocTypeQName - the association type QName
        resultsCallback - the callback that will be called with the results
      • getPrimaryParentAssoc

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ChildAssociationRef> getPrimaryParentAssoc​(java.lang.Long childNodeId)
        Description copied from interface: NodeDAO
        Finds the association between the node's primary parent and the node itself
        Specified by:
        getPrimaryParentAssoc in interface NodeDAO
        Returns:
        Returns the primary (defining) association or null if it is a root node
      • getParentAssocs

        public void getParentAssocs​(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 interface: NodeDAO
        Get the parent association of a given parent node, optionally filtering on association QName and association type QName.

        This is an efficient query for node paths.

        Specified by:
        getParentAssocs in interface NodeDAO
        Parameters:
        childNodeId - the child node ID
        assocTypeQName - the association type qname to filter on; null for no filtering
        assocQName - the association qname to filter on; null for no filtering
        isPrimary - filter for primary (true) or secondary associations; null for no filtering.
        resultsCallback - the callback that will be called with the results
      • cycleCheck

        public void cycleCheck​(java.lang.Long nodeId)
        Potentially cheaper than evaluating all of a node's paths to check for child association cycles

        TODO: When is it cheaper to go up and when is it cheaper to go down? Look at using direct queries to pass through layers both up and down.

        Specified by:
        cycleCheck in interface NodeDAO
        Parameters:
        nodeId - the node to start with
      • getPaths

        public java.util.List<org.alfresco.service.cmr.repository.Path> getPaths​(org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.NodeRef> nodePair,
                                                                                 boolean primaryOnly)
                                                                          throws org.alfresco.service.cmr.repository.InvalidNodeRefException
        Description copied from interface: NodeDAO
        Build the paths for a node. When searching for primaryOnly == true, checks that there is exactly one path.
        Specified by:
        getPaths in interface NodeDAO
        Parameters:
        nodePair - the leave or child node to start with
        primaryOnly - true to follow only primary parent associations
        Throws:
        org.alfresco.service.cmr.repository.InvalidNodeRefException
      • setCheckNodeConsistency

        public void setCheckNodeConsistency()
        Description copied from interface: NodeBulkLoader
        Transaction-scope setting to make the Node loader to guarantee the validity of all caches: some cache data will be reloaded; some cache data will be considered safe.
        Specified by:
        setCheckNodeConsistency in interface NodeBulkLoader
      • getCachedAncestors

        public java.util.Set<java.lang.Long> getCachedAncestors​(java.util.List<java.lang.Long> nodeIds)
        Description copied from interface: NodeBulkLoader
        Gets the current set of cached ancestors of the given list of nodes.
        Specified by:
        getCachedAncestors in interface NodeBulkLoader
        Parameters:
        nodeIds - a list of node IDs to visit
        Returns:
        the current set of cached ancestors of the given list of nodes, including the nodes themselves.
      • cacheNodesById

        public void cacheNodesById​(java.util.List<java.lang.Long> nodeIds)
        Description copied from interface: NodeBulkLoader
        Pre-cache data relevant to the given nodes. There is no need to split the collection up before calling this method; it is up to the implementations to ensure that batching is done where necessary.
        Specified by:
        cacheNodesById in interface NodeBulkLoader
        Parameters:
        nodeIds - the nodes that will be cached.
      • cacheNodes

        public void cacheNodes​(java.util.List<org.alfresco.service.cmr.repository.NodeRef> nodeRefs)
        Pre-cache data relevant to the given nodes. There is no need to split the collection up before calling this method; it is up to the implementations to ensure that batching is done where necessary.

        Loads properties, aspects, parent associations and the ID-noderef cache.

        Specified by:
        cacheNodes in interface NodeBulkLoader
        Parameters:
        nodeRefs - the nodes that will be cached.
      • clear

        public void clear()
        FOR TESTING ONLY: Clears out node cache data

        Simply clears out all the node-related caches.

        Specified by:
        clear in interface NodeBulkLoader
      • getMaxTxnIdByCommitTime

        public java.lang.Long getMaxTxnIdByCommitTime​(long maxCommitTime)
        Description copied from interface: NodeDAO
        Retrieves the maximum transaction ID for which the commit time is less than the given time.
        Specified by:
        getMaxTxnIdByCommitTime in interface NodeDAO
        Parameters:
        maxCommitTime - the max commit time (ms)
        Returns:
        the last transaction on or before the given time
      • getTxnById

        public Transaction getTxnById​(java.lang.Long txnId)
        Description copied from interface: NodeDAO
        Retrieves a specific transaction.
        Specified by:
        getTxnById in interface NodeDAO
        Parameters:
        txnId - the unique transaction ID.
        Returns:
        the requested transaction or null
      • getTxnChanges

        public java.util.List<org.alfresco.service.cmr.repository.NodeRef.Status> getTxnChanges​(java.lang.Long txnId)
        Specified by:
        getTxnChanges in interface NodeDAO
        Returns:
        Returns the node statuses for a transaction, regardless of store
      • getTxnChangesForStore

        public java.util.List<org.alfresco.service.cmr.repository.NodeRef.Status> getTxnChangesForStore​(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                                                                        java.lang.Long txnId)
        Specified by:
        getTxnChangesForStore in interface NodeDAO
        Returns:
        Returns the node statuses for a transaction, limited to the store
      • getTxnsByCommitTimeAscending

        public java.util.List<Transaction> getTxnsByCommitTimeAscending​(java.lang.Long fromTimeInclusive,
                                                                        java.lang.Long toTimeExclusive,
                                                                        int count,
                                                                        java.util.List<java.lang.Long> excludeTxnIds,
                                                                        boolean remoteOnly)
        Description copied from interface: NodeDAO
        Get all transactions in a given time range. Since time-based retrieval doesn't guarantee uniqueness for any given millisecond, a list of optional exclusions may be provided.
        Specified by:
        getTxnsByCommitTimeAscending in interface NodeDAO
        excludeTxnIds - a list of txn IDs to ignore. null is allowed.
        remoteOnly - true if locally-written transactions must be ignored
      • getTxnsByCommitTimeDescending

        public java.util.List<Transaction> getTxnsByCommitTimeDescending​(java.lang.Long fromTimeInclusive,
                                                                         java.lang.Long toTimeExclusive,
                                                                         int count,
                                                                         java.util.List<java.lang.Long> excludeTxnIds,
                                                                         boolean remoteOnly)
        Description copied from interface: NodeDAO
        Get all transactions in a given time range. Since time-based retrieval doesn't guarantee uniqueness for any given millisecond, a list of optional exclusions may be provided.
        Specified by:
        getTxnsByCommitTimeDescending in interface NodeDAO
        excludeTxnIds - a list of txn IDs to ignore. null is allowed.
        remoteOnly - true if locally-written transactions must be ignored
      • getTxnsByCommitTimeAscending

        public java.util.List<Transaction> getTxnsByCommitTimeAscending​(java.util.List<java.lang.Long> includeTxnIds)
        Description copied from interface: NodeDAO
        Get a specific list of transactions ordered by commit time.
        Specified by:
        getTxnsByCommitTimeAscending in interface NodeDAO
        Parameters:
        includeTxnIds - a list of transaction IDs to search for
        Returns:
        Returns the transactions by commit time for the given IDs
      • getTxnsUnused

        public java.util.List<java.lang.Long> getTxnsUnused​(java.lang.Long minTxnId,
                                                            long maxCommitTime,
                                                            int count)
        Specified by:
        getTxnsUnused in interface NodeDAO
      • purgeTxn

        public void purgeTxn​(java.lang.Long txnId)
        Specified by:
        purgeTxn in interface NodeDAO
      • getMinTxnCommitTime

        public java.lang.Long getMinTxnCommitTime()
        Specified by:
        getMinTxnCommitTime in interface NodeDAO
        Returns:
        Returns the minimum commit time or null if there are no transactions
      • getMaxTxnCommitTime

        public java.lang.Long getMaxTxnCommitTime()
        Specified by:
        getMaxTxnCommitTime in interface NodeDAO
        Returns:
        Returns the maximum commit time or null if there are no transactions
      • getMinTxnCommitTimeForDeletedNodes

        public java.lang.Long getMinTxnCommitTimeForDeletedNodes()
        Specified by:
        getMinTxnCommitTimeForDeletedNodes in interface NodeDAO
        Returns:
        Returns the minimum commit time for deleted nodes or null if there are no transactions
      • getMinTxnId

        public java.lang.Long getMinTxnId()
        Specified by:
        getMinTxnId in interface NodeDAO
        Returns:
        Returns the minimum id or 0 if there are no transactions
      • getMinUnusedTxnCommitTime

        public java.lang.Long getMinUnusedTxnCommitTime()
        Specified by:
        getMinUnusedTxnCommitTime in interface NodeDAO
        Returns:
        the commit time of the oldest unused transaction
      • getMaxTxnId

        public java.lang.Long getMaxTxnId()
        Specified by:
        getMaxTxnId in interface NodeDAO
        Returns:
        Returns the maximum id or 0 if there are no transactions
      • selectServer

        protected abstract ServerEntity selectServer​(java.lang.String ipAddress)
      • insertServer

        protected abstract java.lang.Long insertServer​(java.lang.String ipAddress)
      • insertTransaction

        protected abstract java.lang.Long insertTransaction​(java.lang.Long serverId,
                                                            java.lang.String changeTxnId,
                                                            java.lang.Long commit_time_ms)
      • updateTransaction

        protected abstract int updateTransaction​(java.lang.Long txnId,
                                                 java.lang.Long commit_time_ms)
      • deleteTransaction

        protected abstract int deleteTransaction​(java.lang.Long txnId)
      • selectAllStores

        protected abstract java.util.List<StoreEntity> selectAllStores()
      • selectStore

        protected abstract StoreEntity selectStore​(org.alfresco.service.cmr.repository.StoreRef storeRef)
      • selectStoreRootNode

        protected abstract NodeEntity selectStoreRootNode​(org.alfresco.service.cmr.repository.StoreRef storeRef)
      • insertStore

        protected abstract java.lang.Long insertStore​(StoreEntity store)
      • updateStoreRoot

        protected abstract int updateStoreRoot​(StoreEntity store)
      • updateStore

        protected abstract int updateStore​(StoreEntity store)
      • updateNodesInStore

        protected abstract int updateNodesInStore​(java.lang.Long txnId,
                                                  java.lang.Long storeId)
      • insertNode

        protected abstract java.lang.Long insertNode​(NodeEntity node)
      • updateNode

        protected abstract int updateNode​(NodeUpdateEntity nodeUpdate)
      • updateNodes

        protected abstract int updateNodes​(java.lang.Long txnId,
                                           java.util.List<java.lang.Long> nodeIds)
      • updatePrimaryChildrenSharedAclId

        protected abstract void updatePrimaryChildrenSharedAclId​(java.lang.Long txnId,
                                                                 java.lang.Long primaryParentNodeId,
                                                                 java.lang.Long optionalOldSharedAlcIdInAdditionToNull,
                                                                 java.lang.Long newSharedAlcId)
      • deleteNodeById

        protected abstract int deleteNodeById​(java.lang.Long nodeId)
      • deleteNodesByCommitTime

        protected abstract int deleteNodesByCommitTime​(long fromTxnCommitTimeMs,
                                                       long toTxnCommitTimeMs)
      • selectNodeById

        protected abstract NodeEntity selectNodeById​(java.lang.Long id)
      • selectNodeByNodeRef

        protected abstract NodeEntity selectNodeByNodeRef​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      • selectNodesByUuids

        protected abstract java.util.List<Node> selectNodesByUuids​(java.lang.Long storeId,
                                                                   java.util.SortedSet<java.lang.String> uuids)
      • selectNodesByIds

        protected abstract java.util.List<Node> selectNodesByIds​(java.util.SortedSet<java.lang.Long> ids)
      • deleteNodeProperties

        protected abstract int deleteNodeProperties​(java.lang.Long nodeId,
                                                    java.util.Set<java.lang.Long> qnameIds)
      • deleteNodeProperties

        protected abstract int deleteNodeProperties​(java.lang.Long nodeId,
                                                    java.util.List<NodePropertyKey> propKeys)
      • insertNodeProperties

        protected abstract void insertNodeProperties​(java.lang.Long nodeId,
                                                     java.util.Map<NodePropertyKey,​NodePropertyValue> persistableProps)
      • selectNodeAspects

        protected abstract java.util.Map<NodeVersionKey,​java.util.Set<org.alfresco.service.namespace.QName>> selectNodeAspects​(java.util.Set<java.lang.Long> nodeIds)
      • insertNodeAspect

        protected abstract void insertNodeAspect​(java.lang.Long nodeId,
                                                 java.lang.Long qnameId)
      • deleteNodeAspects

        protected abstract int deleteNodeAspects​(java.lang.Long nodeId,
                                                 java.util.Set<java.lang.Long> qnameIds)
      • selectNodesWithAspects

        protected abstract void selectNodesWithAspects​(java.util.List<java.lang.Long> qnameIds,
                                                       java.lang.Long minNodeId,
                                                       java.lang.Long maxNodeId,
                                                       NodeDAO.NodeRefQueryCallback resultsCallback)
      • insertNodeAssoc

        protected abstract java.lang.Long insertNodeAssoc​(java.lang.Long sourceNodeId,
                                                          java.lang.Long targetNodeId,
                                                          java.lang.Long assocTypeQNameId,
                                                          int assocIndex)
      • updateNodeAssoc

        protected abstract int updateNodeAssoc​(java.lang.Long id,
                                               int assocIndex)
      • deleteNodeAssoc

        protected abstract int deleteNodeAssoc​(java.lang.Long sourceNodeId,
                                               java.lang.Long targetNodeId,
                                               java.lang.Long assocTypeQNameId)
      • deleteNodeAssocs

        protected abstract int deleteNodeAssocs​(java.util.List<java.lang.Long> ids)
      • selectNodeAssocs

        protected abstract java.util.List<NodeAssocEntity> selectNodeAssocs​(java.lang.Long nodeId)
      • selectNodeAssocsBySource

        protected abstract java.util.List<NodeAssocEntity> selectNodeAssocsBySource​(java.lang.Long sourceNodeId,
                                                                                    java.lang.Long typeQNameId)
      • selectNodeAssocsBySourceAndPropertyValue

        protected abstract java.util.List<NodeAssocEntity> selectNodeAssocsBySourceAndPropertyValue​(java.lang.Long sourceNodeId,
                                                                                                    java.lang.Long typeQNameId,
                                                                                                    java.lang.Long propertyQNameId,
                                                                                                    NodePropertyValue nodeValue)
      • selectNodeAssocsByTarget

        protected abstract java.util.List<NodeAssocEntity> selectNodeAssocsByTarget​(java.lang.Long targetNodeId,
                                                                                    java.lang.Long typeQNameId)
      • selectNodeAssocById

        protected abstract NodeAssocEntity selectNodeAssocById​(java.lang.Long assocId)
      • selectNodeAssocMaxIndex

        protected abstract int selectNodeAssocMaxIndex​(java.lang.Long sourceNodeId,
                                                       java.lang.Long assocTypeQNameId)
      • insertChildAssoc

        protected abstract java.lang.Long insertChildAssoc​(ChildAssocEntity assoc)
      • deleteChildAssocs

        protected abstract int deleteChildAssocs​(java.util.List<java.lang.Long> ids)
      • updateChildAssocIndex

        protected abstract int updateChildAssocIndex​(java.lang.Long parentNodeId,
                                                     java.lang.Long childNodeId,
                                                     org.alfresco.service.namespace.QName assocTypeQName,
                                                     org.alfresco.service.namespace.QName assocQName,
                                                     int index)
      • updateChildAssocUniqueName

        protected abstract int updateChildAssocUniqueName​(java.lang.Long assocId,
                                                          java.lang.String name)
      • selectChildAssoc

        protected abstract ChildAssocEntity selectChildAssoc​(java.lang.Long assocId)
      • selectChildNodeIds

        protected abstract java.util.List<ChildAssocEntity> selectChildNodeIds​(java.lang.Long nodeId,
                                                                               java.lang.Boolean isPrimary,
                                                                               java.lang.Long minAssocIdInclusive,
                                                                               int maxResults)
      • selectPrimaryChildAcls

        protected abstract java.util.List<NodeIdAndAclId> selectPrimaryChildAcls​(java.lang.Long nodeId)
      • selectChildAssoc

        protected abstract 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)
      • selectChildAssocs

        protected abstract 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)
        Parameters are all optional except the parent node ID and the callback
      • selectChildAssocs

        protected abstract void selectChildAssocs​(java.lang.Long parentNodeId,
                                                  org.alfresco.service.namespace.QName assocTypeQName,
                                                  org.alfresco.service.namespace.QName assocQName,
                                                  int maxResults,
                                                  NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      • selectChildAssocs

        protected abstract void selectChildAssocs​(java.lang.Long parentNodeId,
                                                  java.util.Set<org.alfresco.service.namespace.QName> assocTypeQNames,
                                                  NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      • selectChildAssoc

        protected abstract ChildAssocEntity selectChildAssoc​(java.lang.Long parentNodeId,
                                                             org.alfresco.service.namespace.QName assocTypeQName,
                                                             java.lang.String childName)
      • selectChildAssocs

        protected abstract void selectChildAssocs​(java.lang.Long parentNodeId,
                                                  org.alfresco.service.namespace.QName assocTypeQName,
                                                  java.util.Collection<java.lang.String> childNames,
                                                  NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      • selectChildAssocsByPropertyValue

        protected abstract void selectChildAssocsByPropertyValue​(java.lang.Long parentNodeId,
                                                                 org.alfresco.service.namespace.QName propertyQName,
                                                                 NodePropertyValue nodeValue,
                                                                 NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      • selectChildAssocsByChildTypes

        protected abstract void selectChildAssocsByChildTypes​(java.lang.Long parentNodeId,
                                                              java.util.Set<org.alfresco.service.namespace.QName> childNodeTypeQNames,
                                                              NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      • selectChildAssocsWithoutParentAssocsOfType

        protected abstract void selectChildAssocsWithoutParentAssocsOfType​(java.lang.Long parentNodeId,
                                                                           org.alfresco.service.namespace.QName assocTypeQName,
                                                                           NodeDAO.ChildAssocRefQueryCallback resultsCallback)
      • selectParentAssocs

        protected abstract 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)
        Parameters are all optional except the parent node ID and the callback
      • selectParentAssocs

        protected abstract java.util.List<ChildAssocEntity> selectParentAssocs​(java.lang.Long childNodeId)
      • selectPrimaryParentAssocs

        protected abstract java.util.List<ChildAssocEntity> selectPrimaryParentAssocs​(java.lang.Long childNodeId)
        No DB constraint, so multiple returned
      • updatePrimaryParentAssocs

        protected abstract 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)
      • moveNodeData

        protected abstract void moveNodeData​(java.lang.Long fromNodeId,
                                             java.lang.Long toNodeId)
        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.
        Parameters:
        fromNodeId - the source node
        toNodeId - the target node
      • deleteSubscriptions

        protected abstract void deleteSubscriptions​(java.lang.Long nodeId)
      • selectLastTxnBeforeCommitTime

        protected abstract Transaction selectLastTxnBeforeCommitTime​(java.lang.Long maxCommitTime)
      • selectTransactionCount

        protected abstract int selectTransactionCount()
      • selectTxnById

        protected abstract Transaction selectTxnById​(java.lang.Long txnId)
      • selectTxnChanges

        protected abstract java.util.List<NodeEntity> selectTxnChanges​(java.lang.Long txnId,
                                                                       java.lang.Long storeId)
      • selectTxns

        protected abstract 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)
      • selectTxnsUnused

        protected abstract java.util.List<java.lang.Long> selectTxnsUnused​(java.lang.Long minTxnId,
                                                                           java.lang.Long maxCommitTime,
                                                                           java.lang.Integer count)
      • selectMinTxnCommitTime

        protected abstract java.lang.Long selectMinTxnCommitTime()
      • selectMaxTxnCommitTime

        protected abstract java.lang.Long selectMaxTxnCommitTime()
      • selectMinTxnCommitTimeForDeletedNodes

        protected abstract java.lang.Long selectMinTxnCommitTimeForDeletedNodes()
      • selectMinTxnId

        protected abstract java.lang.Long selectMinTxnId()
      • selectMaxTxnId

        protected abstract java.lang.Long selectMaxTxnId()
      • selectMinUnusedTxnCommitTime

        protected abstract java.lang.Long selectMinUnusedTxnCommitTime()