Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Custom CORE SPA Page HierarchyUtils import causing Bundle issue

Avatar

Level 2

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

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

return descendedPageModels;
}


 

Venkatesha_BG_0-1680198828793.png


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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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.

Avatar

Level 2

Thanks for the response. Yes We should use delegate pattern