public List<ICFBamClearTopDepObj> readClearTopDepByContTblIdx(
     long TenantId, long ContTableId, boolean forceRead) {
   final String S_ProcName = "readClearTopDepByContTblIdx";
   CFBamClearTopDepByContTblIdxKey key =
       schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredContTableId(ContTableId);
   Map<CFBamScopePKey, ICFBamClearTopDepObj> dict;
   if (indexByContTblIdx == null) {
     indexByContTblIdx =
         new HashMap<CFBamClearTopDepByContTblIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>();
   }
   if ((!forceRead) && indexByContTblIdx.containsKey(key)) {
     dict = indexByContTblIdx.get(key);
   } else {
     dict = new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>();
     // Allow other threads to dirty-read while we're loading
     indexByContTblIdx.put(key, dict);
     ICFBamClearTopDepObj obj;
     CFBamClearTopDepBuff[] buffList =
         schema
             .getBackingStore()
             .getTableClearTopDep()
             .readDerivedByContTblIdx(schema.getAuthorization(), TenantId, ContTableId);
     CFBamClearTopDepBuff buff;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj =
           (ICFBamClearTopDepObj)
               schema.getScopeTableObj().constructByClassCode(buff.getClassCode());
       obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey());
       obj.setBuff(buff);
       ICFBamClearTopDepObj realized = (ICFBamClearTopDepObj) obj.realize();
     }
   }
   Comparator<ICFBamClearTopDepObj> cmp =
       new Comparator<ICFBamClearTopDepObj>() {
         public int compare(ICFBamClearTopDepObj lhs, ICFBamClearTopDepObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFBamScopePKey lhsPKey = lhs.getPKey();
             CFBamScopePKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = dict.size();
   ICFBamClearTopDepObj arr[] = new ICFBamClearTopDepObj[len];
   Iterator<ICFBamClearTopDepObj> 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<ICFBamClearTopDepObj> arrayList = new ArrayList<ICFBamClearTopDepObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFBamClearTopDepObj> sortedList = arrayList;
   return (sortedList);
 }
 public List<ICFBamClearTopDepObj> readAllClearTopDep(boolean forceRead) {
   final String S_ProcName = "readAllClearTopDep";
   if ((allClearTopDep == null) || forceRead) {
     Map<CFBamScopePKey, ICFBamClearTopDepObj> map =
         new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>();
     allClearTopDep = map;
     CFBamClearTopDepBuff[] buffList =
         schema.getBackingStore().getTableClearTopDep().readAllDerived(schema.getAuthorization());
     CFBamClearTopDepBuff buff;
     ICFBamClearTopDepObj obj;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj =
           (ICFBamClearTopDepObj)
               schema.getScopeTableObj().constructByClassCode(buff.getClassCode());
       obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey());
       obj.setBuff(buff);
       ICFBamClearTopDepObj realized = (ICFBamClearTopDepObj) obj.realize();
     }
   }
   Comparator<ICFBamClearTopDepObj> cmp =
       new Comparator<ICFBamClearTopDepObj>() {
         public int compare(ICFBamClearTopDepObj lhs, ICFBamClearTopDepObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFBamScopePKey lhsPKey = lhs.getPKey();
             CFBamScopePKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = allClearTopDep.size();
   ICFBamClearTopDepObj arr[] = new ICFBamClearTopDepObj[len];
   Iterator<ICFBamClearTopDepObj> valIter = allClearTopDep.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<ICFBamClearTopDepObj> arrayList = new ArrayList<ICFBamClearTopDepObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFBamClearTopDepObj> sortedList = arrayList;
   return (sortedList);
 }