Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Deciphering the "Custom Node Types" document

Avatar

Level 2

I'm trying to learn how to create new Nodes in the JCR programmatically, and I am getting ConstraintViolationExceptions. I have found this guide on the Adobe site describing various custom node types that are implemented in AEM and their properties and dependencies.

Unfortunately, this document does not clearly communicate the node definitions--it lists some properties but doesn't explain the meanings, rules, or relationships between the properties and the node type. For example:

[cq:AuditEvent] - * (undefined) - * (undefined) multiple + * (nt:base) = nt:base multiple version - cq:time (date) - cq:userid (string) - cq:path (string) - cq:type (string) - cq:category (string) - cq:properties (binary)

Why are some of these lines indented? What does the hyphen ("-") mean? What does the asterisk ("*") mean? What does the plus ("+") mean? What does the greater-than sign (">") mean? Does this document signify which properties are required and which are optional?

1 Accepted Solution

Avatar

Correct answer by
Level 10

That is a good pickup - these symbols are confusing. I will log a bug to make sure that these are explained. 

The best part of that doc is it shows the props that belong to a node type. For example - CQ:PAGECONTENT. 

CQ:PAGECONTENT

Description
Defines the default node for page content, with the minimum properties as used by WCM.
@prop jcr:title
Title for the page.
@prop jcr:description
Description of this page.
@prop cq:template
Path to the template used to create the page.
@prop cq:allowedTemplates
List of regular expressions used to determine the path(s) to allowed template.
@prop pageTitle
Title usually displayed in the <title> tag.
@prop navTitle
Title usually used in navigation.
@prop hideInNav
Specifies whether the page should be hidden in the navigation.
@prop onTime
Time when this page becomes valid.
@prop offTime
Time when this page becomes invalid.
@prop cq:lastModified
Date the page (or its paragraphs) was last modified.
@prop cq:lastModifiedBy
Last user to change the page (or its paragraphs).
@prop jcr:language
The language of page content.

 

You will get a ConstraintViolationException when you try and access a prop of a node that does not exist. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

That is a good pickup - these symbols are confusing. I will log a bug to make sure that these are explained. 

The best part of that doc is it shows the props that belong to a node type. For example - CQ:PAGECONTENT. 

CQ:PAGECONTENT

Description
Defines the default node for page content, with the minimum properties as used by WCM.
@prop jcr:title
Title for the page.
@prop jcr:description
Description of this page.
@prop cq:template
Path to the template used to create the page.
@prop cq:allowedTemplates
List of regular expressions used to determine the path(s) to allowed template.
@prop pageTitle
Title usually displayed in the <title> tag.
@prop navTitle
Title usually used in navigation.
@prop hideInNav
Specifies whether the page should be hidden in the navigation.
@prop onTime
Time when this page becomes valid.
@prop offTime
Time when this page becomes invalid.
@prop cq:lastModified
Date the page (or its paragraphs) was last modified.
@prop cq:lastModifiedBy
Last user to change the page (or its paragraphs).
@prop jcr:language
The language of page content.

 

You will get a ConstraintViolationException when you try and access a prop of a node that does not exist.