public CFSecuritySecGroupMemberBuff[] readDerivedByGroupIdx(
      CFSecurityAuthorization Authorization, long ClusterId, int SecGroupId) {
    final String S_ProcName = "CFFreeSwitchRamSecGroupMember.readDerivedByGroupIdx";
    CFSecuritySecGroupMemberByGroupIdxKey key = schema.getFactorySecGroupMember().newGroupIdxKey();
    key.setRequiredClusterId(ClusterId);
    key.setRequiredSecGroupId(SecGroupId);

    CFSecuritySecGroupMemberBuff[] recArray;
    if (dictByGroupIdx.containsKey(key)) {
      Map<CFSecuritySecGroupMemberPKey, CFSecuritySecGroupMemberBuff> subdictGroupIdx =
          dictByGroupIdx.get(key);
      recArray = new CFSecuritySecGroupMemberBuff[subdictGroupIdx.size()];
      Iterator<CFSecuritySecGroupMemberBuff> iter = subdictGroupIdx.values().iterator();
      int idx = 0;
      while (iter.hasNext()) {
        recArray[idx++] = iter.next();
      }
    } else {
      Map<CFSecuritySecGroupMemberPKey, CFSecuritySecGroupMemberBuff> subdictGroupIdx =
          new HashMap<CFSecuritySecGroupMemberPKey, CFSecuritySecGroupMemberBuff>();
      dictByGroupIdx.put(key, subdictGroupIdx);
      recArray = new CFSecuritySecGroupMemberBuff[0];
    }
    return (recArray);
  }
  public CFSecurityISOLanguageBuff[] readDerivedByCode2Idx(
      CFSecurityAuthorization Authorization, String ISO6391Code) {
    final String S_ProcName = "CFInternetRamISOLanguage.readDerivedByCode2Idx";
    CFSecurityISOLanguageByCode2IdxKey key = schema.getFactoryISOLanguage().newCode2IdxKey();
    key.setOptionalISO6391Code(ISO6391Code);

    CFSecurityISOLanguageBuff[] recArray;
    if (dictByCode2Idx.containsKey(key)) {
      Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx =
          dictByCode2Idx.get(key);
      recArray = new CFSecurityISOLanguageBuff[subdictCode2Idx.size()];
      Iterator<CFSecurityISOLanguageBuff> iter = subdictCode2Idx.values().iterator();
      int idx = 0;
      while (iter.hasNext()) {
        recArray[idx++] = iter.next();
      }
    } else {
      Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx =
          new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>();
      dictByCode2Idx.put(key, subdictCode2Idx);
      recArray = new CFSecurityISOLanguageBuff[0];
    }
    return (recArray);
  }
  public CFSecurityServiceBuff[] readDerivedByTypeIdx(
      CFSecurityAuthorization Authorization, int ServiceTypeId) {
    final String S_ProcName = "CFBamRamService.readDerivedByTypeIdx";
    CFSecurityServiceByTypeIdxKey key = schema.getFactoryService().newTypeIdxKey();
    key.setRequiredServiceTypeId(ServiceTypeId);

    CFSecurityServiceBuff[] recArray;
    if (dictByTypeIdx.containsKey(key)) {
      Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictTypeIdx = dictByTypeIdx.get(key);
      recArray = new CFSecurityServiceBuff[subdictTypeIdx.size()];
      Iterator<CFSecurityServiceBuff> iter = subdictTypeIdx.values().iterator();
      int idx = 0;
      while (iter.hasNext()) {
        recArray[idx++] = iter.next();
      }
    } else {
      Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictTypeIdx =
          new HashMap<CFSecurityServicePKey, CFSecurityServiceBuff>();
      dictByTypeIdx.put(key, subdictTypeIdx);
      recArray = new CFSecurityServiceBuff[0];
    }
    return (recArray);
  }
  public CFDbTestOptFullRangeBuff[] readDerivedByTenantIdx(
      CFSecurityAuthorization Authorization, long TenantId) {
    final String S_ProcName = "CFDbTestRamOptFullRange.readDerivedByTenantIdx";
    CFDbTestOptFullRangeByTenantIdxKey key = schema.getFactoryOptFullRange().newTenantIdxKey();
    key.setRequiredTenantId(TenantId);

    CFDbTestOptFullRangeBuff[] recArray;
    if (dictByTenantIdx.containsKey(key)) {
      Map<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff> subdictTenantIdx =
          dictByTenantIdx.get(key);
      recArray = new CFDbTestOptFullRangeBuff[subdictTenantIdx.size()];
      Iterator<CFDbTestOptFullRangeBuff> iter = subdictTenantIdx.values().iterator();
      int idx = 0;
      while (iter.hasNext()) {
        recArray[idx++] = iter.next();
      }
    } else {
      Map<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff> subdictTenantIdx =
          new HashMap<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff>();
      dictByTenantIdx.put(key, subdictTenantIdx);
      recArray = new CFDbTestOptFullRangeBuff[0];
    }
    return (recArray);
  }
 public List<ICFSecuritySecDeviceObj> readSecDeviceByUserIdx(UUID SecUserId, boolean forceRead) {
   final String S_ProcName = "readSecDeviceByUserIdx";
   CFSecuritySecDeviceByUserIdxKey key =
       ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey();
   key.setRequiredSecUserId(SecUserId);
   Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> dict;
   if (indexByUserIdx == null) {
     indexByUserIdx =
         new HashMap<
             CFSecuritySecDeviceByUserIdxKey,
             Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj>>();
   }
   if ((!forceRead) && indexByUserIdx.containsKey(key)) {
     dict = indexByUserIdx.get(key);
   } else {
     dict = new HashMap<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj>();
     // Allow other threads to dirty-read while we're loading
     indexByUserIdx.put(key, dict);
     ICFSecuritySecDeviceObj obj;
     CFSecuritySecDeviceBuff[] buffList =
         ((ICFAsteriskSchema) schema.getBackingStore())
             .getTableSecDevice()
             .readDerivedByUserIdx(schema.getAuthorization(), SecUserId);
     CFSecuritySecDeviceBuff buff;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj = schema.getSecDeviceTableObj().newInstance();
       obj.setPKey(((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newPKey());
       obj.setBuff(buff);
       ICFSecuritySecDeviceObj realized = (ICFSecuritySecDeviceObj) obj.realize();
     }
   }
   Comparator<ICFSecuritySecDeviceObj> cmp =
       new Comparator<ICFSecuritySecDeviceObj>() {
         public int compare(ICFSecuritySecDeviceObj lhs, ICFSecuritySecDeviceObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFSecuritySecDevicePKey lhsPKey = lhs.getPKey();
             CFSecuritySecDevicePKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = dict.size();
   ICFSecuritySecDeviceObj arr[] = new ICFSecuritySecDeviceObj[len];
   Iterator<ICFSecuritySecDeviceObj> valIter = dict.values().iterator();
   int idx = 0;
   while ((idx < len) && valIter.hasNext()) {
     arr[idx++] = valIter.next();
   }
   if (idx < len) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   } else if (valIter.hasNext()) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   }
   Arrays.sort(arr, cmp);
   ArrayList<ICFSecuritySecDeviceObj> arrayList = new ArrayList<ICFSecuritySecDeviceObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFSecuritySecDeviceObj> sortedList = arrayList;
   return (sortedList);
 }
 public List<ICFSecuritySecDeviceObj> readAllSecDevice(boolean forceRead) {
   final String S_ProcName = "readAllSecDevice";
   if ((allSecDevice == null) || forceRead) {
     Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> map =
         new HashMap<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj>();
     allSecDevice = map;
     CFSecuritySecDeviceBuff[] buffList =
         ((ICFAsteriskSchema) schema.getBackingStore())
             .getTableSecDevice()
             .readAllDerived(schema.getAuthorization());
     CFSecuritySecDeviceBuff buff;
     ICFSecuritySecDeviceObj obj;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj = newInstance();
       obj.setPKey(((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newPKey());
       obj.setBuff(buff);
       ICFSecuritySecDeviceObj realized = (ICFSecuritySecDeviceObj) obj.realize();
     }
   }
   Comparator<ICFSecuritySecDeviceObj> cmp =
       new Comparator<ICFSecuritySecDeviceObj>() {
         public int compare(ICFSecuritySecDeviceObj lhs, ICFSecuritySecDeviceObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFSecuritySecDevicePKey lhsPKey = lhs.getPKey();
             CFSecuritySecDevicePKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = allSecDevice.size();
   ICFSecuritySecDeviceObj arr[] = new ICFSecuritySecDeviceObj[len];
   Iterator<ICFSecuritySecDeviceObj> valIter = allSecDevice.values().iterator();
   int idx = 0;
   while ((idx < len) && valIter.hasNext()) {
     arr[idx++] = valIter.next();
   }
   if (idx < len) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   } else if (valIter.hasNext()) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   }
   Arrays.sort(arr, cmp);
   ArrayList<ICFSecuritySecDeviceObj> arrayList = new ArrayList<ICFSecuritySecDeviceObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFSecuritySecDeviceObj> sortedList = arrayList;
   return (sortedList);
 }