Thursday 12 February 2015

Override default String Type Value in Dialog : TypeHint CQ5

Hi Guys, 

Today i got to know how to override the default data type that is String when values are going to be store in JCR. As I found some related stuff in very old forum of CQ5 but it seems away from the search.

Use-Case : I am using my dialog with number of widgets which has xtype numberfield. So i suppose to store these in JCR as Long Type, but it take String as default type so my numbers are getting store in String type rather than Long type.

Solution is via using TypeHint. TypeHint  is one of the concept inside SlingPostServlet where it force the property to store its value with given Type. Below example demonstrate it :

1) Create a widget say num1 inside you dialog with xtype numberfield.  Same like below image :



2) Create a typehint node same as like the below image. Here the name property will be /nameofActualProp@TypeHint. 


3) Enter the values in dialog and submit it, you can view your property value as Long type in JCR rather than String.



Hope this will help

Thanks


Tuesday 3 February 2015

Render a component at multiple sections in same page or within different page.

Hi Guys,

I will try to explain how to replicate the component's content on the different parts on page, even you can render the component's content on some other pages as well. Though it is simple if someone aware about the functionality of <cq:include /> or <sling include/>. But for those who are new and has some usecase like to render the same component in multiple parts of page, and on change of value of primary component all the dependent component replicate its value on the different sections of page.

So Lets look at <cq:include path="" resourceType=""/> . When i started work on CQ i was aware only about 

 <cq:include path="mycomponent" resourceType = "myproject/components/mycomponent"/>

To include mycomponent here my node will get create with name of mycomponent and the corresponding script will render at this time will be of myproject/components/mycomponent

So Let's you have pageA and which contains the parsys only, & you want, if you drop component in parsys it should replicate at the various sections of of pageA. So this can achieve by :

1) You dropped the component in parsys of pageA then the JCR structure will be like : 

pageA
   |---jcr:content
            |----parsys
                   |-----mycomponent

2) When you drop the component script will get execute for the resourceType mycomponent & it renders the content over page.

3) Now in the script of pageA say resourceType i.e. basepage.jsp . I included the below line.

 <cq:include path="/content/myproject/en/pageA/jcr:content/parsys/mycomponent" resourceType="myproject/components/mycomponent" />

This line say include the /content/myproject/en/pageA/jcr:content/parsys/mycomponent resource which obviously will have content stored as we have dropped it previously inside parsys and entered the content it that. & To render its content we will use the script of myproject/components/mycomponent component.




The one thing that was new for me was the explanation of path.

Hope this will help.
Thanks

Monday 2 February 2015

Themes in clientlibs to include specific resources AEM6/CQ5

Hi Guys,

As we know, clientlibs in CQ5 use to include our js/css files via one line of code in our script file apart from other benefits. One thing that i had in my mind is what would be the case, If I want to add only few JS files via my <cq:includeClientLib />. Now got the answer which is might not be the full proof but yes, fulfill the aim of a developer. Answer is via Themes.

Use-Case : Have 3 JS files alpha.js,beta.js,gamma.js. I have Clientlib with category themetest. So with <cq:includeClientLibs /> how can i selectively inject the js files inside my script file.

Below demonstration will exaplin you how :

1) Create a clientlibrary folder with name say clientlibtest with categories themetest.
2) Create js folder and add two file say alpha.js & beta.js inside it.
3) Register their entries in js.txt file.
4) create a folder named themes under your clientlibtest folder.
5) Create a clientlib folder with any name say themegamma, keep the categories of themegamma should be same as clientlibtest i.e themetest
6) Create js folder under themegamma and add file say gamma.js inside it.
7) Register its entry in js.txt file which you created inside themegamma.

Below is the snapshot :




Now if you write the statement:

<cq:includeClientLib js="themetest" themed="true"/>
In that case only gamma.js will gets load.

<cq:includeClientLib js="themetest" themed="false"/>
In that case alpha.js & beta.js files will gets load.

<cq:includeClientLib js="themetest"/>
In that case all of js files will gets load.


Hope this will help.

Thanks

Sunday 1 February 2015

Enable SSL in AEM6

Hi Guys,

In this blog, I'll provide the demonstration of how you can enable SSL on the AEM6 on Author Instance. I have done it earlier in CQ5 via felix console, but in AEM6 I think some fields are added & some are missed as in below image :


Here some fields are new like truststore etc. AFAIK, Also keystore alias is also not available in this configuration, so I faced some issues to configure this. But some help from Adobe Docs worked.

Below are the steps to follow :

1) Navigate to the directory in your local AEM instance & generate the keystore via below command:

user@user-Aspire:/media/user/Misc/SelfWork/Author/crx-quickstart/conf$ keytool -genkeypair -keyalg RSA -validity 3650 -alias cqse -keystore cqkeystore.keystore -keypass password -storepass password -dname "CN=sbroders-w7, OU=CQ, O=Adobe, L=Ottawa, S=Ontario, C=CA"

This will generate the keystore cqkeystore.keystore under /crx-quickstart/conf directory.

2) Navigate to the /apps and create the folder system, and apply the configurations as per the adobe docs. Finally your configuration in crxde will look like :


Restart you AEM Instance. 

3) Hit https://localhost:5433/ and proceed.

Hope this will help.
Thanks