@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FeatureId other = (FeatureId) obj; if (params == null) { if (other.params != null) return false; } else if (!params.equals(other.params)) return false; if (specId == null) { if (other.specId != null) return false; } else if (!specId.equals(other.specId)) return false; return true; }
if (other.feature != null) return false; } else if (!feature.equals(other.feature)) return false; if (include != other.include)
if (other.specId != null) return false; } else if (!specId.equals(other.specId)) return false; if (unsetParams == null) {
@SuppressWarnings("unchecked") public B removeFeature(FeatureId id) throws ProvisioningDescriptionException { int index = -1; // Although that is a list, we have a single ConfigModel for a given ConfigId for (int i = 0; i < items.size(); i++) { ConfigItem ci = items.get(i); if (ci instanceof FeatureConfig) { FeatureConfig conf = (FeatureConfig) ci; if (conf.getSpecId().equals(id.getSpec())) { boolean eq = true; for (Entry<String, String> entry : id.getParams().entrySet()) { String val = conf.getParam(entry.getKey()); if (val == null || !val.equals(entry.getValue())) { eq = false; break; } } if (eq) { index = i; break; } } } } if (index == -1) { throw new ProvisioningDescriptionException("Feature " + id + " is not added"); } items = CollectionUtils.remove(items, index); return (B) this; }
private static FeatureConfig getExistingFeature(ConfigModel cm, FeatureId featId) { for (ConfigItem ci : cm.getItems()) { if (ci instanceof FeatureConfig) { FeatureConfig fi = (FeatureConfig) ci; if (fi.getSpecId().equals(featId.getSpec())) { boolean eq = true; for (String name : featId.getParamNames()) { String p = fi.getParam(name); if (p == null || !p.equals(featId.getParam(name))) { eq = false; break; } } if (eq) { return fi; } } } } return null; }