Q11. )You have a site structure as — /content/yourproject/en_us/global/contactus.html . Now a property named cloudConfig may be present at any of the hierarchy . Your task is to fetch that property value and use it in contactus.html. What will you use for the best possible solution?
The property could be present at any of the pages in the hierarchy, so the first solution you may think of is getting a property on that page, if it’s not present iterate to its parent page, check the property on that page, if it’s not present iterate parent page and so on. But this is a Brute-force method. Not at all appreciated.
Alternatively, you may use InheritanceValueMap to achieve this task. This interface is meant to make it much easier for developers to access properties inherited from parent pages. To do this, the interface provides two methods, getInherited(String, Class) and getInherited(String, Object), each of these methods will check for a value on the current resource and then check up the page hierarchy for another page with a value on the same content attribute. It will only attempt to retrieve values at the same page content path.
InheritanceValueMap iProperties = new HierarchyNodeInheritanceValueMap(resource); String value = iProperties.getInherited("myProp",String.class);
Q12. ) In reference to the above question, you have a component at the page contactus.html . Now that component should pick different configurations for publish and author modes. How will you handle this in your servlet?
The easiest way to do so is that in your @Component find the runMode and then based on that choose the values. But this is strongly NOT advisable.
The approach to this question would be to make the component/servlet require a configuration (policy=ConfigurationPolicy.REQUIRE) and Then create a run mode dependent configuration for that component.
Read More for what happens in OSGi felix
Q13. ) Imagine you have a component A with a dialog A , and another component B with dialog B . You want to use that other dialogA’s tab into dialogB ? Now you want to use a user input from dialog A into dialog B, how will you proceed with that?
- For this use-case, a specific widget with the label
cqinclude
exists which allows for the inclusion of dialogA elements in other dialogB definitions. The generic JSON format is used on the client side to construct the actual dialog. example :
{ "jcr:primaryType": "cq:Widget", "xtype": "cqinclude", "path": "/libs/replication/components/agent/tab_extended.infinity.json" }
The path
property needs to point to a dialog-resource that is to be included in JSON format.
- To use User Input from dialog A to dialog B is somewhat tricky. Depending on the use-case/ requirement you can store the user input variable on the page property– jcr:content from Dialog A. And while opening the dialogB , write a listener function on load content event and pick that stored value from the location of dialog A. The approach can be changed ample of ways depending on a particular Use case.
Q14. ) Consider there are 3 components:
1. Component A ———A.jsp ————-output T1
2. Component B ———B.jsp ————-output T2 ; sling:resourceSuperType is A
You want to create another component C (sling:resourceType is B ) and component D (sling:resourceSuperType is B ) wherein, you need an output of T3 only. Which jsps you may override in both the cases individually?
If you understand inheritance in components this question would be a cakewalk. Note that the question seeks as ONLY one single output (only T3, not T1 /T2) Please check the solution I am suggesting:
- Component C: As sling:resourceType is Component B. First of all B.jsp is called and then from its sling:resourceSuperType A.jsp. Thereby both the jsps are called. Hence to override the output you would have to override A.jsp and B.jsp both, and in one of them give output T3.
- Component D: As sling:resourceSuperType is Component B. you may need to override only B.jsp and change it to display output T3.
Q15. ) Let’s say there are Article pages and NEWS Pages in your project. Every article page can be linked to NEWS pages using Related NEWS component. And every NEWS page should have RELATED Articles component with list a of Articles where it is present. How will design the solution for this, keeping in mind Caching Strategies and Authoring Convenience ?
Pingback: How to Prepare ? – CQ5 AEM Tricks of Trade
I have one question for the migration of the Page content versions to new instances/upgrade to higher version of AEM.
As per the documentation from the Adobe are we going to lose the versions. ?
https://docs.adobe.com/docs/en/cq/5-6-1/core/administering/backup_and_restore.html#Package%20Backup
I am trying to retain my page content versions authored data when migrating to another instance. Tried via the package manager but getting error like below
” /jcr:system/jcr:versionStorage/b7/c0/80 (javax.jcr.PathNotFoundException: 80)
saving approx 3 nodes…
Package imported (with errors, check logs!) ”
Is there any chance for retaining page versions via the API.
Note :- I cannot go for an in-place upgrade, as i have AEM Instance A with some set of applications and another AEM instance B with different set of applications and planning a migration to AEM instance C
LikeLiked by 1 person
Hi Vardhan,
If you want to transfer content along with the Versions you may try to package out the version Nodes using the Filter option of Package Manager. If the number of versions are huge and the packages doesnt work due to that, try to version purge some older versions and then try to package out.
Even after that if the package fails, please post the error logs here .
Regards
Hashim
LikeLike
Thank you Hashim,
when i tried taking a package and install in another instance able to see the following error.
” Importing content…
– /
– /content
– /content/geometrixx
– /content/geometrixx/en
– /content/geometrixx/en/products
– /content/geometrixx/en/products/triangle
– /content/geometrixx/en/products/triangle/features
U /content/geometrixx/en/products/triangle/features/jcr:content
– /content/geometrixx/en/products/triangle/features/jcr:content/par
– /content/geometrixx/en/products/triangle/features/jcr:content/rightpar
A /content/geometrixx/en/products/triangle/features/jcr:content/title
– /content/geometrixx/en/products/triangle/features/jcr:content/par/image
– /content/geometrixx/en/products/triangle/features/jcr:content/par/table_0
– /content/geometrixx/en/products/triangle/features/jcr:content/rightpar/iparsys_fake_par
– /jcr:system
– /jcr:system/jcr:versionStorage/b7/c0
E /jcr:system/jcr:versionStorage/b7/c0/80 (javax.jcr.PathNotFoundException: 80)
saving approx 3 nodes…
Package imported (with errors, check logs!)
Package installed in 662ms. “
LikeLike
Hi ,
I believe some of the version nodes are corrupted in your existing environment. Try two things:
1. Are you able to install the package in another environment of same configuration and version
2. Try to exploit VLT tool and checkout the versions using that. Then use vlt to checkin the nodes in your new instance.
3. If all this fails, then try to run a consistency check on the version nodes.
Do let me know what are your findings. Hopefully it should work.
Regards
Hashim
LikeLike
Pingback: AEM Useful Links – enlightenmyknowledge
How to Access versioning in publish instance
LikeLike
Hi , I didnt get the question. Why do you want to Access a version of a page in Publish instance. Versions are stored in Author and the final verified version is Pushed to Publish.
LikeLike
thanks for replay Hashim Khan
when publish page, we are able to generate versions in jcr:system level in author instance but i need to generate versions data in publish instance..
i am able to create versions digital assets in publish instance for this i change workflow launcher (dam metadata writeback) runmodes publish to author,publish.
how can we do versioning for pages in publish instance ?
LikeLike
I would say it doesn’t seem to be a good idea to create Versions on Publish instance due to the reason as Author has all the versions and its not good to clutter the Publish instance with versions. But still if you must need it, you can probably use Page Manager API.
https://docs.adobe.com/docs/en/aem/6-1/ref/javadoc/com/day/cq/wcm/api/PageManager.html
LikeLike
thanks, i able to create versions in publish instance
LikeLiked by 1 person
Hi HashimKhan
How to activate Page with out create versionHistory data Jcr:system Level
/jcr:system/jcr:versionStorage/b6/7f/7c/b67f7c22-678f-4696-9022-80a21665aed5/1.0
i don’t want create versions like 1.0, 1.1,1.2….. when i am activate page
Because I am already using create Version workflow by using this i am generating version data 1.0,1.1…..
LikeLike
You can try to disable the versioning https://helpx.adobe.com/experience-manager/kb/DisableVersioning.html
LikeLike
thanks for reply
in My workflow i have two models 1)create version model 2) activate page workflow
by create version workflow i am creating versions like 1,0,1,,1,1,2 this one is fine.
again i m using activation page model to activate page author to publish instance.
in that it will creating versions 1,0,1,,1,1,2…….. i don’t need to create versions in this model.
in workflow only one time i need to create versions .
is it possible particular activate page model i need to disable versions.
LikeLike
com.day.cq.wcm.core.impl.VersionManagerImpl in this osgi configuration
versionmanager.createVersionOnActivation (Boolean, : false)
i am not able to create versions
how to do for specific project this configuration
i don’t want affect this configuration remaining projects
LikeLike
i approached another process, my problem is solved
Thank you
LikeLike
Do let us know how you approached the problem. Thanks
LikeLike
i am not using pageActivation Model in Workflow
i am create versions by using createVersion Model then Assign that version in to etc/test/node properties
As per coding just replicating etc/test/node to publish instance
replicator.replicate(session, ReplicationActionType.ACTIVATE, etc/test/node );
my project requirement we don’t need to activate pages.
LikeLike
com.day.cq.wcm.core.impl.VersionManagerImpl in this osgi configuration
versionmanager.createVersionOnActivation (Boolean, : true )
Is it Possible how to do for specific project this configuration
versionmanager.createVersionOnActivation (Boolean, : false )
i don’t want affect this configuration remaining projects
LikeLike
Pingback: Your Complete Guide for Passing Adobe Experience Manager (AEM) 6 Architect Certification (9A0-385) Exam
Hi Hashim,
I am new to the AEM. Just wandering usually we deploy the WAR files to the application server in J2EE projects. How we will create a PROD or other high level environment for AEM. Is there is any recommended practice from Adobe?
LikeLike
HI, Yes there are a lot of Best Practices https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/best-practices.html
LikeLike
Hi Hashim, Where can I check my dam is pointing to which environment? like DEV,STG and Prod ?
LikeLike