org.alfresco.repo.node.db.hibernate
Class HibernateNodeDaoServiceImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl
All Implemented Interfaces:
NodeDaoService, NodeBulkLoader, TransactionalDao, org.springframework.beans.factory.InitializingBean

public class HibernateNodeDaoServiceImpl
extends org.springframework.orm.hibernate3.support.HibernateDaoSupport
implements NodeDaoService, TransactionalDao, NodeBulkLoader

Hibernate-specific implementation of the persistence-independent node DAO interface


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.node.db.NodeDaoService
NodeDaoService.ChildAssocRefQueryCallback, NodeDaoService.ChildAssocRefQueryCallbackFilter, NodeDaoService.NodePropertyHandler, NodeDaoService.NodeRefQueryCallback, NodeDaoService.ObjectArrayQueryCallback
 
Field Summary
static java.lang.Class[] DUPLICATE_CHILD_NAME_EXCEPTIONS
          Exceptions that indicate duplicate child names violations.
 
Constructor Summary
HibernateNodeDaoServiceImpl()
           
 
Method Summary
 void addNodeAspects(java.lang.Long nodeId, java.util.Set aspectQNames)
           
 void addNodeProperties(java.lang.Long nodeId, java.util.Map properties)
           
 void addNodeProperty(java.lang.Long nodeId, QName qname, java.io.Serializable propertyValue)
           
 void beforeCommit()
          Ensure that any transaction that might be present is updated to reflect the current time.
 void cacheNodes(java.util.List nodeRefs)
          Pre-cache data relevant to the given nodes.

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

 void clear()
          Clears the cached nodes

Clears the L1 cache, the parentAssocsCache and storeAndNodeIdCache

static java.util.Map convertToPersistentProperties(java.util.Map in, QNameDAO qnameDAO, LocaleDAO localeDAO, ContentDataDAO contentDataDAO, DictionaryService dictionaryService)
           
static java.util.Map convertToPublicProperties(java.util.Map propertyValues, QNameDAO qnameDAO, LocaleDAO localeDAO, ContentDataDAO contentDataDAO, DictionaryService dictionaryService)
           
 org.alfresco.util.Pair createStore(StoreRef storeRef)
          Ensures that the store protocol/identifier combination is unique
 void deleteChildAssoc(java.lang.Long assocId)
           
 boolean deleteChildAssoc(java.lang.Long parentNodeId, java.lang.Long childNodeId, QName assocTypeQName, QName assocQName)
          Deletes an explicit child association.
 void deleteNode(java.lang.Long nodeId)
          Manually ensures that all cascading of associations is taken care of
 void deleteNodeAssoc(java.lang.Long assocId)
           
 boolean equals(java.lang.Object obj)
          Checks equality by type and uuid
 void flush()
          Just flushes the session
 org.alfresco.util.Pair getChildAssoc(java.lang.Long parentNodeId, java.lang.Long childNodeId, QName assocTypeQName, QName assocQName)
           
 org.alfresco.util.Pair getChildAssoc(java.lang.Long parentNodeId, QName assocTypeQName, java.lang.String childName)
           
 void getChildAssocs(java.lang.Long parentNodeId, NodeDaoService.ChildAssocRefQueryCallback resultsCallback, boolean recurse)
          Get a collection of all child association references for a given parent node.
 void getChildAssocs(java.lang.Long parentNodeId, QName assocTypeQName, java.util.Collection childNames, NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
          Get a collection of all child associations references where the child name is an exact match.
 void getChildAssocs(java.lang.Long parentNodeId, QName assocQName, NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
          Get a collection of all child association references for a given parent node.
 void getChildAssocsByChildTypes(java.lang.Long parentNodeId, java.util.Set childNodeTypeQNames, NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
           
 void getChildAssocsByTypeQNameAndQName(java.lang.Long parentNodeId, QName assocTypeQName, QName assocQName, NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
           
 void getChildAssocsByTypeQNames(java.lang.Long parentNodeId, java.util.List assocTypeQNames, NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
           
 void getChildAssocsWithoutParentAssocsOfType(java.lang.Long parentNodeId, QName assocTypeQName, NodeDaoService.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.
 void getContentUrlsForStore(StoreRef storeRef, NodeDaoService.ObjectArrayQueryCallback resultsCallback)
          Iterate over all content nodes to get owner/creator and content url (in order to extract content size)
 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 getNodeAccessControlList(java.lang.Long nodeId)
           
 java.util.Set getNodeAspects(java.lang.Long nodeId)
           
 org.alfresco.util.Pair getNodeAssoc(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, QName assocTypeQName)
           
 AssociationRef getNodeAssocOrNull(java.lang.Long assocId)
          Gets a node association by ID.
 java.util.Collection getNodeAssocsToAndFrom(java.lang.Long nodeId)
           
 org.alfresco.util.Pair getNodePair(java.lang.Long nodeId)
           
 org.alfresco.util.Pair getNodePair(NodeRef nodeRef)
           
 java.util.Map getNodeProperties(java.lang.Long nodeId)
           
 java.util.Map getNodePropertiesRaw(java.lang.Long nodeId)
           
 java.io.Serializable getNodeProperty(java.lang.Long nodeId, QName propertyQName)
           
 NodeRef.Status getNodeRefStatus(NodeRef nodeRef)
           
 void getNodesDeletedInOldTxns(java.lang.Long minNodeId, long maxCommitTime, int count, NodeDaoService.NodeRefQueryCallback resultsCallback)
          Gets a batch of deleted nodes in old transactions.
 void getNodesWithAspect(QName aspectQName, java.lang.Long minNodeId, int count, NodeDaoService.NodeRefQueryCallback resultsCallback)
           
 void getNodesWithChildrenInDifferentStore(java.lang.Long storeId, java.lang.Long minNodeId, int count, NodeDaoService.NodeRefQueryCallback resultsCallback)
          Deprecated. Not performant. Do not use.
 QName getNodeType(java.lang.Long nodeId)
           
 java.util.Collection getParentAssocs(java.lang.Long childNodeId)
          Get all parent associations for the node. This includes a check to ensuret that only root nodes don't have primary parents
 void getPrimaryChildAssocs(java.lang.Long parentNodeId, NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
           
 void getPrimaryChildAssocsNotInSameStore(java.lang.Long parentNodeId, NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
           
 org.alfresco.util.Pair getPrimaryParentAssoc(java.lang.Long childNodeId)
          Finds the association between the node's primary parent and the node itself This method includes a check for multiple primary parent associations.
 void getPropertyValuesByActualType(DataTypeDefinition actualDataTypeDefinition, NodeDaoService.NodePropertyHandler handler)
          Iterate over all property values for the given type definition.
 void getPropertyValuesByPropertyAndValue(StoreRef storeRef, QName propertyQName, java.lang.String value, NodeDaoService.NodePropertyHandler handler)
          Iterate over all nodes that have a given property type with a given string value.
static java.io.Serializable getPublicProperty(java.util.Map propertyValues, QName propertyQName, QNameDAO qnameDAO, LocaleDAO localeDAO, ContentDataDAO contentDataDAO, DictionaryService dictionaryService)
           
 org.alfresco.util.Pair getRootNode(StoreRef storeRef)
           
 java.util.Collection getSourceNodeAssocs(java.lang.Long targetNodeId)
           
 java.util.List getStores()
          Fetch a list of all stores in the repository
 java.util.Collection getTargetNodeAssocs(java.lang.Long sourceNodeId)
           
 int getTransactionCount()
           
 Transaction getTxnById(long txnId)
          Retrieves a specific transaction.
 java.util.List getTxnChanges(long txnId)
           
 java.util.List getTxnChangesForStore(StoreRef storeRef, long txnId)
           
 int getTxnDeleteCount(long txnId)
           
 java.util.List getTxnsByCommitTimeAscending(long fromTimeInclusive, long toTimeExclusive, int count, java.util.List excludeTxnIds, boolean remoteOnly)
          Get all transactions in a given time range.
 java.util.List getTxnsByCommitTimeDescending(long fromTimeInclusive, long toTimeExclusive, int count, java.util.List excludeTxnIds, boolean remoteOnly)
          Get all transactions in a given time range.
 java.util.List getTxnsByMinCommitTime(java.util.List includeTxnIds)
          Get the lowest commit time for a set of transactions
 java.util.List getTxnsUnused(java.lang.Long minTxnId, long maxCommitTime, int count)
           
 int getTxnUpdateCount(long txnId)
           
 void getUsersWithoutUsage(StoreRef storeRef, NodeDaoService.ObjectArrayQueryCallback resultsCallback)
          Iterate over all person nodes to get users without a calculated usage
 void getUsersWithoutUsageProp(StoreRef storeRef, NodeDaoService.ObjectArrayQueryCallback resultsCallback)
          Iterate over all person nodes with missing usage property (for one-off patch)
 void getUsersWithUsage(StoreRef storeRef, NodeDaoService.ObjectArrayQueryCallback resultsCallback)
          Iterate over all person nodes to get users with a calculated usage
 int hashCode()
           
 boolean hasNodeAspect(java.lang.Long nodeId, QName aspectQName)
           
 boolean isDirty()
          Does this Session contain any changes which must be synchronized with the store?
 org.alfresco.util.Pair moveNodeToStore(java.lang.Long nodeId, StoreRef storeRef)
          This moves the entire node, ensuring that a trail is left behind.
 org.alfresco.util.Pair newChildAssoc(java.lang.Long parentNodeId, java.lang.Long childNodeId, boolean isPrimary, QName assocTypeQName, QName assocQName, java.lang.String newName)
           
 org.alfresco.util.Pair newNode(StoreRef storeRef, java.lang.String uuid, QName nodeTypeQName)
          Create a new node.
 org.alfresco.util.Pair newNodeAssoc(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, QName assocTypeQName)
           
 void prependPaths(org.alfresco.util.Pair currentNodePair, org.alfresco.util.Pair currentRootNodePair, Path currentPath, java.util.Collection completedPaths, java.util.Stack assocIdStack, boolean primaryOnly)
          Recursive method used to build up paths from a given node to the root.
 void purgeNode(java.lang.Long nodeId)
          Final purge of the node entry.
 void purgeTxn(java.lang.Long txnId)
           
 void removeNodeAspects(java.lang.Long nodeId, java.util.Set aspectQNames)
           
 void removeNodeProperties(java.lang.Long nodeId, java.util.Set propertyQNamesIncl)
           
 void setAclDaoComponent(AclDaoComponent aclDaoComponent)
           
 void setAuditableTransactionHelper(RetryingTransactionHelper auditableTransactionHelper)
          Set the component to start new transactions when setting auditable properties (timestamps) in the post-transaction phase.
 void setBehaviourFilter(BehaviourFilter behaviourFilter)
          Set the component to determine the correct aspect behaviours.
 void setChildNameUnique(java.lang.Long childAssocId, java.lang.String childName)
          Change the name of the child node.
 void setContentDataDAO(ContentDataDAO contentDataDAO)
          Set the component for storing and retrieving ContentData
 void setDictionaryService(DictionaryService dictionaryService)
          Set the component for querying the dictionary model
 void setEnableTimestampPropagation(boolean enableTimestampPropagation)
          Enable/disable propagation of timestamps from child to parent nodes.
Note: This only has an effect on child associations that use the propagateTimestamps element.
 void setLocaleDAO(LocaleDAO localeDAO)
          Set the component for creating Locale entities
 void setNodeAccessControlList(java.lang.Long nodeId, java.lang.Long aclId)
           
 void setNodeProperties(java.lang.Long nodeId, java.util.Map propertiesIncl)
           
 void setNodeStatus(java.lang.Long nodeId)
           
 void setParentAssocsCache(SimpleCache parentAssocsCache)
          Set the transaction-aware cache to store parent associations by child node id
 void setQnameDAO(QNameDAO qnameDAO)
          Set the component for creating QName entities.
 void setStoreAndNodeIdCache(SimpleCache storeAndNodeIdCache)
          Ste the transaction-aware cache to store Store and Root Node IDs by Store Reference
 void setTransactionService(TransactionService transactionService)
          Executes post-transaction code
 void setUsageDeltaDAO(UsageDeltaDAO usageDeltaDAO)
           
 org.alfresco.util.Pair updateChildAssoc(java.lang.Long childAssocId, java.lang.Long parentNodeId, java.lang.Long childNodeId, QName assocTypeQName, QName assocQName, int index, java.lang.String childName)
           
 void updateNode(java.lang.Long nodeId, StoreRef storeRefAfter, java.lang.String uuidAfter, QName nodeTypeQName)
           
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUPLICATE_CHILD_NAME_EXCEPTIONS

public static final java.lang.Class[] DUPLICATE_CHILD_NAME_EXCEPTIONS
Exceptions that indicate duplicate child names violations.

Constructor Detail

HibernateNodeDaoServiceImpl

public HibernateNodeDaoServiceImpl()
Method Detail

equals

public boolean equals(java.lang.Object obj)
Checks equality by type and uuid

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
HibernateNodeDaoServiceImpl.uuid

setQnameDAO

public void setQnameDAO(QNameDAO qnameDAO)
Set the component for creating QName entities.


setContentDataDAO

public void setContentDataDAO(ContentDataDAO contentDataDAO)
Set the component for storing and retrieving ContentData


setUsageDeltaDAO

public void setUsageDeltaDAO(UsageDeltaDAO usageDeltaDAO)

setAclDaoComponent

public void setAclDaoComponent(AclDaoComponent aclDaoComponent)

setLocaleDAO

public void setLocaleDAO(LocaleDAO localeDAO)
Set the component for creating Locale entities


setDictionaryService

public void setDictionaryService(DictionaryService dictionaryService)
Set the component for querying the dictionary model


setEnableTimestampPropagation

public void setEnableTimestampPropagation(boolean enableTimestampPropagation)
Enable/disable propagation of timestamps from child to parent nodes.
Note: This only has an effect on child associations that use the propagateTimestamps element.


setTransactionService

public void setTransactionService(TransactionService transactionService)
Executes post-transaction code


setAuditableTransactionHelper

public void setAuditableTransactionHelper(RetryingTransactionHelper auditableTransactionHelper)
Set the component to start new transactions when setting auditable properties (timestamps) in the post-transaction phase.


setBehaviourFilter

public void setBehaviourFilter(BehaviourFilter behaviourFilter)
Set the component to determine the correct aspect behaviours. This applies particularly to the cm:auditable case, where the setting of values is done automatically except when the behaviour is disabled.


setStoreAndNodeIdCache

public void setStoreAndNodeIdCache(SimpleCache storeAndNodeIdCache)
Ste the transaction-aware cache to store Store and Root Node IDs by Store Reference

Parameters:
storeAndNodeIdCache - the cache

setParentAssocsCache

public void setParentAssocsCache(SimpleCache parentAssocsCache)
Set the transaction-aware cache to store parent associations by child node id

Parameters:
parentAssocsCache - the cache

beforeCommit

public void beforeCommit()
Ensure that any transaction that might be present is updated to reflect the current time.

Specified by:
beforeCommit in interface TransactionalDao

isDirty

public boolean isDirty()
Does this Session contain any changes which must be synchronized with the store?

Specified by:
isDirty in interface NodeDaoService
Specified by:
isDirty in interface TransactionalDao
Returns:
true => changes are pending

flush

public void flush()
Just flushes the session

Specified by:
flush in interface NodeDaoService
Specified by:
flush in interface TransactionalDao

getStores

public java.util.List getStores()
Description copied from interface: NodeDaoService
Fetch a list of all stores in the repository

Specified by:
getStores in interface NodeDaoService
Returns:
Returns a list of stores
See Also:
HibernateNodeDaoServiceImpl.QUERY_GET_ALL_STORES

getRootNode

public org.alfresco.util.Pair getRootNode(StoreRef storeRef)
Specified by:
getRootNode in interface NodeDaoService

createStore

public org.alfresco.util.Pair createStore(StoreRef storeRef)
Ensures that the store protocol/identifier combination is unique

Specified by:
createStore in interface NodeDaoService
Returns:
Returns the root node, which is added automatically.

getNodeRefStatus

public NodeRef.Status getNodeRefStatus(NodeRef nodeRef)
Specified by:
getNodeRefStatus in interface NodeDaoService

newNode

public org.alfresco.util.Pair newNode(StoreRef storeRef,
                                      java.lang.String uuid,
                                      QName nodeTypeQName)
                               throws InvalidTypeException
Description copied from interface: NodeDaoService
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 NodeDaoService
Parameters:
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
Returns:
Returns a new node Id of the given type and attached to the store
Throws:
InvalidTypeException - if the node type is invalid or if the node type is not a valid real node

moveNodeToStore

public org.alfresco.util.Pair moveNodeToStore(java.lang.Long nodeId,
                                              StoreRef storeRef)
This moves the entire node, ensuring that a trail is left behind. It is more efficient to move the node and recreate a deleted node in it's wake because of the other properties and aspects that need to go with the node.

Specified by:
moveNodeToStore in interface NodeDaoService

getNodePair

public org.alfresco.util.Pair getNodePair(NodeRef nodeRef)
Specified by:
getNodePair in interface NodeDaoService
Parameters:
nodeRef - the node reference
Returns:
Returns the node entity ID

getNodePair

public org.alfresco.util.Pair getNodePair(java.lang.Long nodeId)
Specified by:
getNodePair in interface NodeDaoService

getNodeType

public QName getNodeType(java.lang.Long nodeId)
Specified by:
getNodeType in interface NodeDaoService

setNodeStatus

public void setNodeStatus(java.lang.Long nodeId)
Specified by:
setNodeStatus in interface NodeDaoService

getNodeAccessControlList

public java.lang.Long getNodeAccessControlList(java.lang.Long nodeId)
Specified by:
getNodeAccessControlList in interface NodeDaoService

setNodeAccessControlList

public void setNodeAccessControlList(java.lang.Long nodeId,
                                     java.lang.Long aclId)
Specified by:
setNodeAccessControlList in interface NodeDaoService

updateNode

public void updateNode(java.lang.Long nodeId,
                       StoreRef storeRefAfter,
                       java.lang.String uuidAfter,
                       QName nodeTypeQName)
Specified by:
updateNode in interface NodeDaoService
storeRefAfter - the new store or null to keep the existing one
uuidAfter - the new UUID for the node or null to keep it the same
nodeTypeQName - the new type QName for the node or null to keep the existing one

getNodePropertiesRaw

public java.util.Map getNodePropertiesRaw(java.lang.Long nodeId)
Specified by:
getNodePropertiesRaw in interface NodeDaoService
Parameters:
nodeId - the node's ID
Returns:
Returns a copy of the low-level properties including auditable properties
See Also:
NodeDaoService.getNodePair(NodeRef)

getNodeProperty

public java.io.Serializable getNodeProperty(java.lang.Long nodeId,
                                            QName propertyQName)
Specified by:
getNodeProperty in interface NodeDaoService

getNodeProperties

public java.util.Map getNodeProperties(java.lang.Long nodeId)
Specified by:
getNodeProperties in interface NodeDaoService

addNodeProperty

public void addNodeProperty(java.lang.Long nodeId,
                            QName qname,
                            java.io.Serializable propertyValue)
Specified by:
addNodeProperty in interface NodeDaoService

addNodeProperties

public void addNodeProperties(java.lang.Long nodeId,
                              java.util.Map properties)
Specified by:
addNodeProperties in interface NodeDaoService

setNodeProperties

public void setNodeProperties(java.lang.Long nodeId,
                              java.util.Map propertiesIncl)
Specified by:
setNodeProperties in interface NodeDaoService

removeNodeProperties

public void removeNodeProperties(java.lang.Long nodeId,
                                 java.util.Set propertyQNamesIncl)
Specified by:
removeNodeProperties in interface NodeDaoService

getNodeAspects

public java.util.Set getNodeAspects(java.lang.Long nodeId)
Specified by:
getNodeAspects in interface NodeDaoService

addNodeAspects

public void addNodeAspects(java.lang.Long nodeId,
                           java.util.Set aspectQNames)
Specified by:
addNodeAspects in interface NodeDaoService

removeNodeAspects

public void removeNodeAspects(java.lang.Long nodeId,
                              java.util.Set aspectQNames)
Specified by:
removeNodeAspects in interface NodeDaoService

hasNodeAspect

public boolean hasNodeAspect(java.lang.Long nodeId,
                             QName aspectQName)
Specified by:
hasNodeAspect in interface NodeDaoService

deleteNode

public void deleteNode(java.lang.Long nodeId)
Manually ensures that all cascading of associations is taken care of

Specified by:
deleteNode in interface NodeDaoService

purgeNode

public void purgeNode(java.lang.Long nodeId)
Final purge of the node entry. No transaction recording is done for this.

Specified by:
purgeNode in interface NodeDaoService

newChildAssoc

public org.alfresco.util.Pair newChildAssoc(java.lang.Long parentNodeId,
                                            java.lang.Long childNodeId,
                                            boolean isPrimary,
                                            QName assocTypeQName,
                                            QName assocQName,
                                            java.lang.String newName)
Specified by:
newChildAssoc in interface NodeDaoService
newName - the cm:name to apply to the association
Returns:
Returns the persisted and filled association's ID
See Also:
ChildAssoc

setChildNameUnique

public void setChildNameUnique(java.lang.Long childAssocId,
                               java.lang.String childName)
Description copied from interface: NodeDaoService
Change the name of the child node.

Specified by:
setChildNameUnique in interface NodeDaoService
childName - the name to put on the association

updateChildAssoc

public org.alfresco.util.Pair updateChildAssoc(java.lang.Long childAssocId,
                                               java.lang.Long parentNodeId,
                                               java.lang.Long childNodeId,
                                               QName assocTypeQName,
                                               QName assocQName,
                                               int index,
                                               java.lang.String childName)
Specified by:
updateChildAssoc in interface NodeDaoService
index - the association index. -1 to keep the existing value

getChildAssocs

public void getChildAssocs(java.lang.Long parentNodeId,
                           NodeDaoService.ChildAssocRefQueryCallback resultsCallback,
                           boolean recurse)
Description copied from interface: NodeDaoService
Get a collection of all child association references for a given parent node.

WARNING: Be sure selective when doing this call recursively.

Specified by:
getChildAssocs in interface NodeDaoService
Parameters:
parentNodeId - the parent node
resultsCallback - the callback that will be called with the results
recurse - if true then iterate over the entire tree of nodes. Resursion is done top-down i.e. the first level children are all enumerated first, followed by all second level children and so on.

getChildAssocs

public void getChildAssocs(java.lang.Long parentNodeId,
                           QName assocQName,
                           NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
Description copied from interface: NodeDaoService
Get a collection of all child association references for a given parent node.

Specified by:
getChildAssocs in interface NodeDaoService
Parameters:
parentNodeId - the parent node
resultsCallback - the callback that will be called with the results

getChildAssocs

public void getChildAssocs(java.lang.Long parentNodeId,
                           QName assocTypeQName,
                           java.util.Collection childNames,
                           NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
Description copied from interface: NodeDaoService
Get a collection of all child associations references where the child name is an exact match. This method only works if the association type fundamentally supports unique-name enforcement.

Specified by:
getChildAssocs in interface NodeDaoService
Parameters:
parentNodeId - the parent node
assocTypeQName - the type of the association to check.
childNames - the names of the child nodes (cm:name). These will be matched exactly.
resultsCallback - the callback that will be called with the results

getChildAssocsByTypeQNames

public void getChildAssocsByTypeQNames(java.lang.Long parentNodeId,
                                       java.util.List assocTypeQNames,
                                       NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
Specified by:
getChildAssocsByTypeQNames in interface NodeDaoService

getChildAssocsByTypeQNameAndQName

public void getChildAssocsByTypeQNameAndQName(java.lang.Long parentNodeId,
                                              QName assocTypeQName,
                                              QName assocQName,
                                              NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
Specified by:
getChildAssocsByTypeQNameAndQName in interface NodeDaoService

getChildAssocsByChildTypes

public void getChildAssocsByChildTypes(java.lang.Long parentNodeId,
                                       java.util.Set childNodeTypeQNames,
                                       NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
Specified by:
getChildAssocsByChildTypes in interface NodeDaoService

getPrimaryChildAssocs

public void getPrimaryChildAssocs(java.lang.Long parentNodeId,
                                  NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
Specified by:
getPrimaryChildAssocs in interface NodeDaoService

getPrimaryChildAssocsNotInSameStore

public void getPrimaryChildAssocsNotInSameStore(java.lang.Long parentNodeId,
                                                NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
Specified by:
getPrimaryChildAssocsNotInSameStore in interface NodeDaoService

getChildAssoc

public org.alfresco.util.Pair getChildAssoc(java.lang.Long parentNodeId,
                                            QName assocTypeQName,
                                            java.lang.String childName)
Specified by:
getChildAssoc in interface NodeDaoService
Returns:
Returns an association matching the given parent, type and child name (cm:name) - or null if not found

getChildAssoc

public org.alfresco.util.Pair getChildAssoc(java.lang.Long parentNodeId,
                                            java.lang.Long childNodeId,
                                            QName assocTypeQName,
                                            QName assocQName)
Specified by:
getChildAssoc in interface NodeDaoService
Returns:
Returns a matching association or null if one was not found
See Also:
ChildAssoc

clear

public void clear()
Clears the cached nodes

Clears the L1 cache, the parentAssocsCache and storeAndNodeIdCache

Specified by:
clear in interface NodeBulkLoader

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.

getNodesWithAspect

public void getNodesWithAspect(QName aspectQName,
                               java.lang.Long minNodeId,
                               int count,
                               NodeDaoService.NodeRefQueryCallback resultsCallback)
Specified by:
getNodesWithAspect in interface NodeDaoService

getNodesWithChildrenInDifferentStore

public void getNodesWithChildrenInDifferentStore(java.lang.Long storeId,
                                                 java.lang.Long minNodeId,
                                                 int count,
                                                 NodeDaoService.NodeRefQueryCallback resultsCallback)
Deprecated. Not performant. Do not use.

Description copied from interface: NodeDaoService
Gets a set of nodes that have parents in the given store, but are themselves located in a different store.

Specified by:
getNodesWithChildrenInDifferentStore in interface NodeDaoService
Parameters:
storeId - the store of the parent nodes
minNodeId - the min node ID to return
count - the maximum number of results
resultsCallback - the node callback

getChildAssocsWithoutParentAssocsOfType

public void getChildAssocsWithoutParentAssocsOfType(java.lang.Long parentNodeId,
                                                    QName assocTypeQName,
                                                    NodeDaoService.ChildAssocRefQueryCallback resultsCallback)
Description copied from interface: NodeDaoService
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 NodeDaoService
Parameters:
parentNodeId - the parent node ID
assocTypeQName - the association type QName
resultsCallback - the callback that will be called with the results

deleteChildAssoc

public void deleteChildAssoc(java.lang.Long assocId)
Specified by:
deleteChildAssoc in interface NodeDaoService

deleteChildAssoc

public boolean deleteChildAssoc(java.lang.Long parentNodeId,
                                java.lang.Long childNodeId,
                                QName assocTypeQName,
                                QName assocQName)
Description copied from interface: NodeDaoService
Deletes an explicit child association.

Specified by:
deleteChildAssoc in interface NodeDaoService
Returns:
Returns true if the association was deleted, otherwise false

prependPaths

public void prependPaths(org.alfresco.util.Pair currentNodePair,
                         org.alfresco.util.Pair currentRootNodePair,
                         Path currentPath,
                         java.util.Collection completedPaths,
                         java.util.Stack assocIdStack,
                         boolean primaryOnly)
                  throws CyclicChildRelationshipException
Recursive method used to build up paths from a given node to the root.

Whilst walking up the hierarchy to the root, some nodes may have a root aspect. Everytime one of these is encountered, a new path is farmed off, but the method continues to walk up the hierarchy.

Specified by:
prependPaths in interface NodeDaoService
Parameters:
currentNode - the node to start from, i.e. the child node to work upwards from
currentPath - the path from the current node to the descendent that we started from
completedPaths - paths that have reached the root are added to this collection
assocStack - the parent-child relationships traversed whilst building the path. Used to detected cyclic relationships.
primaryOnly - true if only the primary parent association must be traversed. If this is true, then the only root is the top level node having no parents.
Throws:
CyclicChildRelationshipException

getParentAssocs

public java.util.Collection getParentAssocs(java.lang.Long childNodeId)
Get all parent associations for the node. This methods includes a cache safety check. This includes a check to ensuret that only root nodes don't have primary parents

Specified by:
getParentAssocs in interface NodeDaoService
Returns:
Returns all parent associations for the node.

getPrimaryParentAssoc

public org.alfresco.util.Pair getPrimaryParentAssoc(java.lang.Long childNodeId)
Finds the association between the node's primary parent and the node itself This method includes a check for multiple primary parent associations. The check doesn't fail but will warn (once per instance) of the occurence of the error. It is up to the administrator to fix the issue at the moment, but the server will not stop working.

Specified by:
getPrimaryParentAssoc in interface NodeDaoService

newNodeAssoc

public org.alfresco.util.Pair newNodeAssoc(java.lang.Long sourceNodeId,
                                           java.lang.Long targetNodeId,
                                           QName assocTypeQName)
Specified by:
newNodeAssoc in interface NodeDaoService
Returns:
Returns the persisted and filled association
See Also:
NodeAssoc

getNodeAssocsToAndFrom

public java.util.Collection getNodeAssocsToAndFrom(java.lang.Long nodeId)
Specified by:
getNodeAssocsToAndFrom in interface NodeDaoService
Returns:
Returns a list of all node associations associated with the given node

getNodeAssoc

public org.alfresco.util.Pair getNodeAssoc(java.lang.Long sourceNodeId,
                                           java.lang.Long targetNodeId,
                                           QName assocTypeQName)
Specified by:
getNodeAssoc in interface NodeDaoService
Returns:
Returns the node association or null if not found

getNodeAssocOrNull

public AssociationRef getNodeAssocOrNull(java.lang.Long assocId)
Description copied from interface: NodeDaoService
Gets a node association by ID.

Specified by:
getNodeAssocOrNull in interface NodeDaoService
Parameters:
assocId - the association id
Returns:
the node association, or null if it does not exist

getTargetNodeAssocs

public java.util.Collection getTargetNodeAssocs(java.lang.Long sourceNodeId)
Specified by:
getTargetNodeAssocs in interface NodeDaoService
Returns:
Returns all the node associations where the node is the source

getSourceNodeAssocs

public java.util.Collection getSourceNodeAssocs(java.lang.Long targetNodeId)
Specified by:
getSourceNodeAssocs in interface NodeDaoService
Returns:
Returns all the node associations where the node is the target

deleteNodeAssoc

public void deleteNodeAssoc(java.lang.Long assocId)
Specified by:
deleteNodeAssoc in interface NodeDaoService

getPropertyValuesByPropertyAndValue

public void getPropertyValuesByPropertyAndValue(StoreRef storeRef,
                                                QName propertyQName,
                                                java.lang.String value,
                                                NodeDaoService.NodePropertyHandler handler)
Description copied from interface: NodeDaoService
Iterate over all nodes that have a given property type with a given string value.

Specified by:
getPropertyValuesByPropertyAndValue in interface NodeDaoService
Parameters:
storeRef - the store to search in
propertyQName - the qualified name of the property
value - the string value to match
handler - the callback to use while iterating over the URLs

getContentUrlsForStore

public void getContentUrlsForStore(StoreRef storeRef,
                                   NodeDaoService.ObjectArrayQueryCallback resultsCallback)
Description copied from interface: NodeDaoService
Iterate over all content nodes to get owner/creator and content url (in order to extract content size)

Specified by:
getContentUrlsForStore in interface NodeDaoService
Parameters:
storeRef - the store to search in

getUsersWithoutUsageProp

public void getUsersWithoutUsageProp(StoreRef storeRef,
                                     NodeDaoService.ObjectArrayQueryCallback resultsCallback)
Description copied from interface: NodeDaoService
Iterate over all person nodes with missing usage property (for one-off patch)

Specified by:
getUsersWithoutUsageProp in interface NodeDaoService
Parameters:
storeRef - the store to search in

getUsersWithoutUsage

public void getUsersWithoutUsage(StoreRef storeRef,
                                 NodeDaoService.ObjectArrayQueryCallback resultsCallback)
Description copied from interface: NodeDaoService
Iterate over all person nodes to get users without a calculated usage

Specified by:
getUsersWithoutUsage in interface NodeDaoService
Parameters:
storeRef - the store to search in

getUsersWithUsage

public void getUsersWithUsage(StoreRef storeRef,
                              NodeDaoService.ObjectArrayQueryCallback resultsCallback)
Description copied from interface: NodeDaoService
Iterate over all person nodes to get users with a calculated usage

Specified by:
getUsersWithUsage in interface NodeDaoService
Parameters:
storeRef - the store to search in

getPropertyValuesByActualType

public void getPropertyValuesByActualType(DataTypeDefinition actualDataTypeDefinition,
                                          NodeDaoService.NodePropertyHandler handler)
Description copied from interface: NodeDaoService
Iterate over all property values for the given type definition. This will also dig out values that were persisted as type d:any.

Specified by:
getPropertyValuesByActualType in interface NodeDaoService
Parameters:
actualDataTypeDefinition - the persisted type to retrieve
handler - the callback to use while iterating over the URLs

getNodesDeletedInOldTxns

public void getNodesDeletedInOldTxns(java.lang.Long minNodeId,
                                     long maxCommitTime,
                                     int count,
                                     NodeDaoService.NodeRefQueryCallback resultsCallback)
Description copied from interface: NodeDaoService
Gets a batch of deleted nodes in old transactions.

Specified by:
getNodesDeletedInOldTxns in interface NodeDaoService
Parameters:
minNodeId - the minimum node ID
maxCommitTime - the maximum commit time (to set a minimum transaction age)
count - the maximum number of results (for batching)
resultsCallback - the callback to pass results back

getTxnById

public Transaction getTxnById(long txnId)
Description copied from interface: NodeDaoService
Retrieves a specific transaction.

Specified by:
getTxnById in interface NodeDaoService
Parameters:
txnId - the unique transaction ID.
Returns:
the requested transaction or null

getMinTxnCommitTime

public java.lang.Long getMinTxnCommitTime()
Specified by:
getMinTxnCommitTime in interface NodeDaoService

getMaxTxnCommitTime

public java.lang.Long getMaxTxnCommitTime()
Specified by:
getMaxTxnCommitTime in interface NodeDaoService

getMaxTxnIdByCommitTime

public java.lang.Long getMaxTxnIdByCommitTime(long maxCommitTime)
Description copied from interface: NodeDaoService
Retrieves the maximum transaction ID for which the commit time is less than the given time.

Specified by:
getMaxTxnIdByCommitTime in interface NodeDaoService
Parameters:
maxCommitTime - the max commit time (ms)
Returns:
the last transaction on or before the given time

getTxnsByMinCommitTime

public java.util.List getTxnsByMinCommitTime(java.util.List includeTxnIds)
Description copied from interface: NodeDaoService
Get the lowest commit time for a set of transactions

Specified by:
getTxnsByMinCommitTime in interface NodeDaoService
Parameters:
includeTxnIds - a list of transaction IDs to search for
Returns:
Returns the transactions by commit time for the given IDs

getTxnUpdateCount

public int getTxnUpdateCount(long txnId)
Specified by:
getTxnUpdateCount in interface NodeDaoService

getTxnDeleteCount

public int getTxnDeleteCount(long txnId)
Specified by:
getTxnDeleteCount in interface NodeDaoService

getTransactionCount

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

getTxnsByCommitTimeAscending

public java.util.List getTxnsByCommitTimeAscending(long fromTimeInclusive,
                                                   long toTimeExclusive,
                                                   int count,
                                                   java.util.List excludeTxnIds,
                                                   boolean remoteOnly)
Description copied from interface: NodeDaoService
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 NodeDaoService
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(long fromTimeInclusive,
                                                    long toTimeExclusive,
                                                    int count,
                                                    java.util.List excludeTxnIds,
                                                    boolean remoteOnly)
Description copied from interface: NodeDaoService
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 NodeDaoService
excludeTxnIds - a list of txn IDs to ignore. null is allowed.
remoteOnly - true if locally-written transactions must be ignored

getTxnChangesForStore

public java.util.List getTxnChangesForStore(StoreRef storeRef,
                                            long txnId)
Specified by:
getTxnChangesForStore in interface NodeDaoService

getTxnChanges

public java.util.List getTxnChanges(long txnId)
Specified by:
getTxnChanges in interface NodeDaoService

getTxnsUnused

public java.util.List getTxnsUnused(java.lang.Long minTxnId,
                                    long maxCommitTime,
                                    int count)
Specified by:
getTxnsUnused in interface NodeDaoService

purgeTxn

public void purgeTxn(java.lang.Long txnId)
Specified by:
purgeTxn in interface NodeDaoService

convertToPersistentProperties

public static java.util.Map convertToPersistentProperties(java.util.Map in,
                                                          QNameDAO qnameDAO,
                                                          LocaleDAO localeDAO,
                                                          ContentDataDAO contentDataDAO,
                                                          DictionaryService dictionaryService)

getPublicProperty

public static java.io.Serializable getPublicProperty(java.util.Map propertyValues,
                                                     QName propertyQName,
                                                     QNameDAO qnameDAO,
                                                     LocaleDAO localeDAO,
                                                     ContentDataDAO contentDataDAO,
                                                     DictionaryService dictionaryService)

convertToPublicProperties

public static java.util.Map convertToPublicProperties(java.util.Map propertyValues,
                                                      QNameDAO qnameDAO,
                                                      LocaleDAO localeDAO,
                                                      ContentDataDAO contentDataDAO,
                                                      DictionaryService dictionaryService)


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