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 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 CFSecurityClusterBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization, long Id) {
    final String S_ProcName = "CFDbTestRamCluster.readDerivedByIdIdx() ";
    CFSecurityClusterPKey key = schema.getFactoryCluster().newPKey();
    key.setRequiredId(Id);

    CFSecurityClusterBuff buff;
    if (dictByPKey.containsKey(key)) {
      buff = dictByPKey.get(key);
    } else {
      buff = null;
    }
    return (buff);
  }
 public CFDbTestOptFullRangeBuff lockDerived(
     CFSecurityAuthorization Authorization, CFDbTestOptFullRangePKey PKey) {
   final String S_ProcName = "CFDbTestRamOptFullRange.readDerived";
   CFDbTestOptFullRangePKey key = schema.getFactoryOptFullRange().newPKey();
   key.setRequiredId(PKey.getRequiredId());
   CFDbTestOptFullRangeBuff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
 public CFDbTestLoaderBehaviourBuff readDerived(
     CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourPKey PKey) {
   final String S_ProcName = "CFDbTestRamLoaderBehaviour.readDerived";
   CFDbTestLoaderBehaviourPKey key = schema.getFactoryLoaderBehaviour().newPKey();
   key.setRequiredId(PKey.getRequiredId());
   CFDbTestLoaderBehaviourBuff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
  public CFSecurityClusterBuff readDerivedByUDescrIdx(
      CFSecurityAuthorization Authorization, String Description) {
    final String S_ProcName = "CFDbTestRamCluster.readDerivedByUDescrIdx";
    CFSecurityClusterByUDescrIdxKey key = schema.getFactoryCluster().newUDescrIdxKey();
    key.setRequiredDescription(Description);

    CFSecurityClusterBuff buff;
    if (dictByUDescrIdx.containsKey(key)) {
      buff = dictByUDescrIdx.get(key);
    } else {
      buff = null;
    }
    return (buff);
  }
  public CFDbTestLoaderBehaviourBuff readDerivedByUNameIdx(
      CFSecurityAuthorization Authorization, String Name) {
    final String S_ProcName = "CFDbTestRamLoaderBehaviour.readDerivedByUNameIdx";
    CFDbTestLoaderBehaviourByUNameIdxKey key = schema.getFactoryLoaderBehaviour().newUNameIdxKey();
    key.setRequiredName(Name);

    CFDbTestLoaderBehaviourBuff buff;
    if (dictByUNameIdx.containsKey(key)) {
      buff = dictByUNameIdx.get(key);
    } else {
      buff = null;
    }
    return (buff);
  }
  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);
  }
  protected long generateNextId64(long argId, short argSliceId) {
    CFDbTestRamClusterId64Gen key = new CFDbTestRamClusterId64Gen();
    key.setRequiredId(argId);
    key.setRequiredSliceId(argSliceId);

    CFDbTestRamClusterId64Gen useGen = id64Generator.get(key);
    if (useGen == null) {
      id64Generator.put(key, key);
      useGen = key;
    }

    long retNext = useGen.getNextId();

    return (retNext);
  }
  public CFDbTestOptFullRangeBuff readDerivedByUDescrIdx(
      CFSecurityAuthorization Authorization, long TenantId, String Description) {
    final String S_ProcName = "CFDbTestRamOptFullRange.readDerivedByUDescrIdx";
    CFDbTestOptFullRangeByUDescrIdxKey key = schema.getFactoryOptFullRange().newUDescrIdxKey();
    key.setRequiredTenantId(TenantId);
    key.setRequiredDescription(Description);

    CFDbTestOptFullRangeBuff buff;
    if (dictByUDescrIdx.containsKey(key)) {
      buff = dictByUDescrIdx.get(key);
    } else {
      buff = null;
    }
    return (buff);
  }
  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 updateOptFullRange(
      CFSecurityAuthorization Authorization, CFDbTestOptFullRangeBuff Buff) {
    CFDbTestOptFullRangePKey pkey = schema.getFactoryOptFullRange().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFDbTestOptFullRangeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateOptFullRange", "Existing record not found", "OptFullRange", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateOptFullRange", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFDbTestOptFullRangeByUDescrIdxKey existingKeyUDescrIdx =
        schema.getFactoryOptFullRange().newUDescrIdxKey();
    existingKeyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    CFDbTestOptFullRangeByUDescrIdxKey newKeyUDescrIdx =
        schema.getFactoryOptFullRange().newUDescrIdxKey();
    newKeyUDescrIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

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

    CFDbTestOptFullRangeByTenantIdxKey newKeyTenantIdx =
        schema.getFactoryOptFullRange().newTenantIdxKey();
    newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

    // Check unique indexes

    if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) {
      if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateOptFullRange", "OptFullRangeUDescrIdx", newKeyUDescrIdx);
      }
    }

    // Validate foreign keys

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableTenant()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), "updateOptFullRange", "Container", "Tenant", "Tenant", null);
        }
      }
    }

    // Update is valid

    Map<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff> subdict;

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

    dictByUDescrIdx.remove(existingKeyUDescrIdx);
    dictByUDescrIdx.put(newKeyUDescrIdx, Buff);

    subdict = dictByTenantIdx.get(existingKeyTenantIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByTenantIdx.containsKey(newKeyTenantIdx)) {
      subdict = dictByTenantIdx.get(newKeyTenantIdx);
    } else {
      subdict = new HashMap<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff>();
      dictByTenantIdx.put(newKeyTenantIdx, subdict);
    }
    subdict.put(pkey, Buff);
  }