need to call the expense fragment data in service call. | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
BrianKasingli
BrianKasingliAccepted solution
New Participant
Feb 22, 2021 1:51 PM UTC

Reading an experience fragment from a OSGI service will be the same way as accessing a resource and valueMap from the CRXDE.

 

Optional<Resource> contentFragmentCarousel = Optional.ofNullable(resolver.getResource("/content/experience-fragments/my-site/offers/latest-offers/master/jcr:content/root/carousel")); String myCustomPropValue = contentFragmentCarousel .map(Resource::getValueMap) .map(e -> e.get("myCustomProp", String.class)) .orElse("defaultText");

 

 

 

 

3 replies

BrianKasingli
New Participant
Feb 22, 2021 2:24 PM UTC

DELETED

Translate
BrianKasingli
BrianKasingliAccepted solution
New Participant
Feb 22, 2021 1:51 PM UTC

Reading an experience fragment from a OSGI service will be the same way as accessing a resource and valueMap from the CRXDE.

 

Optional<Resource> contentFragmentCarousel = Optional.ofNullable(resolver.getResource("/content/experience-fragments/my-site/offers/latest-offers/master/jcr:content/root/carousel")); String myCustomPropValue = contentFragmentCarousel .map(Resource::getValueMap) .map(e -> e.get("myCustomProp", String.class)) .orElse("defaultText");

 

 

 

 

Translate
Kiran_Vedantam
New Participant
Feb 22, 2021 10:31 AM UTC

Hi @mohanasundaramp,

 

Please find a similar post here

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

Translate