public void forgetISOCountryCurrencyByCurrencyIdx(short ISOCurrencyId) { if (indexByCurrencyIdx == null) { return; } CFSecurityISOCountryCurrencyByCurrencyIdxKey key = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); key.setRequiredISOCurrencyId(ISOCurrencyId); if (indexByCurrencyIdx.containsKey(key)) { Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(key); if (mapCurrencyIdx != null) { List<ICFSecurityISOCountryCurrencyObj> toForget = new LinkedList<ICFSecurityISOCountryCurrencyObj>(); ICFSecurityISOCountryCurrencyObj cur = null; Iterator<ICFSecurityISOCountryCurrencyObj> iter = mapCurrencyIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByCurrencyIdx.remove(key); } }
public void forgetISOCountryCurrency( ICFSecurityISOCountryCurrencyObj Obj, boolean forgetSubObjects) { ICFSecurityISOCountryCurrencyObj obj = Obj; CFSecurityISOCountryCurrencyPKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecurityISOCountryCurrencyObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByCountryIdx != null) { CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(keepObj.getRequiredISOCountryId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCountryIdx = indexByCountryIdx.get(keyCountryIdx); if (mapCountryIdx != null) { mapCountryIdx.remove(keepObj.getPKey()); } } if (indexByCurrencyIdx != null) { CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(keepObj.getRequiredISOCurrencyId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(keyCurrencyIdx); if (mapCurrencyIdx != null) { mapCurrencyIdx.remove(keepObj.getPKey()); } } if (allISOCountryCurrency != null) { allISOCountryCurrency.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) {} } }
public void deleteISOCountryCurrencyByCurrencyIdx(short ISOCurrencyId) { CFSecurityISOCountryCurrencyByCurrencyIdxKey key = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); key.setRequiredISOCurrencyId(ISOCurrencyId); if (indexByCurrencyIdx == null) { indexByCurrencyIdx = new HashMap< CFSecurityISOCountryCurrencyByCurrencyIdxKey, Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj>>(); } if (indexByCurrencyIdx.containsKey(key)) { Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> dict = indexByCurrencyIdx.get(key); ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountryCurrency() .deleteISOCountryCurrencyByCurrencyIdx(schema.getAuthorization(), ISOCurrencyId); Iterator<ICFSecurityISOCountryCurrencyObj> iter = dict.values().iterator(); ICFSecurityISOCountryCurrencyObj obj; List<ICFSecurityISOCountryCurrencyObj> toForget = new LinkedList<ICFSecurityISOCountryCurrencyObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexByCurrencyIdx.remove(key); } else { ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountryCurrency() .deleteISOCountryCurrencyByCurrencyIdx(schema.getAuthorization(), ISOCurrencyId); } }
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); }
public ICFSecurityISOCountryCurrencyObj realizeISOCountryCurrency( ICFSecurityISOCountryCurrencyObj Obj) { ICFSecurityISOCountryCurrencyObj obj = Obj; CFSecurityISOCountryCurrencyPKey pkey = obj.getPKey(); ICFSecurityISOCountryCurrencyObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFSecurityISOCountryCurrencyObj existingObj = members.get(pkey); keepObj = existingObj; /* * We always rebind the data because if we're being called, some index has * been updated and is refreshing it's data, which may or may not have changed */ // Detach object from alternate and duplicate indexes, leave PKey alone if (indexByCountryIdx != null) { CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(keepObj.getRequiredISOCountryId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCountryIdx = indexByCountryIdx.get(keyCountryIdx); if (mapCountryIdx != null) { mapCountryIdx.remove(keepObj.getPKey()); } } if (indexByCurrencyIdx != null) { CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(keepObj.getRequiredISOCurrencyId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(keyCurrencyIdx); if (mapCurrencyIdx != null) { mapCurrencyIdx.remove(keepObj.getPKey()); } } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByCountryIdx != null) { CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(keepObj.getRequiredISOCountryId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCountryIdx = indexByCountryIdx.get(keyCountryIdx); if (mapCountryIdx != null) { mapCountryIdx.put(keepObj.getPKey(), keepObj); } } if (indexByCurrencyIdx != null) { CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(keepObj.getRequiredISOCurrencyId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(keyCurrencyIdx); if (mapCurrencyIdx != null) { mapCurrencyIdx.put(keepObj.getPKey(), keepObj); } } if (allISOCountryCurrency != null) { allISOCountryCurrency.put(keepObj.getPKey(), keepObj); } } else { keepObj = obj; keepObj.setIsNew(false); // Attach new object to PKey, all, alternate, and duplicate indexes members.put(keepObj.getPKey(), keepObj); if (allISOCountryCurrency != null) { allISOCountryCurrency.put(keepObj.getPKey(), keepObj); } if (indexByCountryIdx != null) { CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(keepObj.getRequiredISOCountryId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCountryIdx = indexByCountryIdx.get(keyCountryIdx); if (mapCountryIdx != null) { mapCountryIdx.put(keepObj.getPKey(), keepObj); } } if (indexByCurrencyIdx != null) { CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(keepObj.getRequiredISOCurrencyId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(keyCurrencyIdx); if (mapCurrencyIdx != null) { mapCurrencyIdx.put(keepObj.getPKey(), keepObj); } } } return (keepObj); }