示例#1
0
 /** Rule was deactivated in parent profile. */
 public void deactivated(int parentProfileId, int deactivatedRuleId, String userName) {
   ActiveRule parentActiveRule = getSession().getEntity(ActiveRule.class, deactivatedRuleId);
   RulesProfile profile = getSession().getEntity(RulesProfile.class, parentProfileId);
   ruleDisabled(profile, parentActiveRule, userName);
   for (RulesProfile child : getChildren(parentProfileId)) {
     deactivate(child, parentActiveRule.getRule(), userName);
   }
   getSession().commit();
 }
示例#2
0
  private void deactivate(RulesProfile profile, Rule rule, String userName) {
    ActiveRule activeRule = profile.getActiveRule(rule);
    if (activeRule != null) {
      if (activeRule.isInherited()) {
        ruleDisabled(profile, activeRule, userName);
        removeActiveRule(profile, activeRule);
      } else {
        activeRule.setInheritance(null);
        getSession().saveWithoutFlush(activeRule);
        return; // no need to change in children
      }

      for (RulesProfile child : getChildren(profile)) {
        deactivate(child, rule, userName);
      }
    }
  }