Skip to main content
Level 2
February 22, 2021
Solved

need to call the expense fragment data in service call.

  • February 22, 2021
  • 3 replies
  • 1278 views

Hi,

 

Any one help how to read in experience fragment data into service level.

 

Thanks,

Mohan 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

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

Kiran_Vedantam
Community Advisor
Community Advisor
February 22, 2021

Hi @mohanasundaramp,

 

Please find a similar post here

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

BrianKasingli
Adobe Champion and Community Advisor
BrianKasingliAdobe Champion and Community AdvisorAccepted solution
Adobe Champion and Community Advisor
February 22, 2021

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");

 

 

 

 

BrianKasingli
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
February 22, 2021

DELETED