org.alfresco.repo.version
Class NodeServiceImpl

java.lang.Object
  extended by org.alfresco.repo.version.NodeServiceImpl
All Implemented Interfaces:
VersionBaseModel, VersionModel, NodeService
Direct Known Subclasses:
Node2ServiceImpl

public class NodeServiceImpl
extends java.lang.Object
implements NodeService, VersionModel

The light weight version store node service implementation.


Field Summary
protected  ContentDataDAO contentDataDAO
           
protected  NodeService dbNodeService
           
protected  DictionaryService dicitionaryService
           
protected static java.lang.String MSG_UNSUPPORTED
          Error messages
 
Fields inherited from interface org.alfresco.repo.version.VersionModel
ASPECT_VERSION_STORE_ROOT, ASSOC_ROOT_VERSION, ASSOC_SUCCESSOR, CHILD_QNAME_VERSION_HISTORIES, CHILD_QNAME_VERSION_META_DATA, CHILD_QNAME_VERSIONED_ASSOCS, CHILD_QNAME_VERSIONED_ATTRIBUTES, CHILD_QNAME_VERSIONED_CHILD_ASSOCS, CHILD_QNAME_VERSIONS, CHILD_VERSION_META_DATA, CHILD_VERSIONED_ASSOCS, CHILD_VERSIONED_ATTRIBUTES, CHILD_VERSIONED_CHILD_ASSOCS, NAMESPACE_URI, PROP_ASSOC_QNAME, PROP_ASSOC_TYPE_QNAME, PROP_FROZEN_ASPECTS, PROP_FROZEN_NODE_ID, PROP_FROZEN_NODE_STORE_ID, PROP_FROZEN_NODE_STORE_PROTOCOL, PROP_FROZEN_NODE_TYPE, PROP_IS_MULTI_VALUE, PROP_IS_PRIMARY, PROP_META_DATA_NAME, PROP_META_DATA_VALUE, PROP_MULTI_VALUE, PROP_NTH_SIBLING, PROP_QNAME, PROP_QNAME_ASSOC_QNAME, PROP_QNAME_ASSOC_TYPE_QNAME, PROP_QNAME_FROZEN_ASPECTS, PROP_QNAME_FROZEN_NODE_ID, PROP_QNAME_FROZEN_NODE_STORE_ID, PROP_QNAME_FROZEN_NODE_STORE_PROTOCOL, PROP_QNAME_FROZEN_NODE_TYPE, PROP_QNAME_IS_MULTI_VALUE, PROP_QNAME_IS_PRIMARY, PROP_QNAME_META_DATA_NAME, PROP_QNAME_META_DATA_VALUE, PROP_QNAME_MULTI_VALUE, PROP_QNAME_NTH_SIBLING, PROP_QNAME_QNAME, PROP_QNAME_TRANSLATION_VERSIONS, PROP_QNAME_VALUE, PROP_QNAME_VERSION_LABEL, PROP_QNAME_VERSION_NUMBER, PROP_QNAME_VERSIONED_NODE_ID, PROP_VALUE, STORE_ID, TYPE_QNAME_VERSION, TYPE_QNAME_VERSION_HISTORY, TYPE_QNAME_VERSION_META_DATA_VALUE, TYPE_QNAME_VERSIONED_ASSOC, TYPE_QNAME_VERSIONED_CHILD_ASSOC, TYPE_QNAME_VERSIONED_PROPERTY, TYPE_VERSION, TYPE_VERSION_META_DATA_VALUE, TYPE_VERSIONED_ASSOC, TYPE_VERSIONED_CHILD_ASSOC, TYPE_VERSIONED_PROPERTY
 
Fields inherited from interface org.alfresco.repo.version.VersionBaseModel
ASPECT_LOCALNAME_VERSION_STORE_ROOT, ASSOC_LOCALNAME_ROOT_VERSION, CHILD_VERSION_HISTORIES, CHILD_VERSIONS, PROP_CREATED_DATE, PROP_CREATOR, PROP_DESCRIPTION, PROP_TRANSLATION_VERSIONS, PROP_VERSION_DESCRIPTION, PROP_VERSION_LABEL, PROP_VERSION_NUMBER, PROP_VERSION_TYPE, PROP_VERSIONED_NODE_ID, STORE_PROTOCOL, TYPE_VERSION_HISTORY
 
Constructor Summary
NodeServiceImpl()
           
 
Method Summary
 void addAspect(NodeRef nodeRef, QName aspectRef, 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.
 java.util.List cleanup()
          No-op
 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)
          Delegates to the NodeService used as the version store implementation
 void deleteNode(NodeRef nodeRef)
          Deletes the given node.
 void deleteStore(StoreRef storeRef)
          Delete a store and all its contents.
 boolean exists(NodeRef nodeRef)
          Delegates to the NodeService used as the version store implementation
 boolean exists(StoreRef storeRef)
          Delegates to the NodeService used as the version store implementation
 java.util.Set getAspects(NodeRef nodeRef)
          Translation for version store
 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)
          Performs conversion from version store properties to real associations
 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 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)
          Delegates to the NodeService used as the version store implementation
 java.util.List getParentAssocs(NodeRef nodeRef)
          The node will appear to be attached to the root of the version store
 java.util.List getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
          The node will apprear to be attached to the root of the version store
 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)
          Simulates the node begin attached ot the root node of the version store.
 java.util.Map getProperties(NodeRef nodeRef)
          Property translation for version store
 java.io.Serializable getProperty(NodeRef nodeRef, QName qname)
          Property translation for version store
 NodeRef getRootNode(StoreRef storeRef)
          Delegates to the NodeService used as the version store implementation
 java.util.List getSourceAssocs(NodeRef sourceRef, 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()
          Delegates to the NodeService used as the version store implementation
 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)
          Type translation for version store
 boolean hasAspect(NodeRef nodeRef, QName aspectRef)
          Translation for version store
 ChildAssociationRef moveNode(NodeRef nodeToMoveRef, NodeRef newParentRef, QName assocTypeQName, QName assocQName)
          Moves the primary location of the given node.
 void removeAspect(NodeRef nodeRef, QName aspectRef)
          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 targetParentNodeRef, QName assocTypeQName, QName assocQName)
          Restore an individual node (along with its sub-tree nodes) to the target location.
 void setChildAssociationIndex(ChildAssociationRef childAssocRef, int index)
          Set the ordering index of the child association.
 void setContentDataDAO(ContentDataDAO contentDataDAO)
          Set the DAO to resolved content data reference IDs into ContentData instances
 void setDbNodeService(NodeService nodeService)
          Sets the db node service, used as the version store implementation
 void setDictionaryService(DictionaryService dictionaryService)
          Sets the dictionary service
 void setProperties(NodeRef nodeRef, java.util.Map properties)
          Set the values of all properties to be an Serializable instances.
 void setProperty(NodeRef nodeRef, QName qame, java.io.Serializable value)
          Sets the value of a property to be any Serializable instance.
 void setSearcher(SearchService searcher)
          Sets the searcher
 void setType(NodeRef nodeRef, QName typeQName)
          Re-sets the type of the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_UNSUPPORTED

protected static final java.lang.String MSG_UNSUPPORTED
Error messages

See Also:
Constant Field Values

dbNodeService

protected NodeService dbNodeService

dicitionaryService

protected DictionaryService dicitionaryService

contentDataDAO

protected ContentDataDAO contentDataDAO
Constructor Detail

NodeServiceImpl

public NodeServiceImpl()
Method Detail

setDbNodeService

public void setDbNodeService(NodeService nodeService)
Sets the db node service, used as the version store implementation

Parameters:
nodeService - the node service

setSearcher

public void setSearcher(SearchService searcher)
Sets the searcher


setDictionaryService

public void setDictionaryService(DictionaryService dictionaryService)
Sets the dictionary service


setContentDataDAO

public void setContentDataDAO(ContentDataDAO contentDataDAO)
Set the DAO to resolved content data reference IDs into ContentData instances


cleanup

public java.util.List cleanup()
No-op


getStores

public java.util.List getStores()
Delegates to the NodeService used as the version store implementation

Specified by:
getStores in interface NodeService
Returns:
Returns a list of store references

createStore

public StoreRef createStore(java.lang.String protocol,
                            java.lang.String identifier)
Delegates to the NodeService used as the version store implementation

Specified by:
createStore in interface NodeService
identifier - the protocol-specific identifier
Returns:
Returns a reference to the store

deleteStore

public void deleteStore(StoreRef storeRef)
Description copied from interface: NodeService
Delete a store and all its contents.

Specified by:
deleteStore in interface NodeService
Parameters:
storeRef - the store to delete
Throws:
java.lang.UnsupportedOperationException - always

exists

public boolean exists(StoreRef storeRef)
Delegates to the NodeService used as the version store implementation

Specified by:
exists in interface NodeService
Parameters:
storeRef - a reference to the store to look for
Returns:
Returns true if the store exists, otherwise false

exists

public boolean exists(NodeRef nodeRef)
Delegates to the NodeService used as the version store implementation

Specified by:
exists in interface NodeService
Parameters:
nodeRef - a reference to the node to look for
Returns:
Returns true if the node exists, otherwise false

getNodeStatus

public NodeRef.Status getNodeStatus(NodeRef nodeRef)
Delegates to the NodeService used as the version store implementation

Specified by:
getNodeStatus in interface NodeService
Parameters:
nodeRef - a reference to a current or previously existing node
Returns:
Returns the status of the node, or null if the node never existed

getRootNode

public NodeRef getRootNode(StoreRef storeRef)
Delegates to the NodeService used as the version store implementation

Specified by:
getRootNode in interface NodeService
Parameters:
storeRef - a reference to an existing store
Returns:
Returns a reference to the root node of the store

createNode

public ChildAssociationRef createNode(NodeRef parentRef,
                                      QName assocTypeQName,
                                      QName assocQName,
                                      QName nodeTypeQName)
                               throws InvalidNodeRefException
Specified by:
createNode in interface NodeService
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException
See Also:
NodeService.createNode(NodeRef, QName, QName, QName, Map)

createNode

public ChildAssociationRef createNode(NodeRef parentRef,
                                      QName assocTypeQName,
                                      QName assocQName,
                                      QName nodeTypeQName,
                                      java.util.Map properties)
                               throws InvalidNodeRefException
Description copied from interface: NodeService
Creates a new, non-abstract, real node as a primary child of the given parent node.

Specified by:
createNode in interface NodeService
Parameters:
parentRef - the parent node
assocTypeQName - the type of the association to create. This is used for verification against the data dictionary.
assocQName - the qualified name of the association
nodeTypeQName - a reference to the node type
properties - optional map of properties to keyed by their qualified names
Returns:
Returns a reference to the newly created child association
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the parent reference is invalid
See Also:
DictionaryService

deleteNode

public void deleteNode(NodeRef nodeRef)
                throws InvalidNodeRefException
Description copied from interface: NodeService
Deletes the given node.

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.

Specified by:
deleteNode in interface NodeService
Parameters:
nodeRef - reference to a node within a store
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the reference given is invalid

addChild

public ChildAssociationRef addChild(NodeRef parentRef,
                                    NodeRef childRef,
                                    QName assocTypeQName,
                                    QName qname)
                             throws InvalidNodeRefException
Description copied from interface: NodeService
Makes a parent-child association between the given nodes. Both nodes must belong to the same store.

Specified by:
addChild in interface NodeService
assocTypeQName - the qualified name of the association type as defined in the datadictionary
qname - the qualified name of the association
Returns:
Returns a reference to the newly created child association
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the parent or child nodes could not be found

addChild

public java.util.List addChild(java.util.Collection parentRefs,
                               NodeRef childRef,
                               QName assocTypeQName,
                               QName qname)
                        throws InvalidNodeRefException
Description copied from interface: NodeService
Associates a given child node with a given collection of parents. All nodes must belong to the same store.

Specified by:
addChild in interface NodeService
assocTypeQName - the qualified name of the association type as defined in the datadictionary
qname - the qualified name of the association
Returns:
Returns a reference to the newly created child association
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the parent or child nodes could not be found

removeChild

public void removeChild(NodeRef parentRef,
                        NodeRef childRef)
                 throws InvalidNodeRefException
Description copied from interface: NodeService
Severs all parent-child relationships between two nodes.

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.

Specified by:
removeChild in interface NodeService
Parameters:
parentRef - the parent end of the association
childRef - the child end of the association
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the parent or child nodes could not be found

removeChildAssociation

public boolean removeChildAssociation(ChildAssociationRef childAssocRef)
Description copied from interface: NodeService
Remove a specific child association.

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.

Specified by:
removeChildAssociation in interface NodeService
Parameters:
childAssocRef - the association to remove
Returns:
Returns true if the association existed, otherwise false.
Throws:
java.lang.UnsupportedOperationException - always

removeSeconaryChildAssociation

public boolean removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
Description copied from interface: NodeService
Remove a specific secondary child association.

Specified by:
removeSeconaryChildAssociation in interface NodeService
Parameters:
childAssocRef - the association to remove
Returns:
Returns true if the association existed, otherwise false.
Throws:
java.lang.UnsupportedOperationException - always

moveNode

public ChildAssociationRef moveNode(NodeRef nodeToMoveRef,
                                    NodeRef newParentRef,
                                    QName assocTypeQName,
                                    QName assocQName)
                             throws InvalidNodeRefException
Description copied from interface: NodeService
Moves the primary location of the given node.

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.

Specified by:
moveNode in interface NodeService
Parameters:
nodeToMoveRef - the node to move
newParentRef - the new parent of the moved node
assocTypeQName - 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
Returns:
Returns a reference to the newly created child association
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if either the parent node or move node reference is invalid
See Also:
NodeService.getPrimaryParent(NodeRef)

setChildAssociationIndex

public void setChildAssociationIndex(ChildAssociationRef childAssocRef,
                                     int index)
                              throws InvalidChildAssociationRefException
Description copied from interface: NodeService
Set the ordering index of the child association. This affects the ordering of of the return values of methods that return a set of children or child associations.

Specified by:
setChildAssociationIndex in interface NodeService
Parameters:
childAssocRef - the child association that must be moved in the order
index - an arbitrary index that will affect the return order
Throws:
java.lang.UnsupportedOperationException - always
InvalidChildAssociationRefException
See Also:
NodeService.getChildAssocs(NodeRef), NodeService.getChildAssocs(NodeRef, QNamePattern, QNamePattern), ChildAssociationRef.getNthSibling()

getType

public QName getType(NodeRef nodeRef)
              throws InvalidNodeRefException
Type translation for version store

Specified by:
getType in interface NodeService
Returns:
Returns the type name
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
DictionaryService

setType

public void setType(NodeRef nodeRef,
                    QName typeQName)
             throws InvalidNodeRefException
Description copied from interface: NodeService
Re-sets the type of the node. Can be called in order specialise a node to a sub-type. This should be used with caution since calling it changes the type of the node and thus implies a different set of aspects, properties and associations. It is the calling codes responsibility to ensure that the node is in a approriate state after changing the type.

Specified by:
setType in interface NodeService
Parameters:
nodeRef - the node reference
typeQName - the type QName
Throws:
InvalidNodeRefException
See Also:
NodeService.setType(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)

addAspect

public void addAspect(NodeRef nodeRef,
                      QName aspectRef,
                      java.util.Map aspectProperties)
               throws InvalidNodeRefException,
                      InvalidAspectException
Description copied from interface: NodeService
Applies an aspect to the given node. After this method has been called, the node with have all the aspect-related properties present

Specified by:
addAspect in interface NodeService
aspectRef - the aspect to apply to the node
aspectProperties - a minimum of the mandatory properties required for the aspect
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException
InvalidAspectException - if the class reference is not to a valid aspect
See Also:
DictionaryService.getAspect(QName), ClassDefinition.getProperties()

hasAspect

public boolean hasAspect(NodeRef nodeRef,
                         QName aspectRef)
                  throws InvalidNodeRefException,
                         InvalidAspectException
Translation for version store

Specified by:
hasAspect in interface NodeService
Returns:
Returns true if the aspect has been applied to the given node, otherwise false
Throws:
InvalidNodeRefException - if the node could not be found
InvalidAspectException - if the aspect reference is invalid

removeAspect

public void removeAspect(NodeRef nodeRef,
                         QName aspectRef)
                  throws InvalidNodeRefException,
                         InvalidAspectException
Description copied from interface: NodeService
Remove an aspect and all related properties from a node

Specified by:
removeAspect in interface NodeService
aspectRef - the type of aspect to remove
Throws:
java.lang.UnsupportedOperationException - always
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 node

getAspects

public java.util.Set getAspects(NodeRef nodeRef)
                         throws InvalidNodeRefException
Translation for version store

Specified by:
getAspects in interface NodeService
Returns:
Returns a set of all aspects applied to the node, including mandatory aspects
Throws:
InvalidNodeRefException - if the node could not be found

getProperties

public java.util.Map getProperties(NodeRef nodeRef)
                            throws InvalidNodeRefException
Property translation for version store

Specified by:
getProperties in interface NodeService
Returns:
Returns all properties keyed by their qualified name
Throws:
InvalidNodeRefException - if the node could not be found

getProperty

public java.io.Serializable getProperty(NodeRef nodeRef,
                                        QName qname)
                                 throws InvalidNodeRefException
Property translation for version store

Specified by:
getProperty in interface NodeService
qname - the qualified name of the property
Returns:
Returns the value of the property, or null if not yet set
Throws:
InvalidNodeRefException - if the node could not be found

setProperties

public void setProperties(NodeRef nodeRef,
                          java.util.Map properties)
                   throws InvalidNodeRefException
Description copied from interface: NodeService
Set the values of all properties to be an Serializable instances. The properties given must still fulfill the requirements of the class and aspects relevant to the node.

NOTE: Null values are allowed.

Specified by:
setProperties in interface NodeService
Parameters:
nodeRef - the node to chance
properties - all the properties of the node keyed by their qualified names
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the node could not be found

addProperties

public void addProperties(NodeRef nodeRef,
                          java.util.Map properties)
                   throws InvalidNodeRefException
Description copied from interface: NodeService
Add all given properties to the node.

NOTE: Null values are allowed and will replace the existing value.

Specified by:
addProperties in interface NodeService
Parameters:
nodeRef - the node to change
properties - the properties to change, keyed by their qualified names
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the node could not be found

setProperty

public void setProperty(NodeRef nodeRef,
                        QName qame,
                        java.io.Serializable value)
                 throws InvalidNodeRefException
Description copied from interface: NodeService
Sets the value of a property to be any Serializable instance.

NOTE: Null values are allowed.

Specified by:
setProperty in interface NodeService
Parameters:
nodeRef - a reference to an existing node
qame - the fully qualified name of the property
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the node could not be found

removeProperty

public void removeProperty(NodeRef nodeRef,
                           QName qname)
                    throws InvalidNodeRefException
Description copied from interface: NodeService
Removes a property value completely.

Specified by:
removeProperty in interface NodeService
Parameters:
nodeRef - a reference to an existing node
qname - the fully qualified name of the property
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the node could not be found

getParentAssocs

public java.util.List getParentAssocs(NodeRef nodeRef)
The node will appear to be attached to the root of the version store

Specified by:
getParentAssocs in interface NodeService
Parameters:
nodeRef - the child node
Returns:
Returns a list of all parent-child associations that exist where the given node is the child
See Also:
NodeService.getParentAssocs(NodeRef)

getParentAssocs

public java.util.List getParentAssocs(NodeRef nodeRef,
                                      QNamePattern typeQNamePattern,
                                      QNamePattern qnamePattern)
The node will apprear to be attached to the root of the version store

Specified by:
getParentAssocs in interface NodeService
Parameters:
nodeRef - the child node
typeQNamePattern - the pattern that the type qualified name of the association must match
qnamePattern - the pattern that the qnames of the assocs must match
Returns:
Returns a list of all parent-child associations that exist where the given node is the child
See Also:
NodeService.getParentAssocs(NodeRef, QNamePattern, QNamePattern)

getChildAssocs

public java.util.List getChildAssocs(NodeRef nodeRef)
                              throws InvalidNodeRefException
Description copied from interface: NodeService
Get all child associations of the given node.

The resultant list is ordered by (a) explicit index and (b) association creation time.

Specified by:
getChildAssocs in interface NodeService
Parameters:
nodeRef - the parent node - usually a container
Returns:
Returns a collection of ChildAssocRef instances. If the node is not a container then the result will be empty.
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
RegexQNamePattern.MATCH_ALL, NodeServiceImpl.getChildAssocs(NodeRef, QNamePattern, QNamePattern)

getChildAssocs

public java.util.List getChildAssocs(NodeRef nodeRef,
                                     QNamePattern typeQNamePattern,
                                     QNamePattern qnamePattern,
                                     boolean preload)
                              throws InvalidNodeRefException
Description copied from interface: NodeService
Gets all child associations where the pattern of the association qualified name is a match. Using a 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.

Specified by:
getChildAssocs in interface NodeService
Parameters:
nodeRef - the parent node - usually a container
typeQNamePattern - the pattern that the type qualified name of the association must match
qnamePattern - the pattern that the qnames of the assocs must match
preload - should the nodes be preloaded into the cache?
Returns:
Returns a list of ChildAssociationRef instances. If the node is not a container then the result will be empty.
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
QName, RegexQNamePattern.MATCH_ALL

getChildAssocs

public java.util.List getChildAssocs(NodeRef nodeRef,
                                     QNamePattern typeQNamePattern,
                                     QNamePattern qnamePattern)
                              throws InvalidNodeRefException
Performs conversion from version store properties to real associations

Specified by:
getChildAssocs in interface NodeService
Parameters:
nodeRef - the parent node - usually a container
typeQNamePattern - the pattern that the type qualified name of the association must match
qnamePattern - the pattern that the qnames of the assocs must match
Returns:
Returns a list of ChildAssociationRef instances. If the node is not a container then the result will be empty.
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
QName, RegexQNamePattern.MATCH_ALL

getChildAssocs

public java.util.List getChildAssocs(NodeRef nodeRef,
                                     java.util.Set childNodeTypes)
Description copied from interface: NodeService
Retrieve immediate children of a given node where the child nodes are in the given inclusive list and not in the given exclusive list.

Specified by:
getChildAssocs in interface NodeService
Parameters:
nodeRef - the parent node - usually a container
Returns:
Returns a list of ChildAssociationRef instances.
Throws:
java.lang.UnsupportedOperationException - always

getChildrenByName

public java.util.List getChildrenByName(NodeRef nodeRef,
                                        QName assocTypeQName,
                                        java.util.Collection childNames)
Description copied from interface: NodeService
Get the nodes with the given names within the context of the parent node.

Specified by:
getChildrenByName in interface NodeService
childNames - a collection of up to 1000 child names to match on
Throws:
java.lang.UnsupportedOperationException - always
See Also:
#getChildByName(NodeRef, QName, String)}

getChildByName

public NodeRef getChildByName(NodeRef nodeRef,
                              QName assocTypeQName,
                              java.lang.String childName)
Description copied from interface: NodeService
Get the node with the given name within the context of the parent node. The name is case-insensitive as Alfresco has to support case-insensitive clients as standard.

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.

Specified by:
getChildByName in interface NodeService
Parameters:
nodeRef - the parent node - usuall a container
assocTypeQName - the type of the association
childName - the name of the node as per the property cm:name
Returns:
Returns the child node or null if not found
Throws:
java.lang.UnsupportedOperationException - always

getPrimaryParent

public ChildAssociationRef getPrimaryParent(NodeRef nodeRef)
                                     throws InvalidNodeRefException
Simulates the node begin attached ot the root node of the version store.

Specified by:
getPrimaryParent in interface NodeService
Returns:
Returns the primary parent-child association of the node
Throws:
InvalidNodeRefException - if the node could not be found

createAssociation

public AssociationRef createAssociation(NodeRef sourceRef,
                                        NodeRef targetRef,
                                        QName assocTypeQName)
                                 throws InvalidNodeRefException,
                                        AssociationExistsException
Specified by:
createAssociation in interface NodeService
Parameters:
sourceRef - a reference to a real node
targetRef - a reference to a node
assocTypeQName - the qualified name of the association type
Returns:
Returns a reference to the new association
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if either of the nodes could not be found
AssociationExistsException

removeAssociation

public void removeAssociation(NodeRef sourceRef,
                              NodeRef targetRef,
                              QName assocTypeQName)
Specified by:
removeAssociation in interface NodeService
Parameters:
sourceRef - the associaton source node
targetRef - the association target node
assocTypeQName - the qualified name of the association type
Throws:
java.lang.UnsupportedOperationException - always

getAssoc

public AssociationRef getAssoc(java.lang.Long id)
Gets an association by ID.

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

getTargetAssocs

public java.util.List getTargetAssocs(NodeRef sourceRef,
                                      QNamePattern qnamePattern)
Description copied from interface: NodeService
Fetches all associations from the given source where the associations' qualified names match the pattern provided.

Specified by:
getTargetAssocs in interface NodeService
Parameters:
sourceRef - the association source
qnamePattern - the association qname pattern to match against
Returns:
Returns a list of NodeAssocRef instances for which the given node is a source
Throws:
java.lang.UnsupportedOperationException - always
See Also:
QName, RegexQNamePattern.MATCH_ALL

getSourceAssocs

public java.util.List getSourceAssocs(NodeRef sourceRef,
                                      QNamePattern qnamePattern)
Description copied from interface: NodeService
Fetches all associations to the given target where the associations' qualified names match the pattern provided.

Specified by:
getSourceAssocs in interface NodeService
Parameters:
sourceRef - the association target
qnamePattern - the association qname pattern to match against
Returns:
Returns a list of NodeAssocRef instances for which the given node is a target
Throws:
java.lang.UnsupportedOperationException - always
See Also:
QName, RegexQNamePattern.MATCH_ALL

getPath

public Path getPath(NodeRef nodeRef)
             throws InvalidNodeRefException
Description copied from interface: NodeService
The root node has an entry in the path(s) returned. For this reason, there will always be at least one path element in the returned path(s). The first element will have a null parent reference and qname.

Specified by:
getPath in interface NodeService
Returns:
Returns the path to the node along the primary node path
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the node could not be found
See Also:
NodeService.getPaths(NodeRef, boolean)

getPaths

public java.util.List getPaths(NodeRef nodeRef,
                               boolean primaryOnly)
                        throws InvalidNodeRefException
Description copied from interface: NodeService
The root node has an entry in the path(s) returned. For this reason, there will always be at least one path element in the returned path(s). The first element will have a null parent reference and qname.

Specified by:
getPaths in interface NodeService
primaryOnly - true if only the primary path must be retrieved. If true, the result will have exactly one entry.
Returns:
Returns a List of all possible paths to the given node
Throws:
java.lang.UnsupportedOperationException - always
InvalidNodeRefException - if the node could not be found

getStoreArchiveNode

public NodeRef getStoreArchiveNode(StoreRef storeRef)
Description copied from interface: NodeService
Get the node where archived items will have gone when deleted from the given store.

Specified by:
getStoreArchiveNode in interface NodeService
Parameters:
storeRef - the store that items were deleted from
Returns:
Returns the archive node parent
Throws:
java.lang.UnsupportedOperationException - always

restoreNode

public NodeRef restoreNode(NodeRef archivedNodeRef,
                           NodeRef targetParentNodeRef,
                           QName assocTypeQName,
                           QName assocQName)
Description copied from interface: NodeService
Restore an individual node (along with its sub-tree nodes) to the target location. The archived node must have the archived aspect set against it.

Specified by:
restoreNode in interface NodeService
Parameters:
archivedNodeRef - the archived node
targetParentNodeRef - the parent to move the node into or null to use the original
assocTypeQName - the primary association type name to use in the new location or null to use the original
assocQName - the primary association name to use in the new location or null to use the original
Returns:
Returns the reference to the newly created node
Throws:
java.lang.UnsupportedOperationException - always

getChildAssocsWithoutParentAssocsOfType

public java.util.Collection getChildAssocsWithoutParentAssocsOfType(NodeRef parent,
                                                                    QName assocTypeQName)
Description copied from interface: NodeService
Gets the set of child associations of a certain parent node without parent associations of a certain type to other nodes with the same parent! In effect the 'orphans' with respect to a certain association type.

Specified by:
getChildAssocsWithoutParentAssocsOfType in interface NodeService
Parameters:
parent - the parent node reference
assocTypeQName - the association type QName
Returns:
a set of child associations
Throws:
java.lang.UnsupportedOperationException - always


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