mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'feature-2.4/RM-3000_setPropertyValueInRMRulesNotWorking' into 'release/V2.4'
Feature 2.4/rm 3000 set property value in rm rules not working RM-3000 - The set property value action can not be used in RM rules page. Because the actions were not working as expected in other languages the mechanism has been changed to use localization in MNT-6350 and a caching mechanism has been implemented. So the getLocalizedParameterDefinitions is called only once at server startup. The actions in RM have been added before this change and we continued to implement getParameterDefintions. The method getLocalizedParameterDefinitions which is protected calls addParameterDefinitions to build the results so I've overridden addParameterDefinitions to include the delegate's parameters for DelegateAction. The actions executeScript and sendEmail were also affected by this change. I've added unit test to cover all 3 of them. See merge request !81
This commit is contained in:
@@ -189,7 +189,7 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setDescriptionKey(getDescriptionKey());
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setAdhocPropertiesAllowed(getAdhocPropertiesAllowed());
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setConditionEvaluator(name);
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setParameterDefinitions(getParameterDefintions());
|
||||
((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setLocalizedParameterDefinitions(getLocalizedParameterDefinitions());
|
||||
}
|
||||
return this.actionConditionDefinition;
|
||||
}
|
||||
|
@@ -94,4 +94,11 @@ public class DelegateAction extends RMActionExecuterAbstractBase
|
||||
{
|
||||
return delegateActionExecuter.getActionDefinition().getParameterDefinitions();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
|
||||
{
|
||||
super.addParameterDefinitions(paramList);
|
||||
paramList.addAll(delegateActionExecuter.getActionDefinition().getParameterDefinitions());
|
||||
}
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.TestActionPropertySubs;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionDefinition;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
|
||||
/**
|
||||
* Extended action service test.
|
||||
@@ -178,4 +179,54 @@ public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* RM-3000
|
||||
* Tests if the actions extending DelegateAction inherit the parameter definitions from their delegate action
|
||||
*/
|
||||
public void testDelegateActions()
|
||||
{
|
||||
/*
|
||||
* set-property-value is the delegate action for setPropertyValue.
|
||||
*/
|
||||
assertTrue(inheritsAllParameterDefinitions("setPropertyValue", "set-property-value"));
|
||||
|
||||
/*
|
||||
* rmscript is the delegate action for executeScript.
|
||||
*/
|
||||
assertTrue(inheritsAllParameterDefinitions("executeScript", "rmscript"));
|
||||
|
||||
/*
|
||||
* mail is the delegate action for sendEmail.
|
||||
*/
|
||||
assertTrue(inheritsAllParameterDefinitions("sendEmail", "mail"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the action definition rmAction inherits all the parameter definitions from delegateAction.
|
||||
* @param rmAction The name of the action definition extending DelegateAction.
|
||||
* @param delegateAction The name of the delegate action.
|
||||
* @return true if rmAction inherits all the parameter definitions from delegateAction. false otherwise.
|
||||
*/
|
||||
private boolean inheritsAllParameterDefinitions(String rmAction, String delegateAction)
|
||||
{
|
||||
/*
|
||||
* Get the parameter definition list for rmAction
|
||||
*/
|
||||
ActionDefinition rmActionDefinition = actionService.getActionDefinition(rmAction);
|
||||
assertNotNull(rmActionDefinition);
|
||||
List<ParameterDefinition> rmParameterDefinitions = rmActionDefinition.getParameterDefinitions();
|
||||
|
||||
/*
|
||||
* Get the parameter definition list for the delegate action
|
||||
*/
|
||||
ActionDefinition delegateActionDefinition = actionService.getActionDefinition(delegateAction);
|
||||
assertNotNull(delegateActionDefinition);
|
||||
List<ParameterDefinition> delegateParameterDefinitions = delegateActionDefinition.getParameterDefinitions();
|
||||
|
||||
/*
|
||||
* Check if rmActionDefinition contains all the elements in rmActionDefinition
|
||||
*/
|
||||
return rmParameterDefinitions.containsAll(delegateParameterDefinitions);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user