if (anotherGroup.hasItems()) {
Iterator<Map.Entry<String, AttributeItem>> otherItemEntries = anotherGroup.getItems().entrySet().iterator();
while (otherItemEntries.hasNext()) {
Map.Entry<String, AttributeItem> otherItemEntry = otherItemEntries.next();
String otherAttributeName = otherItemEntry.getKey();
AttributeItem item = this.items.get(otherAttributeName);
if (item == null) {
return false;
}
AttributeGroup group = item.getGroup();
AttributeGroup otherGroup = otherItemEntry.getValue().getGroup();
if (group != null) {
if (!group.isSupersetOf(otherGroup)) {
return false;
}
} else {
if (otherGroup != null) {
return true;
}
}
group = item.getKeyGroup();
otherGroup = otherItemEntry.getValue().getKeyGroup();
if (group != null) {
if (!group.isSupersetOf(otherGroup)) {
return false;
}
} else {
if (otherGroup != null) {
return true;
}
}
if (item.getGroups() != null){
if (otherItemEntry.getValue().getGroups() == null){
return true;
}
for (AttributeGroup element : item.getGroups().values()){
AttributeGroup otherElement = otherItemEntry.getValue().getGroups().get(element.getType());
if (!element.isSupersetOf(otherElement)) {
return false;
}
}
}
if (item.getKeyGroups() != null){
if (otherItemEntry.getValue().getKeyGroups() == null){
return true;
}
for (AttributeGroup element : item.getKeyGroups().values()){
AttributeGroup otherElement = otherItemEntry.getValue().getKeyGroups().get(element.getType());
if (!element.isSupersetOf(otherElement)) {
return false;
}
}