org.alfresco.service.cmr.repository
Interface NodeService


public interface NodeService

Interface for public and internal node and store operations.

Amongst other things, this service must enforce the unique name check as mandated by the duplicate entity in the model.


    
       ...
       
          
             ...
             false
          
       
    
 
When duplicates are not allowed, and the cm:name property of a node changes, then the DuplicateChildNodeNameException exception must be thrown. Client code can catch this exception and deal with it appropriately.


Nested Class Summary
static class NodeService.FindNodeParameters
          General node-find parameters.
 
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)
          Create a peer association between two nodes, optionally specifying the ordering.
 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 store for the given protocol and identifier.
 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)
           
 java.util.List findNodes(NodeService.FindNodeParameters params)
           
 java.util.Set getAllRootNodes(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)
          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, QName typeQName, QName qname, int maxResults, boolean preload)
          Gets the first n child associations, optionally filtered by type qualified name and qualified name.
 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.
 java.util.List getChildAssocsByPropertyValue(NodeRef nodeRef, QName propertyQName, java.io.Serializable value)
          Retrieve the immediate children of a given node based on the value of a property of those children.
 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.
 java.lang.Long getNodeAclId(NodeRef nodeRef)
           
 NodeRef getNodeRef(java.lang.Long nodeId)
          Get the node reference for a given node DB ID
 NodeRef.Status getNodeStatus(NodeRef nodeRef)
          Gets the ID of the last transaction that caused the node to change.
 java.util.List getParentAssocs(NodeRef nodeRef)
           
 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.
 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)
          Remove a specific child association.
 void removeProperty(NodeRef nodeRef, QName qname)
          Removes a property value completely.
 boolean removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
          Deprecated. Use NodeService.removeSecondaryChildAssociation(ChildAssociationRef)
 boolean removeSecondaryChildAssociation(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 setAssociations(NodeRef sourceRef, QName assocTypeQName, java.util.List targetRefs)
          Re-assign all typed target associations for a given node.
 void setChildAssociationIndex(ChildAssociationRef childAssocRef, int index)
          Set the ordering index of the child association.
 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.
 

Method Detail

getStores

@Auditable
java.util.List getStores()
Gets a list of all available node store references

Returns:
Returns a list of store references

createStore

@Auditable(parameters={"protocol", "identifier"})
StoreRef createStore(java.lang.String protocol,
                                         java.lang.String identifier)
                     throws StoreExistsException
Create a new store for the given protocol and identifier. The implementation may create the store in any number of locations, including a database or Subversion.

Parameters:
protocolthe - implementation protocol
identifier - the protocol-specific identifier
Returns:
Returns a reference to the store
Throws:
StoreExistsException

deleteStore

@Auditable(parameters="storeRef")
void deleteStore(StoreRef storeRef)
Delete a store and all its contents.

Parameters:
storeRef - the store to delete
Throws:
InvalidStoreRefException - if the store reference is invalid

exists

@Auditable(parameters="storeRef")
boolean exists(StoreRef storeRef)
Parameters:
storeRef - a reference to the store to look for
Returns:
Returns true if the store exists, otherwise false

exists

@Auditable(parameters="nodeRef")
boolean exists(NodeRef nodeRef)
Parameters:
nodeRef - a reference to the node to look for
Returns:
Returns true if the node exists, otherwise false

getNodeStatus

@Auditable(parameters="nodeRef")
NodeRef.Status getNodeStatus(NodeRef nodeRef)
Gets the ID of the last transaction that caused the node to change. This includes deletions, so it is possible that the node being referenced no longer exists. If the node never existed, then null is returned.

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

getNodeRef

@Auditable(parameters="nodeId")
NodeRef getNodeRef(java.lang.Long nodeId)
Get the node reference for a given node DB ID

Parameters:
nodeId - the node's DB ID
Returns:
the corresponding node reference or null if not found

getRootNode

@Auditable(parameters="storeRef")
NodeRef getRootNode(StoreRef storeRef)
                    throws InvalidStoreRefException
Parameters:
storeRef - a reference to an existing store
Returns:
Returns a reference to the root node of the store
Throws:
InvalidStoreRefException - if the store could not be found

getAllRootNodes

@Auditable(parameters="storeRef")
java.util.Set getAllRootNodes(StoreRef storeRef)
Parameters:
storeRef - a reference to an existing store
Returns:
Returns a set of references to all nodes in the store tagged with the root aspect
Throws:
InvalidStoreRefException - if the store could not be found

createNode

@Auditable(parameters={"parentRef", "assocTypeQName", "assocQName", "nodeTypeQName"})
ChildAssociationRef createNode(NodeRef parentRef,
                                                   QName assocTypeQName,
                                                   QName assocQName,
                                                   QName nodeTypeQName)
                               throws InvalidNodeRefException,
                                      InvalidTypeException
Throws:
InvalidNodeRefException
InvalidTypeException
See Also:
NodeService.createNode(NodeRef, QName, QName, QName, Map)

createNode

@Auditable(parameters={"parentRef", "assocTypeQName", "assocQName", "nodeTypeQName", "properties"})
ChildAssociationRef createNode(NodeRef parentRef,
                                                   QName assocTypeQName,
                                                   QName assocQName,
                                                   QName nodeTypeQName,
                                                   java.util.Map properties)
                               throws InvalidNodeRefException,
                                      InvalidTypeException
Creates a new, non-abstract, real node as a primary child of the given parent node.

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:
InvalidNodeRefException - if the parent reference is invalid
InvalidTypeException - if the node type reference is not recognised
See Also:
DictionaryService

moveNode

@Auditable(parameters={"nodeToMoveRef", "newParentRef", "assocTypeQName", "assocQName"})
ChildAssociationRef moveNode(NodeRef nodeToMoveRef,
                                                 NodeRef newParentRef,
                                                 QName assocTypeQName,
                                                 QName assocQName)
                             throws InvalidNodeRefException
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.

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:
InvalidNodeRefException - if either the parent node or move node reference is invalid
CyclicChildRelationshipException - if the child partakes in a cyclic relationship after the add
See Also:
NodeService.getPrimaryParent(NodeRef)

setChildAssociationIndex

@Auditable(parameters={"childAssocRef", "index"})
void setChildAssociationIndex(ChildAssociationRef childAssocRef,
                                                  int index)
                              throws InvalidChildAssociationRefException
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.

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

getType

@Auditable(parameters="nodeRef")
QName getType(NodeRef nodeRef)
              throws InvalidNodeRefException
Parameters:
nodeRef -
Returns:
Returns the type name
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
DictionaryService

setType

@Auditable(parameters={"nodeRef", "typeQName"})
void setType(NodeRef nodeRef,
                                 QName typeQName)
             throws InvalidNodeRefException
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.

Parameters:
nodeRef - the node reference
typeQName - the type QName
Throws:
InvalidNodeRefException
Since:
1.1

addAspect

@Auditable(parameters={"nodeRef", "aspectTypeQName", "aspectProperties"})
void addAspect(NodeRef nodeRef,
                                   QName aspectTypeQName,
                                   java.util.Map aspectProperties)
               throws InvalidNodeRefException,
                      InvalidAspectException
Applies an aspect to the given node. After this method has been called, the node with have all the aspect-related properties present

Parameters:
nodeRef -
aspectTypeQName - the aspect to apply to the node
aspectProperties - a minimum of the mandatory properties required for the aspect
Throws:
InvalidNodeRefException
InvalidAspectException - if the class reference is not to a valid aspect
See Also:
DictionaryService.getAspect(QName), ClassDefinition.getProperties()

removeAspect

@Auditable(parameters={"nodeRef", "aspectTypeQName"})
void removeAspect(NodeRef nodeRef,
                                      QName aspectTypeQName)
                  throws InvalidNodeRefException,
                         InvalidAspectException
Remove an aspect and all related properties from a node

Parameters:
nodeRef -
aspectTypeQName - the type of aspect to remove
Throws:
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

hasAspect

@Auditable(parameters={"nodeRef", "aspectTypeQName"})
boolean hasAspect(NodeRef nodeRef,
                                      QName aspectTypeQName)
                  throws InvalidNodeRefException,
                         InvalidAspectException
Determines if a given aspect is present on a node. Aspects may only be removed if they are NOT mandatory.

Parameters:
nodeRef -
aspectTypeQName -
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

getAspects

@Auditable(parameters="nodeRef")
java.util.Set getAspects(NodeRef nodeRef)
                         throws InvalidNodeRefException
Parameters:
nodeRef -
Returns:
Returns a set of all aspects applied to the node, including mandatory aspects
Throws:
InvalidNodeRefException - if the node could not be found

deleteNode

@Auditable(parameters="nodeRef")
void deleteNode(NodeRef nodeRef)
                throws InvalidNodeRefException
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.

Parameters:
nodeRef - reference to a node within a store
Throws:
InvalidNodeRefException - if the reference given is invalid

addChild

@Auditable(parameters={"parentRef", "childRef", "assocTypeQName", "qname"})
ChildAssociationRef addChild(NodeRef parentRef,
                                                 NodeRef childRef,
                                                 QName assocTypeQName,
                                                 QName qname)
                             throws InvalidNodeRefException
Makes a parent-child association between the given nodes. Both nodes must belong to the same store.

Parameters:
parentRef - the parent node
childRef - the child node
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:
InvalidNodeRefException - if the parent or child nodes could not be found
CyclicChildRelationshipException - if the child partakes in a cyclic relationship after the add

addChild

@Auditable(parameters={"parentRefs", "childRef", "assocTypeQName", "qname"})
java.util.List addChild(java.util.Collection parentRefs,
                                            NodeRef childRef,
                                            QName assocTypeQName,
                                            QName qname)
                        throws InvalidNodeRefException
Associates a given child node with a given collection of parents. All nodes must belong to the same store.

Parameters:
parentRefs - the parent nodes (there will be this many associations created).
childRef - the child node
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:
InvalidNodeRefException - if the parent or child nodes could not be found
CyclicChildRelationshipException - if the child partakes in a cyclic relationship after the add

removeChild

@Auditable(parameters={"parentRef", "childRef"})
void removeChild(NodeRef parentRef,
                                     NodeRef childRef)
                 throws InvalidNodeRefException
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.

Parameters:
parentRef - the parent end of the association
childRef - the child end of the association
Throws:
InvalidNodeRefException - if the parent or child nodes could not be found

removeChildAssociation

@Auditable(parameters="childAssocRef")
boolean removeChildAssociation(ChildAssociationRef childAssocRef)
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.

Parameters:
childAssocRef - the association to remove
Returns:
Returns true if the association existed, otherwise false.

removeSeconaryChildAssociation

@Auditable(parameters="childAssocRef")
boolean removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
Deprecated. Use NodeService.removeSecondaryChildAssociation(ChildAssociationRef)


removeSecondaryChildAssociation

@Auditable(parameters="childAssocRef")
boolean removeSecondaryChildAssociation(ChildAssociationRef childAssocRef)
Remove a specific secondary child association.

Parameters:
childAssocRef - the association to remove
Returns:
Returns true if the association existed, otherwise false.
Throws:
java.lang.IllegalArgumentException - if the association is primary
Since:
4.0

getProperties

@Auditable(parameters="nodeRef")
java.util.Map getProperties(NodeRef nodeRef)
                            throws InvalidNodeRefException
Parameters:
nodeRef -
Returns:
Returns all properties keyed by their qualified name
Throws:
InvalidNodeRefException - if the node could not be found

getNodeAclId

@Auditable(parameters="nodeRef")
java.lang.Long getNodeAclId(NodeRef nodeRef)
                            throws InvalidNodeRefException
Parameters:
nodeRef -
Returns:
Returns the acl id of the node
Throws:
InvalidNodeRefException - if the node could not be found

getProperty

@Auditable(parameters={"nodeRef", "qname"})
java.io.Serializable getProperty(NodeRef nodeRef,
                                                     QName qname)
                                 throws InvalidNodeRefException
Parameters:
nodeRef -
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

@Auditable(parameters={"nodeRef", "properties"})
void setProperties(NodeRef nodeRef,
                                       java.util.Map properties)
                   throws InvalidNodeRefException
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.

Parameters:
nodeRef - the node to chance
properties - all the properties of the node keyed by their qualified names
Throws:
InvalidNodeRefException - if the node could not be found

addProperties

@Auditable(parameters={"nodeRef", "properties"})
void addProperties(NodeRef nodeRef,
                                       java.util.Map properties)
                   throws InvalidNodeRefException
Add all given properties to the node.

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

Parameters:
nodeRef - the node to change
properties - the properties to change, keyed by their qualified names
Throws:
InvalidNodeRefException - if the node could not be found

setProperty

@Auditable(parameters={"nodeRef", "qname", "value"})
void setProperty(NodeRef nodeRef,
                                     QName qname,
                                     java.io.Serializable value)
                 throws InvalidNodeRefException
Sets the value of a property to be any Serializable instance.

NOTE: Null values are allowed.

Parameters:
nodeRef - a reference to an existing node
qname - the fully qualified name of the property
propertyValue - the value of the property - never null
Throws:
InvalidNodeRefException - if the node could not be found

removeProperty

@Auditable(parameters={"nodeRef", "qname"})
void removeProperty(NodeRef nodeRef,
                                        QName qname)
                    throws InvalidNodeRefException
Removes a property value completely.

Parameters:
nodeRef - a reference to an existing node
qname - the fully qualified name of the property
Throws:
InvalidNodeRefException - if the node could not be found

getParentAssocs

@Auditable(parameters="nodeRef")
java.util.List getParentAssocs(NodeRef nodeRef)
                               throws InvalidNodeRefException
Parameters:
nodeRef - the child node
Returns:
Returns a list of all parent-child associations that exist where the given node is the child
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
NodeService.getParentAssocs(NodeRef, QNamePattern, QNamePattern)

getParentAssocs

@Auditable(parameters={"nodeRef", "typeQNamePattern", "qnamePattern"})
java.util.List getParentAssocs(NodeRef nodeRef,
                                                   QNamePattern typeQNamePattern,
                                                   QNamePattern qnamePattern)
                               throws InvalidNodeRefException
Gets all parent associations where the pattern of the association qualified name is a match

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

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
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
ChildAssociationRef.getNthSibling(), NodeService.setChildAssociationIndex(ChildAssociationRef, int), QName, RegexQNamePattern.MATCH_ALL

getChildAssocs

@Auditable(parameters="nodeRef")
java.util.List getChildAssocs(NodeRef nodeRef)
                              throws InvalidNodeRefException
Get all child associations of the given node.

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

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:
NodeService.getChildAssocs(NodeRef, QNamePattern, QNamePattern), NodeService.setChildAssociationIndex(ChildAssociationRef, int), ChildAssociationRef.getNthSibling()

getChildAssocs

@Auditable(parameters={"nodeRef", "typeQNamePattern", "qnamePattern"})
java.util.List getChildAssocs(NodeRef nodeRef,
                                                  QNamePattern typeQNamePattern,
                                                  QNamePattern qnamePattern)
                              throws InvalidNodeRefException
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.

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

@Auditable(parameters={"nodeRef", "typeQName", "qname", "maxResults", "preload"})
java.util.List getChildAssocs(NodeRef nodeRef,
                                                  QName typeQName,
                                                  QName qname,
                                                  int maxResults,
                                                  boolean preload)
                              throws InvalidNodeRefException
Gets the first n child associations, optionally filtered by type qualified name and qualified name.

Parameters:
nodeRef - the parent node - usually a container
typeQName - the association type qname to filter on; null for no filtering
qname - the association qname to filter on; null for no filtering
maxResults - the maximum number of results to return. The query will be terminated efficiently after that number of results
preload - should the child nodes be batch loaded?
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

getChildAssocs

@Auditable(parameters={"nodeRef", "typeQNamePattern", "qnamePattern"})
java.util.List getChildAssocs(NodeRef nodeRef,
                                                  QNamePattern typeQNamePattern,
                                                  QNamePattern qnamePattern,
                                                  boolean preload)
                              throws InvalidNodeRefException
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.

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

@Auditable(parameters={"nodeRef", "childNodeTypes"})
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.

Parameters:
nodeRef - the parent node - usually a container
childNodeTypes - the types that the children may be. Subtypes are not automatically calculated and the list must therefore be exhaustive.
Returns:
Returns a list of ChildAssociationRef instances.
Throws:
InvalidNodeRefException - if the node could not be found

getChildAssocsByPropertyValue

@Auditable(parameters={"nodeRef", "propertyQName", "value"})
java.util.List getChildAssocsByPropertyValue(NodeRef nodeRef,
                                                                 QName propertyQName,
                                                                 java.io.Serializable value)
Retrieve the immediate children of a given node based on the value of a property of those children.

If the property to be searched is multi-valued then will match on any one values.

Please note, the following system maintained properties that cannot be used with this method.

  • cm:name - use getChildByName instead
  • cm:created
  • cm:creator
  • cm:modified
  • cm:modifier
  • sys:node-uuid
  • sys:node-dbid
  • sys:store-identifier
  • sys:store-protocol
    • Parameters:
      nodeRef - the parent node - usually a container
      propertyQName - the fully qualified name of the property
      value - the value to search for. Must be a simple type such as String, Number, Date or Boolean, it cannot be a collection, a content property, MLText or a float.
      Returns:
      Returns a list of ChildAssociationRef instances.

getChildByName

@Auditable(parameters={"nodeRef", "assocTypeQName", "childName"})
NodeRef getChildByName(NodeRef nodeRef,
                                           QName assocTypeQName,
                                           java.lang.String childName)
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.

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

getChildrenByName

@Auditable(parameters={"nodeRef", "assocTypeQName", "childName"})
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.

Parameters:
childNames - a collection of up to 1000 child names to match on
See Also:
#getChildByName(NodeRef, QName, String)}

getPrimaryParent

@Auditable(parameters="nodeRef")
ChildAssociationRef getPrimaryParent(NodeRef nodeRef)
                                     throws InvalidNodeRefException
Fetches the primary parent-child relationship.

For a root node, the parent node reference will be null.

Parameters:
nodeRef -
Returns:
Returns the primary parent-child association of the node
Throws:
InvalidNodeRefException - if the node could not be found

getChildAssocsWithoutParentAssocsOfType

@Auditable(parameters={"parent", "assocTypeQName"})
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.

Parameters:
parent - the parent node reference
assocTypeQName - the association type QName
Returns:
a set of child associations

createAssociation

@Auditable(parameters={"sourceRef", "targetRef", "assocTypeQName", "insertAfter"})
AssociationRef createAssociation(NodeRef sourceRef,
                                                     NodeRef targetRef,
                                                     QName assocTypeQName)
                                 throws InvalidNodeRefException,
                                        AssociationExistsException
Create a peer association between two nodes, optionally specifying the ordering.

Note that inserting the association into a specific location is more expensive than specifying the natural ordering (null).

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:
InvalidNodeRefException - if either of the nodes could not be found
AssociationExistsException

removeAssociation

@Auditable(parameters={"sourceRef", "targetRef", "assocTypeQName"})
void removeAssociation(NodeRef sourceRef,
                                           NodeRef targetRef,
                                           QName assocTypeQName)
                       throws InvalidNodeRefException
Parameters:
sourceRef - the associaton source node
targetRef - the association target node
assocTypeQName - the qualified name of the association type
Throws:
InvalidNodeRefException - if either of the nodes could not be found

setAssociations

@Auditable(parameters={"sourceRef", "assocTypeQName", "targetRefs"})
void setAssociations(NodeRef sourceRef,
                                         QName assocTypeQName,
                                         java.util.List targetRefs)
Re-assign all typed target associations for a given node.

Parameters:
sourceRef - the source node
assocTypeQName - the specific type of the association
targetRefs - the target nodes (not null but empty list is accepted).

getAssoc

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

Parameters:
assocId - the association id
Returns:
the association, or null if it does not exist

getTargetAssocs

@Auditable(parameters={"sourceRef", "qnamePattern"})
java.util.List getTargetAssocs(NodeRef sourceRef,
                                                   QNamePattern qnamePattern)
                               throws InvalidNodeRefException
Fetches all associations from the given source where the associations' qualified names match the pattern provided.

The results are ordered if a specific type of association is requested

Parameters:
sourceRef - the association source
qnamePattern - the association qname pattern to match against
Returns:
a list of NodeAssocRef instances for which the given node is a source
Throws:
InvalidNodeRefException - if the source node could not be found
See Also:
QName, RegexQNamePattern.MATCH_ALL

getSourceAssocs

@Auditable(parameters={"targetRef", "qnamePattern"})
java.util.List getSourceAssocs(NodeRef targetRef,
                                                   QNamePattern qnamePattern)
                               throws InvalidNodeRefException
Fetches all associations to the given target where the associations' qualified names match the pattern provided.

Parameters:
targetRef - 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:
InvalidNodeRefException
See Also:
QName, RegexQNamePattern.MATCH_ALL

getPath

@Auditable(parameters="nodeRef")
Path getPath(NodeRef nodeRef)
             throws InvalidNodeRefException
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.

Parameters:
nodeRef -
Returns:
Returns the path to the node along the primary node path
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
NodeService.getPaths(NodeRef, boolean)

getPaths

@Auditable(parameters={"nodeRef", "primaryOnly"})
java.util.List getPaths(NodeRef nodeRef,
                                            boolean primaryOnly)
                        throws InvalidNodeRefException
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.

Parameters:
nodeRef -
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:
InvalidNodeRefException - if the node could not be found

getStoreArchiveNode

@Auditable(parameters="storeRef")
NodeRef getStoreArchiveNode(StoreRef storeRef)
Get the node where archived items will have gone when deleted from the given store.

Parameters:
storeRef - the store that items were deleted from
Returns:
Returns the archive node parent

restoreNode

@Auditable(parameters={"archivedNodeRef", "destinationParentNodeRef", "assocTypeQName", "assocQName"})
NodeRef restoreNode(NodeRef archivedNodeRef,
                                        NodeRef destinationParentNodeRef,
                                        QName assocTypeQName,
                                        QName assocQName)
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.

Parameters:
archivedNodeRef - the archived node
destinationParentNodeRef - 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

findNodes

java.util.List findNodes(NodeService.FindNodeParameters params)


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