We are facing issue with accessing custom Embedded fields in Java DXA 1.4 solution. Default DXA Linklist component is working fine, but when we create custom schema like "CeairLinkList" Then it is not rendering the fields and always throw Null for URL and text fields values. Same custom embedded field is working fine with DXA 1.4 .Net solution.
Code Block:
@SemanticEntity(entityName = "CeairLinkList", vocabulary = > "http://schema.org", prefix = "e", public_ = true)
public class CeairLinkList extends AbstractEntityModel
{
@JsonProperty("Headline")
private String headline;
@JsonProperty("Links")
private List<CeairLink> links;
/**
* <p>Getter for the field <code>headline</code>.</p>
*
* @return a {@link java.lang.String} object.
*/
public String getHeadline() {
return headline;
}
/**
* <p>Setter for the field <code>headline</code>.</p>
*
* @param headline a {@link java.lang.String} object.
*/
public void setHeadline(String headline) {
this.headline = headline;
}
/**
* <p>Getter for the field <code>links</code>.</p>
*
* @return a {@link java.util.List} object.
*/
public List<CeairLink> getLinks() {
return links;
}
/**
* <p>Setter for the field <code>links</code>.</p>
*
* @param links a {@link java.util.List} object.
*/
public void setLinks(List<CeairLink> links) {
this.links = links;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return "CeairLinkList{" +
"headline='" + headline + '\'' +
", links=" + links +
'}';
}
@ComponentScan(basePackages = {"com.ceair.dxa"})
public class CeairModuleInitializer {
@RegisteredViewModels({
//added Pages
@RegisteredViewModel(viewName = "TwoColumnLayoutWithLeftIndentation", modelClass = PageModelImpl.class),
@RegisteredViewModel(viewName = "OneColumnLayout", modelClass = PageModelImpl.class),
//added Regions
@RegisteredViewModel(viewName = "Main", modelClass = RegionModelImpl.class),
@RegisteredViewModel(viewName = "Top", modelClass = RegionModelImpl.class),
//added Models
@RegisteredViewModel(viewName = "HeroBanner", modelClass = CeairHeroBanner.class),
@RegisteredViewModel(viewName = "ExpandableBox", modelClass = CeairGenericContent.class),
@RegisteredViewModel(viewName = "ArticleDetail", modelClass = CeairGenericContent.class),
@RegisteredViewModel(viewName = "LeftNavigation", modelClass = NavigationLinks.class),
@RegisteredViewModel(viewName = "RelatedContent", modelClass = CeairLinkList.class),
@RegisteredViewModel(viewName = "HeroBannerHeadingLeft", modelClass = CeairHeroBanner.class),
@RegisteredViewModel(viewName = "NewsList", modelClass = CeairContentList.class),
@RegisteredViewModel(viewName = "NewsList2", modelClass = ContentList.class)
})
@Component
@ModuleInfo(name = "Ceair module", areaName = "Ceair", description = "Ceair DXA module which contains basic views")
public static class CeairViewInitializer extends AbstractInitializer {
@Override
protected String getAreaName() {
return "Ceair";
}
}
@SemanticEntity(entityName = "CeairLink", vocabulary = SDL_CORE, prefix = "e")
public class CeairLink extends AbstractEntityModel {
@SemanticProperties({
@SemanticProperty("internalLink"),
@SemanticProperty("externalLink"),
@SemanticProperty("e:internalLink"),
@SemanticProperty("e:externalLink")
})
@JsonProperty("Url")
private String url;
@JsonProperty("LinkText")
@SemanticProperty("e:linkText")
private String linkText;
@SemanticProperty("e:alternateText")
@JsonProperty("AlternateText")
private String alternateText;
/**
* <p>Getter for the field <code>url</code>.</p>
*
* @return a {@link java.lang.String} object.
*/
public String getUrl() {
return url;
}
/**
* <p>Setter for the field <code>url</code>.</p>
*
* @param url a {@link java.lang.String} object.
*/
public void setUrl(String url) {
this.url = url;
}
/**
* <p>Getter for the field <code>linkText</code>.</p>
*
* @return a {@link java.lang.String} object.
*/
public String getLinkText() {
return linkText;
}
/**
* <p>Setter for the field <code>linkText</code>.</p>
*
* @param linkText a {@link java.lang.String} object.
*/
public void setLinkText(String linkText) {
this.linkText = linkText;
}
/**
* <p>Getter for the field <code>alternateText</code>.</p>
*
* @return a {@link java.lang.String} object.
*/
public String getAlternateText() {
return alternateText;
}
/**
* <p>Setter for the field <code>alternateText</code>.</p>
*
* @param alternateText a {@link java.lang.String} object.
*/
public void setAlternateText(String alternateText) {
this.alternateText = alternateText;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return "CeairLink{" +
"url='" + url + '\'' +
", linkText='" + linkText + '\'' +
", alternateText='" + alternateText + '\'' +
'}';
}
}
CeairLinkList
Schema? I see you are trying to map it using schema.org (is it mapped on the CM side to this too), butCeairLinkList
is not a Schema on schema.org, so that public mapping does not make any sense.