We need to access metadata fields in our keywords. We realised that in the master branch of the dxa-web-application-java project, there's already a KeywordModel that will solve this issue in previous dxa versions. So we added the needed classes into our project.
However, when debugging I realised that we are not mapping the keyword info in our model because the extensionData is null. Do we need to upload the TBBs?
private String getMetadataSchemaId(Keyword keyword) {
if (keyword.getExtensionData() == null ||
!keyword.getExtensionData().containsKey("DXA") ||
!keyword.getExtensionData().get("DXA").getContent().containsKey("MetadataSchemaId")) {
return null;
}
return (String) keyword.getExtensionData().get("DXA").getContent().get("MetadataSchemaId").getValues().get(0);
}