HI All,
I want to create page and drop components along with its dialog values using java code. Is there any way to invoke any API with component field values to drop component in page ?
Currently I am creating jcr node using sling api but the disadvantage I see in that approach is , when we have many components and each component design is different, then I need to change the node creation logic. So is there any API to directly save component to page?
Thanks,
Vidhu
Why don't you add the components to the template?
Example:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:description="Template with focus on content."
jcr:primaryType="cq:Template"
jcr:title="Custom Page"
ranking="{Long}200">
<jcr:content
jcr:primaryType="cq:PageContent"
sling:resourceType="<YOUR_SITE>/components/structure/page">
<par
jcr:primaryType="nt:unstructured"
sling:resourceType="wcm/foundation/components/parsys">
<custom-component
jcr:primaryType="nt:unstructured"
sling:resourceType="<YOUR_SITE>/components/content/custom-component"
property="value"/>
</par>
</jcr:content>
</jcr:root>
Thanks,
It is not possible as per our architecture. I am just trying to automate content author functionality to create pages using java. Components and templates are already developed and cant be redesigned.
Views
Replies
Total Likes
Could you elaborate why it is not possible?
Views
Replies
Total Likes
We are doing content migration from our legacy site to our new aem site. So we are taking content from inventory and are dynamically mapping content to AEM components using java code. We have our components development completed and now we need to automate the creation of pages. So we analyse components required for a particular page and then create page using java code with all the components.
I hope you understood our context.
Views
Replies
Total Likes
We are doing content migration from our legacy site to our new aem site. So we are taking content from inventory and are dynamically mapping content to AEM components using java code. We have our components development completed and now we need to automate the creation of pages. So we analyse components required for a particular page and then create page using java code with all the components.
I hope you understood our context.
Views
Replies
Total Likes
Views
Replies
Total Likes
Yes, I understand what the case is here. Still, I would recommend to add the components to the template. If you do this, you can call the PageManager to create a page with your specific template for all of the pages on your legacy system. This way, the new created page will have the components available to which you mapped your content on the legacy system.
For more info on the PageManager, please look at
PageManager ("The Adobe AEM Quickstart and Web Application.")
vidhumitram53839032 , let me see if I fully understand your requirement:
Legacy System
New System
Requirement
If that's the case, then you're on the right path, continue to use Sling APIs for creating the JCR nodes in the new system (don't forget to add sling:resourcePath to map to the Component) and in case of node's properties maybe Create a generic Method to read a ValueMap<String, Object> from legacy Node, traverse it and create the properties in new system.
Views
Likes
Replies