public ICFBamClearTopDepObj readClearTopDepByUNameIdx(
     long TenantId, long ContTableId, String Name, boolean forceRead) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFBamClearTopDepByUNameIdxKey, ICFBamClearTopDepObj>();
   }
   CFBamClearTopDepByUNameIdxKey key =
       schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredContTableId(ContTableId);
   key.setRequiredName(Name);
   ICFBamClearTopDepObj obj = null;
   if ((!forceRead) && indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
   } else {
     CFBamClearTopDepBuff buff =
         schema
             .getBackingStore()
             .getTableClearTopDep()
             .readDerivedByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name);
     if (buff != null) {
       obj =
           (ICFBamClearTopDepObj)
               schema.getScopeTableObj().constructByClassCode(buff.getClassCode());
       obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey());
       obj.setBuff(buff);
       obj = (ICFBamClearTopDepObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUNameIdx.put(key, null);
     }
   }
   return (obj);
 }
  public void forgetClearTopDepByUNameIdx(long TenantId, long ContTableId, String Name) {
    if (indexByUNameIdx == null) {
      return;
    }
    CFBamClearTopDepByUNameIdxKey key =
        schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
    key.setRequiredTenantId(TenantId);
    key.setRequiredContTableId(ContTableId);
    key.setRequiredName(Name);
    if (indexByUNameIdx.containsKey(key)) {
      ICFBamClearTopDepObj probed = indexByUNameIdx.get(key);
      if (probed != null) {
        probed.forget(true);
      }

      indexByUNameIdx.remove(key);
    }
  }
 public void deleteClearTopDepByUNameIdx(long TenantId, long ContTableId, String Name) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFBamClearTopDepByUNameIdxKey, ICFBamClearTopDepObj>();
   }
   CFBamClearTopDepByUNameIdxKey key =
       schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredContTableId(ContTableId);
   key.setRequiredName(Name);
   ICFBamClearTopDepObj obj = null;
   if (indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
     schema
         .getBackingStore()
         .getTableClearTopDep()
         .deleteClearTopDepByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name);
     obj.forget(true);
   } else {
     schema
         .getBackingStore()
         .getTableClearTopDep()
         .deleteClearTopDepByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name);
   }
 }
  public void forgetClearTopDep(ICFBamClearTopDepObj Obj, boolean forgetSubObjects) {
    ICFBamClearTopDepObj obj = Obj;
    CFBamScopePKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFBamClearTopDepObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByTenantIdx != null) {
        CFBamScopeByTenantIdxKey keyTenantIdx =
            schema.getBackingStore().getFactoryScope().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          indexByTenantIdx.remove(keyTenantIdx);
        }
      }

      if (indexByTableIdx != null) {
        CFBamClearDepByTableIdxKey keyTableIdx =
            schema.getBackingStore().getFactoryClearDep().newTableIdxKey();
        keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx);
        if (mapTableIdx != null) {
          indexByTableIdx.remove(keyTableIdx);
        }
      }

      if (indexByContTblIdx != null) {
        CFBamClearTopDepByContTblIdxKey keyContTblIdx =
            schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
        keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx =
            indexByContTblIdx.get(keyContTblIdx);
        if (mapContTblIdx != null) {
          mapContTblIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUNameIdx != null) {
        CFBamClearTopDepByUNameIdxKey keyUNameIdx =
            schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
        keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        keyUNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByUNameIdx.remove(keyUNameIdx);
      }

      if (allClearTopDep != null) {
        allClearTopDep.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {
        schema
            .getClearSubDep1TableObj()
            .forgetClearSubDep1ByContClearTopIdx(
                keepObj.getRequiredTenantId(), keepObj.getRequiredId());
      }
    }
    schema.getClearDepTableObj().forgetClearDep(obj);
  }
  public ICFBamClearTopDepObj realizeClearTopDep(ICFBamClearTopDepObj Obj) {
    ICFBamClearTopDepObj obj = Obj;
    CFBamScopePKey pkey = obj.getPKey();
    ICFBamClearTopDepObj keepObj = null;
    if (members.containsKey(pkey) && (null != members.get(pkey))) {
      ICFBamClearTopDepObj 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 (indexByTenantIdx != null) {
        CFBamScopeByTenantIdxKey keyTenantIdx =
            schema.getBackingStore().getFactoryScope().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          indexByTenantIdx.remove(keyTenantIdx);
        }
      }

      if (indexByTableIdx != null) {
        CFBamClearDepByTableIdxKey keyTableIdx =
            schema.getBackingStore().getFactoryClearDep().newTableIdxKey();
        keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx);
        if (mapTableIdx != null) {
          indexByTableIdx.remove(keyTableIdx);
        }
      }

      if (indexByContTblIdx != null) {
        CFBamClearTopDepByContTblIdxKey keyContTblIdx =
            schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
        keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx =
            indexByContTblIdx.get(keyContTblIdx);
        if (mapContTblIdx != null) {
          mapContTblIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUNameIdx != null) {
        CFBamClearTopDepByUNameIdxKey keyUNameIdx =
            schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
        keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        keyUNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByUNameIdx.remove(keyUNameIdx);
      }
      // Keep passing the new object because it's the one with the buffer
      // that the base table needs to copy to the existing object from
      // the cache.
      keepObj = (ICFBamClearTopDepObj) schema.getClearDepTableObj().realizeClearDep(Obj);

      // Attach new object to alternate and duplicate indexes -- PKey stay stable

      if (indexByTenantIdx != null) {
        CFBamScopeByTenantIdxKey keyTenantIdx =
            schema.getBackingStore().getFactoryScope().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByTableIdx != null) {
        CFBamClearDepByTableIdxKey keyTableIdx =
            schema.getBackingStore().getFactoryClearDep().newTableIdxKey();
        keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx);
        if (mapTableIdx != null) {
          mapTableIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByContTblIdx != null) {
        CFBamClearTopDepByContTblIdxKey keyContTblIdx =
            schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
        keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx =
            indexByContTblIdx.get(keyContTblIdx);
        if (mapContTblIdx != null) {
          mapContTblIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUNameIdx != null) {
        CFBamClearTopDepByUNameIdxKey keyUNameIdx =
            schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
        keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        keyUNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByUNameIdx.put(keyUNameIdx, keepObj);
      }
      if (allClearTopDep != null) {
        allClearTopDep.put(keepObj.getPKey(), keepObj);
      }
    } else {
      keepObj = obj;
      keepObj = (ICFBamClearTopDepObj) schema.getClearDepTableObj().realizeClearDep(keepObj);
      // Attach new object to PKey, all, alternate, and duplicate indexes
      members.put(keepObj.getPKey(), keepObj);
      if (allClearTopDep != null) {
        allClearTopDep.put(keepObj.getPKey(), keepObj);
      }

      if (indexByTenantIdx != null) {
        CFBamScopeByTenantIdxKey keyTenantIdx =
            schema.getBackingStore().getFactoryScope().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByTableIdx != null) {
        CFBamClearDepByTableIdxKey keyTableIdx =
            schema.getBackingStore().getFactoryClearDep().newTableIdxKey();
        keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx);
        if (mapTableIdx != null) {
          mapTableIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByContTblIdx != null) {
        CFBamClearTopDepByContTblIdxKey keyContTblIdx =
            schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
        keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx =
            indexByContTblIdx.get(keyContTblIdx);
        if (mapContTblIdx != null) {
          mapContTblIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUNameIdx != null) {
        CFBamClearTopDepByUNameIdxKey keyUNameIdx =
            schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
        keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        keyUNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByUNameIdx.put(keyUNameIdx, keepObj);
      }
    }
    return (keepObj);
  }