Previously, we used a Simple content fragment model(OOTB) to create CF and reading programmatically using the Original rendition created under each file. The 6.5.10 simple fragment model is deprecated, so we created a new Content fragment model that does not create renditions.
Is anyone know why it is not creating any renditions under file with the new Content fragment model?
With Simple fragment Model it is creating rendition -
With New custom content fragment model --
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @ramaem12 ,
I am not sure on the renditions difference between two but i guess if you use Content Fragment API you just need a CF path to get its "Original" data.
//Get the resource of content fragment as below. Resource fragmentResource = resourceResolver.getResource(“/content/dam/fragments/my-test-fragment”); //Adapt it to a fragment resource if (fragmentResource != null) { ContentFragment fragment = fragmentResource.adaptTo(ContentFragment.class); Iterator<ContentElement> elements = fragment.getElements();
while (elements.hasNext()){
ContentElement element = elements.next();
} }
https://aemdeveloper.wordpress.com/2017/08/22/create-access-the-content-fragment-programmatically/
Hi @ramaem12 ,
I am not sure on the renditions difference between two but i guess if you use Content Fragment API you just need a CF path to get its "Original" data.
//Get the resource of content fragment as below. Resource fragmentResource = resourceResolver.getResource(“/content/dam/fragments/my-test-fragment”); //Adapt it to a fragment resource if (fragmentResource != null) { ContentFragment fragment = fragmentResource.adaptTo(ContentFragment.class); Iterator<ContentElement> elements = fragment.getElements();
while (elements.hasNext()){
ContentElement element = elements.next();
} }
https://aemdeveloper.wordpress.com/2017/08/22/create-access-the-content-fragment-programmatically/
Hi,
When you are creating the content fragment could you please check the logs and let us know whats coming there.
The content is stored under data node in latest AEM versions(not sure from which version), refer to the below image. The rendition folder is empty but the variations and the content is stored under data node
I was using specific logic to handle this - https://github.com/adobe/aem-core-wcm-components/blob/master/bundles/core/src/main/java/com/adobe/cq... (Just for your info) but as @Kishore_Kumar_ mentioned use the Content Fragment API to fetch the content.
Regards
Albin I
As @Albin_Issac mentioned, Latest version of AEM ( Ex: 6.5.13/14) CF data will be stored under cf/jcr:content/data/master node and variations are under cf/jcr:content/data/cf1(variations)
To get CF propeties:
OOTB Content Fragment API will help to get all properties of CF which store under master node
//Get the resource of content fragment as below. Resource fragmentResource = resourceResolver.getResource(“/content/dam/fragments/my-test-fragment”); //Adapt it to a fragment resource if (fragmentResource != null) { ContentFragment fragment = fragmentResource.adaptTo(ContentFragment.class); Iterator<ContentElement> elements = fragment.getElements();
while (elements.hasNext()){
ContentElement element = elements.next();
} }
To get Image renditions:
- Observed that latest version of AEM CF renditions are not storing.
- For testing purpose, added some image renditions manually in CF reditions folder. if we want to get those renditions by using CF API. have to loop rever (need to read parent from the child then loop the condition to get renditions node).
Note : recursiveness and it will not be generic approach.
Views
Likes
Replies