TemplateHashModel staticModels = wrapper.getStaticModels();
Object servicesStatic = null;
try {
servicesStatic = staticModels.get(CoreServices.class.getName());
} catch (TemplateModelException e) {
throw new JibeRuntimeException("Services class can not be inserted into template model", e);
}
model.put("CoreServices", servicesStatic);
Context currentContext = Context.getCurrentContext();
if (currentContext != null) {
model.put("CurrentContext", currentContext);
}
Template t = null;
try {
t = getConfig().getTemplate(
new StringBuilder("/").append(templateId.replace('.', '/')).append(".ftl").toString());
} catch (IOException e) {
throw new TemplateNotFoundException();
}
Writer out = new StringWriter(1024);
try {
t.process(model, out);
} catch (Exception e) {
throw new JibeRuntimeException("There was an error processing template:" + templateId, e);
}
return out.toString();
}