mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- fix for constraints for repeats. looks like a side effect of chiba upgrade. rather than constrain based on count(.) need to use count(../<nodeset>) since it seems like they are evaluating the constraints on individual items rather than the bind nodeset.
- fix for handling of fractionDigits for range controls - automatically add namespace declarations for freemarker output path pattern expressions - better error handling/reporting for output path patterns - pass around formInstanceDataName for use in the label of the viewroot - regenerate renditions on update - updated unit tests - use xf:minOccurs and xf:maxOccurs for repeat bindings rather than alfresco:minimum and alfresco:maximum (hadn't seen that it was part of the spec - not supported by chiba - but doesn't interfere) - fix for attributes with fixed values bugs fixed: http://issues.alfresco.com/browse/WCM-317 http://issues.alfresco.com/browse/WCM-302 http://issues.alfresco.com/browse/WCM-333 http://issues.alfresco.com/browse/WCM-270 http://issues.alfresco.com/browse/WCM-312 http://issues.alfresco.com/browse/WCM-305 http://issues.alfresco.com/browse/WCM-298 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5141 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,11 +18,17 @@
|
||||
package org.alfresco.web.forms;
|
||||
|
||||
import freemarker.ext.dom.NodeModel;
|
||||
import freemarker.template.*;
|
||||
import freemarker.template.SimpleDate;
|
||||
import freemarker.template.SimpleHash;
|
||||
import freemarker.template.SimpleScalar;
|
||||
import freemarker.template.TemplateHashModel;
|
||||
import freemarker.template.TemplateModel;
|
||||
import freemarker.template.TemplateModelException;
|
||||
import java.io.*;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import javax.faces.context.FacesContext;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
@@ -30,7 +36,15 @@ import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.*;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.TemplateException;
|
||||
import org.alfresco.service.cmr.repository.TemplateNode;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.service.namespace.*;
|
||||
import org.alfresco.service.cmr.remote.AVMRemote;
|
||||
import org.alfresco.web.app.Application;
|
||||
@@ -158,24 +172,40 @@ public class RenderingEngineTemplateImpl
|
||||
root.put("name", formInstanceDataName.replaceAll("(.+)\\..*", "$1"));
|
||||
root.put("extension",
|
||||
sr.getMimetypeService().getExtension(this.getMimetypeForRendition()));
|
||||
|
||||
Document formInstanceDataDocument = null;
|
||||
try
|
||||
{
|
||||
root.put("xml", NodeModel.wrap(formInstanceData.getDocument()));
|
||||
formInstanceDataDocument = formInstanceData.getDocument();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(e);
|
||||
throw new AlfrescoRuntimeException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
final TemplateService templateService = sr.getTemplateService();
|
||||
final String outputPathPattern = this.getOutputPathPattern();
|
||||
String result = templateService.processTemplateString(null,
|
||||
outputPathPattern,
|
||||
new SimpleHash(root));
|
||||
final String outputPathPattern = (FreeMarkerUtil.buildNamespaceDeclaration(formInstanceDataDocument) +
|
||||
this.getOutputPathPattern());
|
||||
String result = null;
|
||||
try
|
||||
{
|
||||
result = templateService.processTemplateString(null,
|
||||
outputPathPattern,
|
||||
new SimpleHash(root));
|
||||
}
|
||||
catch (final TemplateException te)
|
||||
{
|
||||
LOGGER.error(te.getMessage(), te);
|
||||
throw new AlfrescoRuntimeException("Error processing output path pattern " + outputPathPattern +
|
||||
" for " + formInstanceDataName +
|
||||
" in webapp " + webappName +
|
||||
":\n" + te.getMessage(),
|
||||
te);
|
||||
}
|
||||
final String parentAVMPath = AVMNodeConverter.SplitBase(formInstanceDataAVMPath)[0];
|
||||
result = AVMConstants.buildPath(parentAVMPath,
|
||||
result,
|
||||
@@ -362,10 +392,10 @@ public class RenderingEngineTemplateImpl
|
||||
throws IOException,
|
||||
SAXException
|
||||
{
|
||||
if (arguments.length > 1)
|
||||
if (arguments.length > 2)
|
||||
{
|
||||
throw new IllegalArgumentException("expected zero or one arguments to parseXMLDocuments. got " +
|
||||
arguments.length);
|
||||
throw new IllegalArgumentException("expected exactly one or two arguments to " +
|
||||
"parseXMLDocuments. got " + arguments.length);
|
||||
}
|
||||
if (! (arguments[0] instanceof String))
|
||||
{
|
||||
|
Reference in New Issue
Block a user