|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.node.AbstractNodeServiceImpl
org.alfresco.repo.node.db.DbNodeServiceImpl
public class DbNodeServiceImpl
Node service using database persistence layer to fulfill functionality
Field Summary |
---|
Fields inherited from class org.alfresco.repo.node.AbstractNodeServiceImpl |
---|
dictionaryService, storesToIgnorePolicies, tenantService, transactionService |
Constructor Summary | |
---|---|
DbNodeServiceImpl()
|
Method Summary | |
---|---|
void |
addAspect(NodeRef nodeRef,
QName aspectTypeQName,
java.util.Map aspectProperties)
Applies an aspect to the given node. |
java.util.List |
addChild(java.util.Collection parentRefs,
NodeRef childRef,
QName assocTypeQName,
QName assocQName)
Associates a given child node with a given collection of parents. |
ChildAssociationRef |
addChild(NodeRef parentRef,
NodeRef childRef,
QName assocTypeQName,
QName assocQName)
Makes a parent-child association between the given nodes. |
void |
addProperties(NodeRef nodeRef,
java.util.Map properties)
Add all given properties to the node. |
AssociationRef |
createAssociation(NodeRef sourceRef,
NodeRef targetRef,
QName assocTypeQName)
|
ChildAssociationRef |
createNode(NodeRef parentRef,
QName assocTypeQName,
QName assocQName,
QName nodeTypeQName)
|
ChildAssociationRef |
createNode(NodeRef parentRef,
QName assocTypeQName,
QName assocQName,
QName nodeTypeQName,
java.util.Map properties)
Creates a new, non-abstract, real node as a primary child of the given parent node. |
StoreRef |
createStore(java.lang.String protocol,
java.lang.String identifier)
Defers to the typed service |
void |
deleteNode(NodeRef nodeRef)
Delete Node |
void |
deleteStore(StoreRef storeRef)
Delete a store and all its contents. |
boolean |
exists(NodeRef nodeRef)
|
boolean |
exists(StoreRef storeRef)
|
java.util.Set |
getAspects(NodeRef nodeRef)
|
AssociationRef |
getAssoc(java.lang.Long id)
Gets an association by ID. |
java.util.List |
getChildAssocs(NodeRef nodeRef,
QNamePattern typeQNamePattern,
QNamePattern qnamePattern)
Filters out any associations if their qname is not a match to the given pattern. |
java.util.List |
getChildAssocs(NodeRef nodeRef,
QNamePattern typeQNamePattern,
QNamePattern qnamePattern,
boolean preload)
Filters out any associations if their qname is not a match to the given pattern. |
java.util.List |
getChildAssocs(NodeRef nodeRef,
java.util.Set childNodeTypeQNames)
Retrieve immediate children of a given node where the child nodes are in the given inclusive list and not in the given exclusive list. |
java.util.Collection |
getChildAssocsWithoutParentAssocsOfType(NodeRef parent,
QName assocTypeQName)
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. |
NodeRef |
getChildByName(NodeRef nodeRef,
QName assocTypeQName,
java.lang.String childName)
Get the node with the given name within the context of the parent node. |
java.util.List |
getChildrenByName(NodeRef nodeRef,
QName assocTypeQName,
java.util.Collection childNames)
Get the nodes with the given names within the context of the parent node. |
NodeRef.Status |
getNodeStatus(NodeRef nodeRef)
Gets the ID of the last transaction that caused the node to change. |
java.util.List |
getParentAssocs(NodeRef nodeRef,
QNamePattern typeQNamePattern,
QNamePattern qnamePattern)
Filters out any associations if their qname is not a match to the given pattern. |
java.util.Collection |
getParents(NodeRef nodeRef)
|
Path |
getPath(NodeRef nodeRef)
The root node has an entry in the path(s) returned. |
java.util.List |
getPaths(NodeRef nodeRef,
boolean primaryOnly)
When searching for primaryOnly == true , checks that there is exactly
one path. |
ChildAssociationRef |
getPrimaryParent(NodeRef nodeRef)
Fetches the primary parent-child relationship. |
java.util.Map |
getProperties(NodeRef nodeRef)
|
java.io.Serializable |
getProperty(NodeRef nodeRef,
QName qname)
|
NodeRef |
getRootNode(StoreRef storeRef)
|
java.util.List |
getSourceAssocs(NodeRef targetRef,
QNamePattern qnamePattern)
Fetches all associations to the given target where the associations' qualified names match the pattern provided. |
NodeRef |
getStoreArchiveNode(StoreRef storeRef)
Get the node where archived items will have gone when deleted from the given store. |
java.util.List |
getStores()
Gets a list of all available node store references |
java.util.List |
getTargetAssocs(NodeRef sourceRef,
QNamePattern qnamePattern)
Fetches all associations from the given source where the associations' qualified names match the pattern provided. |
QName |
getType(NodeRef nodeRef)
|
boolean |
hasAspect(NodeRef nodeRef,
QName aspectQName)
Performs a check on the set of node aspects |
void |
indexChildren(org.alfresco.util.Pair nodePair,
boolean cascade)
|
ChildAssociationRef |
moveNode(NodeRef nodeToMoveRef,
NodeRef newParentRef,
QName assocTypeQName,
QName assocQName)
Move Node Drops the old primary association and creates a new one |
void |
removeAspect(NodeRef nodeRef,
QName aspectTypeQName)
Remove an aspect and all related properties from a node |
void |
removeAssociation(NodeRef sourceRef,
NodeRef targetRef,
QName assocTypeQName)
|
void |
removeChild(NodeRef parentRef,
NodeRef childRef)
Severs all parent-child relationships between two nodes. |
boolean |
removeChildAssociation(ChildAssociationRef childAssocRef)
Remove a specific child association. |
void |
removeProperty(NodeRef nodeRef,
QName qname)
Removes a property value completely. |
boolean |
removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
Remove a specific secondary child association. |
NodeRef |
restoreNode(NodeRef archivedNodeRef,
NodeRef destinationParentNodeRef,
QName assocTypeQName,
QName assocQName)
Restore an individual node (along with its sub-tree nodes) to the target location. |
void |
setAvmNodeService(NodeService avmNodeService)
|
void |
setCascadeInTransaction(boolean cascadeInTransaction)
Deprecated. the functionality did not see wide enough usage to warrant the maintenance |
void |
setChildAssociationIndex(ChildAssociationRef childAssocRef,
int index)
Set the ordering index of the child association. |
void |
setNodeDaoService(NodeDaoService nodeDaoService)
|
void |
setNodeIndexer(NodeIndexer nodeIndexer)
|
void |
setProperties(NodeRef nodeRef,
java.util.Map properties)
Ensures that all required properties are present on the node and copies the property values to the Node . |
void |
setProperty(NodeRef nodeRef,
QName qname,
java.io.Serializable value)
Gets the properties map, sets the value (null is allowed) and checks that the new set of properties is valid. |
void |
setStoreArchiveMap(StoreArchiveMap storeArchiveMap)
|
void |
setType(NodeRef nodeRef,
QName typeQName)
Re-sets the type of the node. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DbNodeServiceImpl()
Method Detail |
---|
public void setNodeDaoService(NodeDaoService nodeDaoService)
public void setStoreArchiveMap(StoreArchiveMap storeArchiveMap)
public void setAvmNodeService(NodeService avmNodeService)
public void setNodeIndexer(NodeIndexer nodeIndexer)
nodeIndexer
- the indexer that will be notified of node additions,
modifications and deletionspublic void setCascadeInTransaction(boolean cascadeInTransaction)
public boolean exists(StoreRef storeRef)
storeRef
- a reference to the store to look for
public boolean exists(NodeRef nodeRef)
nodeRef
- a reference to the node to look for
public NodeRef.Status getNodeStatus(NodeRef nodeRef)
NodeService
nodeRef
- a reference to a current or previously existing node
public java.util.List getStores()
NodeService
NodeDaoService.getStores()
public StoreRef createStore(java.lang.String protocol, java.lang.String identifier)
identifier
- the protocol-specific identifier
StoreDaoService#createWorkspace(String)
public void deleteStore(StoreRef storeRef) throws InvalidStoreRefException
NodeService
storeRef
- the store to delete
java.lang.UnsupportedOperationException
- Always
InvalidStoreRefException
- if the store reference is invalidpublic NodeRef getRootNode(StoreRef storeRef) throws InvalidStoreRefException
storeRef
- a reference to an existing store
InvalidStoreRefException
- if the store could not be foundpublic ChildAssociationRef createNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName)
DbNodeServiceImpl.createNode(NodeRef, QName, QName, QName, Map)
public ChildAssociationRef createNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName, java.util.Map properties)
NodeService
parentRef
- the parent nodeassocTypeQName
- the type of the association to create. This is used
for verification against the data dictionary.assocQName
- the qualified name of the associationnodeTypeQName
- a reference to the node typeproperties
- optional map of properties to keyed by their qualified names
NodeService.createNode(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, java.util.Map)
public void setChildAssociationIndex(ChildAssociationRef childAssocRef, int index)
NodeService
childAssocRef
- the child association that must be moved in the orderindex
- an arbitrary index that will affect the return orderNodeService.getChildAssocs(NodeRef)
,
NodeService.getChildAssocs(NodeRef, QNamePattern, QNamePattern)
,
ChildAssociationRef.getNthSibling()
public QName getType(NodeRef nodeRef) throws InvalidNodeRefException
InvalidNodeRefException
- if the node could not be foundDictionaryService
public void setType(NodeRef nodeRef, QName typeQName) throws InvalidNodeRefException
NodeService
nodeRef
- the node referencetypeQName
- the type QName
InvalidNodeRefException
NodeService.setType(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
public void addAspect(NodeRef nodeRef, QName aspectTypeQName, java.util.Map aspectProperties) throws InvalidNodeRefException, InvalidAspectException
NodeService
aspectTypeQName
- the aspect to apply to the nodeaspectProperties
- a minimum of the mandatory properties required for
the aspect
InvalidNodeRefException
InvalidAspectException
- if the class reference is not to a valid aspectNode.getAspects()
public void removeAspect(NodeRef nodeRef, QName aspectTypeQName) throws InvalidNodeRefException, InvalidAspectException
NodeService
aspectTypeQName
- the type of aspect to remove
InvalidNodeRefException
- if the node could not be found
InvalidAspectException
- if the the aspect is unknown or if the
aspect is mandatory for the class of the nodepublic boolean hasAspect(NodeRef nodeRef, QName aspectQName) throws InvalidNodeRefException, InvalidAspectException
InvalidNodeRefException
- if the node could not be found
InvalidAspectException
- if the aspect reference is invalidpublic java.util.Set getAspects(NodeRef nodeRef) throws InvalidNodeRefException
InvalidNodeRefException
- if the node could not be foundpublic void deleteNode(NodeRef nodeRef)
nodeRef
- reference to a node within a storepublic ChildAssociationRef addChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName assocQName)
NodeService
assocTypeQName
- the qualified name of the association type as defined in the datadictionaryassocQName
- the qualified name of the association
public java.util.List addChild(java.util.Collection parentRefs, NodeRef childRef, QName assocTypeQName, QName assocQName)
NodeService
assocTypeQName
- the qualified name of the association type as defined in the datadictionaryassocQName
- the qualified name of the association
public void removeChild(NodeRef parentRef, NodeRef childRef) throws InvalidNodeRefException
NodeService
The child node will be cascade deleted if one of the associations was the primary association, i.e. the one with which the child node was created.
parentRef
- the parent end of the associationchildRef
- the child end of the association
InvalidNodeRefException
- if the parent or child nodes could not be foundpublic boolean removeChildAssociation(ChildAssociationRef childAssocRef)
NodeService
The child node will be cascade deleted if the association was the primary association, i.e. the one with which the child node was created.
childAssocRef
- the association to remove
public boolean removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
NodeService
childAssocRef
- the association to remove
public java.io.Serializable getProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
qname
- the qualified name of the property
InvalidNodeRefException
- if the node could not be foundpublic java.util.Map getProperties(NodeRef nodeRef) throws InvalidNodeRefException
InvalidNodeRefException
- if the node could not be foundpublic void setProperty(NodeRef nodeRef, QName qname, java.io.Serializable value) throws InvalidNodeRefException
nodeRef
- a reference to an existing nodeqname
- the fully qualified name of the property
InvalidNodeRefException
- if the node could not be foundDbNodeServiceImpl.NullPropertyValue
public void setProperties(NodeRef nodeRef, java.util.Map properties) throws InvalidNodeRefException
Node
.
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.
nodeRef
- the node to chanceproperties
- all the properties of the node keyed by their qualified names
InvalidNodeRefException
- if the node could not be foundNode.getProperties()
public void addProperties(NodeRef nodeRef, java.util.Map properties) throws InvalidNodeRefException
NodeService
NOTE: Null values are allowed and will replace the existing value.
nodeRef
- the node to changeproperties
- the properties to change, keyed by their qualified names
InvalidNodeRefException
- if the node could not be foundpublic void removeProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
NodeService
nodeRef
- a reference to an existing nodeqname
- the fully qualified name of the property
InvalidNodeRefException
- if the node could not be foundpublic java.util.Collection getParents(NodeRef nodeRef) throws InvalidNodeRefException
InvalidNodeRefException
public java.util.List getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
nodeRef
- the child nodetypeQNamePattern
- the pattern that the type qualified name of the association must matchqnamePattern
- the pattern that the qnames of the assocs must match
ChildAssociationRef.getNthSibling()
,
NodeService.setChildAssociationIndex(ChildAssociationRef, int)
,
QName
,
RegexQNamePattern.MATCH_ALL
public java.util.List getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
nodeRef
- the parent node - usually a containertypeQNamePattern
- the pattern that the type qualified name of the association must matchqnamePattern
- the pattern that the qnames of the assocs must match
ChildAssociationRef
instances. If the
node is not a container then the result will be empty.QName
,
RegexQNamePattern.MATCH_ALL
public java.util.List getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern, boolean preload)
nodeRef
- the parent node - usually a containertypeQNamePattern
- the pattern that the type qualified name of the association must matchqnamePattern
- the pattern that the qnames of the assocs must matchpreload
- should the nodes be preloaded into the cache?
ChildAssociationRef
instances. If the
node is not a container then the result will be empty.QName
,
RegexQNamePattern.MATCH_ALL
public java.util.List getChildAssocs(NodeRef nodeRef, java.util.Set childNodeTypeQNames)
NodeService
nodeRef
- the parent node - usually a container
ChildAssociationRef
instances.public NodeRef getChildByName(NodeRef nodeRef, QName assocTypeQName, java.lang.String childName)
NodeService
That API method getChildByName only works for associations that don't allow duplicate child names. See cm:folder and the duplicate tag. Child associations without this allow duplicate child names and therefore it is possible to have multiple children with the same name stored against the given association type.
nodeRef
- the parent node - usuall a containerassocTypeQName
- the type of the associationchildName
- the name of the node as per the property cm:name
public java.util.List getChildrenByName(NodeRef nodeRef, QName assocTypeQName, java.util.Collection childNames)
NodeService
childNames
- a collection of up to 1000 child names to match on#getChildByName(NodeRef, QName, String)}
public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException
NodeService
For a root node, the parent node reference will be null.
InvalidNodeRefException
- if the node could not be foundpublic AssociationRef createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName) throws InvalidNodeRefException, AssociationExistsException
sourceRef
- a reference to a real nodetargetRef
- a reference to a nodeassocTypeQName
- the qualified name of the association type
InvalidNodeRefException
- if either of the nodes could not be found
AssociationExistsException
public java.util.Collection getChildAssocsWithoutParentAssocsOfType(NodeRef parent, QName assocTypeQName)
NodeService
parent
- the parent node referenceassocTypeQName
- the association type QName
public void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName) throws InvalidNodeRefException
sourceRef
- the associaton source nodetargetRef
- the association target nodeassocTypeQName
- the qualified name of the association type
InvalidNodeRefException
- if either of the nodes could not be foundpublic AssociationRef getAssoc(java.lang.Long id)
NodeService
null
if it does not existpublic java.util.List getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
NodeService
sourceRef
- the association sourceqnamePattern
- the association qname pattern to match against
NodeAssocRef
instances for which the
given node is a sourceQName
,
RegexQNamePattern.MATCH_ALL
public java.util.List getSourceAssocs(NodeRef targetRef, QNamePattern qnamePattern)
NodeService
targetRef
- the association targetqnamePattern
- the association qname pattern to match against
NodeAssocRef
instances for which the
given node is a targetQName
,
RegexQNamePattern.MATCH_ALL
public Path getPath(NodeRef nodeRef) throws InvalidNodeRefException
NodeService
InvalidNodeRefException
- if the node could not be foundDbNodeServiceImpl.getPaths(NodeRef, boolean)
,
#prependPaths(Node, Path, Collection, Stack, boolean)
public java.util.List getPaths(NodeRef nodeRef, boolean primaryOnly) throws InvalidNodeRefException
primaryOnly == true
, checks that there is exactly
one path.
primaryOnly
- true if only the primary path must be retrieved. If true, the
result will have exactly one entry.
InvalidNodeRefException
- if the node could not be found#prependPaths(Node, Path, Collection, Stack, boolean)
public NodeRef restoreNode(NodeRef archivedNodeRef, NodeRef destinationParentNodeRef, QName assocTypeQName, QName assocQName)
NodeService
archived aspect
set against it.
archivedNodeRef
- the archived nodedestinationParentNodeRef
- the parent to move the node into
or null to use the originalassocTypeQName
- the primary association type name to use in the new location
or null to use the originalassocQName
- the primary association name to use in the new location
or null to use the original
public ChildAssociationRef moveNode(NodeRef nodeToMoveRef, NodeRef newParentRef, QName assocTypeQName, QName assocQName)
nodeToMoveRef
- the node to movenewParentRef
- the new parent of the moved nodeassocTypeQName
- the type of the association to create. This is used
for verification against the data dictionary.assocQName
- the qualified name of the new child association
NodeService.getPrimaryParent(NodeRef)
public void indexChildren(org.alfresco.util.Pair nodePair, boolean cascade)
public NodeRef getStoreArchiveNode(StoreRef storeRef)
NodeService
storeRef
- the store that items were deleted from
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |