use of org.alfresco.service.cmr.repository.TemplateProcessor in project alfresco-repository by Alfresco.
the class TemplateServiceImpl method processTemplate.
/**
* @see org.alfresco.service.cmr.repository.TemplateService#processTemplate(java.lang.String, java.lang.String, java.lang.Object, java.util.Locale)
*/
private void processTemplate(String engine, String template, Object model, Writer out, Locale locale) throws TemplateException {
Locale currentLocale = I18NUtil.getLocaleOrNull();
Locale currentContentLocale = I18NUtil.getContentLocaleOrNull();
try {
// set locale for cases where message method is used inside of template
I18NUtil.setLocale(locale);
// execute template processor
TemplateProcessor processor = getTemplateProcessor(engine);
processor.process(template, model, out, locale);
} catch (TemplateException terr) {
throw terr;
} catch (Throwable err) {
throw new TemplateException(err.getMessage(), err);
} finally {
I18NUtil.setLocale(currentLocale);
I18NUtil.setContentLocale(currentContentLocale);
}
}
use of org.alfresco.service.cmr.repository.TemplateProcessor in project alfresco-repository by Alfresco.
the class TemplateServiceImpl method processTemplate.
/**
* @see org.alfresco.service.cmr.repository.TemplateService#processTemplate(java.lang.String, java.lang.String, java.lang.Object, java.io.Writer)
*/
public void processTemplate(String engine, String template, Object model, Writer out) throws TemplateException {
try {
// execute template processor
TemplateProcessor processor = getTemplateProcessor(engine);
processor.process(template, model, out);
} catch (TemplateException terr) {
throw terr;
} catch (Throwable err) {
throw new TemplateException(err.getMessage(), err);
}
}
use of org.alfresco.service.cmr.repository.TemplateProcessor in project alfresco-repository by Alfresco.
the class TemplateServiceImpl method processTemplateString.
/**
* @see org.alfresco.service.cmr.repository.TemplateService#processTemplateString(java.lang.String, java.lang.String, java.lang.Object, java.io.Writer)
*/
public void processTemplateString(String engine, String template, Object model, Writer out) throws TemplateException {
try {
// execute template processor
TemplateProcessor processor = getTemplateProcessor(engine);
processor.processString(template, model, out);
} catch (TemplateException terr) {
throw terr;
} catch (Throwable err) {
throw new TemplateException(err.getMessage(), err);
}
}
Aggregations