org.alfresco.repo.domain.node
Class AbstractNodeDAOImpl

java.lang.Object
  extended by org.alfresco.repo.domain.node.AbstractNodeDAOImpl
All Implemented Interfaces:
org.alfresco.ibatis.BatchingDAO, NodeDAO, NodeBulkLoader
Direct Known Subclasses:
NodeDAOImpl

public abstract class AbstractNodeDAOImpl
extends java.lang.Object
implements NodeDAO, org.alfresco.ibatis.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

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.domain.node.NodeDAO
NodeDAO.ChildAssocRefQueryCallback, NodeDAO.NodeRefQueryCallback
 
Field Summary
protected  boolean isDebugEnabled
           
protected  org.apache.commons.logging.Log logger
           
static java.lang.Long LONG_ZERO
           
 
Constructor Summary
AbstractNodeDAOImpl()
          Constructor.
 
Method Summary
 boolean addNodeAspects(java.lang.Long nodeId, java.util.Set aspectQNames)
           
 boolean addNodeProperties(java.lang.Long nodeId, java.util.Map properties)
           
 boolean addNodeProperty(java.lang.Long nodeId, org.alfresco.service.namespace.QName qname, java.io.Serializable value)
           
 void cacheNodes(java.util.List nodeRefs)
          Pre-cache data relevant to the given nodes.
 void cacheNodesById(java.util.List nodeIds)
          Pre-cache data relevant to the given nodes.
 void clear()
          FOR TESTING ONLY: Clears out node cache data
 void cycleCheck(org.alfresco.util.Pair nodePair)
          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 deleteChildAssocById(java.lang.Long assocId)
           
protected abstract  int deleteChildAssocsToAndFrom(java.lang.Long nodeId)
           
 void deleteNode(java.lang.Long nodeId)
          Deletes the node and all entities.
protected abstract  int deleteNodeAspects(java.lang.Long nodeId, java.util.Set qnameIds)
           
protected abstract  int deleteNodeAssoc(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, java.lang.Long assocTypeQNameId)
           
protected abstract  int deleteNodeAssocs(java.util.List ids)
           
protected abstract  int deleteNodeAssocsToAndFrom(java.lang.Long nodeId)
           
protected abstract  int deleteNodeAssocsToAndFrom(java.lang.Long nodeId, java.util.Set assocTypeQNameIds)
           
protected abstract  int deleteNodeById(java.lang.Long nodeId, boolean deletedOnly)
           
protected abstract  int deleteNodeProperties(java.lang.Long nodeId, java.util.List propKeys)
           
protected abstract  int deleteNodeProperties(java.lang.Long nodeId, java.util.Set qnameIds)
           
protected abstract  int deleteNodesByCommitTime(boolean deletedOnly, long maxTxnCommitTimeMs)
           
protected abstract  void deleteSubscriptions(java.lang.Long nodeId)
           
protected abstract  int deleteTransaction(java.lang.Long txnId)
           
 boolean exists(java.lang.Long nodeId)
           
 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 getAllRootNodes(org.alfresco.service.cmr.repository.StoreRef storeRef)
           
 org.alfresco.util.Pair getChildAssoc(java.lang.Long assocId)
          Get a specific association
 org.alfresco.util.Pair 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 getChildAssoc(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, java.lang.String childName)
          Get a child association for given parent node, association type and child node name (cm:name).
 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, org.alfresco.service.namespace.QName assocTypeQName, java.util.Collection 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, java.util.Set assocTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
          Get the child associations of a given parent node, optionally filtering on type QName.
 void getChildAssocsByChildTypes(java.lang.Long parentNodeId, java.util.Set childNodeTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
           
 void getChildAssocsByPropertyValue(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName propertyQName, java.io.Serializable value, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
           
 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()
           
 java.lang.Long getMaxTxnCommitTime()
           
 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 getNodeAclId(java.lang.Long nodeId)
           
 java.util.Set getNodeAspects(java.lang.Long nodeId)
           
 org.alfresco.util.Pair getNodeAssoc(java.lang.Long assocId)
           
 org.alfresco.util.Pair getNodeAssocOrNull(java.lang.Long assocId)
           
 org.alfresco.util.Pair getNodePair(java.lang.Long nodeId)
           
 org.alfresco.util.Pair getNodePair(org.alfresco.service.cmr.repository.NodeRef nodeRef)
           
 java.util.Map 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 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 getPaths(org.alfresco.util.Pair nodePair, boolean primaryOnly)
          Build the paths for a node.
 java.util.List getPrimaryChildrenAcls(java.lang.Long nodeId)
          Fetch all primary child node IDs and corresponding ACL IDs.
 org.alfresco.util.Pair getPrimaryParentAssoc(java.lang.Long childNodeId)
          Finds the association between the node's primary parent and the node itself
 org.alfresco.util.Pair getRootNode(org.alfresco.service.cmr.repository.StoreRef storeRef)
           
 java.util.Collection getSourceNodeAssocs(java.lang.Long targetNodeId, org.alfresco.service.namespace.QName typeQName)
           
 java.util.List getStores()
          Fetch a list of all stores in the repository
 java.util.Collection 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 getTxnChanges(java.lang.Long txnId)
           
 java.util.List getTxnChangesForStore(org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.Long txnId)
           
 int getTxnDeleteCount(java.lang.Long txnId)
           
 java.util.List getTxnsByCommitTimeAscending(java.util.List includeTxnIds)
          Get a specific list of transactions ordered by commit time.
 java.util.List getTxnsByCommitTimeAscending(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, int count, java.util.List excludeTxnIds, boolean remoteOnly)
          Get all transactions in a given time range.
 java.util.List getTxnsByCommitTimeDescending(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, int count, java.util.List excludeTxnIds, boolean remoteOnly)
          Get all transactions in a given time range.
 java.util.List getTxnsUnused(java.lang.Long minTxnId, long maxCommitTime, int count)
           
 int getTxnUpdateCount(java.lang.Long txnId)
           
 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 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 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 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.
 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 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
 org.alfresco.util.Pair newStore(org.alfresco.service.cmr.repository.StoreRef storeRef)
          Creates a unique store for the given protocol and identifier combination.
 int purgeNodes(long maxTxnCommitTimeMs)
          Purge deleted nodes where their participating transactions are older than a given time.
 void purgeTxn(java.lang.Long txnId)
           
 boolean removeNodeAspects(java.lang.Long nodeId)
           
 boolean removeNodeAspects(java.lang.Long nodeId, java.util.Set 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 ids)
          Remove all node associations of given IDs
 int removeNodeAssocsToAndFrom(java.lang.Long nodeId)
          Remove all node associations that share the given node.
 int removeNodeAssocsToAndFrom(java.lang.Long nodeId, java.util.Set assocTypeQNames)
          Remove all node associations of given types that share the given node.
 boolean removeNodeProperties(java.lang.Long nodeId, java.util.Set propertyQNames)
           
protected abstract  java.util.List selectAllStores()
           
protected abstract  ChildAssocEntity selectChildAssoc(java.lang.Long assocId)
           
protected abstract  java.util.List 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, org.alfresco.service.namespace.QName assocTypeQName, java.util.Collection childNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
           
protected abstract  void selectChildAssocs(java.lang.Long parentNodeId, java.util.Set assocTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
           
protected abstract  void selectChildAssocsByChildTypes(java.lang.Long parentNodeId, java.util.Set 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  Transaction selectLastTxnBeforeCommitTime(java.lang.Long maxCommitTime)
           
protected abstract  java.lang.Long selectMaxTxnCommitTime()
           
protected abstract  java.lang.Long selectMinTxnCommitTime()
           
protected abstract  java.util.Set selectNodeAspectIds(java.lang.Long nodeId)
           
protected abstract  java.util.List selectNodeAspects(java.util.Set 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 selectNodeAssocsBySource(java.lang.Long sourceNodeId, java.lang.Long typeQNameId)
           
protected abstract  java.util.List selectNodeAssocsByTarget(java.lang.Long targetNodeId, java.lang.Long typeQNameId)
           
protected abstract  NodeEntity selectNodeById(java.lang.Long id, java.lang.Boolean deleted)
           
protected abstract  NodeEntity selectNodeByNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.Boolean deleted)
           
protected abstract  java.util.Map selectNodeProperties(java.lang.Long nodeId)
           
protected abstract  java.util.Map selectNodeProperties(java.lang.Long nodeId, java.util.Set qnameIds)
           
protected abstract  java.util.Map selectNodeProperties(java.util.Set nodeIds)
           
protected abstract  java.util.List selectNodesByIds(java.util.SortedSet ids)
           
protected abstract  java.util.List selectNodesByUuids(java.lang.Long storeId, java.util.SortedSet uuids)
           
protected abstract  void selectNodesWithAspects(java.util.List qnameIds, java.lang.Long minNodeId, java.lang.Long maxNodeId, NodeDAO.NodeRefQueryCallback resultsCallback)
           
protected abstract  java.util.List 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 selectPrimaryChildAcls(java.lang.Long nodeId)
           
protected abstract  java.util.List selectPrimaryParentAssocs(java.lang.Long childNodeId)
          No DB constraint, so multiple returned
protected abstract  ServerEntity selectServer(java.lang.String ipAddress)
           
protected abstract  NodeEntity selectStoreRootNode(java.lang.Long storeId)
           
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 selectTxnChanges(java.lang.Long txnId, java.lang.Long storeId)
           
protected abstract  int selectTxnNodeChangeCount(java.lang.Long txnId, java.lang.Boolean updates)
           
protected abstract  java.util.List selectTxns(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, java.lang.Integer count, java.util.List includeTxnIds, java.util.List excludeTxnIds, java.lang.Long excludeServerId, java.lang.Boolean ascending)
           
protected abstract  java.util.List 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 allRootNodesCache)
          Set the cache that maintains the extended Store root node data
 void setAspectsCache(org.alfresco.repo.cache.SimpleCache aspectsCache)
          Set the cache that maintains the Node QName IDs
 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
 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.
 void setNodeAclId(java.lang.Long nodeId, java.lang.Long aclId)
           
 void setNodeAssocIndex(java.lang.Long id, int assocIndex)
          Update an existing assoc's index.
 void setNodeDefiningAclId(java.lang.Long nodeId, long aclId)
          Used in ACL upgrade only to set the acl id with mimimal overhead
 boolean setNodeProperties(java.lang.Long nodeId, java.util.Map properties)
           
 void setNodesCache(org.alfresco.repo.cache.SimpleCache cache)
          Set the cache that maintains node ID-NodeRef cross referencing data
 void setParentAssocsCache(org.alfresco.repo.cache.SimpleCache parentAssocsCache)
          Set the cache that maintains the Node parent associations
 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 propertiesCache)
          Set the cache that maintains the Node property values
 void setQnameDAO(QNameDAO qnameDAO)
           
 void setRootNodesCache(org.alfresco.repo.cache.SimpleCache cache)
          Set the cache that maintains the Store root node data
 void setTransactionService(TransactionService transactionService)
           
 void setUsageDAO(UsageDAO usageDAO)
           
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 updateChildAssocsUniqueName(java.lang.Long childNodeId, java.lang.String name)
           
 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 updateNodePatchAcl(NodeUpdateEntity nodeUpdate)
           
protected abstract  void updatePrimaryChildrenSharedAclId(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 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
 
Methods inherited from interface org.alfresco.repo.domain.node.NodeDAO
getChildAssocs, selectProperties
 
Methods inherited from interface org.alfresco.ibatis.BatchingDAO
executeBatch, startBatch
 

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

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 cache)
Set the cache that maintains the Store root node data

Parameters:
cache - the cache

setAllRootNodesCache

public void setAllRootNodesCache(org.alfresco.repo.cache.SimpleCache allRootNodesCache)
Set the cache that maintains the extended Store root node data

Parameters:
cache - the cache

setNodesCache

public void setNodesCache(org.alfresco.repo.cache.SimpleCache 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 aspectsCache)
Set the cache that maintains the Node QName IDs

Parameters:
aspectsCache - the cache

setPropertiesCache

public void setPropertiesCache(org.alfresco.repo.cache.SimpleCache propertiesCache)
Set the cache that maintains the Node property values

Parameters:
propertiesCache - the cache

setParentAssocsCache

public void setParentAssocsCache(org.alfresco.repo.cache.SimpleCache parentAssocsCache)
Set the cache that maintains the Node parent associations

Parameters:
parentAssocsCache - the cache

init

public void init()

getCurrentTransactionId

public java.lang.Long getCurrentTransactionId()
Specified by:
getCurrentTransactionId in interface NodeDAO
Returns:
Returns the ID of the current transaction entry or null if there have not been any modifications to nodes registered in the transaction

getStores

public java.util.List 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 getRootNode(org.alfresco.service.cmr.repository.StoreRef storeRef)
Specified by:
getRootNode in interface NodeDAO

getAllRootNodes

public java.util.Set getAllRootNodes(org.alfresco.service.cmr.repository.StoreRef storeRef)
Specified by:
getAllRootNodes in interface NodeDAO

newStore

public org.alfresco.util.Pair 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)
Specified by:
exists in interface NodeDAO

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.

getNodePair

public org.alfresco.util.Pair getNodePair(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Specified by:
getNodePair in interface NodeDAO

getNodePair

public org.alfresco.util.Pair 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 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
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

moveNode

public org.alfresco.util.Pair 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)

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

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

setNodeDefiningAclId

public void setNodeDefiningAclId(java.lang.Long nodeId,
                                 long aclId)
Description copied from interface: NodeDAO
Used in ACL upgrade only to set the acl id with mimimal overhead

Specified by:
setNodeDefiningAclId 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 maxTxnCommitTimeMs)
Description copied from interface: NodeDAO
Purge deleted nodes where their participating transactions are older than a given time.

Specified by:
purgeNodes in interface NodeDAO
Parameters:
maxTxnCommitTimeMs - ignore transactions created after this time
Returns:
Returns the number of deleted nodes purged

getNodeProperties

public java.util.Map 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 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 properties)
Specified by:
addNodeProperties in interface NodeDAO

removeNodeProperties

public boolean removeNodeProperties(java.lang.Long nodeId,
                                    java.util.Set 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
Returns:
Returns true if the cm:modified property was actually set

getNodeAspects

public java.util.Set 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 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 aspectQNames)
Specified by:
removeNodeAspects in interface NodeDAO

getNodesWithAspects

public void getNodesWithAspects(java.util.Set 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
Returns:
Returns the number of associations removed

removeNodeAssocsToAndFrom

public int removeNodeAssocsToAndFrom(java.lang.Long nodeId)
Description copied from interface: NodeDAO
Remove all node associations that share the given node.

Specified by:
removeNodeAssocsToAndFrom in interface NodeDAO
Parameters:
nodeId - the source or target of the associations
Returns:
Returns the number of associations removed

removeNodeAssocsToAndFrom

public int removeNodeAssocsToAndFrom(java.lang.Long nodeId,
                                     java.util.Set assocTypeQNames)
Description copied from interface: NodeDAO
Remove all node associations of given types that share the given node.

Specified by:
removeNodeAssocsToAndFrom in interface NodeDAO
Parameters:
nodeId - the source or target of the associations
assocTypeQNames - the types that should be deleted
Returns:
Returns the number of associations removed

removeNodeAssocs

public int removeNodeAssocs(java.util.List 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

getSourceNodeAssocs

public java.util.Collection 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 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

getNodeAssocOrNull

public org.alfresco.util.Pair 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 getNodeAssoc(java.lang.Long assocId)
Specified by:
getNodeAssoc in interface NodeDAO
Returns:
Returns a specific node association with the given ID

newChildAssoc

public org.alfresco.util.Pair 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
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

getChildAssoc

public org.alfresco.util.Pair 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 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 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,
                           java.util.Set 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 getChildAssoc(java.lang.Long parentNodeId,
                                            org.alfresco.service.namespace.QName assocTypeQName,
                                            java.lang.String childName)
Description copied from interface: NodeDAO
Get a child association for given parent node, association type and child node name (cm:name).

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 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)
Specified by:
getChildAssocsByPropertyValue in interface NodeDAO

getChildAssocsByChildTypes

public void getChildAssocsByChildTypes(java.lang.Long parentNodeId,
                                       java.util.Set childNodeTypeQNames,
                                       NodeDAO.ChildAssocRefQueryCallback resultsCallback)
Specified by:
getChildAssocsByChildTypes 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 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(org.alfresco.util.Pair nodePair)
Potentially cheaper than evaluating all of a node's paths to check for child association cycles

Specified by:
cycleCheck in interface NodeDAO
Parameters:
nodePair - the node to check
path - a set containing the nodes in the path to the node

getPaths

public java.util.List getPaths(org.alfresco.util.Pair 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
primaryOnly - true to follow only primary parent associations
Throws:
org.alfresco.service.cmr.repository.InvalidNodeRefException

cacheNodesById

public void cacheNodesById(java.util.List 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 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

getTransactionCount

public int getTransactionCount()
Specified by:
getTransactionCount in interface NodeDAO

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 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 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

getTxnUpdateCount

public int getTxnUpdateCount(java.lang.Long txnId)
Specified by:
getTxnUpdateCount in interface NodeDAO

getTxnDeleteCount

public int getTxnDeleteCount(java.lang.Long txnId)
Specified by:
getTxnDeleteCount in interface NodeDAO

getTxnsByCommitTimeAscending

public java.util.List getTxnsByCommitTimeAscending(java.lang.Long fromTimeInclusive,
                                                   java.lang.Long toTimeExclusive,
                                                   int count,
                                                   java.util.List 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 getTxnsByCommitTimeDescending(java.lang.Long fromTimeInclusive,
                                                    java.lang.Long toTimeExclusive,
                                                    int count,
                                                    java.util.List 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 getTxnsByCommitTimeAscending(java.util.List 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 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

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 selectAllStores()

selectStoreRootNode

protected abstract NodeEntity selectStoreRootNode(java.lang.Long storeId)

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)

insertNode

protected abstract java.lang.Long insertNode(NodeEntity node)

updateNode

protected abstract int updateNode(NodeUpdateEntity nodeUpdate)

updateNodePatchAcl

protected abstract int updateNodePatchAcl(NodeUpdateEntity nodeUpdate)

updatePrimaryChildrenSharedAclId

protected abstract void updatePrimaryChildrenSharedAclId(java.lang.Long primaryParentNodeId,
                                                         java.lang.Long optionalOldSharedAlcIdInAdditionToNull,
                                                         java.lang.Long newSharedAlcId)

deleteNodeById

protected abstract int deleteNodeById(java.lang.Long nodeId,
                                      boolean deletedOnly)

deleteNodesByCommitTime

protected abstract int deleteNodesByCommitTime(boolean deletedOnly,
                                               long maxTxnCommitTimeMs)

selectNodeById

protected abstract NodeEntity selectNodeById(java.lang.Long id,
                                             java.lang.Boolean deleted)

selectNodeByNodeRef

protected abstract NodeEntity selectNodeByNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                  java.lang.Boolean deleted)

selectNodesByUuids

protected abstract java.util.List selectNodesByUuids(java.lang.Long storeId,
                                                     java.util.SortedSet uuids)

selectNodesByIds

protected abstract java.util.List selectNodesByIds(java.util.SortedSet ids)

selectNodeProperties

protected abstract java.util.Map selectNodeProperties(java.util.Set nodeIds)

selectNodeAspects

protected abstract java.util.List selectNodeAspects(java.util.Set nodeIds)

selectNodeProperties

protected abstract java.util.Map selectNodeProperties(java.lang.Long nodeId)

selectNodeProperties

protected abstract java.util.Map selectNodeProperties(java.lang.Long nodeId,
                                                      java.util.Set qnameIds)

deleteNodeProperties

protected abstract int deleteNodeProperties(java.lang.Long nodeId,
                                            java.util.Set qnameIds)

deleteNodeProperties

protected abstract int deleteNodeProperties(java.lang.Long nodeId,
                                            java.util.List propKeys)

insertNodeProperties

protected abstract void insertNodeProperties(java.lang.Long nodeId,
                                             java.util.Map persistableProps)

selectNodeAspectIds

protected abstract java.util.Set selectNodeAspectIds(java.lang.Long nodeId)

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 qnameIds)

selectNodesWithAspects

protected abstract void selectNodesWithAspects(java.util.List 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)

deleteNodeAssocsToAndFrom

protected abstract int deleteNodeAssocsToAndFrom(java.lang.Long nodeId)

deleteNodeAssocsToAndFrom

protected abstract int deleteNodeAssocsToAndFrom(java.lang.Long nodeId,
                                                 java.util.Set assocTypeQNameIds)

deleteNodeAssocs

protected abstract int deleteNodeAssocs(java.util.List ids)

selectNodeAssocsBySource

protected abstract java.util.List selectNodeAssocsBySource(java.lang.Long sourceNodeId,
                                                           java.lang.Long typeQNameId)

selectNodeAssocsByTarget

protected abstract java.util.List 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)

deleteChildAssocById

protected abstract int deleteChildAssocById(java.lang.Long assocId)

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)

updateChildAssocsUniqueName

protected abstract int updateChildAssocsUniqueName(java.lang.Long childNodeId,
                                                   java.lang.String name)

deleteChildAssocsToAndFrom

protected abstract int deleteChildAssocsToAndFrom(java.lang.Long nodeId)

selectChildAssoc

protected abstract ChildAssocEntity selectChildAssoc(java.lang.Long assocId)

selectPrimaryChildAcls

protected abstract java.util.List selectPrimaryChildAcls(java.lang.Long nodeId)

selectChildAssoc

protected abstract java.util.List 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,
                                          java.util.Set 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 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 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 selectParentAssocs(java.lang.Long childNodeId)

selectPrimaryParentAssocs

protected abstract java.util.List 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 selectTxnChanges(java.lang.Long txnId,
                                                   java.lang.Long storeId)

selectTxnNodeChangeCount

protected abstract int selectTxnNodeChangeCount(java.lang.Long txnId,
                                                java.lang.Boolean updates)
Parameters:
txnId - the transaction ID (never null)
updates - TRUE to select node updates, FALSE to select node deletions or null to select all changes.
Returns:
Returns the number of nodes affected by the transaction

selectTxns

protected abstract java.util.List selectTxns(java.lang.Long fromTimeInclusive,
                                             java.lang.Long toTimeExclusive,
                                             java.lang.Integer count,
                                             java.util.List includeTxnIds,
                                             java.util.List excludeTxnIds,
                                             java.lang.Long excludeServerId,
                                             java.lang.Boolean ascending)

selectTxnsUnused

protected abstract java.util.List 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()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.