Tuesday 10 June 2014

Search, Persistance Manager in AEM/CQ


Search:
There are two supported query languages in AEM
  • SQL2
  • XPATH
Accessing query browser
Tools>Query open query browser



Readable: http://helpx.adobe.com/experience-manager/using/querying-experience-manager-data-using1.html

To read on integrating CQ with Solr search, visit blog: Integrating AEM/ CQ with Solr search

Persistence manager:
Persistence manager helps to save the repository content to a permanent storage solution, such as the file system or a database.
All content is stored in file system in form of tar file at below location.
Location of persistence manager
AEM/CQ install directory-> Author->crx-quickstart->repository->workspaces->crx.default->data_00000.tar
Configuring/modifying the persistence manager location/type
Default tar is <PersistenceManager class="com.day.crx.persistence.tar.TarPersistenceManager"/>
AEM/CQ install directory-> Author->crx-quickstart->repository->repository.xml
MySQL Persistence Manager: Stores the workspace content in a MySQL database.       
Configuration:

<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://localhost:3306/crx"/>
<param name="user" value="userid"/>
<param name="password" value="password"/>
</PersistenceManager>

Backups & restore CQ files

-------------------------------------
AEM provide online & offline backups.
Online:Online method creates a backup of the entire repository, including CQ5. We can perform this method while the repository is in use.
Offline:Creates a backup of the CRX repository files including all of the information stored in CRX, so you can restore the exact state of the repository during backup.
Also incremental so it updates only next day components to backup.

Read More: 
Solr and AEM
JSON for Solr
AEM INTERNALIZATION
Search Persistance
Navigation in AEM
Website design steps in AEM

Navigation API's, Client Library: in AEM CQ


Navigation:Creates a new navigation object.
Navigation API's:
getAbsoluteParent(2)- to get parent page
listChildren- list all children
Pagefilter- to exclude all invalid pages (pages hidden from navigation)

Below given sample code shows how a navigation element can be created.
<%--

navigation component.

navigation component

--%><%
%><%@include file="/libs/foundation/global.jsp"%><%
%>
<%@ page import="java.util.Iterator,
com.day.text.Text,
com.day.cq.wcm.api.PageFilter,
com.day.cq.wcm.api.Page,
com.day.cq.commons.Doctype,
org.apache.commons.lang.StringEscapeUtils" %>
<%@page session="false" %><%
%><%
            // TODO add you code here
%>

<%

    Page navRootPage = currentPage.getAbsoluteParent(2);

if(navRootPage != null){
Iterator<Page> children = navRootPage.listChildren(new PageFilter(request));
    %><ul><%
while(children.hasNext()){
    Page child = children.next();
    %>
<li>
<a href="<%=child.getPath()%>.html">
<%= StringEscapeUtils.escapeXML(child.getTitle())%>
</a>

</li>
<%
}
    %></ul><%

}
%>



Client Library:cq:ClientLibraryFolder
The Client Library (ClientLib) in Adobe AEM makes it easy to include client libraries(files like js or css) by category and each can be accessed through dependencies.
It can be created under etc>clientlibs or design/project folder.

Read More: 
Solr and AEM
JSON for Solr
AEM INTERNALIZATION
Search Persistance
Navigation in AEM

Website design steps in AEM

Dialog , Design Dialog in AEM/CQ


Dialog:

Dialogues will have
1) Field label: messaging information about input.
2) xtype:  type of the user interface
3) Name: is responsible for storage mechanism(it will always start with./ if it is used as storage mechanism)

While creating multiple fields under dialog, new nodes should be named as items.
xtype property is the user name field in dialogs.
items node, image path field -> add xtypepathfield; fieldLabel: Please select an image;name
Widgets located at:
http://localhost:4505/crx/de/index.jsp#/apps/training/components/content/complexcomp/dialog/items/items/tab1/items/tableField
Readable, CQ API : http://dev.day.com/docs/en/cq/5-5/widgets-api/index.html -

Design dialog:[design dialogname/labelshould be always ‘design_dialog’]
Take data input and config info as dialog. But data entered will always remain throughout all pages once we define a data
Note:Widget collection holds widgets
·         In edit mode, dialog always opens on double click.
·         Design dialog can be opened by going to design.

design_dialog’s properties are saved in website design level. So we need to use corresponding API to get the values stored indesign_dialog
Edit config:cq:editConfig - node used to keep edit options for a component/dialog

CQ Samples in github : https://github.com/davidjgonzalez/com.activecq.samples/tree/master/core/src/main/java/com/activecq/samples