public CFSecuritySecDeviceBuff lockDerived(
     CFSecurityAuthorization Authorization, CFSecuritySecDevicePKey PKey) {
   final String S_ProcName = "CFAsteriskRamSecDevice.readDerived";
   CFSecuritySecDevicePKey key = schema.getFactorySecDevice().newPKey();
   key.setRequiredSecUserId(PKey.getRequiredSecUserId());
   key.setRequiredDevName(PKey.getRequiredDevName());
   CFSecuritySecDeviceBuff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
  public void createSecDevice(CFSecurityAuthorization Authorization, CFSecuritySecDeviceBuff Buff) {
    final String S_ProcName = "createSecDevice";
    CFSecuritySecDevicePKey pkey = schema.getFactorySecDevice().newPKey();
    pkey.setRequiredSecUserId(Buff.getRequiredSecUserId());
    pkey.setRequiredDevName(Buff.getRequiredDevName());
    Buff.setRequiredSecUserId(pkey.getRequiredSecUserId());
    Buff.setRequiredDevName(pkey.getRequiredDevName());
    CFSecuritySecDeviceByUserIdxKey keyUserIdx = schema.getFactorySecDevice().newUserIdxKey();
    keyUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    // Validate unique indexes

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

    // Validate foreign keys

    {
      boolean allNull = true;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableSecUser()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredSecUserId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Container", "SecDeviceSecUser", "SecUser", null);
        }
      }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    Map<CFSecuritySecDevicePKey, CFSecuritySecDeviceBuff> subdictUserIdx;
    if (dictByUserIdx.containsKey(keyUserIdx)) {
      subdictUserIdx = dictByUserIdx.get(keyUserIdx);
    } else {
      subdictUserIdx = new HashMap<CFSecuritySecDevicePKey, CFSecuritySecDeviceBuff>();
      dictByUserIdx.put(keyUserIdx, subdictUserIdx);
    }
    subdictUserIdx.put(pkey, Buff);
  }
 public ICFSecuritySecDeviceObj readSecDevice(CFSecuritySecDevicePKey pkey, boolean forceRead) {
   ICFSecuritySecDeviceObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFSecuritySecDeviceBuff readBuff =
         ((ICFAsteriskSchema) schema.getBackingStore())
             .getTableSecDevice()
             .readDerivedByIdIdx(
                 schema.getAuthorization(),
                 pkey.getRequiredSecUserId(),
                 pkey.getRequiredDevName());
     if (readBuff != null) {
       obj = schema.getSecDeviceTableObj().newInstance();
       obj.setPKey(((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFSecuritySecDeviceObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }