public CFSecuritySecFormBuff lockDerived(
     CFSecurityAuthorization Authorization, CFSecuritySecFormPKey PKey) {
   final String S_ProcName = "CFInternetRamSecForm.readDerived";
   CFSecuritySecFormPKey key = schema.getFactorySecForm().newPKey();
   key.setRequiredClusterId(PKey.getRequiredClusterId());
   key.setRequiredSecFormId(PKey.getRequiredSecFormId());
   CFSecuritySecFormBuff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
  public void createSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) {
    final String S_ProcName = "createSecForm";
    CFSecuritySecFormPKey pkey = schema.getFactorySecForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecFormId(
        ((CFInternetRamClusterTable) schema.getTableCluster())
            .nextSecFormIdGen(Authorization, Buff.getRequiredClusterId()));
    Buff.setRequiredClusterId(pkey.getRequiredClusterId());
    Buff.setRequiredSecFormId(pkey.getRequiredSecFormId());
    CFSecuritySecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

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

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

    // Validate unique indexes

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

    if (dictByUJEEServletIdx.containsKey(keyUJEEServletIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "SecFormUJEEServletIdx", keyUJEEServletIdx);
    }

    // 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", "SecFormCluster", "Cluster", null);
        }
      }
    }

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

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

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

    Map<CFSecuritySecFormPKey, CFSecuritySecFormBuff> subdictSecAppIdx;
    if (dictBySecAppIdx.containsKey(keySecAppIdx)) {
      subdictSecAppIdx = dictBySecAppIdx.get(keySecAppIdx);
    } else {
      subdictSecAppIdx = new HashMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>();
      dictBySecAppIdx.put(keySecAppIdx, subdictSecAppIdx);
    }
    subdictSecAppIdx.put(pkey, Buff);

    dictByUJEEServletIdx.put(keyUJEEServletIdx, Buff);
  }
 public static String formatSecFormPKeyAttributes(String separator, CFSecuritySecFormPKey pkey) {
   String retval =
       CFLibXmlUtil.formatRequiredInt64(null, "ClusterId", pkey.getRequiredClusterId())
           + CFLibXmlUtil.formatRequiredInt32(separator, "SecFormId", pkey.getRequiredSecFormId());
   return (retval);
 }