Merged V2.0 to HEAD

5497: cwd variable and forminstancedata
   5512: AR-1303 MLPropertyInterceptor
   5527: CIFS invalid characters


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5543 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-04-25 02:13:55 +00:00
parent 77656d03e1
commit 58bb2adc27
6 changed files with 66 additions and 13 deletions

View File

@@ -154,6 +154,7 @@ public class FormImpl
root.put("xml", NodeModel.wrap(formInstanceData));
root.put("name", formInstanceDataName);
root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME));
root.put("cwd", AVMConstants.getWebappRelativePath(parentAVMPath));
final TemplateService templateService = this.getServiceRegistry().getTemplateService();

View File

@@ -69,9 +69,13 @@ public interface RenderingEngineTemplate
/**
* Returns the output path for the rendition.
*
* @param formInstanceData the form instance data to use for
* processing the pattern.
* @param currentAVMPath the current path where the form is being created.
* @return the output path for the rendition.
*/
public String getOutputPathForRendition(final FormInstanceData formInstanceData);
public String getOutputPathForRendition(final FormInstanceData formInstanceData,
final String currentAVMPath);
/**
* Returns the mimetype to use when generating content for this
@@ -87,8 +91,10 @@ public interface RenderingEngineTemplate
*
* @param formInstanceData the form instance data for which to produce
* the rendition.
* @param renditionAVMPath the path to use for the rendition.
*/
public Rendition render(final FormInstanceData formInstanceData)
public Rendition render(final FormInstanceData formInstanceData,
final String renditionAVMPath)
throws IOException,
SAXException,
RenderingEngine.RenderingException;

View File

@@ -178,9 +178,12 @@ public class RenderingEngineTemplateImpl
* Generates an output path for the rendition by compiling the output path pattern
* as a freemarker template.
*
* @param formInstanceData the form instance data to use for the rendition path.
* @param currentAVMPath the current path in which the form is being created.
*
* @return the output path to use for renditions.
*/
public String getOutputPathForRendition(final FormInstanceData formInstanceData /*,final String parentAVMPath */)
public String getOutputPathForRendition(final FormInstanceData formInstanceData, final String currentAVMPath)
{
final ServiceRegistry sr = this.getServiceRegistry();
final NodeService nodeService = sr.getNodeService();
@@ -212,11 +215,12 @@ public class RenderingEngineTemplateImpl
LOGGER.error(e);
throw new AlfrescoRuntimeException(e.getMessage(), e);
}
final String parentAVMPath = AVMNodeConverter.SplitBase(formInstanceDataAVMPath)[0];
root.put("xml", NodeModel.wrap(formInstanceDataDocument));
root.put("node", new TemplateNode(((FormInstanceDataImpl)formInstanceData).getNodeRef(), sr, null));
root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME));
root.put("cwd", AVMConstants.getWebappRelativePath(currentAVMPath));
final TemplateService templateService = sr.getTemplateService();
final String outputPathPattern = (FreeMarkerUtil.buildNamespaceDeclaration(formInstanceDataDocument) +
this.getOutputPathPattern());
@@ -236,7 +240,7 @@ public class RenderingEngineTemplateImpl
":\n" + te.getMessage(),
te);
}
final String parentAVMPath = AVMNodeConverter.SplitBase(formInstanceDataAVMPath)[0];
result = AVMConstants.buildPath(parentAVMPath,
result,
AVMConstants.PathRelation.SANDBOX_RELATIVE);
@@ -251,13 +255,13 @@ public class RenderingEngineTemplateImpl
WCMAppModel.PROP_MIMETYPE_FOR_RENDITION);
}
public Rendition render(final FormInstanceData formInstanceData)
public Rendition render(final FormInstanceData formInstanceData,
final String renditionAvmPath)
throws IOException,
SAXException,
RenderingEngine.RenderingException
{
final AVMService avmService = this.getServiceRegistry().getAVMService();
final String renditionAvmPath = this.getOutputPathForRendition(formInstanceData);
final boolean isRegenerate = avmService.lookup(-1, renditionAvmPath) != null;
if (!isRegenerate)
{
@@ -559,5 +563,10 @@ public class RenderingEngineTemplateImpl
final FacesContext fc = FacesContext.getCurrentInstance();
return Repository.getServiceRegistry(fc);
}
public int hashCode()
{
return this.getName().hashCode();
}
}