public String getConfigKey() { return rule.getConfigKey(); }
public String getRuleKey() { return rule.getKey(); }
public String getPluginName() { return rule.getPluginName(); }
@Override public boolean equals(Object obj) { if (!(obj instanceof Rule)) { return false; } if (this == obj) { return true; } Rule other = (Rule) obj; return new EqualsBuilder() .append(pluginName, other.getPluginName()) .append(key, other.getKey()) .isEquals(); }
public MeasureKey(Metric metric, Rule rule) { this.metric = metric; if (rule != null && rule.getRulesCategory() != null) { this.rulesCategoryId = rule.getRulesCategory().getId(); } this.rule = rule; }
@Override public String toString() { return new ToStringBuilder(this) .append("id", getId()) .append("name", name) .append("key", key) .append("configKey", configKey) .append("categ", rulesCategory) .append("plugin", pluginName) .append("params", params) .toString(); }
public Rule(String name, String key, RulesCategory rulesCategory, String pluginName, String description) { this(); setName(name); this.key = key; this.rulesCategory = rulesCategory; this.pluginName = pluginName; this.description = description; }
public final void setName(String name) { this.name = removeNewLineCharacters(name); }
@Override public int hashCode() { int result = rule.hashCode(); result = 31 * result + (rulesProfile != null ? rulesProfile.hashCode() : 0); return result; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ActiveRule that = (ActiveRule) o; if (!rule.equals(that.rule)) { return false; } if (rulesProfile != null ? !rulesProfile.equals(that.rulesProfile) : that.rulesProfile != null) { return false; } return true; }
public boolean isRuleParamEqual(RuleParam ruleParam, RuleParam ruleParamFromDatabase, String ruleKey, String pluginKey) { return ruleParam.getKey().equals(ruleParamFromDatabase.getKey()) && ruleKey.equals(ruleParamFromDatabase.getRule().getKey()) && ruleParamFromDatabase.getRule().getPluginName().equals(pluginKey); }
public List<Rule> getRulesByCategory(RulesCategory categ) { List<Rule> result = new ArrayList<Rule>(); for (Rule rule : getRules()) { if (rule.getRulesCategory().equals(categ)) { result.add(rule); } } return result; }
public Integer getRuleId() { if (getRule() != null) { return getRule().getId(); } return null; }
public Rule(String name, String key, String configKey, RulesCategory rulesCategory, String pluginName, String description) { this(); setName(name); this.key = key; this.configKey = configKey; this.rulesCategory = rulesCategory; this.pluginName = pluginName; this.description = description; }
public void synchronizeRuleOfActiveRule(ActiveRule activeRule, String pluginKey) { Rule rule = activeRule.getRule(); Rule ruleFromDataBase = getRuleByKey(pluginKey, rule.getKey()); activeRule.setRule(ruleFromDataBase); List<RuleParam> ruleParamsFromDataBase = getRuleParams(); for (ActiveRuleParam activeRuleParam : activeRule.getActiveRuleParams()) { boolean found = false; Iterator<RuleParam> iterator = ruleParamsFromDataBase.iterator(); while (iterator.hasNext() && !found) { RuleParam ruleParamFromDataBase = iterator.next(); if (isRuleParamEqual(activeRuleParam.getRuleParam(), ruleParamFromDataBase, rule.getKey(), pluginKey)) { activeRuleParam.setRuleParam(ruleParamFromDataBase); found = true; } } } }