public ICFSecurityTenantObj readTenantByUNameIdx(
     long ClusterId, String TenantName, boolean forceRead) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFSecurityTenantByUNameIdxKey, ICFSecurityTenantObj>();
   }
   CFSecurityTenantByUNameIdxKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredTenantName(TenantName);
   ICFSecurityTenantObj obj = null;
   if ((!forceRead) && indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
   } else {
     CFSecurityTenantBuff buff =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableTenant()
             .readDerivedByUNameIdx(schema.getAuthorization(), ClusterId, TenantName);
     if (buff != null) {
       obj = schema.getTenantTableObj().newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecurityTenantObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUNameIdx.put(key, null);
     }
   }
   return (obj);
 }
  public void forgetTenantByUNameIdx(long ClusterId, String TenantName) {
    if (indexByUNameIdx == null) {
      return;
    }
    CFSecurityTenantByUNameIdxKey key =
        ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
    key.setRequiredClusterId(ClusterId);
    key.setRequiredTenantName(TenantName);
    if (indexByUNameIdx.containsKey(key)) {
      ICFSecurityTenantObj probed = indexByUNameIdx.get(key);
      if (probed != null) {
        probed.forget(true);
      }

      indexByUNameIdx.remove(key);
    }
  }
 public void deleteTenantByUNameIdx(long ClusterId, String TenantName) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFSecurityTenantByUNameIdxKey, ICFSecurityTenantObj>();
   }
   CFSecurityTenantByUNameIdxKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredTenantName(TenantName);
   ICFSecurityTenantObj obj = null;
   if (indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
     ((ICFSecuritySchema) schema.getBackingStore())
         .getTableTenant()
         .deleteTenantByUNameIdx(schema.getAuthorization(), ClusterId, TenantName);
     obj.forget(true);
   } else {
     ((ICFSecuritySchema) schema.getBackingStore())
         .getTableTenant()
         .deleteTenantByUNameIdx(schema.getAuthorization(), ClusterId, TenantName);
   }
 }
  public void forgetTenant(ICFSecurityTenantObj Obj, boolean forgetSubObjects) {
    ICFSecurityTenantObj obj = Obj;
    CFSecurityTenantPKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFSecurityTenantObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByClusterIdx != null) {
        CFSecurityTenantByClusterIdxKey keyClusterIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUNameIdx != null) {
        CFSecurityTenantByUNameIdxKey keyUNameIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
        keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName());
        indexByUNameIdx.remove(keyUNameIdx);
      }

      if (allTenant != null) {
        allTenant.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {
        ((ICFSecuritySchemaObj) schema)
            .getTSecGroupTableObj()
            .forgetTSecGroupByTenantIdx(keepObj.getRequiredId());
      }
    }
  }
  public ICFSecurityTenantObj realizeTenant(ICFSecurityTenantObj Obj) {
    ICFSecurityTenantObj obj = Obj;
    CFSecurityTenantPKey pkey = obj.getPKey();
    ICFSecurityTenantObj keepObj = null;
    if (members.containsKey(pkey) && (null != members.get(pkey))) {
      ICFSecurityTenantObj 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) {
        CFSecurityTenantByClusterIdxKey keyClusterIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUNameIdx != null) {
        CFSecurityTenantByUNameIdxKey keyUNameIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
        keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName());
        indexByUNameIdx.remove(keyUNameIdx);
      }

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

      if (indexByClusterIdx != null) {
        CFSecurityTenantByClusterIdxKey keyClusterIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUNameIdx != null) {
        CFSecurityTenantByUNameIdxKey keyUNameIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
        keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName());
        indexByUNameIdx.put(keyUNameIdx, keepObj);
      }
      if (allTenant != null) {
        allTenant.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 (allTenant != null) {
        allTenant.put(keepObj.getPKey(), keepObj);
      }

      if (indexByClusterIdx != null) {
        CFSecurityTenantByClusterIdxKey keyClusterIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUNameIdx != null) {
        CFSecurityTenantByUNameIdxKey keyUNameIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
        keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName());
        indexByUNameIdx.put(keyUNameIdx, keepObj);
      }
    }
    return (keepObj);
  }