need to call the expense fragment data in service call. | Community
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
  • 1267 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
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
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
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
February 22, 2021

DELETED