diff --git a/config/alfresco/extension/scheduled-action-services-context.xml.sample b/config/alfresco/extension/scheduled-action-services-context.xml.sample index 674aa84b5b..1a24eb50ad 100644 --- a/config/alfresco/extension/scheduled-action-services-context.xml.sample +++ b/config/alfresco/extension/scheduled-action-services-context.xml.sample @@ -33,7 +33,8 @@ {http://www.alfresco.org/model/content/1.0}categories - ${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/cm:generalclassifiable/cm:Languages/cm:English"' )} + + \$\{selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/cm:generalclassifiable/cm:Languages/cm:English"' )\} @@ -95,19 +96,22 @@ destination-folder - ${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home"' )} + + \$\{selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home"' )\} assoc-type - ${node.primaryParentAssoc.typeQName} + + \$\{node.primaryParentAssoc.typeQName\} assoc-name - ${node.primaryParentAssoc.QName} + + \$\{node.primaryParentAssoc.QName\} @@ -150,7 +154,8 @@ value - ${today?string("yyyy-MM-dd'T'HH:mm:ss.sss'Z'")} + + \$\{today?string("yyyy-MM-dd'T'HH:mm:ss.sss'Z'")\} @@ -402,7 +407,8 @@ - @cm\:created:${luceneDateRange(yesterday, "-P10Y")} + + @cm\:created:\$\{luceneDateRange(yesterday, "-P10Y")\} 0 0/1 * * * ? @@ -439,4 +445,4 @@ - \ No newline at end of file + diff --git a/source/java/org/alfresco/repo/action/scheduled/SimpleTemplateActionDefinition.java b/source/java/org/alfresco/repo/action/scheduled/SimpleTemplateActionDefinition.java index 18aaa0bb9a..daa3bf8f88 100644 --- a/source/java/org/alfresco/repo/action/scheduled/SimpleTemplateActionDefinition.java +++ b/source/java/org/alfresco/repo/action/scheduled/SimpleTemplateActionDefinition.java @@ -36,6 +36,9 @@ import org.springframework.context.ApplicationContextAware; /** * This class defines the template used to build a single action. * + * Because SPEL will eat ${foo} or #{foo} in the template when specified in the XML, + * this will also accept \$\{foo\} or \#\{foo\} as well. + * * @author Andy Hind */ public class SimpleTemplateActionDefinition extends AbstractTemplateActionDefinition implements ApplicationContextAware @@ -176,17 +179,30 @@ public class SimpleTemplateActionDefinition extends AbstractTemplateActionDefini // Go through the template definitions and set the values. for (String paramName : parameterTemplates.keySet()) { - // Transform the template + // Fetch the template. Need to de-escape things put in to work + // around it not being possible to disable SPEL for one bean String template = parameterTemplates.get(paramName); - String stringValue = templateService.processTemplateString(getTemplateActionModelFactory() - .getTemplateEngine(), template, getTemplateActionModelFactory().getModel(nodeRef)); + if(template.contains("\\$\\{") || template.contains("\\#\\{")) + { + template = template.replace("\\$\\{", "${"); + template = template.replace("\\#\\{", "#{"); + if(template.contains("\\}")) + { + template = template.replace("\\}", "}"); + } + } + + // Transform the template + String stringValue = templateService.processTemplateString( + getTemplateActionModelFactory().getTemplateEngine(), + template, getTemplateActionModelFactory().getModel(nodeRef)); // Find the data type from the action defintion DataTypeDefinition dataTypeDef; if (actionDefinition.getParameterDefintion(paramName) != null) { - dataTypeDef = dictionaryService - .getDataType(actionDefinition.getParameterDefintion(paramName).getType()); + dataTypeDef = dictionaryService.getDataType( + actionDefinition.getParameterDefintion(paramName).getType()); } // Fall back to the DD using the property name of it is not defined // This is sometimes used for setting a property to a value.