public void deleteOptFullRange(
      CFSecurityAuthorization Authorization, CFDbTestOptFullRangeBuff Buff) {
    final String S_ProcName = "CFDbTestRamOptFullRangeTable.deleteOptFullRange() ";
    CFDbTestOptFullRangePKey pkey = schema.getFactoryOptFullRange().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFDbTestOptFullRangeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteOptFullRange", pkey);
    }
    CFDbTestOptFullRangeByUDescrIdxKey keyUDescrIdx =
        schema.getFactoryOptFullRange().newUDescrIdxKey();
    keyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    CFDbTestOptFullRangeByTenantIdxKey keyTenantIdx =
        schema.getFactoryOptFullRange().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    // Validate reverse foreign keys

    // Delete is valid

    Map<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff> subdict;

    dictByPKey.remove(pkey);

    dictByUDescrIdx.remove(keyUDescrIdx);

    subdict = dictByTenantIdx.get(keyTenantIdx);
    subdict.remove(pkey);
  }
  public void deleteSecDevice(CFSecurityAuthorization Authorization, CFSecuritySecDeviceBuff Buff) {
    final String S_ProcName = "CFAsteriskRamSecDeviceTable.deleteSecDevice() ";
    CFSecuritySecDevicePKey pkey = schema.getFactorySecDevice().newPKey();
    pkey.setRequiredSecUserId(Buff.getRequiredSecUserId());
    pkey.setRequiredDevName(Buff.getRequiredDevName());
    CFSecuritySecDeviceBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteSecDevice", pkey);
    }
    CFSecuritySecDeviceByUserIdxKey keyUserIdx = schema.getFactorySecDevice().newUserIdxKey();
    keyUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

    // Validate reverse foreign keys

    // Delete is valid

    Map<CFSecuritySecDevicePKey, CFSecuritySecDeviceBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByUserIdx.get(keyUserIdx);
    subdict.remove(pkey);
  }
  public void deleteLoaderBehaviour(
      CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourBuff Buff) {
    final String S_ProcName = "CFDbTestRamLoaderBehaviourTable.deleteLoaderBehaviour() ";
    CFDbTestLoaderBehaviourPKey pkey = schema.getFactoryLoaderBehaviour().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFDbTestLoaderBehaviourBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteLoaderBehaviour", pkey);
    }
    CFDbTestLoaderBehaviourByUNameIdxKey keyUNameIdx =
        schema.getFactoryLoaderBehaviour().newUNameIdxKey();
    keyUNameIdx.setRequiredName(existing.getRequiredName());

    // Validate reverse foreign keys

    // Delete is valid

    Map<CFDbTestLoaderBehaviourPKey, CFDbTestLoaderBehaviourBuff> subdict;

    dictByPKey.remove(pkey);

    dictByUNameIdx.remove(keyUNameIdx);
  }
  public void forgetSecDevice(ICFSecuritySecDeviceObj Obj, boolean forgetSubObjects) {
    ICFSecuritySecDeviceObj obj = Obj;
    CFSecuritySecDevicePKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFSecuritySecDeviceObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByUserIdx != null) {
        CFSecuritySecDeviceByUserIdxKey keyUserIdx =
            ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.remove(keepObj.getPKey());
        }
      }

      if (allSecDevice != null) {
        allSecDevice.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {}
    }
  }
  public void updateSecDevice(CFSecurityAuthorization Authorization, CFSecuritySecDeviceBuff Buff) {
    CFSecuritySecDevicePKey pkey = schema.getFactorySecDevice().newPKey();
    pkey.setRequiredSecUserId(Buff.getRequiredSecUserId());
    pkey.setRequiredDevName(Buff.getRequiredDevName());
    CFSecuritySecDeviceBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateSecDevice", "Existing record not found", "SecDevice", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateSecDevice", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecuritySecDeviceByUserIdxKey existingKeyUserIdx =
        schema.getFactorySecDevice().newUserIdxKey();
    existingKeyUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

    CFSecuritySecDeviceByUserIdxKey newKeyUserIdx = schema.getFactorySecDevice().newUserIdxKey();
    newKeyUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    // Check unique indexes

    // Validate foreign keys

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableSecUser()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredSecUserId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), "updateSecDevice", "Container", "SecDeviceSecUser", "SecUser", null);
        }
      }
    }

    // Update is valid

    Map<CFSecuritySecDevicePKey, CFSecuritySecDeviceBuff> subdict;

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

    subdict = dictByUserIdx.get(existingKeyUserIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByUserIdx.containsKey(newKeyUserIdx)) {
      subdict = dictByUserIdx.get(newKeyUserIdx);
    } else {
      subdict = new HashMap<CFSecuritySecDevicePKey, CFSecuritySecDeviceBuff>();
      dictByUserIdx.put(newKeyUserIdx, subdict);
    }
    subdict.put(pkey, Buff);
  }
  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 updateLoaderBehaviour(
      CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourBuff Buff) {
    CFDbTestLoaderBehaviourPKey pkey = schema.getFactoryLoaderBehaviour().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFDbTestLoaderBehaviourBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(),
              "updateLoaderBehaviour",
              "Existing record not found",
              "LoaderBehaviour",
              pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateLoaderBehaviour", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFDbTestLoaderBehaviourByUNameIdxKey existingKeyUNameIdx =
        schema.getFactoryLoaderBehaviour().newUNameIdxKey();
    existingKeyUNameIdx.setRequiredName(existing.getRequiredName());

    CFDbTestLoaderBehaviourByUNameIdxKey newKeyUNameIdx =
        schema.getFactoryLoaderBehaviour().newUNameIdxKey();
    newKeyUNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) {
      if (dictByUNameIdx.containsKey(newKeyUNameIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateLoaderBehaviour", "LoaderBehaviourUNameIdx", newKeyUNameIdx);
      }
    }

    // Validate foreign keys

    // Update is valid

    Map<CFDbTestLoaderBehaviourPKey, CFDbTestLoaderBehaviourBuff> subdict;

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

    dictByUNameIdx.remove(existingKeyUNameIdx);
    dictByUNameIdx.put(newKeyUNameIdx, Buff);
  }
  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 deleteCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) {
    final String S_ProcName = "CFDbTestRamClusterTable.deleteCluster() ";
    CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFSecurityClusterBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteCluster", pkey);
    }
    CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx =
        schema.getFactoryCluster().newUDomainNameIdxKey();
    keyUDomainNameIdx.setRequiredFullDomainName(existing.getRequiredFullDomainName());

    CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey();
    keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    // Validate reverse foreign keys

    // Delete is valid

    schema.getTableHostNode().deleteHostNodeByClusterIdx(Authorization, Buff.getRequiredId());
    schema.getTableTenant().deleteTenantByClusterIdx(Authorization, Buff.getRequiredId());
    schema.getTableSecApp().deleteSecAppByClusterIdx(Authorization, Buff.getRequiredId());
    schema.getTableSecGroup().deleteSecGroupByClusterIdx(Authorization, Buff.getRequiredId());
    schema.getTableSysCluster().deleteSysClusterByClusterIdx(Authorization, Buff.getRequiredId());
    Map<CFSecurityClusterPKey, CFSecurityClusterBuff> subdict;

    dictByPKey.remove(pkey);

    dictByUDomainNameIdx.remove(keyUDomainNameIdx);

    dictByUDescrIdx.remove(keyUDescrIdx);
  }
  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 deleteSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) {
    final String S_ProcName = "CFInternetRamSecFormTable.deleteSecForm() ";
    CFSecuritySecFormPKey pkey = schema.getFactorySecForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecFormId(Buff.getRequiredSecFormId());
    CFSecuritySecFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteSecForm", pkey);
    }
    CFSecuritySecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFSecuritySecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    keySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId());

    CFSecuritySecFormByUJEEServletIdxKey keyUJEEServletIdx =
        schema.getFactorySecForm().newUJEEServletIdxKey();
    keyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId());
    keyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName());

    // Validate reverse foreign keys

    // Delete is valid

    Map<CFSecuritySecFormPKey, CFSecuritySecFormBuff> subdict;

    dictByPKey.remove(pkey);

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

    subdict = dictBySecAppIdx.get(keySecAppIdx);
    subdict.remove(pkey);

    dictByUJEEServletIdx.remove(keyUJEEServletIdx);
  }
  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 deleteISOLanguage(
      CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) {
    final String S_ProcName = "CFInternetRamISOLanguageTable.deleteISOLanguage() ";
    CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
    pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
    CFSecurityISOLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteISOLanguage", pkey);
    }
    CFSecurityISOLanguageByCode3IdxKey keyCode3Idx =
        schema.getFactoryISOLanguage().newCode3IdxKey();
    keyCode3Idx.setRequiredISO6392Code(existing.getRequiredISO6392Code());

    CFSecurityISOLanguageByCode2IdxKey keyCode2Idx =
        schema.getFactoryISOLanguage().newCode2IdxKey();
    keyCode2Idx.setOptionalISO6391Code(existing.getOptionalISO6391Code());

    // Validate reverse foreign keys

    // Delete is valid

    schema
        .getTableISOCountryLanguage()
        .deleteISOCountryLanguageByLanguageIdx(Authorization, Buff.getRequiredISOLanguageId());
    Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdict;

    dictByPKey.remove(pkey);

    dictByCode3Idx.remove(keyCode3Idx);

    subdict = dictByCode2Idx.get(keyCode2Idx);
    subdict.remove(pkey);
  }
  public void updateISOLanguage(
      CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) {
    CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
    pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
    CFSecurityISOLanguageBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateISOLanguage", "Existing record not found", "ISOLanguage", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateISOLanguage", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecurityISOLanguageByCode3IdxKey existingKeyCode3Idx =
        schema.getFactoryISOLanguage().newCode3IdxKey();
    existingKeyCode3Idx.setRequiredISO6392Code(existing.getRequiredISO6392Code());

    CFSecurityISOLanguageByCode3IdxKey newKeyCode3Idx =
        schema.getFactoryISOLanguage().newCode3IdxKey();
    newKeyCode3Idx.setRequiredISO6392Code(Buff.getRequiredISO6392Code());

    CFSecurityISOLanguageByCode2IdxKey existingKeyCode2Idx =
        schema.getFactoryISOLanguage().newCode2IdxKey();
    existingKeyCode2Idx.setOptionalISO6391Code(existing.getOptionalISO6391Code());

    CFSecurityISOLanguageByCode2IdxKey newKeyCode2Idx =
        schema.getFactoryISOLanguage().newCode2IdxKey();
    newKeyCode2Idx.setOptionalISO6391Code(Buff.getOptionalISO6391Code());

    // Check unique indexes

    if (!existingKeyCode3Idx.equals(newKeyCode3Idx)) {
      if (dictByCode3Idx.containsKey(newKeyCode3Idx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateISOLanguage", "ISOLanguage6392Idx", newKeyCode3Idx);
      }
    }

    // Validate foreign keys

    // Update is valid

    Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdict;

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

    dictByCode3Idx.remove(existingKeyCode3Idx);
    dictByCode3Idx.put(newKeyCode3Idx, Buff);

    subdict = dictByCode2Idx.get(existingKeyCode2Idx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByCode2Idx.containsKey(newKeyCode2Idx)) {
      subdict = dictByCode2Idx.get(newKeyCode2Idx);
    } else {
      subdict = new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>();
      dictByCode2Idx.put(newKeyCode2Idx, subdict);
    }
    subdict.put(pkey, Buff);
  }
  public void updateSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) {
    CFSecuritySecFormPKey pkey = schema.getFactorySecForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecFormId(Buff.getRequiredSecFormId());
    CFSecuritySecFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateSecForm", "Existing record not found", "SecForm", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateSecForm", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecuritySecFormByClusterIdxKey existingKeyClusterIdx =
        schema.getFactorySecForm().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFSecuritySecFormByClusterIdxKey newKeyClusterIdx =
        schema.getFactorySecForm().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFSecuritySecFormBySecAppIdxKey existingKeySecAppIdx =
        schema.getFactorySecForm().newSecAppIdxKey();
    existingKeySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId());

    CFSecuritySecFormBySecAppIdxKey newKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    newKeySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());

    CFSecuritySecFormByUJEEServletIdxKey existingKeyUJEEServletIdx =
        schema.getFactorySecForm().newUJEEServletIdxKey();
    existingKeyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId());
    existingKeyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName());

    CFSecuritySecFormByUJEEServletIdxKey newKeyUJEEServletIdx =
        schema.getFactorySecForm().newUJEEServletIdxKey();
    newKeyUJEEServletIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUJEEServletIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());
    newKeyUJEEServletIdx.setRequiredJEEServletMapName(Buff.getRequiredJEEServletMapName());

    // Check unique indexes

    if (!existingKeyUJEEServletIdx.equals(newKeyUJEEServletIdx)) {
      if (dictByUJEEServletIdx.containsKey(newKeyUJEEServletIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateSecForm", "SecFormUJEEServletIdx", newKeyUJEEServletIdx);
      }
    }

    // Validate foreign keys

    {
      boolean allNull = true;

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

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableSecApp()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecAppId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), "updateSecForm", "Container", "SecFormApplication", "SecApp", null);
        }
      }
    }

    // Update is valid

    Map<CFSecuritySecFormPKey, CFSecuritySecFormBuff> 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<CFSecuritySecFormPKey, CFSecuritySecFormBuff>();
      dictByClusterIdx.put(newKeyClusterIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictBySecAppIdx.get(existingKeySecAppIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictBySecAppIdx.containsKey(newKeySecAppIdx)) {
      subdict = dictBySecAppIdx.get(newKeySecAppIdx);
    } else {
      subdict = new HashMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>();
      dictBySecAppIdx.put(newKeySecAppIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUJEEServletIdx.remove(existingKeyUJEEServletIdx);
    dictByUJEEServletIdx.put(newKeyUJEEServletIdx, Buff);
  }
  public ICFSecuritySecDeviceObj realizeSecDevice(ICFSecuritySecDeviceObj Obj) {
    ICFSecuritySecDeviceObj obj = Obj;
    CFSecuritySecDevicePKey pkey = obj.getPKey();
    ICFSecuritySecDeviceObj keepObj = null;
    if (members.containsKey(pkey) && (null != members.get(pkey))) {
      ICFSecuritySecDeviceObj 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 (indexByUserIdx != null) {
        CFSecuritySecDeviceByUserIdxKey keyUserIdx =
            ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.remove(keepObj.getPKey());
        }
      }

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

      if (indexByUserIdx != null) {
        CFSecuritySecDeviceByUserIdxKey keyUserIdx =
            ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.put(keepObj.getPKey(), keepObj);
        }
      }
      if (allSecDevice != null) {
        allSecDevice.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 (allSecDevice != null) {
        allSecDevice.put(keepObj.getPKey(), keepObj);
      }

      if (indexByUserIdx != null) {
        CFSecuritySecDeviceByUserIdxKey keyUserIdx =
            ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.put(keepObj.getPKey(), keepObj);
        }
      }
    }
    return (keepObj);
  }
  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);
  }