Description
Originally, I had extended DynamicList<FAQs, SimpleBrokerQuery>
from my custom model FAQsContentList where I want to execute a SimpleBrokerQuery on a few filterKeywords. In the logs I can see that I get query results but when it goes through the default Model Builder, the entity returns n results with null values. Originally I get a list of entity objects but with null values c.s.d.t.m.impl.DefaultModelBuilder - Expected class is pre-set to class com.sdl.dxa.modules.faqs.model.FAQs for model EntityModelData(id=4979, componentTemplate=null, linkUrl=null, content=null, binaryContent=null, externalContent=null)
Now, I get the another error (shown below) when I played around with the template, but the bottom issue is that I am not getting any field values. FAQs schema comes under module FAQs and my DynamicList is under another module ContentList.
The exception is .api.mapping.semantic.SemanticMappingException: Ambiguous semantic mapping for http://www.sdl.com/web/schemas/core:FAQs, found these mappings: [class com.sdl.dxa.modules.faqs.model.FAQs, class com.sdl.dxa.modules.faqs.model.FAQs]
but there are no core schemas called FAQs
Caused by: com.sdl.webapp.common.exceptions.DxaException: Exception happened while creating a entity model from: EntityModelData(id=4560, componentTemplate=null, linkUrl=null, content=null, binaryContent=null, externalContent=null) at com.sdl.dxa.tridion.mapping.impl.DefaultModelBuilder.buildEntityModel(DefaultModelBuilder.java:133) at com.sdl.dxa.tridion.mapping.impl.ModelBuilderPipelineImpl.createEntityModel(ModelBuilderPipelineImpl.java:86) at com.sdl.dxa.tridion.mapping.impl.DefaultContentProvider._convertEntities(DefaultContentProvider.java:120) at com.sdl.dxa.tridion.mapping.impl.DefaultContentProvider.populateDynamicList(DefaultContentProvider.java:213) ... 122 common frames omitted Caused by: com.sdl.webapp.common.exceptions.DxaException: Cannot get a view model tpe because of semantic mapping exception at
com.sdl.webapp.common.impl.model.ViewModelRegistryImpl.getMappedModelTypes(ViewModelRegistryImpl.java:109)
Caused by: com.sdl.webapp.common.api.mapping.semantic.SemanticMappingException: Ambiguous semantic mapping for http://www.sdl.com/web/schemas/core:FAQs, found these mappings: [class com.sdl.dxa.modules.faqs.model.FAQs, class com.sdl.dxa.modules.faqs.model.FAQs]
at com.sdl.webapp.common.impl.mapping.SemanticMappingRegistryImpl.getEntityClassByFullyQualifiedName(SemanticMappingRegistryImpl.java:334)
To resolve the SemanticMappingException caused by Ambiguous semantic mapping, I then created a customTeaser which is mapped to my schema FAQs @SemanticEntity(entityName = "FAQs", vocabulary = SDL_CORE, prefix = "f")
. In my custom ContentListController.enrichModel function, when it calls contentProvider.populateDynamicList(dynamicList, webRequestContext.getLocalization());
, I can see from the logs that it calls my custom DynamicList and the DefaultModelBuilder that is called after this prints the following logs.
c.s.d.t.m.impl.DefaultModelBuilder - Expected class is pre-set to class com.sdl.dxa.modules.contentlist.model.ContentTeaser for model EntityModelData(id=4560, componentTemplate=null, linkUrl=null, content=null, binaryContent=null, externalContent=null)
09:33:37.128 [ajp-nio-8214-exec-1] DEBUG o.s.c.a.AnnotationCacheOperationSource - Adding cacheable method 'getMappedModelTypes' with attribute: [Builder[public java.lang.Class com.sdl.webapp.common.impl.model.ViewModelRegistryImpl.getMappedModelTypes(java.util.Set,java.lang.Class) throws com.sdl.webapp.common.exceptions.DxaException] caches=[defaultCache] | key='' | keyGenerator='localizationAwareKeyGenerator' | cacheManager='' | cacheResolver='' | condition='' | unless='' | sync='false']
09:33:37.128 [ajp-nio-8214-exec-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'localizationAwareKeyGenerator'
09:33:37.128 [ajp-nio-8214-exec-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'cacheManager'
09:33:37.138 [ajp-nio-8214-exec-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'genericSemanticModelDataConverter'
09:33:37.138 [ajp-nio-8214-exec-1] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'r2modelBuilder'
09:33:37.139 [ajp-nio-8214-exec-1] DEBUG c.s.d.t.m.i.DefaultSemanticFieldDataProvider - No data is found for path FieldPath(head=question, tail=null) for semantic field
09:33:37.145 [ajp-nio-8214-exec-1] DEBUG c.s.d.t.m.i.DefaultSemanticFieldDataProvider - No data is found for path FieldPath(head=answer, tail=null) for semantic field
09:33:37.152 [ajp-nio-8214-exec-1] DEBUG c.s.d.t.m.i.DefaultSemanticFieldDataProvider - No data is found for path FieldPath(head=faqsByTopic, tail=null) for semantic field
09:33:37.155 [ajp-nio-8214-exec-1] DEBUG c.s.d.t.m.i.DefaultSemanticFieldDataProvider - No data is found for path FieldPath(head=active, tail=null) for semantic field