@Override public Object clone() { RulesProfile clone = new RulesProfile(getName(), getLanguage(), getDefaultProfile(), getProvided()); if (CollectionUtils.isNotEmpty(getActiveRules())) { clone.setActiveRules(new ArrayList<ActiveRule>(CollectionUtils.collect(getActiveRules(), new Transformer() { public Object transform(Object input) { return ((ActiveRule) input).clone(); } }))); } if (CollectionUtils.isNotEmpty(getAlerts())) { clone.setAlerts(new ArrayList<Alert>(CollectionUtils.collect(getAlerts(), new Transformer() { public Object transform(Object input) { return ((Alert) input).clone(); } }))); } if (CollectionUtils.isNotEmpty(getProjects())) { clone.setProjects(new ArrayList<Resource>(CollectionUtils.collect(getProjects(), new Transformer() { public Object transform(Object input) { return ((Resource) input).clone(); } }))); } return clone; }
@Override public int hashCode() { int result = rule.hashCode(); result = 31 * result + (rulesProfile != null ? rulesProfile.hashCode() : 0); return result; }
@Override public boolean equals(Object obj) { if (!(obj instanceof RulesProfile)) { return false; } if (this == obj) { return true; } RulesProfile other = (RulesProfile) obj; return new EqualsBuilder().append(language, other.getLanguage()).append(name, other.getName()).isEquals(); }
public List<ActiveRule> getActiveRulesByPlugin(String pluginKey) { List<ActiveRule> result = new ArrayList<ActiveRule>(); for (ActiveRule activeRule : getActiveRules()) { if (pluginKey.equals(activeRule.getPluginName())) { result.add(activeRule); } } 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 List<ActiveRule> getActiveRules(RuleFailureLevel level) { List<ActiveRule> result = new ArrayList<ActiveRule>(); for (ActiveRule activeRule : getActiveRules()) { if (activeRule.getLevel().equals(level)) { result.add(activeRule); } } return result; }
public ActiveRule getActiveRule(String pluginKey, String ruleKey) { for (ActiveRule activeRule : getActiveRules()) { if (activeRule.getRuleKey().equals(ruleKey) && activeRule.getPluginName().equals(pluginKey)) { return activeRule; } } return null; }