Custom CORE SPA Page HierarchyUtils import causing Bundle issue | Community
Skip to main content
March 30, 2023
Solved

Custom CORE SPA Page HierarchyUtils import causing Bundle issue

  • March 30, 2023
  • 1 reply
  • 879 views

I am trying to create custom SPA core page model json which implements Page. In that model class, ":children" creation code causing bundle issue.

without this function, page.model.json works fine

@126844
@9944223
public Map<String, ? extends Page> getExportedChildren() {
if (descendedPageModels == null) {
setDescendedPageModels(HierarchyUtils.getDescendantsModels(request, currentPage, currentStyle, modelFactory));
}

return descendedPageModels;
}


 


SPA core version: 1.3.16(latest)
Uber jar: 6.5.13
AEM instance: 6.5.13

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 lukasz-m

Hi @venkatesha_bg,

You can't use HierarchyUtils class in your implementation. This is an internal class, which means it is not exported by spa.project.core.core bundle. It can be easily recognized by package structure, which is like: com.adobe.aem.spa.project.core.internal.impl.utils.HierarchyUtils.

In OSGi you can check that only com.adobe.aem.spa.project.core.models package is exported, so only classes/interfaces from this package can be used in custom implementation.

To solve the issue you have to remove com.adobe.aem.spa.project.core.internal.impl.utils.HierarchyUtils and any other internal class usage from your code.

You should use delegation pattern, in order to create your own Page model class.

1 reply

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
March 31, 2023

Hi @venkatesha_bg,

You can't use HierarchyUtils class in your implementation. This is an internal class, which means it is not exported by spa.project.core.core bundle. It can be easily recognized by package structure, which is like: com.adobe.aem.spa.project.core.internal.impl.utils.HierarchyUtils.

In OSGi you can check that only com.adobe.aem.spa.project.core.models package is exported, so only classes/interfaces from this package can be used in custom implementation.

To solve the issue you have to remove com.adobe.aem.spa.project.core.internal.impl.utils.HierarchyUtils and any other internal class usage from your code.

You should use delegation pattern, in order to create your own Page model class.

September 20, 2023

Thanks for the response. Yes We should use delegate pattern