public CFDbTestReqMinMaxValueBuff lockDerived(
     CFSecurityAuthorization Authorization, CFDbTestReqMinMaxValuePKey PKey) {
   final String S_ProcName = "CFDbTestRamReqMinMaxValue.readDerived";
   CFDbTestReqMinMaxValuePKey key = schema.getFactoryReqMinMaxValue().newPKey();
   key.setRequiredTenantId(PKey.getRequiredTenantId());
   key.setRequiredId(PKey.getRequiredId());
   CFDbTestReqMinMaxValueBuff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
  public void createReqMinMaxValue(
      CFSecurityAuthorization Authorization, CFDbTestReqMinMaxValueBuff Buff) {
    final String S_ProcName = "createReqMinMaxValue";
    CFDbTestReqMinMaxValuePKey pkey = schema.getFactoryReqMinMaxValue().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(
        ((CFDbTestRamTenantTable) schema.getTableTenant())
            .nextReqMinMaxValueIdGen(Authorization, Buff.getRequiredTenantId()));
    Buff.setRequiredTenantId(pkey.getRequiredTenantId());
    Buff.setRequiredId(pkey.getRequiredId());
    CFDbTestReqMinMaxValueByUDescrIdxKey keyUDescrIdx =
        schema.getFactoryReqMinMaxValue().newUDescrIdxKey();
    keyUDescrIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    CFDbTestReqMinMaxValueByTenantIdxKey keyTenantIdx =
        schema.getFactoryReqMinMaxValue().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
      throw CFLib.getDefaultExceptionFactory()
          .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
    }

    if (dictByUDescrIdx.containsKey(keyUDescrIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "ReqMinMaxValueUDescrIdx", keyUDescrIdx);
    }

    // Validate foreign keys

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

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    dictByUDescrIdx.put(keyUDescrIdx, Buff);

    Map<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff> subdictTenantIdx;
    if (dictByTenantIdx.containsKey(keyTenantIdx)) {
      subdictTenantIdx = dictByTenantIdx.get(keyTenantIdx);
    } else {
      subdictTenantIdx = new HashMap<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff>();
      dictByTenantIdx.put(keyTenantIdx, subdictTenantIdx);
    }
    subdictTenantIdx.put(pkey, Buff);
  }