/**
  * INTERNAL: This method will insert the group into the entity hierarchy just below this
  * AttributeGroup.
  *
  * @param group
  */
 public void insertSubClass(CoreAttributeGroup group) {
   if (this == group) {
     return;
   }
   group.superClassGroup = this;
   if (subClasses != null) {
     for (Iterator<CoreAttributeGroup> subClasses = this.subClasses.iterator();
         subClasses.hasNext(); ) {
       CoreAttributeGroup subClass = subClasses.next();
       if (group != subClass && group.getType().isAssignableFrom(subClass.getType())) {
         group.subClasses.add(subClass);
         subClass.superClassGroup = group;
         subClasses.remove();
       }
     }
   } else {
     this.subClasses = new HashSet<CoreAttributeGroup>();
   }
   this.subClasses.add(group);
 }
 /**
  * INTERNAL: This method is used internally in the clone processing.
  *
  * @param cloneMap
  * @return
  */
 public CoreAttributeGroup clone(
     Map<
             CoreAttributeGroup<ATTRIBUTE_ITEM, DESCRIPTOR>,
             CoreAttributeGroup<ATTRIBUTE_ITEM, DESCRIPTOR>>
         cloneMap) {
   CoreAttributeGroup clone = cloneMap.get(this);
   if (clone != null) {
     return clone;
   }
   try {
     clone = (CoreAttributeGroup) super.clone();
   } catch (CloneNotSupportedException e) {
     throw new AssertionError(e);
   }
   clone.name = this.name;
   clone.type = this.type;
   clone.typeName = this.typeName;
   clone.isValidated = this.isValidated;
   cloneMap.put(this, clone);
   if (this.allsubclasses != null) {
     for (CoreAttributeGroup group : this.allsubclasses.values()) {
       clone.getSubClassGroups().put(group.getType(), group.clone(cloneMap));
     }
   }
   if (this.superClassGroup != null) {
     clone.superClassGroup = this.superClassGroup.clone(cloneMap);
   }
   if (this.subClasses != null) {
     clone.subClasses = new HashSet<CoreAttributeGroup>();
     for (CoreAttributeGroup group : this.subClasses) {
       clone.subClasses.add(group.clone(cloneMap));
     }
   }
   // all attributes and nested groups should be cloned, too
   clone.items = null;
   if (hasItems()) {
     clone.items = new HashMap<String, ATTRIBUTE_ITEM>();
     for (ATTRIBUTE_ITEM item : this.items.values()) {
       clone.items.put(item.getAttributeName(), item.clone(cloneMap, clone));
     }
   }
   return clone;
 }