Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.service.cmr.repository
Interface NodeService

@org.alfresco.api.AlfrescoPublicApi
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.

    <type name="cm:folder">
       ...
       <associations>
          <child-association name="cm:contains">
             ...
             <duplicate>false</duplicate>
          </child-association>
       </associations>
    </type>
 
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.
Author:
Derek Hulley

Method Summary
void
addAspect(NodeRef nodeRef, QName aspectTypeQName, Map<QName,Serializable> aspectProperties)
          Applies an aspect to the given node.
addChild(Collection<NodeRef> parentRefs, NodeRef childRef, QName assocTypeQName, QName qname)
          Associates a given child node with a given collection of parents.
addChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName qname)
          Makes a parent-child association between the given nodes.
void
addProperties(NodeRef nodeRef, Map<QName,Serializable> properties)
          Add all given properties to the node.
int
countChildAssocs(NodeRef nodeRef, boolean isPrimary)
          Counts the number of child associations of nodeRef.
createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
          Create a peer association between two nodes.
createNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName)
createNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName, Map<QName,Serializable> properties)
          Creates a new, non-abstract, real node as a primary child of the given parent node.
createStore(String protocol, 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)
findNodes(org.alfresco.service.cmr.repository.NodeService.FindNodeParameters params)
getAllRootNodes(StoreRef storeRef)
getAspects(NodeRef nodeRef)
getAssoc(Long id)
          Gets an association by ID.
getChildAssocs(NodeRef nodeRef)
          Get all child associations of the given node.
getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
          Gets all child associations where the pattern of the association qualified name is a match.
getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern, boolean preload)
          Gets all child associations where the pattern of the association qualified names match the patterns provided.
getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern, int maxResults, boolean preload)
          Gets all child associations where the pattern of the association qualified name is an exact match.
getChildAssocs(NodeRef nodeRef, Set<QName> childNodeTypeQNames)
          Retrieve immediate children of a given node where the child nodes are in the given inclusive list.
getChildAssocsByPropertyValue(NodeRef nodeRef, QName propertyQName, Serializable value)
          Retrieve the immediate children of a given node based on the value of a property of those children.
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.
getChildByName(NodeRef nodeRef, QName assocTypeQName, String childName)
          Get the node with the given name within the context of the parent node.
getChildrenByName(NodeRef nodeRef, QName assocTypeQName, Collection<String> childNames)
          Get the nodes with the given names within the context of the parent node.
getNodeAclId(NodeRef nodeRef)
getNodeRef(Long nodeId)
          Get the node reference for a given node DB ID
org.alfresco.service.cmr.repository.NodeRef.Status
getNodeStatus(NodeRef nodeRef)
          Gets the ID of the last transaction that caused the node to change.
getParentAssocs(NodeRef nodeRef)
getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
          Gets all parent associations where the pattern of the association qualified name is a match
getPath(NodeRef nodeRef)
          The root node has an entry in the path(s) returned.
getPaths(NodeRef nodeRef, boolean primaryOnly)
          The root node has an entry in the path(s) returned.
getPrimaryParent(NodeRef nodeRef)
          Fetches the primary parent-child relationship.
getProperties(NodeRef nodeRef)
getProperty(NodeRef nodeRef, QName qname)
getRootNode(StoreRef storeRef)
getSourceAssocs(NodeRef targetRef, QNamePattern qnamePattern)
          Fetches all associations to the given target where the associations' qualified names match the pattern provided.
getStoreArchiveNode(StoreRef storeRef)
          Get the node where archived items will have gone when deleted from the given store.
getStores()
          Gets a list of all available node store references
getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
          Fetches all associations from the given source where the associations' qualified names match the pattern provided.
getTargetAssocsByPropertyValue(NodeRef sourceRef, QNamePattern qnamePattern, QName propertyQName, Serializable propertyValue)
          Fetches all associations from the given source where the associations' qualified names match the pattern provided.
getType(NodeRef nodeRef)
boolean
hasAspect(NodeRef nodeRef, QName aspectTypeQName)
          Determines if a given aspect is present on a node.
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 removeSecondaryChildAssociation(ChildAssociationRef)
boolean
removeSecondaryChildAssociation(ChildAssociationRef childAssocRef)
          Remove a specific secondary child association.
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, List<NodeRef> 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, Map<QName,Serializable> properties)
          Replace all current properties on the node with the given properties.
void
setProperty(NodeRef nodeRef, QName qname, 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
List<StoreRefgetStores()
Gets a list of all available node store references
Returns:
Returns a list of store references

createStore
@Auditable(parameters={
  "protocol",
  "identifier"
})
StoreRef createStore(String protocol,
                     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:
protocol - 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")
org.alfresco.service.cmr.repository.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(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")
Set<NodeRefgetAllRootNodes(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:
createNode(NodeRef, QName, QName, QName, Map)

createNode
@Auditable(parameters={
  "parentRef",
  "assocTypeQName",
  "assocQName",
  "nodeTypeQName",
  "properties"
})
ChildAssociationRef createNode(NodeRef parentRef,
                               QName assocTypeQName,
                               QName assocQName,
                               QName nodeTypeQName,
                               Map<QName,Serializable> 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
org.alfresco.service.cmr.repository.CyclicChildRelationshipException - if the child partakes in a cyclic relationship after the add
See Also:
getPrimaryParent(NodeRef)

setChildAssociationIndex
@Auditable(parameters={
  "childAssocRef",
  "index"
})
void setChildAssociationIndex(ChildAssociationRef childAssocRef,
                              int index)
                       throws org.alfresco.service.cmr.repository.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:
org.alfresco.service.cmr.repository.InvalidChildAssociationRefException
See Also:
getChildAssocs(NodeRef), getChildAssocs(NodeRef, QNamePattern, QNamePattern), ChildAssociationRef.getNthSibling()

getType
@Auditable(parameters="nodeRef")
QName getType(NodeRef nodeRef)
       throws InvalidNodeRefException
Parameters:
nodeRef - 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,
               Map<QName,Serializable> 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 - 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 - 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 - NodeRef
aspectTypeQName - QName
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")
Set<QNamegetAspects(NodeRef nodeRef)
               throws InvalidNodeRefException
Parameters:
nodeRef - 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
org.alfresco.service.cmr.repository.CyclicChildRelationshipException - if the child partakes in a cyclic relationship after the add

addChild
@Auditable(parameters={
  "parentRefs",
  "childRef",
  "assocTypeQName",
  "qname"
})
List<ChildAssociationRefaddChild(Collection<NodeRef> 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
org.alfresco.service.cmr.repository.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 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:
IllegalArgumentException - if the association is primary
Since:
4.0

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

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

getProperty
@Auditable(parameters={
  "nodeRef",
  "qname"
})
Serializable getProperty(NodeRef nodeRef,
                         QName qname)
                  throws InvalidNodeRefException
Parameters:
nodeRef - 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,
                   Map<QName,Serializable> properties)
            throws InvalidNodeRefException
Replace all current properties on the node with the given properties. 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,
                   Map<QName,Serializable> 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,
                 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
value - 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")
List<ChildAssociationRefgetParentAssocs(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:
getParentAssocs(NodeRef, QNamePattern, QNamePattern)

getParentAssocs
@Auditable(parameters={
  "nodeRef",
  "typeQNamePattern",
  "qnamePattern"
})
List<ChildAssociationRefgetParentAssocs(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(), setChildAssociationIndex(ChildAssociationRef, int), QName, RegexQNamePattern.MATCH_ALL

getChildAssocs
@Auditable(parameters="nodeRef")
List<ChildAssociationRefgetChildAssocs(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:
getChildAssocs(NodeRef, QNamePattern, QNamePattern), setChildAssociationIndex(ChildAssociationRef, int), ChildAssociationRef.getNthSibling()

getChildAssocs
@Auditable(parameters={
  "nodeRef",
  "typeQNamePattern",
  "qnamePattern"
})
List<ChildAssociationRefgetChildAssocs(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.

Note that all child associations are fetched and preloading is done for all results.

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(NodeRef, QNamePattern, QNamePattern, int, boolean)

getChildAssocs
@Auditable(parameters={
  "nodeRef",
  "typeQNamePattern",
  "qnamePattern",
  "maxResults",
  "preload"
})
List<ChildAssociationRefgetChildAssocs(NodeRef nodeRef,
                                         QNamePattern typeQNamePattern,
                                         QNamePattern qnamePattern,
                                         int maxResults,
                                         boolean preload)
                                  throws InvalidNodeRefException
Gets all child associations where the pattern of the association qualified name is an exact match.
Parameters:
nodeRef - the parent node - usually a container
typeQNamePattern - the qualified name of the association (null to ignore)
qnamePattern - the path qualified name (null to ignore)
maxResults - the number of results to get
preload - true if the nodes must be preloaded into the cache
Returns:
Returns a list of ChildAssociationRef instances
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
QName

getChildAssocs
@Auditable(parameters={
  "nodeRef",
  "typeQNamePattern",
  "qnamePattern"
})
List<ChildAssociationRefgetChildAssocs(NodeRef nodeRef,
                                         QNamePattern typeQNamePattern,
                                         QNamePattern qnamePattern,
                                         boolean preload)
                                  throws InvalidNodeRefException
Gets all child associations where the pattern of the association qualified names match the patterns provided.

Note that all results are retrieved but preloading is optional.

Parameters:
nodeRef - the parent node - usually a container
typeQNamePattern - the qualified name pattern of the association
qnamePattern - the path qualified name pattern
preload - true if the nodes must be preloaded into the cache
Returns:
Returns a list of ChildAssociationRef instances
Throws:
InvalidNodeRefException - if the node could not be found
See Also:
RegexQNamePattern.MATCH_ALL, QName, getChildAssocs(NodeRef, QNamePattern, QNamePattern, int, boolean)

getChildAssocs
@Auditable(parameters={
  "nodeRef",
  "childNodeTypes"
})
List<ChildAssociationRefgetChildAssocs(NodeRef nodeRef,
                                         Set<QName> 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
childNodeTypeQNames - 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"
})
List<ChildAssociationRefgetChildAssocsByPropertyValue(NodeRef nodeRef,
                                                        QName propertyQName,
                                                        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,
                           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"
    })
    List<ChildAssociationRefgetChildrenByName(NodeRef nodeRef,
                                                QName assocTypeQName,
                                                Collection<String> 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 - 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"
    })
    Collection<ChildAssociationRefgetChildAssocsWithoutParentAssocsOfType(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"
    })
    AssociationRef createAssociation(NodeRef sourceRef,
                                     NodeRef targetRef,
                                     QName assocTypeQName)
                              throws InvalidNodeRefException,
                                     AssociationExistsException
    Create a peer association between two nodes.

    The ordering will be natural. To change association ordering, use setAssociations.

    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 - if an association of the same type exists between the nodes
    See Also:
    setAssociations(NodeRef, QName, List)

    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,
                         List<NodeRef> 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(Long id)
    Gets an association by ID.
    Parameters:
    id - the association id
    Returns:
    the association, or null if it does not exist

    getTargetAssocs
    @Auditable(parameters={
      "sourceRef",
      "qnamePattern"
    })
    List<AssociationRefgetTargetAssocs(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

    getTargetAssocsByPropertyValue
    @Auditable(parameters={
      "sourceRef",
      "qnamePattern",
      "propertyQName",
      "propertyValue"
    })
    List<AssociationRefgetTargetAssocsByPropertyValue(NodeRef sourceRef,
                                                        QNamePattern qnamePattern,
                                                        QName propertyQName,
                                                        Serializable propertyValue)
    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
    propertyQName - the fully qualified name of the property of the association target. Optional parameter - can be null.
    propertyValue - association target property 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. If propertyQName is null the value is ignored.
    Returns:
    a list of AssociationRef instances for which the given node is a source
    Throws:
    InvalidNodeRefException - if the source node could not be
    IllegalArgumentException - if propertyQName is a system maintained property
    See Also:
    QName, RegexQNamePattern.MATCH_ALL

    getSourceAssocs
    @Auditable(parameters={
      "targetRef",
      "qnamePattern"
    })
    List<AssociationRefgetSourceAssocs(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 - NodeRef
    Returns:
    Returns the path to the node along the primary node path
    Throws:
    InvalidNodeRefException - if the node could not be found
    See Also:
    getPaths(NodeRef, boolean)

    getPaths
    @Auditable(parameters={
      "nodeRef",
      "primaryOnly"
    })
    List<PathgetPaths(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 - 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
    List<NodeReffindNodes(org.alfresco.service.cmr.repository.NodeService.FindNodeParameters params)

    countChildAssocs
    @Auditable(parameters={
      "nodeRef",
      "isPrimary"
    })
    int countChildAssocs(NodeRef nodeRef,
                         boolean isPrimary)
                  throws InvalidNodeRefException
    Counts the number of child associations of nodeRef.
    Parameters:
    nodeRef - the parent node id
    isPrimary - count just primary associations?
    Returns:
    Returns the number of child associations
    Throws:
    InvalidNodeRefException

    Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
    PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
    SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

    Copyright © 2005–2018 Alfresco Software. All rights reserved.

    Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.