|
|||||||||
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.avm.AVMNodeService
public class AVMNodeService
NodeService implementing facade over AVMService.
Field Summary |
---|
Fields inherited from class org.alfresco.repo.node.AbstractNodeServiceImpl |
---|
dictionaryService, storesToIgnorePolicies, tenantService, transactionService |
Constructor Summary | |
---|---|
AVMNodeService()
Default constructor. |
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 qname)
Associates a given child node with a given collection of parents. |
ChildAssociationRef |
addChild(NodeRef parentRef,
NodeRef childRef,
QName assocTypeQName,
QName qname)
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)
Create a new AVM store. |
void |
deleteNode(NodeRef nodeRef)
Deletes the given node. |
void |
deleteStore(StoreRef storeRef)
Delete a store and all its contents. |
boolean |
exists(NodeRef nodeRef)
|
boolean |
exists(StoreRef storeRef)
Does the indicated store exist? |
java.util.Set |
getAspects(NodeRef nodeRef)
|
AssociationRef |
getAssoc(java.lang.Long id)
Gets an association by ID. |
java.util.List |
getChildAssocs(NodeRef nodeRef)
Get all child associations of the given node. |
java.util.List |
getChildAssocs(NodeRef nodeRef,
QNamePattern typeQNamePattern,
QNamePattern qnamePattern)
Gets all child associations where the pattern of the association qualified name is a match. |
java.util.List |
getChildAssocs(NodeRef nodeRef,
QNamePattern typeQNamePattern,
QNamePattern qnamePattern,
boolean preload)
Gets all child associations where the pattern of the association qualified name is a match. |
java.util.List |
getChildAssocs(NodeRef nodeRef,
java.util.Set childNodeTypes)
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 a child NodeRef by name. |
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)
Defers to the pattern matching overload |
java.util.List |
getParentAssocs(NodeRef nodeRef,
QNamePattern typeQNamePattern,
QNamePattern qnamePattern)
Gets all parent associations where the pattern of the association qualified name is a match |
Path |
getPath(NodeRef nodeRef)
The root node has an entry in the path(s) returned. |
java.util.List |
getPaths(NodeRef nodeRef,
boolean primaryOnly)
The root node has an entry in the path(s) returned. |
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 aspectTypeQName)
Determines if a given aspect is present on a node. |
protected PropertyValue |
makePropertyValue(PropertyDefinition propertyDef,
java.io.Serializable value)
Helper method to convert the Serializable value into a full,
persistable PropertyValue . |
protected java.io.Serializable |
makeSerializableValue(PropertyDefinition propertyDef,
PropertyValue propertyValue)
Extracts the externally-visible property from the propertyValue . |
ChildAssociationRef |
moveNode(NodeRef nodeToMoveRef,
NodeRef newParentRef,
QName assocTypeQName,
QName assocQName)
Moves the primary location of the given node. |
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)
TODO: Check implementation |
void |
removeProperty(NodeRef nodeRef,
QName qname)
Removes a property value completely. |
boolean |
removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
TODO: Implement |
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 |
setAvmService(AVMService service)
Set the AVMService. |
void |
setChildAssociationIndex(ChildAssociationRef childAssocRef,
int index)
Set the ordering index of the child association. |
void |
setInvokePolicies(boolean invoke)
|
void |
setProperties(NodeRef nodeRef,
java.util.Map properties)
Set the values of all properties to be an Serializable instances. |
void |
setProperty(NodeRef nodeRef,
QName qname,
java.io.Serializable value)
Sets the value of a property to be any Serializable instance. |
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 AVMNodeService()
Method Detail |
---|
public void setAvmService(AVMService service)
service
- The AVMService instance.public void setInvokePolicies(boolean invoke)
protected PropertyValue makePropertyValue(PropertyDefinition propertyDef, java.io.Serializable value)
Serializable
value into a full,
persistable PropertyValue
.
Where the property definition is null, the value will take on the
generic ANY
value.
Where the property definition specifies a multi-valued property but the value provided is not a collection, the value will be wrapped in a collection.
propertyDef
- the property dictionary definition, may be nullvalue
- the value, which will be converted according to the definition -
may be null
protected java.io.Serializable makeSerializableValue(PropertyDefinition propertyDef, PropertyValue propertyValue)
propertyValue
.
propertyDef
- the model property definition - may be nullpropertyValue
- the persisted property
public java.util.List getStores()
getStores
in interface NodeService
public StoreRef createStore(java.lang.String protocol, java.lang.String identifier) throws StoreExistsException
createStore
in interface NodeService
protocol
- the implementation protocolidentifier
- the protocol-specific identifier
StoreExistsException
public void deleteStore(StoreRef storeRef) throws InvalidStoreRefException
NodeService
deleteStore
in interface NodeService
storeRef
- the store to delete
java.lang.UnsupportedOperationException
- Always
InvalidStoreRefException
- if the store reference is invalidpublic boolean exists(StoreRef storeRef)
exists
in interface NodeService
storeRef
- a reference to the store to look for
public boolean exists(NodeRef nodeRef)
exists
in interface NodeService
nodeRef
- a reference to the node to look for
public NodeRef.Status getNodeStatus(NodeRef nodeRef)
getNodeStatus
in interface NodeService
nodeRef
- a reference to a current or previously existing node
public NodeRef getRootNode(StoreRef storeRef) throws InvalidStoreRefException
getRootNode
in interface NodeService
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) throws InvalidNodeRefException, InvalidTypeException
createNode
in interface NodeService
InvalidNodeRefException
InvalidTypeException
AVMNodeService.createNode(NodeRef, QName, QName, QName, Map)
public ChildAssociationRef createNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName, java.util.Map properties) throws InvalidNodeRefException, InvalidTypeException
createNode
in interface 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
InvalidNodeRefException
- if the parent reference is invalid
InvalidTypeException
- if the node type reference is not recognisedDictionaryService
public ChildAssociationRef moveNode(NodeRef nodeToMoveRef, NodeRef newParentRef, QName assocTypeQName, QName assocQName) throws InvalidNodeRefException
This involves changing the node's primary parent and possibly the name of the association referencing it.
If the new parent is in a different store from the original, then the entire node hierarchy is moved to the new store. Inter-store associations are not affected.
moveNode
in interface NodeService
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
InvalidNodeRefException
- if either the parent node or move node reference is invalid
CyclicChildRelationshipException
- if the child partakes in a cyclic relationship after the addAVMNodeService.getPrimaryParent(NodeRef)
public void setChildAssociationIndex(ChildAssociationRef childAssocRef, int index) throws InvalidChildAssociationRefException
setChildAssociationIndex
in interface NodeService
childAssocRef
- the child association that must be moved in the orderindex
- an arbitrary index that will affect the return order
InvalidChildAssociationRefException
AVMNodeService.getChildAssocs(NodeRef)
,
AVMNodeService.getChildAssocs(NodeRef, QNamePattern, QNamePattern)
,
ChildAssociationRef.getNthSibling()
public QName getType(NodeRef nodeRef) throws InvalidNodeRefException
getType
in interface NodeService
nodeRef
-
InvalidNodeRefException
- if the node could not be foundDictionaryService
public void setType(NodeRef nodeRef, QName typeQName) throws InvalidNodeRefException
setType
in interface NodeService
nodeRef
- the node referencetypeQName
- the type QName
InvalidNodeRefException
public void addAspect(NodeRef nodeRef, QName aspectTypeQName, java.util.Map aspectProperties) throws InvalidNodeRefException, InvalidAspectException
addAspect
in interface NodeService
nodeRef
- 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 aspectDictionaryService.getAspect(QName)
,
ClassDefinition.getProperties()
public void removeAspect(NodeRef nodeRef, QName aspectTypeQName) throws InvalidNodeRefException, InvalidAspectException
removeAspect
in interface NodeService
nodeRef
- 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 aspectTypeQName) throws InvalidNodeRefException, InvalidAspectException
hasAspect
in interface NodeService
nodeRef
- aspectTypeQName
-
InvalidNodeRefException
- if the node could not be found
InvalidAspectException
- if the aspect reference is invalidpublic java.util.Set getAspects(NodeRef nodeRef) throws InvalidNodeRefException
getAspects
in interface NodeService
nodeRef
-
InvalidNodeRefException
- if the node could not be foundpublic void deleteNode(NodeRef nodeRef) throws InvalidNodeRefException
All associations (both children and regular node associations) will be deleted, and where the given node is the primary parent, the children will also be cascade deleted.
deleteNode
in interface NodeService
nodeRef
- reference to a node within a store
InvalidNodeRefException
- if the reference given is invalidpublic ChildAssociationRef addChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName qname) throws InvalidNodeRefException
addChild
in interface NodeService
parentRef
- childRef
- assocTypeQName
- the qualified name of the association type as defined in the datadictionaryqname
- the qualified name of the association
InvalidNodeRefException
- if the parent or child nodes could not be found
CyclicChildRelationshipException
- if the child partakes in a cyclic relationship after the addpublic java.util.List addChild(java.util.Collection parentRefs, NodeRef childRef, QName assocTypeQName, QName qname) throws InvalidNodeRefException
addChild
in interface NodeService
parentRefs
- childRef
- assocTypeQName
- the qualified name of the association type as defined in the datadictionaryqname
- the qualified name of the association
InvalidNodeRefException
- if the parent or child nodes could not be found
CyclicChildRelationshipException
- if the child partakes in a cyclic relationship after the addpublic void removeChild(NodeRef parentRef, NodeRef childRef) throws InvalidNodeRefException
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.
removeChild
in interface NodeService
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)
removeChildAssociation
in interface NodeService
childAssocRef
- the association to remove
public boolean removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
removeSeconaryChildAssociation
in interface NodeService
childAssocRef
- the association to remove
public java.util.Map getProperties(NodeRef nodeRef) throws InvalidNodeRefException
getProperties
in interface NodeService
nodeRef
-
InvalidNodeRefException
- if the node could not be foundpublic java.io.Serializable getProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
getProperty
in interface NodeService
nodeRef
- qname
- the qualified name of the property
InvalidNodeRefException
- if the node could not be foundpublic void removeProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
removeProperty
in interface NodeService
nodeRef
- a reference to an existing nodeqname
- the fully qualified name of the property
InvalidNodeRefException
- if the node could not be foundpublic void setProperties(NodeRef nodeRef, java.util.Map properties) throws InvalidNodeRefException
Serializable
instances.
The properties given must still fulfill the requirements of the class and
aspects relevant to the node.
NOTE: Null values are allowed.
setProperties
in interface NodeService
nodeRef
- properties
- all the properties of the node keyed by their qualified names
InvalidNodeRefException
- if the node could not be foundpublic void addProperties(NodeRef nodeRef, java.util.Map properties)
NodeService
NOTE: Null values are allowed and will replace the existing value.
addProperties
in interface NodeService
nodeRef
- the node to changeproperties
- the properties to change, keyed by their qualified namespublic void setProperty(NodeRef nodeRef, QName qname, java.io.Serializable value) throws InvalidNodeRefException
Serializable
instance.
To remove a property value, use AVMNodeService.getProperties(NodeRef)
, remove the
value and call AVMNodeService.setProperties(NodeRef, Map)
.
NOTE: Null values are allowed.
setProperty
in interface NodeService
nodeRef
- qname
- the fully qualified name of the propertypropertyValue
- the value of the property - never null
InvalidNodeRefException
- if the node could not be foundpublic java.util.List getParentAssocs(NodeRef nodeRef) throws InvalidNodeRefException
AbstractNodeServiceImpl
getParentAssocs
in interface NodeService
getParentAssocs
in class AbstractNodeServiceImpl
nodeRef
- the child node
InvalidNodeRefException
- if the node could not be foundAVMNodeService.getParentAssocs(NodeRef, QNamePattern, QNamePattern)
public java.util.List getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern) throws InvalidNodeRefException
The resultant list is ordered by (a) explicit index and (b) association creation time.
getParentAssocs
in interface NodeService
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
InvalidNodeRefException
- if the node could not be foundChildAssociationRef.getNthSibling()
,
AVMNodeService.setChildAssociationIndex(ChildAssociationRef, int)
,
QName
,
RegexQNamePattern.MATCH_ALL
public java.util.List getChildAssocs(NodeRef nodeRef) throws InvalidNodeRefException
The resultant list is ordered by (a) explicit index and (b) association creation time.
getChildAssocs
in interface NodeService
getChildAssocs
in class AbstractNodeServiceImpl
nodeRef
- the parent node - usually a container
ChildAssocRef
instances. If the
node is not a container then the result will be empty.
InvalidNodeRefException
- if the node could not be foundAVMNodeService.getChildAssocs(NodeRef, QNamePattern, QNamePattern)
,
AVMNodeService.setChildAssociationIndex(ChildAssociationRef, int)
,
ChildAssociationRef.getNthSibling()
public java.util.List getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern) throws InvalidNodeRefException
getChildAssocs
in interface NodeService
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
ChildAssocRef
instances. If the
node is not a container then the result will be empty.
InvalidNodeRefException
- if the node could not be foundQName
,
RegexQNamePattern.MATCH_ALL
public java.util.List getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern, boolean preload) throws InvalidNodeRefException
NodeService
wildcard
for the type and a specific qualified name
for the association is
akin to using the XPath browse expression ./{url}localname in the context of the
parent node.
getChildAssocs
in interface NodeService
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.
InvalidNodeRefException
- if the node could not be foundQName
,
RegexQNamePattern.MATCH_ALL
public java.util.List getChildAssocs(NodeRef nodeRef, java.util.Set childNodeTypes)
NodeService
getChildAssocs
in interface NodeService
nodeRef
- the parent node - usually a container
ChildAssociationRef
instances.public java.util.List getChildrenByName(NodeRef nodeRef, QName assocTypeQName, java.util.Collection childNames)
NodeService
getChildrenByName
in interface NodeService
childNames
- a collection of up to 1000 child names to match on#getChildByName(NodeRef, QName, String)}
public NodeRef getChildByName(NodeRef nodeRef, QName assocTypeQName, java.lang.String childName)
getChildByName
in interface NodeService
nodeRef
- The parent node.assocTypeQName
- The type of the Child Association.childName
- The name of the child to get.
public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException
For a root node, the parent node reference will be null.
getPrimaryParent
in interface NodeService
nodeRef
-
InvalidNodeRefException
- if the node could not be foundpublic AssociationRef createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName) throws InvalidNodeRefException, AssociationExistsException
createAssociation
in interface NodeService
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 void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName) throws InvalidNodeRefException
removeAssociation
in interface NodeService
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)
getAssoc
in interface NodeService
assocId
- the association id
null
if it does not existpublic java.util.List getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern) throws InvalidNodeRefException
getTargetAssocs
in interface NodeService
sourceRef
- the association sourceqnamePattern
- the association qname pattern to match against
NodeAssocRef
instances for which the
given node is a source
InvalidNodeRefException
- if the source node could not be foundQName
,
RegexQNamePattern.MATCH_ALL
public java.util.List getSourceAssocs(NodeRef targetRef, QNamePattern qnamePattern) throws InvalidNodeRefException
getSourceAssocs
in interface NodeService
targetRef
- the association targetqnamePattern
- the association qname pattern to match against
NodeAssocRef
instances for which the
given node is a target
InvalidNodeRefException
QName
,
RegexQNamePattern.MATCH_ALL
public Path getPath(NodeRef nodeRef) throws InvalidNodeRefException
getPath
in interface NodeService
nodeRef
-
InvalidNodeRefException
- if the node could not be foundAVMNodeService.getPaths(NodeRef, boolean)
public java.util.List getPaths(NodeRef nodeRef, boolean primaryOnly) throws InvalidNodeRefException
getPaths
in interface NodeService
nodeRef
- 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 foundpublic NodeRef getStoreArchiveNode(StoreRef storeRef)
getStoreArchiveNode
in interface NodeService
storeRef
- the store that items were deleted from
public NodeRef restoreNode(NodeRef archivedNodeRef, NodeRef destinationParentNodeRef, QName assocTypeQName, QName assocQName)
archived aspect
set against it.
restoreNode
in interface NodeService
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 java.util.Collection getChildAssocsWithoutParentAssocsOfType(NodeRef parent, QName assocTypeQName)
NodeService
getChildAssocsWithoutParentAssocsOfType
in interface NodeService
parent
- the parent node referenceassocTypeQName
- the association type QName
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |