public void forgetSecGroupIncludeByGroupIdx(long ClusterId, int SecGroupId) {
    if (indexByGroupIdx == null) {
      return;
    }
    CFSecuritySecGroupIncludeByGroupIdxKey key =
        ((ICFInternetSchema) schema.getBackingStore()).getFactorySecGroupInclude().newGroupIdxKey();
    key.setRequiredClusterId(ClusterId);
    key.setRequiredSecGroupId(SecGroupId);
    if (indexByGroupIdx.containsKey(key)) {
      Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapGroupIdx =
          indexByGroupIdx.get(key);
      if (mapGroupIdx != null) {
        List<ICFSecuritySecGroupIncludeObj> toForget =
            new LinkedList<ICFSecuritySecGroupIncludeObj>();
        ICFSecuritySecGroupIncludeObj cur = null;
        Iterator<ICFSecuritySecGroupIncludeObj> iter = mapGroupIdx.values().iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          toForget.add(cur);
        }
        iter = toForget.iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          cur.forget(true);
        }
      }

      indexByGroupIdx.remove(key);
    }
  }
 public void deleteSecGroupIncludeByGroupIdx(long ClusterId, int SecGroupId) {
   CFSecuritySecGroupIncludeByGroupIdxKey key =
       ((ICFInternetSchema) schema.getBackingStore()).getFactorySecGroupInclude().newGroupIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredSecGroupId(SecGroupId);
   if (indexByGroupIdx == null) {
     indexByGroupIdx =
         new HashMap<
             CFSecuritySecGroupIncludeByGroupIdxKey,
             Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj>>();
   }
   if (indexByGroupIdx.containsKey(key)) {
     Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> dict =
         indexByGroupIdx.get(key);
     ((ICFInternetSchema) schema.getBackingStore())
         .getTableSecGroupInclude()
         .deleteSecGroupIncludeByGroupIdx(schema.getAuthorization(), ClusterId, SecGroupId);
     Iterator<ICFSecuritySecGroupIncludeObj> iter = dict.values().iterator();
     ICFSecuritySecGroupIncludeObj obj;
     List<ICFSecuritySecGroupIncludeObj> toForget =
         new LinkedList<ICFSecuritySecGroupIncludeObj>();
     while (iter.hasNext()) {
       obj = iter.next();
       toForget.add(obj);
     }
     iter = toForget.iterator();
     while (iter.hasNext()) {
       obj = iter.next();
       obj.forget(true);
     }
     indexByGroupIdx.remove(key);
   } else {
     ((ICFInternetSchema) schema.getBackingStore())
         .getTableSecGroupInclude()
         .deleteSecGroupIncludeByGroupIdx(schema.getAuthorization(), ClusterId, SecGroupId);
   }
 }
 public List<ICFSecuritySecGroupIncludeObj> readSecGroupIncludeByGroupIdx(
     long ClusterId, int SecGroupId, boolean forceRead) {
   final String S_ProcName = "readSecGroupIncludeByGroupIdx";
   CFSecuritySecGroupIncludeByGroupIdxKey key =
       ((ICFInternetSchema) schema.getBackingStore()).getFactorySecGroupInclude().newGroupIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredSecGroupId(SecGroupId);
   Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> dict;
   if (indexByGroupIdx == null) {
     indexByGroupIdx =
         new HashMap<
             CFSecuritySecGroupIncludeByGroupIdxKey,
             Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj>>();
   }
   if ((!forceRead) && indexByGroupIdx.containsKey(key)) {
     dict = indexByGroupIdx.get(key);
   } else {
     dict = new HashMap<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj>();
     // Allow other threads to dirty-read while we're loading
     indexByGroupIdx.put(key, dict);
     ICFSecuritySecGroupIncludeObj obj;
     CFSecuritySecGroupIncludeBuff[] buffList =
         ((ICFInternetSchema) schema.getBackingStore())
             .getTableSecGroupInclude()
             .readDerivedByGroupIdx(schema.getAuthorization(), ClusterId, SecGroupId);
     CFSecuritySecGroupIncludeBuff buff;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj = schema.getSecGroupIncludeTableObj().newInstance();
       obj.setPKey(
           ((ICFInternetSchema) schema.getBackingStore()).getFactorySecGroupInclude().newPKey());
       obj.setBuff(buff);
       ICFSecuritySecGroupIncludeObj realized = (ICFSecuritySecGroupIncludeObj) obj.realize();
     }
   }
   Comparator<ICFSecuritySecGroupIncludeObj> cmp =
       new Comparator<ICFSecuritySecGroupIncludeObj>() {
         public int compare(ICFSecuritySecGroupIncludeObj lhs, ICFSecuritySecGroupIncludeObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFSecuritySecGroupIncludePKey lhsPKey = lhs.getPKey();
             CFSecuritySecGroupIncludePKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = dict.size();
   ICFSecuritySecGroupIncludeObj arr[] = new ICFSecuritySecGroupIncludeObj[len];
   Iterator<ICFSecuritySecGroupIncludeObj> valIter = dict.values().iterator();
   int idx = 0;
   while ((idx < len) && valIter.hasNext()) {
     arr[idx++] = valIter.next();
   }
   if (idx < len) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   } else if (valIter.hasNext()) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   }
   Arrays.sort(arr, cmp);
   ArrayList<ICFSecuritySecGroupIncludeObj> arrayList =
       new ArrayList<ICFSecuritySecGroupIncludeObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFSecuritySecGroupIncludeObj> sortedList = arrayList;
   return (sortedList);
 }
  public void forgetSecGroupInclude(ICFSecuritySecGroupIncludeObj Obj, boolean forgetSubObjects) {
    ICFSecuritySecGroupIncludeObj obj = Obj;
    CFSecuritySecGroupIncludePKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFSecuritySecGroupIncludeObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByClusterIdx != null) {
        CFSecuritySecGroupIncludeByClusterIdxKey keyClusterIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByGroupIdx != null) {
        CFSecuritySecGroupIncludeByGroupIdxKey keyGroupIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newGroupIdxKey();
        keyGroupIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyGroupIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByIncludeIdx != null) {
        CFSecuritySecGroupIncludeByIncludeIdxKey keyIncludeIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newIncludeIdxKey();
        keyIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapIncludeIdx =
            indexByIncludeIdx.get(keyIncludeIdx);
        if (mapIncludeIdx != null) {
          mapIncludeIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUIncludeIdx != null) {
        CFSecuritySecGroupIncludeByUIncludeIdxKey keyUIncludeIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newUIncludeIdxKey();
        keyUIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUIncludeIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        keyUIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        indexByUIncludeIdx.remove(keyUIncludeIdx);
      }

      if (allSecGroupInclude != null) {
        allSecGroupInclude.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {}
    }
  }
  public ICFSecuritySecGroupIncludeObj realizeSecGroupInclude(ICFSecuritySecGroupIncludeObj Obj) {
    ICFSecuritySecGroupIncludeObj obj = Obj;
    CFSecuritySecGroupIncludePKey pkey = obj.getPKey();
    ICFSecuritySecGroupIncludeObj keepObj = null;
    if (members.containsKey(pkey) && (null != members.get(pkey))) {
      ICFSecuritySecGroupIncludeObj existingObj = members.get(pkey);
      keepObj = existingObj;

      /*
       *	We always rebind the data because if we're being called, some index has
       *	been updated and is refreshing it's data, which may or may not have changed
       */

      // Detach object from alternate and duplicate indexes, leave PKey alone

      if (indexByClusterIdx != null) {
        CFSecuritySecGroupIncludeByClusterIdxKey keyClusterIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByGroupIdx != null) {
        CFSecuritySecGroupIncludeByGroupIdxKey keyGroupIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newGroupIdxKey();
        keyGroupIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyGroupIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByIncludeIdx != null) {
        CFSecuritySecGroupIncludeByIncludeIdxKey keyIncludeIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newIncludeIdxKey();
        keyIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapIncludeIdx =
            indexByIncludeIdx.get(keyIncludeIdx);
        if (mapIncludeIdx != null) {
          mapIncludeIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUIncludeIdx != null) {
        CFSecuritySecGroupIncludeByUIncludeIdxKey keyUIncludeIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newUIncludeIdxKey();
        keyUIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUIncludeIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        keyUIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        indexByUIncludeIdx.remove(keyUIncludeIdx);
      }

      keepObj.setBuff(Obj.getBuff());
      // Attach new object to alternate and duplicate indexes -- PKey stay stable

      if (indexByClusterIdx != null) {
        CFSecuritySecGroupIncludeByClusterIdxKey keyClusterIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByGroupIdx != null) {
        CFSecuritySecGroupIncludeByGroupIdxKey keyGroupIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newGroupIdxKey();
        keyGroupIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyGroupIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByIncludeIdx != null) {
        CFSecuritySecGroupIncludeByIncludeIdxKey keyIncludeIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newIncludeIdxKey();
        keyIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapIncludeIdx =
            indexByIncludeIdx.get(keyIncludeIdx);
        if (mapIncludeIdx != null) {
          mapIncludeIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUIncludeIdx != null) {
        CFSecuritySecGroupIncludeByUIncludeIdxKey keyUIncludeIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newUIncludeIdxKey();
        keyUIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUIncludeIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        keyUIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        indexByUIncludeIdx.put(keyUIncludeIdx, keepObj);
      }
      if (allSecGroupInclude != null) {
        allSecGroupInclude.put(keepObj.getPKey(), keepObj);
      }
    } else {
      keepObj = obj;
      keepObj.setIsNew(false);
      // Attach new object to PKey, all, alternate, and duplicate indexes
      members.put(keepObj.getPKey(), keepObj);
      if (allSecGroupInclude != null) {
        allSecGroupInclude.put(keepObj.getPKey(), keepObj);
      }

      if (indexByClusterIdx != null) {
        CFSecuritySecGroupIncludeByClusterIdxKey keyClusterIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByGroupIdx != null) {
        CFSecuritySecGroupIncludeByGroupIdxKey keyGroupIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newGroupIdxKey();
        keyGroupIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyGroupIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByIncludeIdx != null) {
        CFSecuritySecGroupIncludeByIncludeIdxKey keyIncludeIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newIncludeIdxKey();
        keyIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapIncludeIdx =
            indexByIncludeIdx.get(keyIncludeIdx);
        if (mapIncludeIdx != null) {
          mapIncludeIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUIncludeIdx != null) {
        CFSecuritySecGroupIncludeByUIncludeIdxKey keyUIncludeIdx =
            ((ICFInternetSchema) schema.getBackingStore())
                .getFactorySecGroupInclude()
                .newUIncludeIdxKey();
        keyUIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUIncludeIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        keyUIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        indexByUIncludeIdx.put(keyUIncludeIdx, keepObj);
      }
    }
    return (keepObj);
  }