public ICFSecuritySecGroupObj readSecGroupByUNameIdx(
     long ClusterId, String Name, boolean forceRead) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFSecuritySecGroupByUNameIdxKey, ICFSecuritySecGroupObj>();
   }
   CFSecuritySecGroupByUNameIdxKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredName(Name);
   ICFSecuritySecGroupObj obj = null;
   if ((!forceRead) && indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
   } else {
     CFSecuritySecGroupBuff buff =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableSecGroup()
             .readDerivedByUNameIdx(schema.getAuthorization(), ClusterId, Name);
     if (buff != null) {
       obj = schema.getSecGroupTableObj().newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecuritySecGroupObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUNameIdx.put(key, null);
     }
   }
   return (obj);
 }
 public ICFSecuritySecGroupObj updateSecGroup(ICFSecuritySecGroupObj Obj) {
   ICFSecuritySecGroupObj obj = Obj;
   ((ICFSecuritySchema) schema.getBackingStore())
       .getTableSecGroup()
       .updateSecGroup(schema.getAuthorization(), Obj.getSecGroupBuff());
   obj = (ICFSecuritySecGroupObj) Obj.realize();
   return (obj);
 }
 public ICFSecuritySecGroupObj createSecGroup(ICFSecuritySecGroupObj Obj) {
   ICFSecuritySecGroupObj obj = Obj;
   CFSecuritySecGroupBuff buff = obj.getSecGroupBuff();
   ((ICFSecuritySchema) schema.getBackingStore())
       .getTableSecGroup()
       .createSecGroup(schema.getAuthorization(), buff);
   obj.copyBuffToPKey();
   obj = obj.realize();
   return (obj);
 }
 public ICFSecuritySecGroupObj lockSecGroup(CFSecuritySecGroupPKey pkey) {
   ICFSecuritySecGroupObj locked = null;
   CFSecuritySecGroupBuff lockBuff =
       ((ICFSecuritySchema) schema.getBackingStore())
           .getTableSecGroup()
           .lockDerived(schema.getAuthorization(), pkey);
   if (lockBuff != null) {
     locked = schema.getSecGroupTableObj().newInstance();
     locked.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
     locked.setBuff(lockBuff);
     locked = (ICFSecuritySecGroupObj) locked.realize();
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newCollisionDetectedException(getClass(), "lockSecGroup", pkey);
   }
   return (locked);
 }
 public ICFSecuritySecGroupObj readSecGroup(CFSecuritySecGroupPKey pkey, boolean forceRead) {
   ICFSecuritySecGroupObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFSecuritySecGroupBuff readBuff =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableSecGroup()
             .readDerivedByIdIdx(
                 schema.getAuthorization(),
                 pkey.getRequiredClusterId(),
                 pkey.getRequiredSecGroupId());
     if (readBuff != null) {
       obj = schema.getSecGroupTableObj().newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFSecuritySecGroupObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
 public List<ICFSecuritySecGroupObj> readSecGroupByClusterIdx(long ClusterId, boolean forceRead) {
   final String S_ProcName = "readSecGroupByClusterIdx";
   CFSecuritySecGroupByClusterIdxKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey();
   key.setRequiredClusterId(ClusterId);
   Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> dict;
   if (indexByClusterIdx == null) {
     indexByClusterIdx =
         new HashMap<
             CFSecuritySecGroupByClusterIdxKey,
             Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj>>();
   }
   if ((!forceRead) && indexByClusterIdx.containsKey(key)) {
     dict = indexByClusterIdx.get(key);
   } else {
     dict = new HashMap<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj>();
     // Allow other threads to dirty-read while we're loading
     indexByClusterIdx.put(key, dict);
     ICFSecuritySecGroupObj obj;
     CFSecuritySecGroupBuff[] buffList =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableSecGroup()
             .readDerivedByClusterIdx(schema.getAuthorization(), ClusterId);
     CFSecuritySecGroupBuff buff;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj = schema.getSecGroupTableObj().newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
       obj.setBuff(buff);
       ICFSecuritySecGroupObj realized = (ICFSecuritySecGroupObj) obj.realize();
     }
   }
   Comparator<ICFSecuritySecGroupObj> cmp =
       new Comparator<ICFSecuritySecGroupObj>() {
         public int compare(ICFSecuritySecGroupObj lhs, ICFSecuritySecGroupObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFSecuritySecGroupPKey lhsPKey = lhs.getPKey();
             CFSecuritySecGroupPKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = dict.size();
   ICFSecuritySecGroupObj arr[] = new ICFSecuritySecGroupObj[len];
   Iterator<ICFSecuritySecGroupObj> 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<ICFSecuritySecGroupObj> arrayList = new ArrayList<ICFSecuritySecGroupObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFSecuritySecGroupObj> sortedList = arrayList;
   return (sortedList);
 }
 public List<ICFSecuritySecGroupObj> readAllSecGroup(boolean forceRead) {
   final String S_ProcName = "readAllSecGroup";
   if ((allSecGroup == null) || forceRead) {
     Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> map =
         new HashMap<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj>();
     allSecGroup = map;
     CFSecuritySecGroupBuff[] buffList =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableSecGroup()
             .readAllDerived(schema.getAuthorization());
     CFSecuritySecGroupBuff buff;
     ICFSecuritySecGroupObj obj;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj = newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
       obj.setBuff(buff);
       ICFSecuritySecGroupObj realized = (ICFSecuritySecGroupObj) obj.realize();
     }
   }
   Comparator<ICFSecuritySecGroupObj> cmp =
       new Comparator<ICFSecuritySecGroupObj>() {
         public int compare(ICFSecuritySecGroupObj lhs, ICFSecuritySecGroupObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFSecuritySecGroupPKey lhsPKey = lhs.getPKey();
             CFSecuritySecGroupPKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = allSecGroup.size();
   ICFSecuritySecGroupObj arr[] = new ICFSecuritySecGroupObj[len];
   Iterator<ICFSecuritySecGroupObj> valIter = allSecGroup.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<ICFSecuritySecGroupObj> arrayList = new ArrayList<ICFSecuritySecGroupObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFSecuritySecGroupObj> sortedList = arrayList;
   return (sortedList);
 }