Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicList returns list of entities with null values #91

Open
sudhakhayal opened this issue Apr 5, 2018 · 4 comments
Open

DynamicList returns list of entities with null values #91

sudhakhayal opened this issue Apr 5, 2018 · 4 comments

Comments

@sudhakhayal
Copy link

sudhakhayal commented Apr 5, 2018

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
@majiccode
Copy link
Contributor

Hi,
I'm looking into this issue and was wondering if you could give me a few more details regarding your actual code, schema & models. If possible could you supply the schemas/models you are using and the code you are using. Such as your DynamicList<,> implementation, browser query and usage of these. I'm trying to set up an environment to reproduce these issues so this would save a lot of time if you could supply this.

Many thanks
Paul.

@sudhakhayal
Copy link
Author

sudhakhayal commented Apr 10, 2018 via email

@majiccode
Copy link
Contributor

Hi Sudha,
Maybe you forgot to attach them ? :)
Paul.

willprice76 pushed a commit to willprice76/dxa-web-application-java that referenced this issue Apr 10, 2018
HTML page source contains both a blank href and a href with the publi…
willprice76 pushed a commit to willprice76/dxa-web-application-java that referenced this issue Apr 10, 2018
…I-3061 to develop

* commit '6bf0ece6e3167ab1e97f3d1343a4ff54861ad678':
  Revert "TSI-3966 replace & when encoding (TSI-3061, CRQ-8774)"
@sudhakhayal
Copy link
Author

sudhakhayal commented Apr 19, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants