Package org.alfresco.repo.node.db
Class DbNodeServiceImpl
- java.lang.Object
-
- org.alfresco.repo.node.AbstractNodeServiceImpl
-
- org.alfresco.repo.node.db.DbNodeServiceImpl
-
- All Implemented Interfaces:
NodeService,Extensible
public class DbNodeServiceImpl extends AbstractNodeServiceImpl implements Extensible, NodeService
Node service using database persistence layer to fulfill functionality- Author:
- Derek Hulley
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.alfresco.service.cmr.repository.NodeService
NodeService.FindNodeParameters
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_PENDING_DELETE_NODES-
Fields inherited from class org.alfresco.repo.node.AbstractNodeServiceImpl
dictionaryService, storesToIgnorePolicies, tenantService, transactionService
-
-
Constructor Summary
Constructors Constructor Description DbNodeServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAspect(NodeRef nodeRef, QName aspectTypeQName, Map<QName,Serializable> aspectProperties)List<ChildAssociationRef>addChild(Collection<NodeRef> parentRefs, NodeRef childRef, QName assocTypeQName, QName assocQName)ChildAssociationRefaddChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName assocQName)voidaddProperties(NodeRef nodeRef, Map<QName,Serializable> properties)intcountChildAssocs(NodeRef nodeRef, boolean isPrimary)AssociationRefcreateAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)ChildAssociationRefcreateNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName)ChildAssociationRefcreateNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName, Map<QName,Serializable> properties)StoreRefcreateStore(String protocol, String identifier)Defers to the typed servicevoiddeleteNode(NodeRef nodeRef)Delete NodevoiddeleteStore(StoreRef storeRef)booleanexists(NodeRef nodeRef)booleanexists(StoreRef storeRef)List<NodeRef>findNodes(NodeService.FindNodeParameters params)Set<NodeRef>getAllRootNodes(StoreRef storeRef)Set<QName>getAspects(NodeRef nodeRef)AssociationRefgetAssoc(Long id)List<ChildAssociationRef>getChildAssocs(NodeRef nodeRef)Defers to the pattern matching overloadList<ChildAssociationRef>getChildAssocs(NodeRef nodeRef, Set<QName> childNodeTypeQNames)List<ChildAssociationRef>getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)Filters out any associations if their qname is not a match to the given pattern.List<ChildAssociationRef>getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern, boolean preload)Filters out any associations if their qname is not a match to the given pattern.List<ChildAssociationRef>getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern, int maxResults, boolean preload)Fetches the first n child associations in an efficient mannerList<ChildAssociationRef>getChildAssocsByPropertyValue(NodeRef nodeRef, QName propertyQName, Serializable value)Collection<ChildAssociationRef>getChildAssocsWithoutParentAssocsOfType(NodeRef parent, QName assocTypeQName)NodeRefgetChildByName(NodeRef nodeRef, QName assocTypeQName, String childName)List<ChildAssociationRef>getChildrenByName(NodeRef nodeRef, QName assocTypeQName, Collection<String> childNames)LonggetNodeAclId(NodeRef nodeRef)NodeRefgetNodeRef(Long nodeId)NodeRef.StatusgetNodeStatus(NodeRef nodeRef)List<ChildAssociationRef>getParentAssocs(NodeRef nodeRef)Defers to the pattern matching overloadList<ChildAssociationRef>getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)Filters out any associations if their qname is not a match to the given pattern.Collection<NodeRef>getParents(NodeRef nodeRef)PathgetPath(NodeRef nodeRef)List<Path>getPaths(NodeRef nodeRef, boolean primaryOnly)When searching forprimaryOnly == true, checks that there is exactly one path.ChildAssociationRefgetPrimaryParent(NodeRef nodeRef)Map<QName,Serializable>getProperties(NodeRef nodeRef)SerializablegetProperty(NodeRef nodeRef, QName qname)NodeRefgetRootNode(StoreRef storeRef)List<AssociationRef>getSourceAssocs(NodeRef targetRef, QNamePattern qnamePattern)NodeRefgetStoreArchiveNode(StoreRef storeRef)List<StoreRef>getStores()List<AssociationRef>getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)List<AssociationRef>getTargetAssocsByPropertyValue(NodeRef sourceRef, QNamePattern qnamePattern, QName propertyQName, Serializable propertyValue)<M extends Trait>
ExtendedTrait<M>getTrait(Class<? extends M> traitAPI)QNamegetType(NodeRef nodeRef)booleanhasAspect(NodeRef nodeRef, QName aspectQName)Performs a check on the set of node aspectsChildAssociationRefmoveNode(NodeRef nodeToMoveRef, NodeRef newParentRef, QName assocTypeQName, QName assocQName)Move Node Drops the old primary association and creates a new onevoidremoveAspect(NodeRef nodeRef, QName aspectTypeQName)voidremoveAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)voidremoveChild(NodeRef parentRef, NodeRef childRef)booleanremoveChildAssociation(ChildAssociationRef childAssocRef)voidremoveProperty(NodeRef nodeRef, QName qname)booleanremoveSecondaryChildAssociation(ChildAssociationRef childAssocRef)NodeRefrestoreNode(NodeRef archivedNodeRef, NodeRef destinationParentNodeRef, QName assocTypeQName, QName assocQName)Archives the node without the cm:auditable aspect behaviourvoidsetAssociations(NodeRef sourceRef, QName assocTypeQName, List<NodeRef> targetRefs)voidsetChildAssociationIndex(ChildAssociationRef childAssocRef, int index)voidsetEnableTimestampPropagation(boolean enableTimestampPropagation)Set whether cm:auditable timestamps should be propagated to parent nodes where the parent-child relationship has been marked using propagateTimestamps.voidsetNodeDAO(NodeDAO nodeDAO)voidsetPermissionService(PermissionService permissionService)voidsetPolicyBehaviourFilter(BehaviourFilter policyBehaviourFilter)voidsetProperties(NodeRef nodeRef, Map<QName,Serializable> properties)Ensures that all required properties are present on the node and copies the property values to theNode.voidsetProperty(NodeRef nodeRef, QName qname, Serializable value)Gets the properties map, sets the value (null is allowed) and checks that the new set of properties is valid.voidsetQnameDAO(QNameDAO qnameDAO)voidsetStoreArchiveMap(StoreArchiveMap storeArchiveMap)voidsetType(NodeRef nodeRef, QName typeQName)-
Methods inherited from class org.alfresco.repo.node.AbstractNodeServiceImpl
equals, generateGuid, getDefaultProperties, getDefaultProperties, getTypeAndAspectQNames, hashCode, init, invokeBeforeAddAspect, invokeBeforeArchiveNode, invokeBeforeCreateNode, invokeBeforeCreateStore, invokeBeforeDeleteAssociation, invokeBeforeDeleteChildAssociation, invokeBeforeDeleteNode, invokeBeforeMoveNode, invokeBeforeRemoveAspect, invokeBeforeSetType, invokeBeforeUpdateNode, invokeOnAddAspect, invokeOnCreateAssociation, invokeOnCreateChildAssociation, invokeOnCreateNode, invokeOnCreateStore, invokeOnDeleteAssociation, invokeOnDeleteChildAssociation, invokeOnDeleteNode, invokeOnMoveNode, invokeOnRemoveAspect, invokeOnRestoreNode, invokeOnSetType, invokeOnUpdateNode, invokeOnUpdateProperties, removeSeconaryChildAssociation, setDictionaryService, setPolicyComponent, setStoresToIgnorePolicies, setTenantService, setTransactionService
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.alfresco.service.cmr.repository.NodeService
removeSeconaryChildAssociation
-
-
-
-
Field Detail
-
KEY_PENDING_DELETE_NODES
public static final String KEY_PENDING_DELETE_NODES
- See Also:
- Constant Field Values
-
-
Method Detail
-
setQnameDAO
public void setQnameDAO(QNameDAO qnameDAO)
-
setNodeDAO
public void setNodeDAO(NodeDAO nodeDAO)
-
setPermissionService
public void setPermissionService(PermissionService permissionService)
-
setStoreArchiveMap
public void setStoreArchiveMap(StoreArchiveMap storeArchiveMap)
-
setPolicyBehaviourFilter
public void setPolicyBehaviourFilter(BehaviourFilter policyBehaviourFilter)
- Parameters:
policyBehaviourFilter- component used to enable and disable behaviours
-
setEnableTimestampPropagation
public void setEnableTimestampPropagation(boolean enableTimestampPropagation)
Set whether cm:auditable timestamps should be propagated to parent nodes where the parent-child relationship has been marked using propagateTimestamps.- Parameters:
enableTimestampPropagation- true to propagate timestamps to the parent node where appropriate
-
exists
public boolean exists(StoreRef storeRef)
- Specified by:
existsin interfaceNodeService
-
exists
public boolean exists(NodeRef nodeRef)
- Specified by:
existsin interfaceNodeService
-
getNodeStatus
public NodeRef.Status getNodeStatus(NodeRef nodeRef)
- Specified by:
getNodeStatusin interfaceNodeService
-
getNodeRef
public NodeRef getNodeRef(Long nodeId)
- Specified by:
getNodeRefin interfaceNodeService
-
getStores
public List<StoreRef> getStores()
- Specified by:
getStoresin interfaceNodeService
-
createStore
public StoreRef createStore(String protocol, String identifier)
Defers to the typed service- Specified by:
createStorein interfaceNodeService
-
deleteStore
public void deleteStore(StoreRef storeRef) throws InvalidStoreRefException
- Specified by:
deleteStorein interfaceNodeService- Throws:
UnsupportedOperationException- AlwaysInvalidStoreRefException
-
getRootNode
public NodeRef getRootNode(StoreRef storeRef) throws InvalidStoreRefException
- Specified by:
getRootNodein interfaceNodeService- Throws:
InvalidStoreRefException
-
getAllRootNodes
public Set<NodeRef> getAllRootNodes(StoreRef storeRef)
- Specified by:
getAllRootNodesin interfaceNodeService
-
createNode
public ChildAssociationRef createNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName)
- Specified by:
createNodein interfaceNodeService- See Also:
createNode(NodeRef, QName, QName, QName, Map)
-
getChildAssocs
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef) throws InvalidNodeRefException
Description copied from class:AbstractNodeServiceImplDefers to the pattern matching overload- Specified by:
getChildAssocsin interfaceNodeService- Overrides:
getChildAssocsin classAbstractNodeServiceImpl- Throws:
InvalidNodeRefException- See Also:
RegexQNamePattern.MATCH_ALL,NodeService.getChildAssocs(NodeRef, QNamePattern, QNamePattern)
-
findNodes
public List<NodeRef> findNodes(NodeService.FindNodeParameters params)
- Specified by:
findNodesin interfaceNodeService- Overrides:
findNodesin classAbstractNodeServiceImpl
-
createNode
public ChildAssociationRef createNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName, Map<QName,Serializable> properties)
- Specified by:
createNodein interfaceNodeService
-
setChildAssociationIndex
public void setChildAssociationIndex(ChildAssociationRef childAssocRef, int index)
- Specified by:
setChildAssociationIndexin interfaceNodeService
-
getType
public QName getType(NodeRef nodeRef) throws InvalidNodeRefException
- Specified by:
getTypein interfaceNodeService- Throws:
InvalidNodeRefException
-
setType
public void setType(NodeRef nodeRef, QName typeQName) throws InvalidNodeRefException
- Specified by:
setTypein interfaceNodeService- Throws:
InvalidNodeRefException- See Also:
NodeService.setType(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
-
addAspect
public void addAspect(NodeRef nodeRef, QName aspectTypeQName, Map<QName,Serializable> aspectProperties) throws InvalidNodeRefException, InvalidAspectException
- Specified by:
addAspectin interfaceNodeService- Throws:
InvalidNodeRefExceptionInvalidAspectException
-
countChildAssocs
public int countChildAssocs(NodeRef nodeRef, boolean isPrimary) throws InvalidNodeRefException
- Specified by:
countChildAssocsin interfaceNodeService- Throws:
InvalidNodeRefException
-
removeAspect
public void removeAspect(NodeRef nodeRef, QName aspectTypeQName) throws InvalidNodeRefException, InvalidAspectException
- Specified by:
removeAspectin interfaceNodeService- Throws:
InvalidNodeRefExceptionInvalidAspectException
-
hasAspect
public boolean hasAspect(NodeRef nodeRef, QName aspectQName) throws InvalidNodeRefException, InvalidAspectException
Performs a check on the set of node aspects- Specified by:
hasAspectin interfaceNodeService- Throws:
InvalidNodeRefExceptionInvalidAspectException
-
getAspects
public Set<QName> getAspects(NodeRef nodeRef) throws InvalidNodeRefException
- Specified by:
getAspectsin interfaceNodeService- Throws:
InvalidNodeRefException
-
deleteNode
public void deleteNode(NodeRef nodeRef)
Delete Node- Specified by:
deleteNodein interfaceNodeService
-
addChild
public ChildAssociationRef addChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName assocQName)
- Specified by:
addChildin interfaceNodeService
-
addChild
public List<ChildAssociationRef> addChild(Collection<NodeRef> parentRefs, NodeRef childRef, QName assocTypeQName, QName assocQName)
- Specified by:
addChildin interfaceNodeService
-
removeChild
public void removeChild(NodeRef parentRef, NodeRef childRef) throws InvalidNodeRefException
- Specified by:
removeChildin interfaceNodeService- Throws:
InvalidNodeRefException
-
removeChildAssociation
public boolean removeChildAssociation(ChildAssociationRef childAssocRef)
- Specified by:
removeChildAssociationin interfaceNodeService
-
removeSecondaryChildAssociation
public boolean removeSecondaryChildAssociation(ChildAssociationRef childAssocRef)
- Specified by:
removeSecondaryChildAssociationin interfaceNodeService
-
getProperty
public Serializable getProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
- Specified by:
getPropertyin interfaceNodeService- Throws:
InvalidNodeRefException
-
getProperties
public Map<QName,Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException
- Specified by:
getPropertiesin interfaceNodeService- Throws:
InvalidNodeRefException
-
getNodeAclId
public Long getNodeAclId(NodeRef nodeRef) throws InvalidNodeRefException
- Specified by:
getNodeAclIdin interfaceNodeService- Throws:
InvalidNodeRefException
-
setProperty
public void setProperty(NodeRef nodeRef, QName qname, Serializable value) throws InvalidNodeRefException
Gets the properties map, sets the value (null is allowed) and checks that the new set of properties is valid.- Specified by:
setPropertyin interfaceNodeService- Throws:
InvalidNodeRefException
-
setProperties
public void setProperties(NodeRef nodeRef, Map<QName,Serializable> properties) throws InvalidNodeRefException
Ensures that all required properties are present on the node and copies the property values to theNode.To remove a property, remove it from the map before calling this method. Null-valued properties are allowed.
If any of the values are null, a marker object is put in to mimic nulls. They will be turned back into a real nulls when the properties are requested again.
- Specified by:
setPropertiesin interfaceNodeService- Throws:
InvalidNodeRefException
-
addProperties
public void addProperties(NodeRef nodeRef, Map<QName,Serializable> properties) throws InvalidNodeRefException
- Specified by:
addPropertiesin interfaceNodeService- Throws:
InvalidNodeRefException
-
removeProperty
public void removeProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
- Specified by:
removePropertyin interfaceNodeService- Throws:
InvalidNodeRefException
-
getParents
public Collection<NodeRef> getParents(NodeRef nodeRef) throws InvalidNodeRefException
- Throws:
InvalidNodeRefException
-
getParentAssocs
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
Filters out any associations if their qname is not a match to the given pattern.- Specified by:
getParentAssocsin interfaceNodeService
-
getParentAssocs
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef) throws InvalidNodeRefException
Description copied from class:AbstractNodeServiceImplDefers to the pattern matching overload- Specified by:
getParentAssocsin interfaceNodeService- Overrides:
getParentAssocsin classAbstractNodeServiceImpl- Throws:
InvalidNodeRefException- See Also:
RegexQNamePattern.MATCH_ALL,NodeService.getParentAssocs(NodeRef, QNamePattern, QNamePattern)
-
getChildAssocs
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
Filters out any associations if their qname is not a match to the given pattern.- Specified by:
getChildAssocsin interfaceNodeService
-
getChildAssocs
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern, boolean preload)
Filters out any associations if their qname is not a match to the given pattern.- Specified by:
getChildAssocsin interfaceNodeService
-
getChildAssocs
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern, int maxResults, boolean preload)
Fetches the first n child associations in an efficient manner- Specified by:
getChildAssocsin interfaceNodeService
-
getChildAssocs
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, Set<QName> childNodeTypeQNames)
- Specified by:
getChildAssocsin interfaceNodeService
-
getChildByName
public NodeRef getChildByName(NodeRef nodeRef, QName assocTypeQName, String childName)
- Specified by:
getChildByNamein interfaceNodeService
-
getChildrenByName
public List<ChildAssociationRef> getChildrenByName(NodeRef nodeRef, QName assocTypeQName, Collection<String> childNames)
- Specified by:
getChildrenByNamein interfaceNodeService
-
getPrimaryParent
public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException
- Specified by:
getPrimaryParentin interfaceNodeService- Throws:
InvalidNodeRefException
-
createAssociation
public AssociationRef createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName) throws InvalidNodeRefException, AssociationExistsException
- Specified by:
createAssociationin interfaceNodeService- Throws:
InvalidNodeRefExceptionAssociationExistsException
-
setAssociations
public void setAssociations(NodeRef sourceRef, QName assocTypeQName, List<NodeRef> targetRefs)
- Specified by:
setAssociationsin interfaceNodeService
-
getChildAssocsWithoutParentAssocsOfType
public Collection<ChildAssociationRef> getChildAssocsWithoutParentAssocsOfType(NodeRef parent, QName assocTypeQName)
- Specified by:
getChildAssocsWithoutParentAssocsOfTypein interfaceNodeService
-
getChildAssocsByPropertyValue
public List<ChildAssociationRef> getChildAssocsByPropertyValue(NodeRef nodeRef, QName propertyQName, Serializable value)
- Specified by:
getChildAssocsByPropertyValuein interfaceNodeService
-
removeAssociation
public void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName) throws InvalidNodeRefException
- Specified by:
removeAssociationin interfaceNodeService- Throws:
InvalidNodeRefException
-
getAssoc
public AssociationRef getAssoc(Long id)
- Specified by:
getAssocin interfaceNodeService
-
getTargetAssocs
public List<AssociationRef> getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
- Specified by:
getTargetAssocsin interfaceNodeService
-
getTargetAssocsByPropertyValue
public List<AssociationRef> getTargetAssocsByPropertyValue(NodeRef sourceRef, QNamePattern qnamePattern, QName propertyQName, Serializable propertyValue)
- Specified by:
getTargetAssocsByPropertyValuein interfaceNodeService
-
getSourceAssocs
public List<AssociationRef> getSourceAssocs(NodeRef targetRef, QNamePattern qnamePattern)
- Specified by:
getSourceAssocsin interfaceNodeService
-
getPath
public Path getPath(NodeRef nodeRef) throws InvalidNodeRefException
- Specified by:
getPathin interfaceNodeService- Throws:
InvalidNodeRefException- See Also:
getPaths(NodeRef, boolean)
-
getPaths
public List<Path> getPaths(NodeRef nodeRef, boolean primaryOnly) throws InvalidNodeRefException
When searching forprimaryOnly == true, checks that there is exactly one path.- Specified by:
getPathsin interfaceNodeService- Throws:
InvalidNodeRefException
-
restoreNode
public NodeRef restoreNode(NodeRef archivedNodeRef, NodeRef destinationParentNodeRef, QName assocTypeQName, QName assocQName)
Archives the node without the cm:auditable aspect behaviour- Specified by:
restoreNodein interfaceNodeService
-
moveNode
public ChildAssociationRef moveNode(NodeRef nodeToMoveRef, NodeRef newParentRef, QName assocTypeQName, QName assocQName)
Move Node Drops the old primary association and creates a new one- Specified by:
moveNodein interfaceNodeService
-
getStoreArchiveNode
public NodeRef getStoreArchiveNode(StoreRef storeRef)
- Specified by:
getStoreArchiveNodein interfaceNodeService
-
getTrait
public <M extends Trait> ExtendedTrait<M> getTrait(Class<? extends M> traitAPI)
- Specified by:
getTraitin interfaceExtensible
-
-