public abstract class AbstractExtensibilityDirective extends AbstractFreeMarkerDirective implements ExtensibilityDirective
Defines the abstract behaviour of an extensibility directive by implementing the common structure. An extensibility directive has the following attributes:
ACTION, ACTION_AFTER, ACTION_BEFORE, ACTION_MERGE, ACTION_MODIFY, ACTION_REMOVE, ACTION_REPLACE, DIRECTIVE_ID, TARGET| Constructor and Description |
|---|
AbstractExtensibilityDirective(String directiveName,
ExtensibilityModel model)
Requires a DirectiveModel to contribute to.
|
| Modifier and Type | Method and Description |
|---|---|
void |
after(ExtensibilityDirectiveData directiveData)
The default implementation of this action is simply to delegate the request to the
ExtensibilityModel.after()
method but this has been abstracted into its own method so that extending directives can easily modify the default
behaviour of this action. |
void |
before(ExtensibilityDirectiveData directiveData)
The default implementation of this action is simply to delegate the request to the
ExtensibilityModel.before()
method but this has been abstracted into its own method so that extending directives can easily modify the default
behaviour of this action. |
ExtensibilityDirectiveData |
createExtensibilityDirectiveData(String id,
String action,
String target,
Map params,
freemarker.template.TemplateDirectiveBody body,
freemarker.core.Environment env)
Creates and returns a
DefaultExtensibilityDirectiveData object containing the
primary data needed for processing the current directive invocation. |
void |
execute(freemarker.core.Environment env,
Map params,
freemarker.template.TemplateModel[] loopVars,
freemarker.template.TemplateDirectiveBody body) |
String |
getId() |
ExtensibilityModel |
getModel() |
void |
merge(ExtensibilityDirectiveData directiveData,
Map<String,Object> params)
Merges the output of directive data into the content model.
|
void |
remove(ExtensibilityDirectiveData directiveData)
The default implementation of this action is simply to delegate the request to the
ExtensibilityModel.remove()
method but this has been abstracted into its own method so that extending directives can easily modify the default
behaviour of this action. |
void |
replace(ExtensibilityDirectiveData directiveData)
The default implementation of this action is simply to delegate the request to the
ExtensibilityModel.replace()
method but this has been abstracted into its own method so that extending directives can easily modify the default
behaviour of this action. |
getBooleanProperty, getDirectiveName, getStringPropertypublic AbstractExtensibilityDirective(String directiveName, ExtensibilityModel model)
directiveName - Stringmodel - ExtensibilityModelpublic String getId()
public ExtensibilityModel getModel()
public ExtensibilityDirectiveData createExtensibilityDirectiveData(String id, String action, String target, Map params, freemarker.template.TemplateDirectiveBody body, freemarker.core.Environment env) throws freemarker.template.TemplateException
Creates and returns a DefaultExtensibilityDirectiveData object containing the
primary data needed for processing the current directive invocation. This object is required
when building the model because TemplateDirectiveModel instances are re-used so
the data assigned to them is volatile.
Extending classes implementing concrete directives should choose to override this method if
the directive being defined requires additional data or needs to instantiate different
ContentModelElement instances in order to provide more advance content processing.
id - The id of the current directive invocationaction - The action of the current directive invocationtarget - The target of the current directive invocation (this could be null)params - The parameters used by the directive invocation.body - The TemplateDirectiveBody of the current directive invocation.env - The current FreeMarker template EnvironmentDefaultExtensibilityDirectiveData object containing the data supplied as
parameters to the method call.freemarker.template.TemplateExceptionpublic void execute(freemarker.core.Environment env,
Map params,
freemarker.template.TemplateModel[] loopVars,
freemarker.template.TemplateDirectiveBody body)
throws freemarker.template.TemplateException,
IOException
execute in interface freemarker.template.TemplateDirectiveModelfreemarker.template.TemplateExceptionIOExceptionpublic void merge(ExtensibilityDirectiveData directiveData, Map<String,Object> params) throws freemarker.template.TemplateException, IOException
Merges the output of directive data into the content model.
The default implementation of this action is simply to delegate the request to the ExtensibilityModel.merge()
method but this has been abstracted into its own method so that extending directives can easily modify the default
behaviour of this action.
directiveData - ExtensibilityDirectiveDataparams - Mapfreemarker.template.TemplateExceptionIOExceptionpublic void before(ExtensibilityDirectiveData directiveData) throws freemarker.template.TemplateException, IOException
The default implementation of this action is simply to delegate the request to the ExtensibilityModel.before()
method but this has been abstracted into its own method so that extending directives can easily modify the default
behaviour of this action.
directiveData - ExtensibilityDirectiveDatafreemarker.template.TemplateExceptionIOExceptionpublic void after(ExtensibilityDirectiveData directiveData) throws freemarker.template.TemplateException, IOException
The default implementation of this action is simply to delegate the request to the ExtensibilityModel.after()
method but this has been abstracted into its own method so that extending directives can easily modify the default
behaviour of this action.
directiveData - ExtensibilityDirectiveDatafreemarker.template.TemplateExceptionIOExceptionpublic void remove(ExtensibilityDirectiveData directiveData) throws freemarker.template.TemplateException, IOException
The default implementation of this action is simply to delegate the request to the ExtensibilityModel.remove()
method but this has been abstracted into its own method so that extending directives can easily modify the default
behaviour of this action.
directiveData - ExtensibilityDirectiveDatafreemarker.template.TemplateExceptionIOExceptionpublic void replace(ExtensibilityDirectiveData directiveData) throws freemarker.template.TemplateException, IOException
The default implementation of this action is simply to delegate the request to the ExtensibilityModel.replace()
method but this has been abstracted into its own method so that extending directives can easily modify the default
behaviour of this action.
directiveData - ExtensibilityDirectiveDatafreemarker.template.TemplateExceptionIOExceptionCopyright © 2005–2021 Alfresco Software. All rights reserved.