mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
adding documentation for rendering engines.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4219 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -33,8 +33,6 @@ import org.springframework.web.jsf.FacesContextUtils;
|
|||||||
/**
|
/**
|
||||||
* Provides helper functions for form data renderers.
|
* Provides helper functions for form data renderers.
|
||||||
*/
|
*/
|
||||||
// XXXarielb this class is probably temporary - but useful to
|
|
||||||
// reduce redundant code until i find a better place to put this stuff
|
|
||||||
public abstract class AbstractRenderingEngine
|
public abstract class AbstractRenderingEngine
|
||||||
implements RenderingEngine
|
implements RenderingEngine
|
||||||
{
|
{
|
||||||
@@ -56,11 +54,21 @@ public abstract class AbstractRenderingEngine
|
|||||||
this.contentService = contentService;
|
this.contentService = contentService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the node ref for the rendering engine template.
|
||||||
|
*
|
||||||
|
* @return the node ref for the rendering engine template.
|
||||||
|
*/
|
||||||
public NodeRef getNodeRef()
|
public NodeRef getNodeRef()
|
||||||
{
|
{
|
||||||
return this.nodeRef;
|
return this.nodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the file extension to use for generated assets.
|
||||||
|
*
|
||||||
|
* @return the file extension to use for generated assets.
|
||||||
|
*/
|
||||||
public String getFileExtension()
|
public String getFileExtension()
|
||||||
{
|
{
|
||||||
return (String)
|
return (String)
|
||||||
@@ -82,6 +90,17 @@ public abstract class AbstractRenderingEngine
|
|||||||
return new FormDataFunctions(AbstractRenderingEngine.getAVMRemote());
|
return new FormDataFunctions(AbstractRenderingEngine.getAVMRemote());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the provided path to an absolute path within the avm.
|
||||||
|
*
|
||||||
|
* @param parentAVMPath used as the parent path if the provided path
|
||||||
|
* is relative, otherwise used to extract the parent path portion up until
|
||||||
|
* the webapp directory.
|
||||||
|
* @param path a path relative to the parentAVMPath path, or if it is
|
||||||
|
* absolute, it is relative to the webapp used in the parentAVMPath.
|
||||||
|
*
|
||||||
|
* @return an absolute path within the avm using the paths provided.
|
||||||
|
*/
|
||||||
protected static String toAVMPath(final String parentAVMPath, final String path)
|
protected static String toAVMPath(final String parentAVMPath, final String path)
|
||||||
{
|
{
|
||||||
String parent = parentAVMPath;
|
String parent = parentAVMPath;
|
||||||
@@ -93,7 +112,6 @@ public abstract class AbstractRenderingEngine
|
|||||||
return parentAVMPath;
|
return parentAVMPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (path.charAt(0) == '/')
|
if (path.charAt(0) == '/')
|
||||||
{
|
{
|
||||||
final Pattern p = Pattern.compile("([^:]+:/" + AVMConstants.DIR_APPBASE +
|
final Pattern p = Pattern.compile("([^:]+:/" + AVMConstants.DIR_APPBASE +
|
||||||
@@ -115,5 +133,4 @@ public abstract class AbstractRenderingEngine
|
|||||||
" and request path " + path);
|
" and request path " + path);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -76,6 +76,12 @@ public class XSLTRenderingEngine
|
|||||||
return o == null ? null : XSLTRenderingEngine.toAVMPath(o.toString(), path);
|
return o == null ? null : XSLTRenderingEngine.toAVMPath(o.toString(), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapter function used by the xsl tempalte to retrieve an xml asset at the given
|
||||||
|
* path.
|
||||||
|
*
|
||||||
|
* @return the document element for the xml asset at the given path.
|
||||||
|
*/
|
||||||
public static Node parseXMLDocument(final ExpressionContext ec, final String path)
|
public static Node parseXMLDocument(final ExpressionContext ec, final String path)
|
||||||
throws TransformerException,
|
throws TransformerException,
|
||||||
IOException,
|
IOException,
|
||||||
@@ -86,6 +92,10 @@ public class XSLTRenderingEngine
|
|||||||
return d != null ? d.getDocumentElement() : null;
|
return d != null ? d.getDocumentElement() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapter function used by the xsl tempalte to retrieve a xml assets in the
|
||||||
|
* current directory.
|
||||||
|
*/
|
||||||
public static NodeIterator parseXMLDocuments(final ExpressionContext ec,
|
public static NodeIterator parseXMLDocuments(final ExpressionContext ec,
|
||||||
final String formName)
|
final String formName)
|
||||||
throws TransformerException,
|
throws TransformerException,
|
||||||
@@ -95,6 +105,15 @@ public class XSLTRenderingEngine
|
|||||||
return XSLTRenderingEngine.parseXMLDocuments(ec, formName, "");
|
return XSLTRenderingEngine.parseXMLDocuments(ec, formName, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapter function used by the xsl tempalte to retrieve a xml assets at
|
||||||
|
* the given path.
|
||||||
|
*
|
||||||
|
* @return an iterator of the document elements for each of the xml
|
||||||
|
* assets at the given path. In order to enable xpath expressions to
|
||||||
|
* properly access siblings, each root element is rooted at a node named
|
||||||
|
* file-list in the alfresco namespace.
|
||||||
|
*/
|
||||||
public static NodeIterator parseXMLDocuments(final ExpressionContext ec,
|
public static NodeIterator parseXMLDocuments(final ExpressionContext ec,
|
||||||
final String formName,
|
final String formName,
|
||||||
String path)
|
String path)
|
||||||
@@ -194,7 +213,10 @@ public class XSLTRenderingEngine
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// for debugging
|
/**
|
||||||
|
* for debugging only. provides the absolute avm path for the given
|
||||||
|
* path.
|
||||||
|
*/
|
||||||
public static String _getAVMPath(final ExpressionContext ec,
|
public static String _getAVMPath(final ExpressionContext ec,
|
||||||
final String path)
|
final String path)
|
||||||
throws TransformerException,
|
throws TransformerException,
|
||||||
|
Reference in New Issue
Block a user