Refactor of template and script services to allow easy addition of further template and script processors.

Hightlights of check-in include:
- Introduction of script processor 
- Neutralisation of script and template models
- The notion of a processor extension introduced
- Extensions applied to processor implementation rather than the services
- Auto selection of processor based on file extension of template or script

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5519 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2007-04-20 17:13:34 +00:00
parent 03c56f4c90
commit 5401499003
44 changed files with 1392 additions and 713 deletions

View File

@@ -39,8 +39,6 @@ import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.TransformActionExecuter;
import org.alfresco.repo.content.transform.magick.ImageMagickContentTransformer;
import org.alfresco.repo.search.QueryParameterDefImpl;
import org.alfresco.repo.template.FreeMarkerProcessor;
import org.alfresco.repo.template.TemplateNode;
import org.alfresco.repo.version.VersionModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
@@ -1739,8 +1737,7 @@ public class Node implements Serializable, Scopeable
private String processTemplate(String template, NodeRef templateRef, ScriptableObject args)
{
// build default model for the template processing
Map<String, Object> model = FreeMarkerProcessor.buildDefaultModel(
services,
Map<String, Object> model = this.services.getTemplateService().buildDefaultModel(
((Node)((Wrapper)scope.get("person", scope)).unwrap()).getNodeRef(),
((Node)((Wrapper)scope.get("companyhome", scope)).unwrap()).getNodeRef(),
((Node)((Wrapper)scope.get("userhome", scope)).unwrap()).getNodeRef(),
@@ -1750,12 +1747,12 @@ public class Node implements Serializable, Scopeable
// add the current node as either the document/space as appropriate
if (this.getIsDocument())
{
model.put("document", new TemplateNode(this.nodeRef, this.services, null));
model.put("space", new TemplateNode(getPrimaryParentAssoc().getParentRef(), this.services, null));
model.put("document", this.nodeRef);
model.put("space", getPrimaryParentAssoc().getParentRef());
}
else
{
model.put("space", new TemplateNode(this.nodeRef, this.services, null));
model.put("space", this.nodeRef);
}
// add the supplied args to the 'args' root object