mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-3687: Execute rules API: Remove field "isEachInheritedRuleExecuted" (#1476)
* ACS-3620: E2Es - API for manual triggering rules on a folder
This commit is contained in:
@@ -104,7 +104,6 @@ public interface Rules
|
||||
*
|
||||
* @param folderNodeId - the ID of a folder
|
||||
* @param eachSubFolderIncluded - indicates if rules should be executed also on sub-folders
|
||||
* @param eachInheritedRuleExecuted - indicates if the inherited rules should be also executed
|
||||
*/
|
||||
RuleExecution executeRules(final String folderNodeId, final boolean eachSubFolderIncluded, final boolean eachInheritedRuleExecuted);
|
||||
RuleExecution executeRules(final String folderNodeId, final boolean eachSubFolderIncluded);
|
||||
}
|
||||
|
@@ -133,12 +133,12 @@ public class RulesImpl implements Rules
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuleExecution executeRules(final String folderNodeId, final boolean eachSubFolderIncluded, final boolean eachInheritedRuleExecuted)
|
||||
public RuleExecution executeRules(final String folderNodeId, final boolean eachSubFolderIncluded)
|
||||
{
|
||||
final NodeRef folderNodeRef = validator.validateFolderNode(folderNodeId, false);
|
||||
final Map<String, Serializable> parameterValues = new HashMap<>();
|
||||
parameterValues.put(ExecuteAllRulesActionExecuter.PARAM_RUN_ALL_RULES_ON_CHILDREN, eachSubFolderIncluded);
|
||||
parameterValues.put(ExecuteAllRulesActionExecuter.PARAM_EXECUTE_INHERITED_RULES, eachInheritedRuleExecuted);
|
||||
parameterValues.put(ExecuteAllRulesActionExecuter.PARAM_EXECUTE_INHERITED_RULES, true);
|
||||
final ActionImpl action = new ActionImpl(null, GUID.generate(), ExecuteAllRulesActionExecuter.NAME);
|
||||
action.setNodeRef(folderNodeRef);
|
||||
action.setParameterValues(parameterValues);
|
||||
@@ -148,7 +148,6 @@ public class RulesImpl implements Rules
|
||||
|
||||
return RuleExecution.builder()
|
||||
.eachSubFolderIncluded(eachSubFolderIncluded)
|
||||
.eachInheritedRuleExecuted(eachInheritedRuleExecuted)
|
||||
.create();
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,6 @@ import org.alfresco.service.Experimental;
|
||||
public class RuleExecution
|
||||
{
|
||||
private boolean eachSubFolderIncluded;
|
||||
private boolean eachInheritedRuleExecuted;
|
||||
|
||||
public boolean getIsEachSubFolderIncluded()
|
||||
{
|
||||
@@ -45,20 +44,10 @@ public class RuleExecution
|
||||
this.eachSubFolderIncluded = eachSubFolderIncluded;
|
||||
}
|
||||
|
||||
public boolean getIsEachInheritedRuleExecuted()
|
||||
{
|
||||
return eachInheritedRuleExecuted;
|
||||
}
|
||||
|
||||
public void setIsEachInheritedRuleExecuted(boolean eachInheritedRuleExecuted)
|
||||
{
|
||||
this.eachInheritedRuleExecuted = eachInheritedRuleExecuted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "RuleExecution{" + "eachSubFolderIncluded=" + eachSubFolderIncluded + ", eachInheritedRuleExecuted=" + eachInheritedRuleExecuted + '}';
|
||||
return "RuleExecution{" + "eachSubFolderIncluded=" + eachSubFolderIncluded + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,13 +58,13 @@ public class RuleExecution
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
RuleExecution that = (RuleExecution) o;
|
||||
return eachSubFolderIncluded == that.eachSubFolderIncluded && eachInheritedRuleExecuted == that.eachInheritedRuleExecuted;
|
||||
return eachSubFolderIncluded == that.eachSubFolderIncluded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(eachSubFolderIncluded, eachInheritedRuleExecuted);
|
||||
return Objects.hash(eachSubFolderIncluded);
|
||||
}
|
||||
|
||||
public static Builder builder()
|
||||
@@ -86,7 +75,6 @@ public class RuleExecution
|
||||
public static class Builder
|
||||
{
|
||||
private boolean eachSubFolderIncluded;
|
||||
private boolean eachInheritedRuleExecuted;
|
||||
|
||||
public Builder eachSubFolderIncluded(boolean eachSubFolderIncluded)
|
||||
{
|
||||
@@ -94,17 +82,10 @@ public class RuleExecution
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder eachInheritedRuleExecuted(boolean eachInheritedRuleExecuted)
|
||||
{
|
||||
this.eachInheritedRuleExecuted = eachInheritedRuleExecuted;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RuleExecution create()
|
||||
{
|
||||
final RuleExecution ruleExecution = new RuleExecution();
|
||||
ruleExecution.setIsEachSubFolderIncluded(eachSubFolderIncluded);
|
||||
ruleExecution.setIsEachInheritedRuleExecuted(eachInheritedRuleExecuted);
|
||||
return ruleExecution;
|
||||
}
|
||||
}
|
||||
|
@@ -65,6 +65,6 @@ public class NodeRuleExecutionsRelation implements RelationshipResourceAction.Cr
|
||||
public List<RuleExecution> create(String folderNodeId, List<RuleExecution> ruleExecutionParameters, Parameters parameters)
|
||||
{
|
||||
final RuleExecution ruleExecution = ruleExecutionParameters.stream().findFirst().orElse(new RuleExecution());
|
||||
return List.of(rules.executeRules(folderNodeId, ruleExecution.getIsEachSubFolderIncluded(), ruleExecution.getIsEachInheritedRuleExecuted()));
|
||||
return List.of(rules.executeRules(folderNodeId, ruleExecution.getIsEachSubFolderIncluded()));
|
||||
}
|
||||
}
|
||||
|
@@ -634,12 +634,9 @@ public class RulesImplTest extends TestCase
|
||||
public void testExecuteRule()
|
||||
{
|
||||
// when
|
||||
final RuleExecution actualRuleExecution = rules.executeRules(FOLDER_NODE_ID, INCLUDE_SUB_FOLDERS, EXECUTE_INHERITED_RULES);
|
||||
final RuleExecution actualRuleExecution = rules.executeRules(FOLDER_NODE_ID, INCLUDE_SUB_FOLDERS);
|
||||
|
||||
final RuleExecution expectedRuleExecution = RuleExecution.builder()
|
||||
.eachSubFolderIncluded(INCLUDE_SUB_FOLDERS)
|
||||
.eachInheritedRuleExecuted(EXECUTE_INHERITED_RULES)
|
||||
.create();
|
||||
final RuleExecution expectedRuleExecution = RuleExecution.builder().eachSubFolderIncluded(INCLUDE_SUB_FOLDERS).create();
|
||||
final ActionImpl expectedAction = new ActionImpl(null, null, ExecuteAllRulesActionExecuter.NAME);
|
||||
expectedAction.setNodeRef(FOLDER_NODE_REF);
|
||||
expectedAction.setParameterValues(Map.of(
|
||||
|
Reference in New Issue
Block a user