NodeLocatorService - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

The NodeLocatorService looks up node locators registered via Spring configuration by name. The service provides a way to lookup one node from another. This Spring configuration file defines a base bean that can be used to define new node locator implementations. Using this bean will automatically register the node locator with the repository and make it available.

The following table shows the node locators available out-of-the-box, the parameters they accept and their use.

Name Class Parameters Usage
companyhome CompanyHomeNodeLocator None Returns the /Company Home folder node
userhome UserHomeNodeLocator None Returns the current user’s home folder node
sharedhome SharedHomeNodeLocator None Returns the Shared Home folder root node
siteshome SitesHomeNodeLocator None Returns the Sites root node
doclib DocLibNodeLocator None Returns the documentLibrary node for the site the source node belongs to
self SelfNodeLocator None Returns the source node
xpath XPathNodeLocator query, store_type and store_id Returns the node pointed to by the given XPath query. The XPath should be relative to the root of a store. If a source node is provided the Store is taken from the node, otherwise the store_type and store_id must be provided.
ancestor AncestorNodeLocator type and aspect Returns an ancestor node of the source node. If no parameters are provided the immediate parent is returned. If a type parameter is present the first ancestor node of that type is returned. If an aspect parameter is present the first ancestor node with that aspect applied is returned. The type and aspect parameters can be combined thus finding an ancestor node of a certain type and with a specific aspect applied.

The following shows how to use one of the out-of-the-box node locators to get a NodeRef for the /Company Home folder:

NodeRef result = serviceRegistry.getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null);