public CFSecuritySecGroupFormBuff lockDerived(
     CFSecurityAuthorization Authorization, CFSecuritySecGroupFormPKey PKey) {
   final String S_ProcName = "CFInternetRamSecGroupForm.readDerived";
   CFSecuritySecGroupFormPKey key = schema.getFactorySecGroupForm().newPKey();
   key.setRequiredClusterId(PKey.getRequiredClusterId());
   key.setRequiredSecGroupFormId(PKey.getRequiredSecGroupFormId());
   CFSecuritySecGroupFormBuff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
  public void createSecGroupForm(
      CFSecurityAuthorization Authorization, CFSecuritySecGroupFormBuff Buff) {
    final String S_ProcName = "createSecGroupForm";
    CFSecuritySecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecGroupFormId(
        ((CFInternetRamClusterTable) schema.getTableCluster())
            .nextSecGroupFormIdGen(Authorization, Buff.getRequiredClusterId()));
    Buff.setRequiredClusterId(pkey.getRequiredClusterId());
    Buff.setRequiredSecGroupFormId(pkey.getRequiredSecGroupFormId());
    CFSecuritySecGroupFormByClusterIdxKey keyClusterIdx =
        schema.getFactorySecGroupForm().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFSecuritySecGroupFormByGroupIdxKey keyGroupIdx =
        schema.getFactorySecGroupForm().newGroupIdxKey();
    keyGroupIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());

    CFSecuritySecGroupFormByAppIdxKey keyAppIdx = schema.getFactorySecGroupForm().newAppIdxKey();
    keyAppIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());

    CFSecuritySecGroupFormByFormIdxKey keyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
    keyFormIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

    CFSecuritySecGroupFormByUFormIdxKey keyUFormIdx =
        schema.getFactorySecGroupForm().newUFormIdxKey();
    keyUFormIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyUFormIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
    keyUFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

    // Validate unique indexes

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

    if (dictByUFormIdx.containsKey(keyUFormIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "SecGroupFormUFormIdx", keyUFormIdx);
    }

    // Validate foreign keys

    {
      boolean allNull = true;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableCluster()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Owner", "SecGroupFormCluster", "Cluster", null);
        }
      }
    }

    {
      boolean allNull = true;
      allNull = false;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableSecGroup()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecGroupId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Container", "SecGroupFormGroup", "SecGroup", null);
        }
      }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictClusterIdx;
    if (dictByClusterIdx.containsKey(keyClusterIdx)) {
      subdictClusterIdx = dictByClusterIdx.get(keyClusterIdx);
    } else {
      subdictClusterIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByClusterIdx.put(keyClusterIdx, subdictClusterIdx);
    }
    subdictClusterIdx.put(pkey, Buff);

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictGroupIdx;
    if (dictByGroupIdx.containsKey(keyGroupIdx)) {
      subdictGroupIdx = dictByGroupIdx.get(keyGroupIdx);
    } else {
      subdictGroupIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByGroupIdx.put(keyGroupIdx, subdictGroupIdx);
    }
    subdictGroupIdx.put(pkey, Buff);

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictAppIdx;
    if (dictByAppIdx.containsKey(keyAppIdx)) {
      subdictAppIdx = dictByAppIdx.get(keyAppIdx);
    } else {
      subdictAppIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByAppIdx.put(keyAppIdx, subdictAppIdx);
    }
    subdictAppIdx.put(pkey, Buff);

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictFormIdx;
    if (dictByFormIdx.containsKey(keyFormIdx)) {
      subdictFormIdx = dictByFormIdx.get(keyFormIdx);
    } else {
      subdictFormIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByFormIdx.put(keyFormIdx, subdictFormIdx);
    }
    subdictFormIdx.put(pkey, Buff);

    dictByUFormIdx.put(keyUFormIdx, Buff);
  }