public void forgetISOCountryCurrencyByCountryIdx(short ISOCountryId) { if (indexByCountryIdx == null) { return; } CFSecurityISOCountryCurrencyByCountryIdxKey key = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); key.setRequiredISOCountryId(ISOCountryId); if (indexByCountryIdx.containsKey(key)) { Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCountryIdx = indexByCountryIdx.get(key); if (mapCountryIdx != null) { List<ICFSecurityISOCountryCurrencyObj> toForget = new LinkedList<ICFSecurityISOCountryCurrencyObj>(); ICFSecurityISOCountryCurrencyObj cur = null; Iterator<ICFSecurityISOCountryCurrencyObj> iter = mapCountryIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByCountryIdx.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 deleteISOCountryCurrencyByCountryIdx(short ISOCountryId) { CFSecurityISOCountryCurrencyByCountryIdxKey key = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); key.setRequiredISOCountryId(ISOCountryId); if (indexByCountryIdx == null) { indexByCountryIdx = new HashMap< CFSecurityISOCountryCurrencyByCountryIdxKey, Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj>>(); } if (indexByCountryIdx.containsKey(key)) { Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> dict = indexByCountryIdx.get(key); ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountryCurrency() .deleteISOCountryCurrencyByCountryIdx(schema.getAuthorization(), ISOCountryId); 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); } indexByCountryIdx.remove(key); } else { ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountryCurrency() .deleteISOCountryCurrencyByCountryIdx(schema.getAuthorization(), ISOCountryId); } }
public void deleteISOCountryCurrencyByCountryIdx( CFSecurityAuthorization Authorization, CFSecurityISOCountryCurrencyByCountryIdxKey argKey) { deleteISOCountryCurrencyByCountryIdx(Authorization, argKey.getRequiredISOCountryId()); }
public List<ICFSecurityISOCountryCurrencyObj> readISOCountryCurrencyByCountryIdx( short ISOCountryId, boolean forceRead) { final String S_ProcName = "readISOCountryCurrencyByCountryIdx"; CFSecurityISOCountryCurrencyByCountryIdxKey key = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); key.setRequiredISOCountryId(ISOCountryId); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> dict; if (indexByCountryIdx == null) { indexByCountryIdx = new HashMap< CFSecurityISOCountryCurrencyByCountryIdxKey, Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj>>(); } if ((!forceRead) && indexByCountryIdx.containsKey(key)) { dict = indexByCountryIdx.get(key); } else { dict = new HashMap<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj>(); // Allow other threads to dirty-read while we're loading indexByCountryIdx.put(key, dict); ICFSecurityISOCountryCurrencyObj obj; CFSecurityISOCountryCurrencyBuff[] buffList = ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountryCurrency() .readDerivedByCountryIdx(schema.getAuthorization(), ISOCountryId); 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); }