Mario R
Mario R

Reputation: 179

How to find correct AEM constant class names?

Most of the time we want to use following string constants,

sling:resourceType,sling:resourceSuperType,cq:template path, property, property.value and p.limit.

There should be some existing classes available. I tried to search this in SlingConstant class but I could not much thing. Is there any existing constant class available for jcr and sling string constants?

Upvotes: 1

Views: 203

Answers (1)

Alexander Berndt
Alexander Berndt

Reputation: 1728

I usually use Google with "Adobe AEM constants XYZ", and usually end here:

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/constant-values.html

There you have 12 hits for sling:resourceType. But most of the containing classes are usually not fitting for your current search.

So I would say:

"sling:resourceType" -> JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY"
"sling:resourceSuperType" -> JcrResourceConstants.SLING_RESOURCE_SUPER_TYPE_PROPERTY
"cq:template" -> NameConstants.PN_TEMPLATE

PN ... Property Name, NT ... Node Type, NN ... Node Name

For the Query Manager are only some constants in com.day.cq.search.Predicate. But also for normal SQL-queries you normally don't use constants. Nevertheless the QueryManager should mainly be used in JavaScript on the Author. Because there you have a web-API out-of-the-box. But in Java I would recommend to use JCR SQL-2. Both XPath and QueryManager are only translated into an SQL-2 query. And again I'm not aware of any constants for SQL-2.

Upvotes: 2

Related Questions