private String expandTemplates ( String message , JsonNode entityJson ) throws IOException , TemplateException { // Read entityJSON data Map < String , Object > data = new HashMap <> ( ) ; data . put ( "data" , MAPPER . convertValue ( entityJson , Map . class ) ) ; data . put ( "entity" , MAPPER . convertValue ( entityJson , Map . class ) ) ; // Read MessageMLV2 template StringWriter sw = new StringWriter ( ) ; Template template = new Template ( "messageML" , message , FREEMARKER ) ; // Expand the template template . process ( data , sw ) ; return sw . toString ( ) ; }
Expand Freemarker templates .