NamespaceService - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

Provides access to content model namespaces and their definition of namespace URIs and Prefixes. The NamespaceService has constants defined for the major namespaces used by internal Alfresco content models, including the prefixes for those.

Content Services namespaces start with http://www.alfresco.org. The top-level namespace sub-divisions are:

  • model - identify a data model
  • view - identify a view of content held in the repository
  • ws - identify a Web Service definition
  • test - identify a test definition

Each namespace typically ends with its version number.

Here is a list of some of the out-of-box content models that are good to know about:

Namespace Common Prefix Description
http://www.alfresco.org alf General Namespace
http://www.alfresco.org/model/dictionary/1.0 d Data Dictionary model
http://www.alfresco.org/model/system/1.0 sys Repository system model
http://www.alfresco.org/model/content/1.0 cm Content Domain model
http://www.alfresco.org/model/application/1.0 app Application model
http://www.alfresco.org/model/bpm/1.0 bpm Business Process Model
http://www.alfresco.org/model/site/1.0 st Site Model
http://www.alfresco.org/model/forum/1.0 fm Forum Model
http://www.alfresco.org/model/user/1.0 usr User model (in repository.jar)
http://www.alfresco.org/view/repository/1.0 view Import / Export View
http://www.alfresco.org/model/action/1.0 act Action service model
http://www.alfresco.org/model/rule/1.0 rule Rule service model
http://www.alfresco.org/ws/service/authentication/1.0 auth Authentication Web Service
http://www.alfresco.org/ws/service/repository/1.0 rep Repository Web Service
http://www.alfresco.org/ws/service/content/1.0 content Content Web Service
http://www.alfresco.org/ws/service/authoring/1.0 author Authoring Web Service
http://www.alfresco.org/ws/service/classification/1.0 cls Classification Web Service
http://www.alfresco.org/ws/cml/1.0 cml Content Manipulation Language
http://www.alfresco.org/ws/model/content/1.0 cm Web Service Content Domain Model
http://www.alfresco.org/model/workflow/1.0 wf Workflow Model (link is to the simple workflow model, not generally extended)

It’s common to use the NamespaceService to get to prefixes for content models, such as in this example:

String companyHomePath = serviceRegistry.getNodeService().getPath(companyHome)
               .toPrefixString(serviceRegistry.getNamespaceService());

This code would result in companyHomePath being set to /app:company_home.

Another example usage is the following code that uses the NamespaceService when a QName is created:

String name = "aName";
QName aQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName(name));

This code would result in aQName being set to {http://www.alfresco.org/model/content/1.0}aName.