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.
OnlineForm:
@SemanticEntity(entityName = "OnlineForm", vocabulary = SDL_CORE, prefix = "of") public class OnlineForm extends AbstractEntityModel { @SemanticProperty("of:webMessage"), private GeneralPageContent webMessage; }
GeneralPageContent
@SemanticEntity(entityName = "GeneralPageContent", vocabulary = SDL_CORE, prefix = "gp") public class GeneralPageContent extends AbstractEntityModel { @SemanticProperty("gp:fullPageContent") @JsonProperty("FullPageContent") private List<Paragraph5Level> fullPageContent; }
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": "test@gmail.com",
"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.