public void forgetDomain(ICFInternetDomainObj Obj, boolean forgetSubObjects) {
    ICFInternetDomainObj obj = Obj;
    CFInternetDomainBasePKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFInternetDomainObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByTenantIdx != null) {
        CFInternetDomainBaseByTenantIdxKey keyTenantIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx =
            indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          indexByTenantIdx.remove(keyTenantIdx);
        }
      }

      if (indexBySubDomIdx != null) {
        CFInternetDomainBySubDomIdxKey keySubDomIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey();
        keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId());
        Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx =
            indexBySubDomIdx.get(keySubDomIdx);
        if (mapSubDomIdx != null) {
          mapSubDomIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByNameIdx != null) {
        CFInternetDomainByNameIdxKey keyNameIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey();
        keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId());
        keyNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByNameIdx.remove(keyNameIdx);
      }

      if (allDomain != null) {
        allDomain.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {
        ((ICFInternetSchemaObj) schema)
            .getTopProjectTableObj()
            .forgetTopProjectByDomainIdx(keepObj.getRequiredTenantId(), keepObj.getRequiredId());
      }
    }
    ((ICFBamSchemaObj) schema).getDomainBaseTableObj().forgetDomainBase(obj);
  }
  public void deleteHostNode(CFSecurityAuthorization Authorization, CFSecurityHostNodeBuff Buff) {
    final String S_ProcName = "CFBamRamHostNodeTable.deleteHostNode() ";
    CFSecurityHostNodePKey pkey = schema.getFactoryHostNode().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredHostNodeId(Buff.getRequiredHostNodeId());
    CFSecurityHostNodeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteHostNode", pkey);
    }
    CFSecurityHostNodeByClusterIdxKey keyClusterIdx =
        schema.getFactoryHostNode().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFSecurityHostNodeByUDescrIdxKey keyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey();
    keyUDescrIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    CFSecurityHostNodeByHostNameIdxKey keyHostNameIdx =
        schema.getFactoryHostNode().newHostNameIdxKey();
    keyHostNameIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyHostNameIdx.setRequiredHostName(existing.getRequiredHostName());

    // Validate reverse foreign keys

    // Delete is valid

    schema
        .getTableService()
        .deleteServiceByHostIdx(
            Authorization, Buff.getRequiredClusterId(), Buff.getRequiredHostNodeId());
    Map<CFSecurityHostNodePKey, CFSecurityHostNodeBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByClusterIdx.get(keyClusterIdx);
    subdict.remove(pkey);

    dictByUDescrIdx.remove(keyUDescrIdx);

    dictByHostNameIdx.remove(keyHostNameIdx);
  }
  public void forgetDomainByNameIdx(long TenantId, long SubDomainOfId, String Name) {
    if (indexByNameIdx == null) {
      return;
    }
    CFInternetDomainByNameIdxKey key =
        ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey();
    key.setRequiredTenantId(TenantId);
    key.setRequiredSubDomainOfId(SubDomainOfId);
    key.setRequiredName(Name);
    if (indexByNameIdx.containsKey(key)) {
      ICFInternetDomainObj probed = indexByNameIdx.get(key);
      if (probed != null) {
        probed.forget(true);
      }

      indexByNameIdx.remove(key);
    }
  }
  public void deleteUuidDef(CFSecurityAuthorization Authorization, CFBamUuidDefBuff Buff) {
    final String S_ProcName = "CFBamRamUuidDefTable.deleteUuidDef() ";
    CFBamValuePKey pkey = schema.getFactoryValue().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFBamUuidDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteUuidDef", pkey);
    }

    // Validate reverse foreign keys

    if (schema
            .getTableUuidCol()
            .readDerivedByIdIdx(
                Authorization, existing.getRequiredTenantId(), existing.getRequiredId())
        != null) {
      throw CFLib.getDefaultExceptionFactory()
          .newDependentsDetectedException(
              getClass(), "deleteUuidDef", "Superclass", "SuperClass", "UuidCol", pkey);
    }

    if (schema
            .getTableUuidType()
            .readDerivedByIdIdx(
                Authorization, existing.getRequiredTenantId(), existing.getRequiredId())
        != null) {
      throw CFLib.getDefaultExceptionFactory()
          .newDependentsDetectedException(
              getClass(), "deleteUuidDef", "Superclass", "SuperClass", "UuidType", pkey);
    }

    // Delete is valid

    Map<CFBamValuePKey, CFBamUuidDefBuff> subdict;

    dictByPKey.remove(pkey);

    schema.getTableAtom().deleteAtom(Authorization, Buff);
  }
  public void updateUuidDef(CFSecurityAuthorization Authorization, CFBamUuidDefBuff Buff) {
    schema.getTableAtom().updateAtom(Authorization, Buff);
    CFBamValuePKey pkey = schema.getFactoryValue().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFBamUuidDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateUuidDef", "Existing record not found", "UuidDef", pkey);
    }
    // Check unique indexes

    // Validate foreign keys

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableAtom()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), "updateUuidDef", "Superclass", "SuperClass", "Atom", null);
        }
      }
    }

    // Update is valid

    Map<CFBamValuePKey, CFBamUuidDefBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.put(pkey, Buff);
  }
  public void updateService(CFSecurityAuthorization Authorization, CFSecurityServiceBuff Buff) {
    CFSecurityServicePKey pkey = schema.getFactoryService().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredServiceId(Buff.getRequiredServiceId());
    CFSecurityServiceBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateService", "Existing record not found", "Service", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateService", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecurityServiceByClusterIdxKey existingKeyClusterIdx =
        schema.getFactoryService().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFSecurityServiceByClusterIdxKey newKeyClusterIdx =
        schema.getFactoryService().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFSecurityServiceByHostIdxKey existingKeyHostIdx = schema.getFactoryService().newHostIdxKey();
    existingKeyHostIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyHostIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId());

    CFSecurityServiceByHostIdxKey newKeyHostIdx = schema.getFactoryService().newHostIdxKey();
    newKeyHostIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyHostIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId());

    CFSecurityServiceByTypeIdxKey existingKeyTypeIdx = schema.getFactoryService().newTypeIdxKey();
    existingKeyTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId());

    CFSecurityServiceByTypeIdxKey newKeyTypeIdx = schema.getFactoryService().newTypeIdxKey();
    newKeyTypeIdx.setRequiredServiceTypeId(Buff.getRequiredServiceTypeId());

    CFSecurityServiceByUTypeIdxKey existingKeyUTypeIdx =
        schema.getFactoryService().newUTypeIdxKey();
    existingKeyUTypeIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUTypeIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId());
    existingKeyUTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId());

    CFSecurityServiceByUTypeIdxKey newKeyUTypeIdx = schema.getFactoryService().newUTypeIdxKey();
    newKeyUTypeIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUTypeIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId());
    newKeyUTypeIdx.setRequiredServiceTypeId(Buff.getRequiredServiceTypeId());

    CFSecurityServiceByUHostPortIdxKey existingKeyUHostPortIdx =
        schema.getFactoryService().newUHostPortIdxKey();
    existingKeyUHostPortIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUHostPortIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId());
    existingKeyUHostPortIdx.setRequiredHostPort(existing.getRequiredHostPort());

    CFSecurityServiceByUHostPortIdxKey newKeyUHostPortIdx =
        schema.getFactoryService().newUHostPortIdxKey();
    newKeyUHostPortIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUHostPortIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId());
    newKeyUHostPortIdx.setRequiredHostPort(Buff.getRequiredHostPort());

    // Check unique indexes

    if (!existingKeyUTypeIdx.equals(newKeyUTypeIdx)) {
      if (dictByUTypeIdx.containsKey(newKeyUTypeIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateService", "ServiceUTypeIdx", newKeyUTypeIdx);
      }
    }

    if (!existingKeyUHostPortIdx.equals(newKeyUHostPortIdx)) {
      if (dictByUHostPortIdx.containsKey(newKeyUHostPortIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateService", "ServiceUHostPort", newKeyUHostPortIdx);
      }
    }

    // Validate foreign keys

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableCluster()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), "updateService", "Owner", "ServiceCluster", "Cluster", null);
        }
      }
    }

    // Update is valid

    Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.put(pkey, Buff);

    subdict = dictByClusterIdx.get(existingKeyClusterIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByClusterIdx.containsKey(newKeyClusterIdx)) {
      subdict = dictByClusterIdx.get(newKeyClusterIdx);
    } else {
      subdict = new HashMap<CFSecurityServicePKey, CFSecurityServiceBuff>();
      dictByClusterIdx.put(newKeyClusterIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByHostIdx.get(existingKeyHostIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByHostIdx.containsKey(newKeyHostIdx)) {
      subdict = dictByHostIdx.get(newKeyHostIdx);
    } else {
      subdict = new HashMap<CFSecurityServicePKey, CFSecurityServiceBuff>();
      dictByHostIdx.put(newKeyHostIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByTypeIdx.get(existingKeyTypeIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByTypeIdx.containsKey(newKeyTypeIdx)) {
      subdict = dictByTypeIdx.get(newKeyTypeIdx);
    } else {
      subdict = new HashMap<CFSecurityServicePKey, CFSecurityServiceBuff>();
      dictByTypeIdx.put(newKeyTypeIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUTypeIdx.remove(existingKeyUTypeIdx);
    dictByUTypeIdx.put(newKeyUTypeIdx, Buff);

    dictByUHostPortIdx.remove(existingKeyUHostPortIdx);
    dictByUHostPortIdx.put(newKeyUHostPortIdx, Buff);
  }
  public ICFInternetDomainObj realizeDomain(ICFInternetDomainObj Obj) {
    ICFInternetDomainObj obj = Obj;
    CFInternetDomainBasePKey pkey = obj.getPKey();
    ICFInternetDomainObj keepObj = null;
    if (members.containsKey(pkey) && (null != members.get(pkey))) {
      ICFInternetDomainObj 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) {
        CFInternetDomainBaseByTenantIdxKey keyTenantIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx =
            indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          indexByTenantIdx.remove(keyTenantIdx);
        }
      }

      if (indexBySubDomIdx != null) {
        CFInternetDomainBySubDomIdxKey keySubDomIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey();
        keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId());
        Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx =
            indexBySubDomIdx.get(keySubDomIdx);
        if (mapSubDomIdx != null) {
          mapSubDomIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByNameIdx != null) {
        CFInternetDomainByNameIdxKey keyNameIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey();
        keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId());
        keyNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByNameIdx.remove(keyNameIdx);
      }
      // 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 = (ICFInternetDomainObj) schema.getDomainBaseTableObj().realizeDomainBase(Obj);

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

      if (indexByTenantIdx != null) {
        CFInternetDomainBaseByTenantIdxKey keyTenantIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx =
            indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexBySubDomIdx != null) {
        CFInternetDomainBySubDomIdxKey keySubDomIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey();
        keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId());
        Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx =
            indexBySubDomIdx.get(keySubDomIdx);
        if (mapSubDomIdx != null) {
          mapSubDomIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByNameIdx != null) {
        CFInternetDomainByNameIdxKey keyNameIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey();
        keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId());
        keyNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByNameIdx.put(keyNameIdx, keepObj);
      }
      if (allDomain != null) {
        allDomain.put(keepObj.getPKey(), keepObj);
      }
    } else {
      keepObj = obj;
      keepObj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().realizeDomainBase(keepObj);
      // Attach new object to PKey, all, alternate, and duplicate indexes
      members.put(keepObj.getPKey(), keepObj);
      if (allDomain != null) {
        allDomain.put(keepObj.getPKey(), keepObj);
      }

      if (indexByTenantIdx != null) {
        CFInternetDomainBaseByTenantIdxKey keyTenantIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx =
            indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexBySubDomIdx != null) {
        CFInternetDomainBySubDomIdxKey keySubDomIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey();
        keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId());
        Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx =
            indexBySubDomIdx.get(keySubDomIdx);
        if (mapSubDomIdx != null) {
          mapSubDomIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByNameIdx != null) {
        CFInternetDomainByNameIdxKey keyNameIdx =
            ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey();
        keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId());
        keyNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByNameIdx.put(keyNameIdx, keepObj);
      }
    }
    return (keepObj);
  }