public CFSecuritySecSessionBuff[] readDerivedByFinishIdx( CFSecurityAuthorization Authorization, UUID SecUserId, Calendar Finish) { final String S_ProcName = "CFSecurityRamSecSession.readDerivedByFinishIdx"; CFSecuritySecSessionByFinishIdxKey key = schema.getFactorySecSession().newFinishIdxKey(); key.setRequiredSecUserId(SecUserId); key.setOptionalFinish(Finish); CFSecuritySecSessionBuff[] recArray; if (dictByFinishIdx.containsKey(key)) { Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdictFinishIdx = dictByFinishIdx.get(key); recArray = new CFSecuritySecSessionBuff[subdictFinishIdx.size()]; Iterator<CFSecuritySecSessionBuff> iter = subdictFinishIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdictFinishIdx = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>(); dictByFinishIdx.put(key, subdictFinishIdx); recArray = new CFSecuritySecSessionBuff[0]; } return (recArray); }
public List<ICFAccTaxObj> readAllTax(boolean forceRead) { final String S_ProcName = "readAllTax"; if ((allTax == null) || forceRead) { Map<CFAccTaxPKey, ICFAccTaxObj> map = new HashMap<CFAccTaxPKey, ICFAccTaxObj>(); allTax = map; CFAccTaxBuff[] buffList = ((ICFAccSchema) schema.getBackingStore()) .getTableTax() .readAllDerived(schema.getAuthorization()); CFAccTaxBuff buff; ICFAccTaxObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newPKey()); obj.setBuff(buff); ICFAccTaxObj realized = (ICFAccTaxObj) obj.realize(); } } Comparator<ICFAccTaxObj> cmp = new Comparator<ICFAccTaxObj>() { public int compare(ICFAccTaxObj lhs, ICFAccTaxObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFAccTaxPKey lhsPKey = lhs.getPKey(); CFAccTaxPKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allTax.size(); ICFAccTaxObj arr[] = new ICFAccTaxObj[len]; Iterator<ICFAccTaxObj> valIter = allTax.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<ICFAccTaxObj> arrayList = new ArrayList<ICFAccTaxObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFAccTaxObj> sortedList = arrayList; return (sortedList); }
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 CFGenKbISOCountryCurrencyBuff[] readDerivedByCurrencyIdx( CFGenKbAuthorization Authorization, short ISOCurrencyId) { final String S_ProcName = "CFGenKbRamISOCountryCurrency.readDerivedByCurrencyIdx() "; CFGenKbISOCountryCurrencyByCurrencyIdxKey key = schema.getFactoryISOCountryCurrency().newCurrencyIdxKey(); key.setRequiredISOCurrencyId(ISOCurrencyId); CFGenKbISOCountryCurrencyBuff[] recArray; if (dictByCurrencyIdx.containsKey(key)) { Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdictCurrencyIdx = dictByCurrencyIdx.get(key); recArray = new CFGenKbISOCountryCurrencyBuff[subdictCurrencyIdx.size()]; Iterator<CFGenKbISOCountryCurrencyBuff> iter = subdictCurrencyIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdictCurrencyIdx = new HashMap<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff>(); dictByCurrencyIdx.put(key, subdictCurrencyIdx); recArray = new CFGenKbISOCountryCurrencyBuff[0]; } return (recArray); }
public CFAccFeeBuff[] readDerivedByTenantIdx( CFSecurityAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAccRamFee.readDerivedByTenantIdx"; CFAccFeeByTenantIdxKey key = schema.getFactoryFee().newTenantIdxKey(); key.setRequiredTenantId(TenantId); CFAccFeeBuff[] recArray; if (dictByTenantIdx.containsKey(key)) { Map<CFAccFeePKey, CFAccFeeBuff> subdictTenantIdx = dictByTenantIdx.get(key); recArray = new CFAccFeeBuff[subdictTenantIdx.size()]; Iterator<CFAccFeeBuff> iter = subdictTenantIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFAccFeePKey, CFAccFeeBuff> subdictTenantIdx = new HashMap<CFAccFeePKey, CFAccFeeBuff>(); dictByTenantIdx.put(key, subdictTenantIdx); recArray = new CFAccFeeBuff[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[] readDerivedByHostIdx( CFSecurityAuthorization Authorization, long ClusterId, long HostNodeId) { final String S_ProcName = "CFBamRamService.readDerivedByHostIdx"; CFSecurityServiceByHostIdxKey key = schema.getFactoryService().newHostIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredHostNodeId(HostNodeId); CFSecurityServiceBuff[] recArray; if (dictByHostIdx.containsKey(key)) { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictHostIdx = dictByHostIdx.get(key); recArray = new CFSecurityServiceBuff[subdictHostIdx.size()]; Iterator<CFSecurityServiceBuff> iter = subdictHostIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictHostIdx = new HashMap<CFSecurityServicePKey, CFSecurityServiceBuff>(); dictByHostIdx.put(key, subdictHostIdx); recArray = new CFSecurityServiceBuff[0]; } return (recArray); }
public List<ICFAccTaxObj> readTaxByTenantIdx(long TenantId, boolean forceRead) { final String S_ProcName = "readTaxByTenantIdx"; CFAccTaxByTenantIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey(); key.setRequiredTenantId(TenantId); Map<CFAccTaxPKey, ICFAccTaxObj> dict; if (indexByTenantIdx == null) { indexByTenantIdx = new HashMap<CFAccTaxByTenantIdxKey, Map<CFAccTaxPKey, ICFAccTaxObj>>(); } if ((!forceRead) && indexByTenantIdx.containsKey(key)) { dict = indexByTenantIdx.get(key); } else { dict = new HashMap<CFAccTaxPKey, ICFAccTaxObj>(); // Allow other threads to dirty-read while we're loading indexByTenantIdx.put(key, dict); ICFAccTaxObj obj; CFAccTaxBuff[] buffList = ((ICFAccSchema) schema.getBackingStore()) .getTableTax() .readDerivedByTenantIdx(schema.getAuthorization(), TenantId); CFAccTaxBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = schema.getTaxTableObj().newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newPKey()); obj.setBuff(buff); ICFAccTaxObj realized = (ICFAccTaxObj) obj.realize(); } } Comparator<ICFAccTaxObj> cmp = new Comparator<ICFAccTaxObj>() { public int compare(ICFAccTaxObj lhs, ICFAccTaxObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFAccTaxPKey lhsPKey = lhs.getPKey(); CFAccTaxPKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFAccTaxObj arr[] = new ICFAccTaxObj[len]; Iterator<ICFAccTaxObj> 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<ICFAccTaxObj> arrayList = new ArrayList<ICFAccTaxObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFAccTaxObj> sortedList = arrayList; return (sortedList); }