public CFSecuritySecGroupMemberBuff lockDerived(
     CFSecurityAuthorization Authorization, CFSecuritySecGroupMemberPKey PKey) {
   final String S_ProcName = "CFFreeSwitchRamSecGroupMember.readDerived";
   CFSecuritySecGroupMemberPKey key = schema.getFactorySecGroupMember().newPKey();
   key.setRequiredClusterId(PKey.getRequiredClusterId());
   key.setRequiredSecGroupMemberId(PKey.getRequiredSecGroupMemberId());
   CFSecuritySecGroupMemberBuff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
  public void createSecGroupMember(
      CFSecurityAuthorization Authorization, CFSecuritySecGroupMemberBuff Buff) {
    final String S_ProcName = "createSecGroupMember";
    CFSecuritySecGroupMemberPKey pkey = schema.getFactorySecGroupMember().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecGroupMemberId(
        ((CFFreeSwitchRamClusterTable) schema.getTableCluster())
            .nextSecGroupMemberIdGen(Authorization, Buff.getRequiredClusterId()));
    Buff.setRequiredClusterId(pkey.getRequiredClusterId());
    Buff.setRequiredSecGroupMemberId(pkey.getRequiredSecGroupMemberId());
    CFSecuritySecGroupMemberByClusterIdxKey keyClusterIdx =
        schema.getFactorySecGroupMember().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFSecuritySecGroupMemberByGroupIdxKey keyGroupIdx =
        schema.getFactorySecGroupMember().newGroupIdxKey();
    keyGroupIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());

    CFSecuritySecGroupMemberByUserIdxKey keyUserIdx =
        schema.getFactorySecGroupMember().newUserIdxKey();
    keyUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    CFSecuritySecGroupMemberByUUserIdxKey keyUUserIdx =
        schema.getFactorySecGroupMember().newUUserIdxKey();
    keyUUserIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyUUserIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
    keyUUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    // Validate unique indexes

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

    if (dictByUUserIdx.containsKey(keyUUserIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "SecGroupMemberUUserIdx", keyUUserIdx);
    }

    // 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", "SecGroupMemberCluster", "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", "SecGroupMemberGroup", "SecGroup", null);
        }
      }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

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

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

    Map<CFSecuritySecGroupMemberPKey, CFSecuritySecGroupMemberBuff> subdictUserIdx;
    if (dictByUserIdx.containsKey(keyUserIdx)) {
      subdictUserIdx = dictByUserIdx.get(keyUserIdx);
    } else {
      subdictUserIdx = new HashMap<CFSecuritySecGroupMemberPKey, CFSecuritySecGroupMemberBuff>();
      dictByUserIdx.put(keyUserIdx, subdictUserIdx);
    }
    subdictUserIdx.put(pkey, Buff);

    dictByUUserIdx.put(keyUUserIdx, Buff);
  }