Problem using custom action with boolean parameter from a rule in Alfresco Share

cancel
Showing results for 
Search instead for 
Did you mean: 
olanda
Partner

Problem using custom action with boolean parameter from a rule in Alfresco Share

We are using ACS Starter 7.3

I have created a custom action with a boolean parameter.


public class testAction extends ActionExecuterAbstractBase {
private static Log logger = LogFactory.getLog(testAction.class);

public static final String NAME = "test-action";
public static final String PARAM_TEST_BOOL = "test-param";


@override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
try {
Boolean test = (Boolean) action.getParameterValue(PARAM_TEST_BOOL);
logger.debug("TEST:" + test);

} catch (Exception e) {
logger.error("Error test'" + actionedUponNodeRef + "':", e);
}
}

@override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
paramList.add(new ParameterDefinitionImpl(PARAM_TEST_BOOL, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PARAM_TEST_BOOL)));
}
}



The action is being used from a rule in Alfresco Share....so, when the user is editing the rule,
the form shows a check box (Up to here all good) Now,
if the user doesn't check the box, the next time the rule is edited, all remains good. if the user checks the box and saves the rule, the next time the rule is edited, the form is displayed wrong an after saving the rule an error is thrown. Caused by: org.springframework.extensions.webscripts.WebScriptException: 02100000 Failed to process template org/alfresco/folder-rules.ftl content-model-share_1 | at org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:196) content-model-share_1 | at org.springframework.extensions.webscripts.WebTemplateProcessor.executeBody(WebTemplateProcessor.java:439) content-model-share_1 | ... 61 more content-model-share_1 | Caused by: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: content-model-share_1 | ==> ruleset [in template "org/alfresco/folder-rules.ftl" at line 18, column 12] content-model-share_1 | content-model-share_1 | ---- content-model-share_1 | Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? content-model-share_1 | ---- content-model-share_1 | content-model-share_1 | ---- FTL stack trace ("~" means nesting-related): content-model-share_1 | - Failed at: #if ruleset.linkedToRuleSet?? [in template "org/alfresco/folder-rules.ftl" at line 18, column 7] content-model-share_1 | - Reached through: @markup id="bd" [in template "org/alfresco/folder-rules.ftl" at line 12, column 4] content-model-share_1 | ~ Reached through: #nested [in template "org/alfresco/include/alfresco-template.ftl" in macro "templateBody" at line 87, column 1] content-model-share_1 | ~ Reached through: @templateBody [in template "org/alfresco/folder-rules.ftl" at line 6, column 1]