public ICFSecurityISOCountryCurrencyObj readISOCountryCurrency( CFSecurityISOCountryCurrencyPKey pkey, boolean forceRead) { ICFSecurityISOCountryCurrencyObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFSecurityISOCountryCurrencyBuff readBuff = ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountryCurrency() .readDerivedByIdIdx( schema.getAuthorization(), pkey.getRequiredISOCountryId(), pkey.getRequiredISOCurrencyId()); if (readBuff != null) { obj = schema.getISOCountryCurrencyTableObj().newInstance(); obj.setPKey( ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newPKey()); obj.setBuff(readBuff); obj = (ICFSecurityISOCountryCurrencyObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
public ICFSecurityISOCountryCurrencyObj lockISOCountryCurrency( CFSecurityISOCountryCurrencyPKey pkey) { ICFSecurityISOCountryCurrencyObj locked = null; CFSecurityISOCountryCurrencyBuff lockBuff = ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountryCurrency() .lockDerived(schema.getAuthorization(), pkey); if (lockBuff != null) { locked = schema.getISOCountryCurrencyTableObj().newInstance(); locked.setPKey( ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountryCurrency().newPKey()); locked.setBuff(lockBuff); locked = (ICFSecurityISOCountryCurrencyObj) locked.realize(); } else { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "lockISOCountryCurrency", pkey); } return (locked); }
public List<ICFSecurityISOCountryCurrencyObj> readISOCountryCurrencyByCurrencyIdx( short ISOCurrencyId, boolean forceRead) { final String S_ProcName = "readISOCountryCurrencyByCurrencyIdx"; CFSecurityISOCountryCurrencyByCurrencyIdxKey key = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); key.setRequiredISOCurrencyId(ISOCurrencyId); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> dict; if (indexByCurrencyIdx == null) { indexByCurrencyIdx = new HashMap< CFSecurityISOCountryCurrencyByCurrencyIdxKey, Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj>>(); } if ((!forceRead) && indexByCurrencyIdx.containsKey(key)) { dict = indexByCurrencyIdx.get(key); } else { dict = new HashMap<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj>(); // Allow other threads to dirty-read while we're loading indexByCurrencyIdx.put(key, dict); ICFSecurityISOCountryCurrencyObj obj; CFSecurityISOCountryCurrencyBuff[] buffList = ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountryCurrency() .readDerivedByCurrencyIdx(schema.getAuthorization(), ISOCurrencyId); CFSecurityISOCountryCurrencyBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = schema.getISOCountryCurrencyTableObj().newInstance(); obj.setPKey( ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newPKey()); obj.setBuff(buff); ICFSecurityISOCountryCurrencyObj realized = (ICFSecurityISOCountryCurrencyObj) obj.realize(); } } Comparator<ICFSecurityISOCountryCurrencyObj> cmp = new Comparator<ICFSecurityISOCountryCurrencyObj>() { public int compare( ICFSecurityISOCountryCurrencyObj lhs, ICFSecurityISOCountryCurrencyObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFSecurityISOCountryCurrencyPKey lhsPKey = lhs.getPKey(); CFSecurityISOCountryCurrencyPKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFSecurityISOCountryCurrencyObj arr[] = new ICFSecurityISOCountryCurrencyObj[len]; Iterator<ICFSecurityISOCountryCurrencyObj> 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<ICFSecurityISOCountryCurrencyObj> arrayList = new ArrayList<ICFSecurityISOCountryCurrencyObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFSecurityISOCountryCurrencyObj> sortedList = arrayList; return (sortedList); }