RuleService : Why does it check for original nodes before applying rule ?

cancel
Showing results for 
Search instead for 
Did you mean: 
ValentinLeblanc
Active Member

RuleService : Why does it check for original nodes before applying rule ?

Hello,

I would like to understand why the RuleServiceImpl class does check for copy before apply a rule to a node.

 

 /**
     * Determines whether the rule can be executed
     */
    private boolean canExecuteRule(Set<ExecutedRuleData> executedRules, NodeRef actionedUponNodeRef, Rule rule)
    {
        boolean result = true;
        
        if (logger.isDebugEnabled() == true)
        {
            logger.debug(" >> Current executed items count = " + executedRules.size());
        }
        
        if (executedRules != null)
        {
            if (executedRules.contains(new ExecutedRuleData(actionedUponNodeRef, rule)) == true)
            {
                if (logger.isDebugEnabled() == true)
                {
                    logger.debug(" >> Already executed this rule (" + rule.getTitle()+ ") on this nodeRef (" + actionedUponNodeRef.getId() + ")");
                }
                result = false;
            }
            else
            {
                result = checkForCopy(executedRules, actionedUponNodeRef, rule);                
            }
        }
        else
        {
            if (logger.isDebugEnabled() == true)
            {
                logger.debug(" >> Executed this rule (" + rule.getTitle()+ ") on (" + actionedUponNodeRef.getId() + ") executed rule is null");
            }
        }
        
        return result;
    }

 

Can anybody explain it to me ? In my case, rules are not applied to nodes that are copied from another node.

Thank you!