0

I have a Schema with a Component link. The linked Component is a content of RTF fields. I have a Schema typeOnlineForm (rootname: OnlineForm) and schema field webMessage is the Component link field type webMessage (xmlName: webMessage) is a Component link of multiple values of General Page Content (rootname: GeneralPageContent) Schema type General Page Content is a Schema containing a field fullPageContent (which is embedded Schema of Paragraph5Level (rootname:Paragraph5Level) and so on. It will be more clearer with the model.

  1. OnlineForm:

    @SemanticEntity(entityName = "OnlineForm", vocabulary = SDL_CORE, prefix = "of")
    public class OnlineForm extends AbstractEntityModel {
    
        @SemanticProperty("of:webMessage"),
        private GeneralPageContent webMessage;
    }
    
  2. GeneralPageContent

    @SemanticEntity(entityName = "GeneralPageContent", vocabulary = SDL_CORE, prefix = "gp")
    public class GeneralPageContent extends AbstractEntityModel {
    
        @SemanticProperty("gp:fullPageContent")
        @JsonProperty("FullPageContent")
        private List<Paragraph5Level> fullPageContent;
    }
    
  3. Paragraph5Level

    @SemanticEntity(entityName = "Paragraph5Level", vocabulary = SDL_CORE, prefix = "pl") 
    public class Paragraph5Level  extends AbstractEntityModel {
    
        @SemanticProperty("pl:heading")
        @JsonProperty("Heading")
        private String heading;
    
        @SemanticProperty("pl:paraContent")
        @JsonProperty("ParaContent")
        private List<RichText> paraContent;
    
        @SemanticProperty("pl:subParagraph")
        @JsonProperty("SubParagraph")
        private List<SubParagraphLevel2> subParagraph;
    }
    

When I preview the Component, I can see the Component link as seen below. (See webMessage and fullPageContent below.

"title": "Feedback",
"adminEmailAddress": "[email protected]",
"webMessage": {
    "$type": "EntityModelData",
    "Id": "9425",
    "ComponentTemplate": {
        "Id": "169",
        "RevisionDate": "0001-01-01T00:00:00"
     },
     "Folder": {
         "Id": "2163",
         "Title": "Web Messages"
     },
     "Content": {
         "fullPageContent": {
             "$type": "ContentModelData",
             "heading": "Your request has been received and a customer service representative will contact you shortly."
         }
     },
     "SchemaId": "416"
},
"formFields": { ...

But in the controller when I call model.getWebMessage, this returns nullPointerException.

5
  • 1
    Your question contains very little information to work with, I think you might get more answers if you edit your question and add some more details. Like what fields are used in the Schema and the source code of the Model. It would be beneficial if you can reduce this to only the relevant fields, so that others can create a similar setup and try to recreate the issue you are seeing. Apr 18, 2018 at 13:59
  • Thanks for responding Bart. I have modified my question. Hope it is more clear.
    – Rache
    Apr 19, 2018 at 6:46
  • 1
    What are the root element/type names of your CM Schemas? Apr 19, 2018 at 7:35
  • Updated the question with root element names
    – Rache
    Apr 22, 2018 at 6:04
  • I didn't see this error before. ERROR c.s.w.c.i.mapping.SemanticMapperImpl - Exception while getting field data for: private com.sdl.dxa.modules.generic.model.GeneralPageContent com.sdl.dxa.modules.onlineforms.model.OnlineForm.webMessage com.sdl.webapp.tridion.fields.exceptions.FieldConverterException: Cannot convert a entity model 9425 to class com.sdl.dxa.modules.generic.model.GeneralPageContent for semantic field webMessage at com.sdl.dxa.tridion.mapping.converter.EntityModelDataConverter.convert(EntityModelDataConverter.java:43)
    – Rache
    Apr 22, 2018 at 7:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.