private boolean containsAttributeKey(final Attribute att) { for (AttributeGroupAttribute attributeGroupAttribute : this.attributeGroupAttributes) { Attribute thisAtt = attributeGroupAttribute.getAttribute(); if (thisAtt.getKey().equals(att.getKey())) { return true; } } return false; }
/** * Compares attribute sets on this and attribute group attribute set before an update and returns * a set of attributes that have been deleted. * * @param before attributeGroupAttribute set before an update. * @return set of attributes that have been deleted. */ public Set<Attribute> getRemovedAttributes(final Set<AttributeGroupAttribute> before) { Set<Attribute> returnSet = new HashSet<Attribute>(); if (before != null && !before.isEmpty()) { for (AttributeGroupAttribute attributeGroupAttribute : before) { Attribute attBefore = attributeGroupAttribute.getAttribute(); if (this.attributeGroupAttributes == null || this.attributeGroupAttributes.isEmpty() || !containsAttributeKey(attBefore)) { returnSet.add(attBefore); continue; } } } return returnSet; }