JQOM is an AEM query language that is like ‘prepared statements’ and SQL2 is like ‘statements’ in JDBC queries. For example, a use case may require all JCR nodes from ‘Geometrixx’ which has the property pageTitle.
Selector selector = qf.selector("cq:PageContent", "s");
Constraint constriant = qf.descendantNode("s", "/content/geometrixx");
constriant = qf.and(constriant, qf.propertyExistence("s", "pageTitle"));
QueryObjectModel qm = qf.createQuery(selector, constriant, null, null);
QueryObjectModelFactory gets the instance of the JCR Object Model. The Selector is used to set the type of node that the query needs to look at. The s parameter is simply an alias. Constraint is used to add all the constraints which is like a where condition into the query model. Finally a query is created with the selector and constraint that captures the response as a QueryObjectModel.
Read More
No comments:
Post a Comment
If you have any doubts or questions, please let us know.