public class TemplateServiceImpl extends Object implements TemplateService
KEY_COMPANY_HOME, KEY_DATE, KEY_IMAGE_RESOLVER, KEY_PERSON, KEY_PRODUCT_NAME, KEY_SHARE_URL, KEY_TEMPLATE, KEY_USER_HOME
Constructor and Description |
---|
TemplateServiceImpl() |
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
buildDefaultModel(org.alfresco.service.cmr.repository.NodeRef person,
org.alfresco.service.cmr.repository.NodeRef companyHome,
org.alfresco.service.cmr.repository.NodeRef userHome,
org.alfresco.service.cmr.repository.NodeRef template,
TemplateImageResolver imageResolver)
Helper method to build a default model
|
TemplateProcessor |
getTemplateProcessor(String engine)
Return a TemplateProcessor instance for the specified engine name.
|
String |
processTemplate(String template,
Object model)
Process a template against the upplied data model and return the result as
a string.
|
void |
processTemplate(String template,
Object model,
Writer out)
Process a template against the supplied data model and write to the out.
|
String |
processTemplate(String engine,
String template,
Object model)
Process a template against the supplied data model and write to the out.
|
String |
processTemplate(String engine,
String template,
Object model,
Locale locale)
Process a template using the supplied locale against the supplied data model and write to the out.
|
void |
processTemplate(String engine,
String template,
Object model,
Writer out)
Process a template against the supplied data model and write to the out.
|
String |
processTemplateString(String engine,
String template,
Object model)
Process a given template, provided as a string, against the supplied data model and return the result as a String
|
void |
processTemplateString(String engine,
String template,
Object model,
Writer out)
Process a given template, provided as a string, against the supplied data model and report the
result back in the provided writer.
|
void |
registerTemplateProcessor(TemplateProcessor templateProcessor)
Registers a new template processor with the template service
|
void |
setDefaultTemplateEngine(String defaultTemplateEngine) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Set the node service
|
public void setDefaultTemplateEngine(String defaultTemplateEngine)
defaultTemplateEngine
- The default Template Engine name to set.public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
nodeService
- the node servicepublic TemplateProcessor getTemplateProcessor(String engine)
TemplateService
getTemplateProcessor
in interface TemplateService
engine
- Name of the template engine to get or null for defaultTemplateService.getTemplateProcessor(java.lang.String)
public void registerTemplateProcessor(TemplateProcessor templateProcessor)
TemplateService
registerTemplateProcessor
in interface TemplateService
templateProcessor
- the template processor to registerTemplateService.registerTemplateProcessor(org.alfresco.service.cmr.repository.TemplateProcessor)
public String processTemplate(String template, Object model) throws TemplateException
TemplateService
processTemplate
in interface TemplateService
template
- Template (qualified classpath name or noderef)model
- Object model to process template againstTemplateException
TemplateService.processTemplate(java.lang.String, java.lang.Object)
public void processTemplate(String template, Object model, Writer out) throws TemplateException
TemplateService
processTemplate
in interface TemplateService
template
- Template (qualified classpath name or noderef)model
- Object model to process template againstout
- Writer object to send output tooTemplateException
TemplateService.processTemplate(java.lang.String, java.lang.Object, java.io.Writer)
public void processTemplate(String engine, String template, Object model, Writer out) throws TemplateException
TemplateService
processTemplate
in interface TemplateService
engine
- Name of the template engine to usetemplate
- Template (qualified classpath name or noderef)model
- Object model to process template againstout
- Writer object to send output tooTemplateException
TemplateService.processTemplate(java.lang.String, java.lang.String, java.lang.Object, java.io.Writer)
public String processTemplate(String engine, String template, Object model, Locale locale) throws TemplateException
TemplateService
processTemplate
in interface TemplateService
engine
- Name of the template engine to usetemplate
- Template ref (qualified classpath name or noderef)model
- Object model to process template againstlocale
- Locale to process the template asTemplateException
TemplateService.processTemplate(java.lang.String, java.lang.String, java.lang.Object, Locale locale)
public String processTemplate(String engine, String template, Object model) throws TemplateException
TemplateService
processTemplate
in interface TemplateService
engine
- Name of the template engine to usetemplate
- Template (qualified classpath name or noderef)model
- Object model to process template againstTemplateException
TemplateService.processTemplate(java.lang.String, java.lang.String, java.lang.Object)
public void processTemplateString(String engine, String template, Object model, Writer out) throws TemplateException
TemplateService
processTemplateString
in interface TemplateService
engine
- Name of the template engine to usetemplate
- Template stringmodel
- Object model to process template againstout
- Writer object to send output tooTemplateException
TemplateService.processTemplateString(java.lang.String, java.lang.String, java.lang.Object, java.io.Writer)
public String processTemplateString(String engine, String template, Object model) throws TemplateException
TemplateService
processTemplateString
in interface TemplateService
engine
- Name of the template engine to usetemplate
- Template stringmodel
- Object model to process template againstTemplateException
TemplateService.processTemplateString(java.lang.String, java.lang.String, java.lang.Object)
public Map<String,Object> buildDefaultModel(org.alfresco.service.cmr.repository.NodeRef person, org.alfresco.service.cmr.repository.NodeRef companyHome, org.alfresco.service.cmr.repository.NodeRef userHome, org.alfresco.service.cmr.repository.NodeRef template, TemplateImageResolver imageResolver)
TemplateService
buildDefaultModel
in interface TemplateService
person
- the person node referencecompanyHome
- the company home node refereenceuserHome
- the user home node referencetemplate
- the node ref for the template (optional)imageResolver
- the image resolver (optional)TemplateService.buildDefaultModel(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.TemplateImageResolver)
Copyright © 2005–2017 Alfresco Software. All rights reserved.