Package org.alfresco.repo.domain.node
Interface NodeDAO
-
- All Superinterfaces:
NodeBulkLoader
- All Known Implementing Classes:
AbstractNodeDAOImpl,NodeDAOImpl,NodeDAOImpl.MSSQL,NodeDAOImpl.MySQL,NodeDAOImpl.MySQLClusterNDB
public interface NodeDAO extends NodeBulkLoader
DAO services for alf_node and related tables- Since:
- 3.4
- Author:
- Derek Hulley
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceNodeDAO.ChildAssocRefQueryCallbackInterface used to iterate over results from child association queriesstatic interfaceNodeDAO.NodeRefQueryCallbackInterface used to iterate over pure node resultsstatic classNodeDAO.NodeViewAn object that contains data giving a 'view' of the node to be deleted.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleanaddNodeAspects(java.lang.Long nodeId, java.util.Set<org.alfresco.service.namespace.QName> aspectQNames)booleanaddNodeProperties(java.lang.Long nodeId, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties)booleanaddNodeProperty(java.lang.Long nodeId, org.alfresco.service.namespace.QName qname, java.io.Serializable value)intcountChildAssocsByParent(java.lang.Long parentNodeId, boolean isPrimary)Counts the number of child associations directly under parentNodeId.voidcycleCheck(java.lang.Long nodeId)Perform a check for cyclic relationshipsvoiddeleteChildAssoc(java.lang.Long assocId)voiddeleteNode(java.lang.Long nodeId)Deletes the node and all entities.intdeleteTxnsUnused(long fromCommitTime, long toCommitTime)Remove unused transactions from commit time 'fromCommitTime' to commit time 'toCommitTime'booleanexists(java.lang.Long nodeId)Find out if a node exists.booleanexists(org.alfresco.service.cmr.repository.NodeRef nodeRef)Find out if a node exists.booleanexists(org.alfresco.service.cmr.repository.StoreRef storeRef)Find out if a store exists or notjava.util.Set<org.alfresco.service.cmr.repository.NodeRef>getAllRootNodes(org.alfresco.service.cmr.repository.StoreRef storeRef)org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef>getChildAssoc(java.lang.Long assocId)Get a specific associationorg.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef>getChildAssoc(java.lang.Long parentNodeId, java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)Get a specific child association given all the determining data.org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef>getChildAssoc(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, java.lang.String childName)Get a child association for given parent node, association type and child node name (cm:name).voidgetChildAssocs(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.voidgetChildAssocs(java.lang.Long parentNodeId, java.util.Set<org.alfresco.service.namespace.QName> assocTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)Get the child associations of a given parent node, optionally filtering on type QName.voidgetChildAssocs(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, java.util.Collection<java.lang.String> childNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)Get the child associations of a given parent node, filtering on type QName and the cm:name of the child nodes.voidgetChildAssocs(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, int maxResults, NodeDAO.ChildAssocRefQueryCallback resultsCallback)Gets the first n child associations of a given parent node, optionally filtering on association QName and association type QName.voidgetChildAssocsByChildTypes(java.lang.Long parentNodeId, java.util.Set<org.alfresco.service.namespace.QName> childNodeTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)voidgetChildAssocsByPropertyValue(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName propertyQName, java.io.Serializable nodeValue, NodeDAO.ChildAssocRefQueryCallback resultsCallback)Select children by property valuesvoidgetChildAssocsWithoutParentAssocsOfType(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.LonggetCurrentTransactionId(boolean ensureNew)java.lang.LonggetMaxNodeId()java.lang.LonggetMaxTxnCommitTime()java.lang.LonggetMaxTxnId()java.lang.LonggetMaxTxnIdByCommitTime(long maxCommitTime)Retrieves the maximum transaction ID for which the commit time is less than the given time.java.lang.LonggetMinNodeId()java.lang.LonggetMinTxnCommitTime()java.lang.LonggetMinTxnCommitTimeForDeletedNodes()java.lang.LonggetMinTxnId()java.lang.LonggetMinUnusedTxnCommitTime()java.lang.LonggetNodeAclId(java.lang.Long nodeId)java.util.Set<org.alfresco.service.namespace.QName>getNodeAspects(java.lang.Long nodeId)org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>getNodeAssoc(java.lang.Long assocId)org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>getNodeAssocOrNull(java.lang.Long assocId)java.util.Collection<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>>getNodeAssocsToAndFrom(java.lang.Long nodeId)org.alfresco.util.Pair<java.lang.Long,java.lang.Long>getNodeIdsIntervalForType(org.alfresco.service.namespace.QName type, java.lang.Long startTxnTime, java.lang.Long endTxnTime)Returns the [minId, maxId] interval for nodes of a type, with the transaction time in the given window time.org.alfresco.service.cmr.repository.NodeRef.StatusgetNodeIdStatus(java.lang.Long nodeId)Get the current status of the node, including deleted nodes.org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef>getNodePair(java.lang.Long nodeId)org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef>getNodePair(org.alfresco.service.cmr.repository.NodeRef nodeRef)java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable>getNodeProperties(java.lang.Long nodeId)java.io.SerializablegetNodeProperty(java.lang.Long nodeId, org.alfresco.service.namespace.QName propertyQName)org.alfresco.service.cmr.repository.NodeRef.StatusgetNodeRefStatus(org.alfresco.service.cmr.repository.NodeRef nodeRef)Get the current status of the node, including deleted nodes.voidgetNodesWithAspects(java.util.Set<org.alfresco.service.namespace.QName> aspectQNames, java.lang.Long minNodeId, java.lang.Long maxNodeId, NodeDAO.NodeRefQueryCallback resultsCallback)Get nodes with aspects between the given rangesorg.alfresco.service.namespace.QNamegetNodeType(java.lang.Long nodeId)java.util.List<Transaction>getOneTxnsByCommitTimeDescending(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, boolean remoteOnly)Get one last transaction in a given time range.voidgetParentAssocs(java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, java.lang.Boolean isPrimary, NodeDAO.ChildAssocRefQueryCallback resultsCallback)Get the parent association of a given parent node, optionally filtering on association QName and association type QName.java.util.List<org.alfresco.service.cmr.repository.Path>getPaths(org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef> nodePair, boolean primaryOnly)Build the paths for a node.java.util.List<NodeIdAndAclId>getPrimaryChildrenAcls(java.lang.Long nodeId)Fetch all primary child node IDs and corresponding ACL IDs.org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef>getPrimaryParentAssoc(java.lang.Long childNodeId)Finds the association between the node's primary parent and the node itselforg.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef>getRootNode(org.alfresco.service.cmr.repository.StoreRef storeRef)java.util.Collection<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>>getSourceNodeAssocs(java.lang.Long targetNodeId, org.alfresco.service.namespace.QName typeQName)org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.StoreRef>getStore(org.alfresco.service.cmr.repository.StoreRef storeRef)Get the ID-ref pair for a storejava.util.List<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.StoreRef>>getStores()Fetch a list of all stores in the repositoryjava.util.Collection<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>>getTargetAssocsByPropertyValue(java.lang.Long sourceNodeId, org.alfresco.service.namespace.QName typeQName, org.alfresco.service.namespace.QName propertyQName, java.io.Serializable propertyValue)Get target associations by type of the association, property name and value.java.util.Collection<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>>getTargetNodeAssocs(java.lang.Long sourceNodeId, org.alfresco.service.namespace.QName typeQName)intgetTransactionCount()TransactiongetTxnById(java.lang.Long txnId)Retrieves a specific transaction.java.util.List<org.alfresco.service.cmr.repository.NodeRef.Status>getTxnChanges(java.lang.Long txnId)java.util.List<org.alfresco.service.cmr.repository.NodeRef.Status>getTxnChangesForStore(org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.Long txnId)java.util.List<Transaction>getTxnsByCommitTimeAscending(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, int count, java.util.List<java.lang.Long> excludeTxnIds, boolean remoteOnly)Get all transactions in a given time range.java.util.List<Transaction>getTxnsByCommitTimeAscending(java.util.List<java.lang.Long> includeTxnIds)Get a specific list of transactions ordered by commit time.java.util.List<Transaction>getTxnsByCommitTimeDescending(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, int count, java.util.List<java.lang.Long> excludeTxnIds, boolean remoteOnly)Get all transactions in a given time range.java.util.List<java.lang.Long>getTxnsUnused(java.lang.Long minTxnId, long maxCommitTime, int count)booleanhasNodeAspect(java.lang.Long nodeId, org.alfresco.service.namespace.QName aspectQName)booleanisInCurrentTxn(java.lang.Long nodeId)org.alfresco.util.Pair<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef>,org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef>>moveNode(java.lang.Long childNodeId, java.lang.Long newParentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)Update a node's primary association, giving it a new parent and new association parameters.voidmoveStore(org.alfresco.service.cmr.repository.StoreRef oldStoreRef, org.alfresco.service.cmr.repository.StoreRef newStoreRef)Changes the old store reference to the new store reference.org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef>newChildAssoc(java.lang.Long parentNodeId, java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, java.lang.String childNodeName)Create a new child association.ChildAssocEntitynewNode(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.String uuid, org.alfresco.service.namespace.QName nodeTypeQName, java.util.Locale nodeLocale, java.lang.String childNodeName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> auditableProperties)Create a new node.java.lang.LongnewNodeAssoc(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, org.alfresco.service.namespace.QName assocTypeQName, int assocIndex)Create a new associationorg.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef>newStore(org.alfresco.service.cmr.repository.StoreRef storeRef)Creates a unique store for the given protocol and identifier combination.intpurgeNodes(long fromTxnCommitTimeMs, long toTxnCommitTimeMs)Purge deleted nodes where their participating transactions are in-between the given time interval.voidpurgeTxn(java.lang.Long txnId)booleanremoveNodeAspects(java.lang.Long nodeId)booleanremoveNodeAspects(java.lang.Long nodeId, java.util.Set<org.alfresco.service.namespace.QName> aspectQNames)intremoveNodeAssoc(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, org.alfresco.service.namespace.QName assocTypeQName)Remove a specific node associationintremoveNodeAssocs(java.util.List<java.lang.Long> ids)Remove all node associations of given IDsbooleanremoveNodeProperties(java.lang.Long nodeId, java.util.Set<org.alfresco.service.namespace.QName> propertyQNames)java.util.List<Node>selectChildAssocsWithoutNodeAssocsOfTypes(java.lang.Long parentNodeId, java.lang.Long minNodeId, java.lang.Long maxNodeId, java.util.Set<org.alfresco.service.namespace.QName> assocToExcludeTypeQNames)java.util.List<NodePropertyEntity>selectNodePropertiesByDataType(org.alfresco.service.namespace.QName dataType, long minNodeId, long maxNodeId)Select all node properties that are between two node IDs and of the given actual typejava.util.List<NodePropertyEntity>selectNodePropertiesByTypes(java.util.Set<org.alfresco.service.namespace.QName> qnames)Used by the re-encryptor to re-encrypt encryptable properties with a new encryption key.intsetChildAssocIndex(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.voidsetChildAssocsUniqueName(java.lang.Long childNodeId, java.lang.String childName)Bulk-update all unique name (cm:name) index for parent associations of a given node.booleansetModifiedDate(java.lang.Long nodeId, java.util.Date date)Deprecated.UsesetModifiedProperties(Long, Date, String)to also change the cm:modifier propertybooleansetModifiedProperties(java.lang.Long nodeId, java.util.Date modifiedDate, java.lang.String modifiedBy)Pull the cm:modified up to the current time without changing any other cm:auditable properties.voidsetNodeAclId(java.lang.Long nodeId, java.lang.Long aclId)voidsetNodeAssocIndex(java.lang.Long id, int assocIndex)Update an existing assoc's index.booleansetNodeProperties(java.lang.Long nodeId, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties)voidsetPrimaryChildrenSharedAclId(java.lang.Long primaryParentNodeId, java.lang.Long optionalOldSharedAlcIdInAdditionToNull, java.lang.Long newSharedAclId)inttouchNodes(java.lang.Long txnId, java.util.List<java.lang.Long> nodeIds)Update the transaction associated with a lust of nodesbooleanupdateNode(java.lang.Long nodeId, org.alfresco.service.namespace.QName nodeTypeQName, java.util.Locale nodeLocale)-
Methods inherited from interface org.alfresco.repo.node.NodeBulkLoader
cacheNodes, cacheNodesById, clear, getCachedAncestors, setCheckNodeConsistency
-
-
-
-
Method Detail
-
getCurrentTransactionId
java.lang.Long getCurrentTransactionId(boolean ensureNew)
- Parameters:
ensureNew- true to ensure that a new transaction entry is created if the current transaction does not have one.- Returns:
- Returns the ID of the current transaction entry or null if there have not been any modifications to nodes registered in the transaction and forceNew is false
-
getStore
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.StoreRef> getStore(org.alfresco.service.cmr.repository.StoreRef storeRef)
Get the ID-ref pair for a store- Returns:
- Returns the ID-reference pair for the store or null if it doesn't exist
-
getStores
java.util.List<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.StoreRef>> getStores()
Fetch a list of all stores in the repository- Returns:
- Returns a list of stores
-
exists
boolean exists(org.alfresco.service.cmr.repository.StoreRef storeRef)
Find out if a store exists or not- Parameters:
storeRef- the store- Returns:
- Returns true if the store exists otherwise false
-
newStore
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef> newStore(org.alfresco.service.cmr.repository.StoreRef storeRef)
Creates a unique store for the given protocol and identifier combination. The root node is created with the "root" aspect.- Returns:
- Returns the root node, which is added automatically.
- Throws:
org.alfresco.service.cmr.repository.StoreExistsException- if the store already exists
-
moveStore
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.- Parameters:
oldStoreRef- the existing storenewStoreRef- the new store
-
getRootNode
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef> getRootNode(org.alfresco.service.cmr.repository.StoreRef storeRef)
-
getAllRootNodes
java.util.Set<org.alfresco.service.cmr.repository.NodeRef> getAllRootNodes(org.alfresco.service.cmr.repository.StoreRef storeRef)
-
exists
boolean exists(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Find out if a node exists. Unpurged deleted nodes do not count as they are the DAO's concern only.- Parameters:
nodeRef- the potentially valid node reference- Returns:
- Returns true if the node is present and undeleted
-
exists
boolean exists(java.lang.Long nodeId)
Find out if a node exists. Unpurged deleted nodes do not count as they are the DAO's concern only.- Parameters:
nodeId- the potentially valid node ID- Returns:
- Returns true if the node is present and undeleted
-
isInCurrentTxn
boolean isInCurrentTxn(java.lang.Long nodeId)
- Returns:
- Returns true if the node was last modified in the current transaction, otherwise false.
- Throws:
org.alfresco.service.cmr.repository.InvalidNodeRefException- if there is no record of the node, past or present
-
getNodeRefStatus
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.- Parameters:
nodeRef- the node reference- Returns:
- Returns the current status of the reference. This will only be null if the node never existed or has been purged following deletion.
-
getNodeIdStatus
org.alfresco.service.cmr.repository.NodeRef.Status getNodeIdStatus(java.lang.Long nodeId)
Get the current status of the node, including deleted nodes.- Parameters:
nodeId- the node id- Returns:
- Returns the current status of the reference. This will only be null if the node never existed or has been purged following deletion.
-
getNodePair
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef> getNodePair(org.alfresco.service.cmr.repository.NodeRef nodeRef)
-
getNodePair
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef> getNodePair(java.lang.Long nodeId)
-
getNodeType
org.alfresco.service.namespace.QName getNodeType(java.lang.Long nodeId)
-
getNodeAclId
java.lang.Long getNodeAclId(java.lang.Long nodeId)
-
newNode
ChildAssocEntity newNode(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.String uuid, org.alfresco.service.namespace.QName nodeTypeQName, java.util.Locale nodeLocale, java.lang.String childNodeName, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> auditableProperties) throws org.alfresco.service.cmr.dictionary.InvalidTypeException
Create a new node. Note that allowing the uuid to be assigned by passing in a null is more efficient.- 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 belonguuid- the node store-unique identifier, or null to assign a GUIDnodeTypeQName- the type of the nodenodeLocale- the locale of the nodechildNodeName- the cm:name of the child node or null to use the node's UUIDauditableProperties- 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 nodeNodeExistsException- if the target reference is already taken by a live node
-
moveNode
org.alfresco.util.Pair<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef>,org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef>> moveNode(java.lang.Long childNodeId, java.lang.Long newParentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)Update a node's primary association, giving it a new parent and new association parameters. **NEW**: If the parent node's store differs from the child node's store, then a new child node's is created.- Parameters:
childNodeId- the child node that is movingnewParentNodeId- the new parent node (may not be null)assocTypeQName- the new association type or null to keep the existing typeassocQName- the new association qname or null to keep the existing name- Returns:
- Returns the (first) new association reference and new child reference (second)
- Throws:
NodeExistsException- if the target UUID of the move (in case of a store move) already exists
-
touchNodes
int touchNodes(java.lang.Long txnId, java.util.List<java.lang.Long> nodeIds)Update the transaction associated with a lust of nodes- Parameters:
txnId- - the tx id to setnodeIds- - the nodes to update- Returns:
- the number of nodes touched
-
updateNode
boolean updateNode(java.lang.Long nodeId, org.alfresco.service.namespace.QName nodeTypeQName, java.util.Locale nodeLocale)- Parameters:
nodeTypeQName- the new type QName for the node or null to keep the existing onenodeLocale- the new locale for the node or null to keep the existing one- Returns:
- true if any changes were made
-
setNodeAclId
void setNodeAclId(java.lang.Long nodeId, java.lang.Long aclId)
-
setPrimaryChildrenSharedAclId
void setPrimaryChildrenSharedAclId(java.lang.Long primaryParentNodeId, java.lang.Long optionalOldSharedAlcIdInAdditionToNull, java.lang.Long newSharedAclId)
-
deleteNode
void deleteNode(java.lang.Long nodeId)
Deletes the node and all entities. Note that the node entry will still exist and be associated with a live transaction.
-
purgeNodes
int purgeNodes(long fromTxnCommitTimeMs, long toTxnCommitTimeMs)Purge deleted nodes where their participating transactions are in-between the given time interval.- Parameters:
fromTxnCommitTimeMs- from commit timetoTxnCommitTimeMs- to commit time- Returns:
- Returns the number of deleted nodes purged
-
getNodeProperty
java.io.Serializable getNodeProperty(java.lang.Long nodeId, org.alfresco.service.namespace.QName propertyQName)
-
getNodeProperties
java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> getNodeProperties(java.lang.Long nodeId)
-
setNodeProperties
boolean setNodeProperties(java.lang.Long nodeId, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties)
-
addNodeProperty
boolean addNodeProperty(java.lang.Long nodeId, org.alfresco.service.namespace.QName qname, java.io.Serializable value)
-
addNodeProperties
boolean addNodeProperties(java.lang.Long nodeId, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> properties)
-
removeNodeProperties
boolean removeNodeProperties(java.lang.Long nodeId, java.util.Set<org.alfresco.service.namespace.QName> propertyQNames)
-
setModifiedDate
boolean setModifiedDate(java.lang.Long nodeId, java.util.Date date)Deprecated.UsesetModifiedProperties(Long, Date, String)to also change the cm:modifier propertyPull 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.- Parameters:
nodeId- the node to changedate- the date to set for cm:modified- Returns:
- Returns true if the cm:modified property was actually set
-
setModifiedProperties
boolean setModifiedProperties(java.lang.Long nodeId, java.util.Date modifiedDate, java.lang.String modifiedBy)Pull the cm:modified up to the current time without changing any other cm:auditable properties. The change may be done in the current transaction or in a later transaction.- Parameters:
nodeId- the node to changemodifiedDate- the date to set for cm:modifiedmodifiedBy- the name to set for cm:modifier- Returns:
- Returns true if the cm:modified and cm:modifier properties were actually set
-
getNodeAspects
java.util.Set<org.alfresco.service.namespace.QName> getNodeAspects(java.lang.Long nodeId)
-
hasNodeAspect
boolean hasNodeAspect(java.lang.Long nodeId, org.alfresco.service.namespace.QName aspectQName)
-
addNodeAspects
boolean addNodeAspects(java.lang.Long nodeId, java.util.Set<org.alfresco.service.namespace.QName> aspectQNames)
-
removeNodeAspects
boolean removeNodeAspects(java.lang.Long nodeId)
-
removeNodeAspects
boolean removeNodeAspects(java.lang.Long nodeId, java.util.Set<org.alfresco.service.namespace.QName> aspectQNames)
-
getNodesWithAspects
void getNodesWithAspects(java.util.Set<org.alfresco.service.namespace.QName> aspectQNames, java.lang.Long minNodeId, java.lang.Long maxNodeId, NodeDAO.NodeRefQueryCallback resultsCallback)Get nodes with aspects between the given ranges- Parameters:
aspectQNames- the aspects that must be on the nodesminNodeId- the minimum node ID (inclusive)maxNodeId- the maximum node ID (exclusive)resultsCallback- callback to process results
-
newNodeAssoc
java.lang.Long newNodeAssoc(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, org.alfresco.service.namespace.QName assocTypeQName, int assocIndex)Create a new association- Parameters:
sourceNodeId- the association sourcetargetNodeId- the association targetassocTypeQName- the type of the association (will be resolved to an ID)assocIndex- the index of the new association (-1 indicates next value)
-
setNodeAssocIndex
void setNodeAssocIndex(java.lang.Long id, int assocIndex)Update an existing assoc's index.- Parameters:
id- the association IDassocIndex- the new index (greater than 0)
-
removeNodeAssoc
int removeNodeAssoc(java.lang.Long sourceNodeId, java.lang.Long targetNodeId, org.alfresco.service.namespace.QName assocTypeQName)Remove a specific node association- Parameters:
sourceNodeId- the source node IDtargetNodeId- the target node idassocTypeQName- the node association QName- Returns:
- Returns the number of associations removed
-
removeNodeAssocs
int removeNodeAssocs(java.util.List<java.lang.Long> ids)
Remove all node associations of given IDs- Parameters:
ids- the IDs of the associations to remove- Returns:
- Returns the number of associations removed
-
getNodeAssocsToAndFrom
java.util.Collection<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>> getNodeAssocsToAndFrom(java.lang.Long nodeId)
- Parameters:
nodeId- the source or target of the associations- Returns:
- Returns all the node associations where the node is the source or target
-
getSourceNodeAssocs
java.util.Collection<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>> getSourceNodeAssocs(java.lang.Long targetNodeId, org.alfresco.service.namespace.QName typeQName)- Parameters:
targetNodeId- the target of the associationtypeQName- the type of the association (optional)- Returns:
- Returns all the node associations where the node is the target
-
getTargetNodeAssocs
java.util.Collection<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>> getTargetNodeAssocs(java.lang.Long sourceNodeId, org.alfresco.service.namespace.QName typeQName)- Parameters:
sourceNodeId- the source of the associationtypeQName- the type of the association (optional)- Returns:
- Returns all the node associations where the node is the source
-
getTargetAssocsByPropertyValue
java.util.Collection<org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef>> getTargetAssocsByPropertyValue(java.lang.Long sourceNodeId, org.alfresco.service.namespace.QName typeQName, org.alfresco.service.namespace.QName propertyQName, java.io.Serializable propertyValue)Get target associations by type of the association, property name and value.- Parameters:
sourceNodeId- the source of the associationtypeQName- the type of the association (null allowed)propertyQName- property QName (null allowed)propertyValue- property value (null allowed only if the propertyQName is null)- Returns:
- Returns all the node associations where the node is the source.
-
getNodeAssocOrNull
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef> getNodeAssocOrNull(java.lang.Long assocId)
- Returns:
- Returns a specific node association with the given ID or null if it doesn't exist
-
getNodeAssoc
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.AssociationRef> getNodeAssoc(java.lang.Long assocId)
- Returns:
- Returns a specific node association with the given ID
- Throws:
org.springframework.dao.ConcurrencyFailureException- if the association ID is invalid
-
newChildAssoc
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef> newChildAssoc(java.lang.Long parentNodeId, java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, java.lang.String childNodeName)Create a new child association. 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.- Parameters:
childNodeName- the cm:name to apply to the association- Returns:
- Returns the persisted and filled association's ID
-
deleteChildAssoc
void deleteChildAssoc(java.lang.Long assocId)
- Parameters:
assocId- the ID of the child association to delete
-
setChildAssocIndex
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.- Parameters:
parentNodeId- the parent node IDchildNodeId- the child node IDassocTypeQName- the association typeassocQName- the association path qualified nameindex- the new index- Returns:
- Returns the number of associations modified
-
setChildAssocsUniqueName
void setChildAssocsUniqueName(java.lang.Long childNodeId, java.lang.String childName)Bulk-update all unique name (cm:name) index for parent associations of a given node.- Parameters:
childNodeId- the child node who's name is changingchildName- the new cm:name value
-
getChildAssoc
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssoc(java.lang.Long assocId)
Get a specific association- Parameters:
assocId- the ID of the association- Returns:
- Returns the association reference or null if it doesn't exist
-
getChildAssoc
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssoc(java.lang.Long parentNodeId, java.lang.Long childNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)Get a specific child association given all the determining data.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.
- Returns:
- Returns a matching association or null if one was not found.
-
getChildAssocs
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. This is an efficient query for node paths.- Parameters:
parentNodeId- the parent node IDchildNodeId- the child node ID to filter on; null for no filteringassocTypeQName- the association type qname to filter on; null for no filteringassocQName- the association qname to filter on; null for no filteringisPrimary- 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
void getChildAssocs(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, int maxResults, NodeDAO.ChildAssocRefQueryCallback resultsCallback)Gets the first n child associations of a given parent node, optionally filtering on association QName and association type QName. This is an efficient query for node paths.- Parameters:
parentNodeId- the parent node IDassocTypeQName- the association type qname to filter on; null for no filteringassocQName- the association qname to filter on; null for no filteringmaxResults- the maximum number of results to return. The query will be terminated efficiently after that number of resultsresultsCallback- the callback that will be called with the results
-
getChildAssocs
void getChildAssocs(java.lang.Long parentNodeId, java.util.Set<org.alfresco.service.namespace.QName> assocTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)Get the child associations of a given parent node, optionally filtering on type QName.- Parameters:
parentNodeId- the parent node IDassocTypeQNames- the association type qnames to filter on; null for no filteringresultsCallback- the callback that will be called with the results
-
getChildAssoc
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef> getChildAssoc(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, java.lang.String childName)Get a child association for given parent node, association type and child node name (cm:name).- Parameters:
parentNodeId- the parent Node IDassocTypeQName- the association type to filter onchildName- 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
void getChildAssocs(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName assocTypeQName, java.util.Collection<java.lang.String> childNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)Get the child associations of a given parent node, filtering on type QName and the cm:name of the child nodes.NOTE: This method only works if the association type fundamentally supports unique-name enforcement.
- Parameters:
parentNodeId- the parent nodeassocTypeQName- 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
-
getChildAssocsByChildTypes
void getChildAssocsByChildTypes(java.lang.Long parentNodeId, java.util.Set<org.alfresco.service.namespace.QName> childNodeTypeQNames, NodeDAO.ChildAssocRefQueryCallback resultsCallback)
-
getChildAssocsWithoutParentAssocsOfType
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.- Parameters:
parentNodeId- the parent node IDassocTypeQName- the association type QNameresultsCallback- the callback that will be called with the results
-
selectChildAssocsWithoutNodeAssocsOfTypes
java.util.List<Node> selectChildAssocsWithoutNodeAssocsOfTypes(java.lang.Long parentNodeId, java.lang.Long minNodeId, java.lang.Long maxNodeId, java.util.Set<org.alfresco.service.namespace.QName> assocToExcludeTypeQNames)
- Parameters:
parentNodeId- the parent node idminNodeId- the minimum node ID (inclusive), null for no limitation on the minimum value of the node idmaxNodeId- the maximum node ID (exclusive), null for no limitation on the maximum value of the node idassocToExcludeTypeQNames- the node associations to exclude, null for no filtering of the associations types- Returns:
- list of child nodes
-
getPrimaryParentAssoc
org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.ChildAssociationRef> getPrimaryParentAssoc(java.lang.Long childNodeId)
Finds the association between the node's primary parent and the node itself- Returns:
- Returns the primary (defining) association or null if it is a root node
-
getParentAssocs
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. This is an efficient query for node paths.- Parameters:
childNodeId- the child node IDassocTypeQName- the association type qname to filter on; null for no filteringassocQName- the association qname to filter on; null for no filteringisPrimary- filter for primary (true) or secondary associations; null for no filtering.resultsCallback- the callback that will be called with the results
-
getPrimaryChildrenAcls
java.util.List<NodeIdAndAclId> getPrimaryChildrenAcls(java.lang.Long nodeId)
Fetch all primary child node IDs and corresponding ACL IDs.- Parameters:
nodeId- the parent node ID- Returns:
- Returns a list of Node ID - ACL ID pairs
-
getPaths
java.util.List<org.alfresco.service.cmr.repository.Path> getPaths(org.alfresco.util.Pair<java.lang.Long,org.alfresco.service.cmr.repository.NodeRef> nodePair, boolean primaryOnly) throws org.alfresco.service.cmr.repository.InvalidNodeRefExceptionBuild the paths for a node. When searching forprimaryOnly == true, checks that there is exactly one path.- Parameters:
nodePair- the leave or child node to start withprimaryOnly- true to follow only primary parent associations- Throws:
org.alfresco.service.cmr.repository.InvalidNodeRefException
-
cycleCheck
void cycleCheck(java.lang.Long nodeId)
Perform a check for cyclic relationships
-
getMaxTxnIdByCommitTime
java.lang.Long getMaxTxnIdByCommitTime(long maxCommitTime)
Retrieves the maximum transaction ID for which the commit time is less than the given time.- Parameters:
maxCommitTime- the max commit time (ms)- Returns:
- the last transaction on or before the given time
-
getTxnById
Transaction getTxnById(java.lang.Long txnId)
Retrieves a specific transaction.- Parameters:
txnId- the unique transaction ID.- Returns:
- the requested transaction or null
-
getTxnsByCommitTimeAscending
java.util.List<Transaction> getTxnsByCommitTimeAscending(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, int count, java.util.List<java.lang.Long> excludeTxnIds, boolean remoteOnly)
Get all transactions in a given time range. Since time-based retrieval doesn't guarantee uniqueness for any given millisecond, a list of optional exclusions may be provided.- Parameters:
excludeTxnIds- a list of txn IDs to ignore. null is allowed.remoteOnly- true if locally-written transactions must be ignored
-
getTxnsByCommitTimeDescending
java.util.List<Transaction> getTxnsByCommitTimeDescending(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, int count, java.util.List<java.lang.Long> excludeTxnIds, boolean remoteOnly)
Get all transactions in a given time range. Since time-based retrieval doesn't guarantee uniqueness for any given millisecond, a list of optional exclusions may be provided.- Parameters:
excludeTxnIds- a list of txn IDs to ignore. null is allowed.remoteOnly- true if locally-written transactions must be ignored
-
getTxnsByCommitTimeAscending
java.util.List<Transaction> getTxnsByCommitTimeAscending(java.util.List<java.lang.Long> includeTxnIds)
Get a specific list of transactions ordered by commit time.- Parameters:
includeTxnIds- a list of transaction IDs to search for- Returns:
- Returns the transactions by commit time for the given IDs
-
getTransactionCount
int getTransactionCount()
-
getTxnChangesForStore
java.util.List<org.alfresco.service.cmr.repository.NodeRef.Status> getTxnChangesForStore(org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.Long txnId)- Returns:
- Returns the node statuses for a transaction, limited to the store
-
getTxnChanges
java.util.List<org.alfresco.service.cmr.repository.NodeRef.Status> getTxnChanges(java.lang.Long txnId)
- Returns:
- Returns the node statuses for a transaction, regardless of store
-
getTxnsUnused
java.util.List<java.lang.Long> getTxnsUnused(java.lang.Long minTxnId, long maxCommitTime, int count)
-
deleteTxnsUnused
int deleteTxnsUnused(long fromCommitTime, long toCommitTime)Remove unused transactions from commit time 'fromCommitTime' to commit time 'toCommitTime'- Parameters:
fromCommitTime- delete unused transactions from commit timetoCommitTime- delete unused transactions to commit time- Returns:
- int
-
purgeTxn
void purgeTxn(java.lang.Long txnId)
-
getMinTxnCommitTime
java.lang.Long getMinTxnCommitTime()
- Returns:
- Returns the minimum commit time or null if there are no transactions
-
getMaxTxnCommitTime
java.lang.Long getMaxTxnCommitTime()
- Returns:
- Returns the maximum commit time or null if there are no transactions
-
getMinTxnCommitTimeForDeletedNodes
java.lang.Long getMinTxnCommitTimeForDeletedNodes()
- Returns:
- Returns the minimum commit time for deleted nodes or null if there are no transactions
-
getMinTxnId
java.lang.Long getMinTxnId()
- Returns:
- Returns the minimum id or 0 if there are no transactions
-
getMinUnusedTxnCommitTime
java.lang.Long getMinUnusedTxnCommitTime()
- Returns:
- the commit time of the oldest unused transaction
-
getMaxTxnId
java.lang.Long getMaxTxnId()
- Returns:
- Returns the maximum id or 0 if there are no transactions
-
getMinNodeId
java.lang.Long getMinNodeId()
- Returns:
- Returns the minimum node id or 0 if there are no nodes
-
getMaxNodeId
java.lang.Long getMaxNodeId()
- Returns:
- Returns the maximum node id or 0 if there are no nodes
-
getNodeIdsIntervalForType
org.alfresco.util.Pair<java.lang.Long,java.lang.Long> getNodeIdsIntervalForType(org.alfresco.service.namespace.QName type, java.lang.Long startTxnTime, java.lang.Long endTxnTime)Returns the [minId, maxId] interval for nodes of a type, with the transaction time in the given window time.- Parameters:
type- the node typestartTxnTime- the starting transaction time, null is allowed, case in which no minimum transaction time is consideredendTxnTime- the end transaction time, null is allowed, case in which no maximum transaction time is considered- Returns:
- the interval, as a pair
-
getChildAssocsByPropertyValue
void getChildAssocsByPropertyValue(java.lang.Long parentNodeId, org.alfresco.service.namespace.QName propertyQName, java.io.Serializable nodeValue, NodeDAO.ChildAssocRefQueryCallback resultsCallback)Select children by property values
-
selectNodePropertiesByTypes
java.util.List<NodePropertyEntity> selectNodePropertiesByTypes(java.util.Set<org.alfresco.service.namespace.QName> qnames)
Used by the re-encryptor to re-encrypt encryptable properties with a new encryption key.
-
selectNodePropertiesByDataType
java.util.List<NodePropertyEntity> selectNodePropertiesByDataType(org.alfresco.service.namespace.QName dataType, long minNodeId, long maxNodeId)
Select all node properties that are between two node IDs and of the given actual type- Parameters:
dataType- the actual, original type of the property, as given by one of the constants onDataTypeDefinitionminNodeId- the minimum node ID (inclusive)maxNodeId- the maximum node ID (exclusive)
-
countChildAssocsByParent
int countChildAssocsByParent(java.lang.Long parentNodeId, boolean isPrimary)Counts the number of child associations directly under parentNodeId.- Parameters:
parentNodeId- the parent node idisPrimary- count just primary associations?
-
getOneTxnsByCommitTimeDescending
java.util.List<Transaction> getOneTxnsByCommitTimeDescending(java.lang.Long fromTimeInclusive, java.lang.Long toTimeExclusive, boolean remoteOnly)
Get one last transaction in a given time range.
-
-