Showing posts with label Basic Concepts. Show all posts
Showing posts with label Basic Concepts. Show all posts

Tuesday, April 25, 2017

AEM 6 QueryBuilder API in brief

AEM 6 QueryBuilder API in brief

Base Path :

http://host:port/bin/querybuilder.json

The query parameters are added after this path in order to search for specific results.

Parameters can be :

path
The path in content repository where you want to search for the results

p.limit(=number)
To limit the parameters. Setting p.limit=-1 will give all the possible results.

p.guessTotal(=true/false or number)
This parameter should be used with large number of result set. When set to true, the query builder returns the appropriate results on the basis of the value of p.offset and p.limit. 
the actual total number of results might not be visible to the user but the minimum number of results will be visible as total number which is the value of this parameter if it is set as number.

type(=cq type of the node like cq:File, nt:unstructured)
Node type of the crx node

nodename(=anystring)
Name of the node. This can accept wild card value like *.jar

orderby(=pathToNodeOrProperty)
This parameter can take node as well as propery to order the results. i.e.
orderby=@jcr:content/cq:lastModified

You can also provide the sorting order like
orderby.sort=desc/asc 

By default it is ascending order

fulltext(=anystring)
To perform a full text search in name, title and path

tagid=(IdOfTheTag)
To search for the pages with specific tag. Also, this can have filter on property as follows.
tagid.property=jcr:content/cq:tags
By default tagid.property will be cq:tags

tag=(titleOfTag)
To search on the basis of tag name

Searching at Multiple Paths
You can add multiple paths as follows
group.1_path=/content/abc
group.a_path=/content/xyz

By default the value of operator here will be add. This can be changed by setting the value of p.or=true which will make sure the search result is present in 1_path or 2_path

property(=nameOfProperty)
Search is performed on the basis of give property. If the property is existing the page, it will be added in the search results.
Additionally you can also provide the value of property as filter i.e.
property.value(=valueOfProperty)


Searching on Multiple Properties
You can search on multiple properties and values as follows. This will have and operation applied.
1_property=nameOfProperty1
1_property.value=valueOfProperty1
2_property=nameOfProperty2
2_property.value=valueOfProperty2


Also you can have multiple values to the property. Which will have or operation applied.
property=nameOfProperty
property.1_value=value1OfProperty
property.2_value=value2OfProperty

p.hits(=full/selective) 
The value full will mean all the properties of the searched pages will be returned and the value selective mean only the selected properties will be shown. i.e.
p.hits=selective
p.properties=jcr:path , jcr:title (Note the speace before and after comma )

p.nodepath(=number)
The number of level upto which the search should be performed. Considering path as the 0 level.

Debugging the query
For query debugging following link can be accessed from your instance of AEM

http://<host>:<port>/libs/cq/search/content/querydebug.html







Monday, April 17, 2017

AEM 6 Sightly

AEM 6 Sightly



Notes :
  • Sightly pages are written in HTL which is HTML template language. 
  • HTL is made simple so that it is easy to use by web developers as well as backend developers.
  • HTL makes use of HTML5
  • HTL pages are compiled as java serlvets and it is evaluated at server side. 
  • HTL is capable of applying proper context to the data which means it is more secure than JSP.
  • HTL can include a jsp file 
  • HTL block statements can not be defined inside script, style or html comments.
  • Context aware escaping that saves from cross site scripting attacks.
  • Javascript USE api is evaluated by serverside javascript engine.
  • HTL removes empty elements automatically
Block Statements :
  • data-sly-use
  • data-sly-unwrap
  • data-sly-call
  • data-sly-template
  • data-sly-text
  • data-slty-attribute
  • data-sly-test
  • data-sly-list
  • data-sly-resource
  • data-sly-include
Expressions :
  • ${name}
  • ${currentPage.title} or ${currentPage["title"]} or ${currentPage['title']}
  • ${true} or {false}
  • ${45}
  • ${"test"}
  • ${[1,2,3,4]}
  • ${array[1]}
  • ${!true}
  • ${ a > b}
  • ${a && b}
  • ${a || b }
  • ${ a < b ? a : b }
  • ${a == b}
  • ${a != b}
  • ${a @ test='test'}
  • $ {['a','b'] @ join=", "}





Sunday, April 16, 2017

All about cq:editConfig

All about cq:editConfig


cq:editConfig is the node with the type cq:editConfig and name cq:editConfig that is defined under the component node. There are different configuration/properties those can be configured with cq:editConfig in order to render the dialog in required way. 

  • cq:layout specifies how the component is edited in classic UI. The possible values are rollover, editbar, auto.
  • cq:dialogMode specifies how the dialog is opened in classic UI. The possible values are floating, rollover and auto.
  • cq:emptyText specifies the text to be displayed when the component is empty.
  • cq:inherit specifies if the values should be inherited from the parent in case they are missing. This can be true or false. 
  • cq:actions specifies the comma separated list of actions those can be performed on the component. This also allow a user to set the label of dialog. These actions are - insert, edit, delete, - , text:value, copymove. All of these should be configued as string array.
cq:editConfig has following child nodes those define the extra behavior configuration for the component. All of these are of the type nt:unstructured except cq:inplaceEditing and cq:listeners which has the type cq:inplaceEditingConfig and cq:editListnersConfig respectively.
  • cq:dropTargets specifies the list of drop targets from the asset finder that can be draged. It should have the child node of cq:dropTargetConfig which has properties - accept, groups and propertyName defined. 
  • cq:actionsConfigs specifies the custom actions that can be defined and listed in cq:actions property of cq:editConfig. For each custom action there should be a new node created under this of type nt:unstructured. This node should have properties like handler and text that defines the action to be performed. handler property can have the ExtJs function.
  • cq:formParameters defines the addtional parameters those are added to the dialog.
  • cq:inplaceEditing defines the inplace editing for the component. The properties those can be configured for this are - active, configPath and editorType. Where in editorType can be text, plaintext, title, begins.
  • cq:listeners specifies the actions those should be taken when the component is changed. The events those are captured by listeners are - beforedelete, beforeedit, beforecopy, beforemove, beforeinsert, beforechildinsert, afterdelete, afteredit, aftercopy, aftermove, afterinsert, afterchildinsert.

Some more AEM 6 Interview Questions for Architects

 Some more AEM 6 Interview Questions for Architects 1. Consider you have a workflow with two steps. One step is to transfer the asset from s...