/** Deal with creation of ActiveRuleChange item when a rule severity is changed on a profile */ private void ruleSeverityChanged( RulesProfile profile, Rule rule, RulePriority oldSeverity, RulePriority newSeverity, String userName) { incrementProfileVersionIfNeeded(profile); ActiveRuleChange rc = new ActiveRuleChange(userName, profile, rule); if (!ObjectUtils.equals(oldSeverity, newSeverity)) { rc.setOldSeverity(oldSeverity); rc.setNewSeverity(newSeverity); getSession().saveWithoutFlush(rc); } }
/** Deal with creation of ActiveRuleChange item when a rule is disabled on a profile */ private void ruleDisabled(RulesProfile profile, ActiveRule disabledRule, String userName) { incrementProfileVersionIfNeeded(profile); ActiveRuleChange rc = new ActiveRuleChange(userName, profile, disabledRule.getRule()); rc.setEnabled(false); rc.setOldSeverity(disabledRule.getSeverity()); if (disabledRule.getRule().getParams() != null) { for (RuleParam p : disabledRule.getRule().getParams()) { String oldParam = disabledRule.getParameter(p.getKey()); if (oldParam != null) { rc.setParameterChange(p.getKey(), oldParam, null); } } } getSession().saveWithoutFlush(rc); }
/** * Deal with creation of ActiveRuleChange item when a rule is changed (severity and/or param(s)) * on a profile */ private void ruleChanged( RulesProfile profile, ActiveRule oldActiveRule, ActiveRule newActiveRule, String userName) { incrementProfileVersionIfNeeded(profile); ActiveRuleChange rc = new ActiveRuleChange(userName, profile, newActiveRule.getRule()); if (oldActiveRule.getSeverity() != newActiveRule.getSeverity()) { rc.setOldSeverity(oldActiveRule.getSeverity()); rc.setNewSeverity(newActiveRule.getSeverity()); } if (oldActiveRule.getRule().getParams() != null) { for (RuleParam p : oldActiveRule.getRule().getParams()) { String oldParam = oldActiveRule.getParameter(p.getKey()); String newParam = newActiveRule.getParameter(p.getKey()); if (!StringUtils.equals(oldParam, newParam)) { rc.setParameterChange(p.getKey(), oldParam, newParam); } } } getSession().saveWithoutFlush(rc); }