public ICFSecurityISOCountryObj readISOCountryByNameIdx(String Name, boolean forceRead) { if (indexByNameIdx == null) { indexByNameIdx = new HashMap<CFSecurityISOCountryByNameIdxKey, ICFSecurityISOCountryObj>(); } CFSecurityISOCountryByNameIdxKey key = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newNameIdxKey(); key.setRequiredName(Name); ICFSecurityISOCountryObj obj = null; if ((!forceRead) && indexByNameIdx.containsKey(key)) { obj = indexByNameIdx.get(key); } else { CFSecurityISOCountryBuff buff = ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountry() .readDerivedByNameIdx(schema.getAuthorization(), Name); if (buff != null) { obj = schema.getISOCountryTableObj().newInstance(); obj.setPKey( ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newPKey()); obj.setBuff(buff); obj = (ICFSecurityISOCountryObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByNameIdx.put(key, null); } } return (obj); }
public ICFSecurityISOCountryObj lockISOCountry(CFSecurityISOCountryPKey pkey) { ICFSecurityISOCountryObj locked = null; CFSecurityISOCountryBuff lockBuff = ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountry() .lockDerived(schema.getAuthorization(), pkey); if (lockBuff != null) { locked = schema.getISOCountryTableObj().newInstance(); locked.setPKey( ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newPKey()); locked.setBuff(lockBuff); locked = (ICFSecurityISOCountryObj) locked.realize(); } else { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "lockISOCountry", pkey); } return (locked); }
public ICFSecurityISOCountryObj readISOCountry(CFSecurityISOCountryPKey pkey, boolean forceRead) { ICFSecurityISOCountryObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFSecurityISOCountryBuff readBuff = ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountry() .readDerivedByIdIdx(schema.getAuthorization(), pkey.getRequiredId()); if (readBuff != null) { obj = schema.getISOCountryTableObj().newInstance(); obj.setPKey( ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newPKey()); obj.setBuff(readBuff); obj = (ICFSecurityISOCountryObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
public List<ICFSecurityISOCountryObj> readAllISOCountry(boolean forceRead) { final String S_ProcName = "readAllISOCountry"; if ((allISOCountry == null) || forceRead) { Map<CFSecurityISOCountryPKey, ICFSecurityISOCountryObj> map = new HashMap<CFSecurityISOCountryPKey, ICFSecurityISOCountryObj>(); allISOCountry = map; CFSecurityISOCountryBuff[] buffList = ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountry() .readAllDerived(schema.getAuthorization()); CFSecurityISOCountryBuff buff; ICFSecurityISOCountryObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = newInstance(); obj.setPKey( ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newPKey()); obj.setBuff(buff); ICFSecurityISOCountryObj realized = (ICFSecurityISOCountryObj) obj.realize(); } } Comparator<ICFSecurityISOCountryObj> cmp = new Comparator<ICFSecurityISOCountryObj>() { public int compare(ICFSecurityISOCountryObj lhs, ICFSecurityISOCountryObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFSecurityISOCountryPKey lhsPKey = lhs.getPKey(); CFSecurityISOCountryPKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allISOCountry.size(); ICFSecurityISOCountryObj arr[] = new ICFSecurityISOCountryObj[len]; Iterator<ICFSecurityISOCountryObj> valIter = allISOCountry.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<ICFSecurityISOCountryObj> arrayList = new ArrayList<ICFSecurityISOCountryObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFSecurityISOCountryObj> sortedList = arrayList; return (sortedList); }
public ICFSecurityISOCountryObj realizeISOCountry(ICFSecurityISOCountryObj Obj) { ICFSecurityISOCountryObj obj = Obj; CFSecurityISOCountryPKey pkey = obj.getPKey(); ICFSecurityISOCountryObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFSecurityISOCountryObj 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 (indexByISOCodeIdx != null) { CFSecurityISOCountryByISOCodeIdxKey keyISOCodeIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountry() .newISOCodeIdxKey(); keyISOCodeIdx.setRequiredISOCode(keepObj.getRequiredISOCode()); indexByISOCodeIdx.remove(keyISOCodeIdx); } if (indexByNameIdx != null) { CFSecurityISOCountryByNameIdxKey keyNameIdx = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newNameIdxKey(); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.remove(keyNameIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByISOCodeIdx != null) { CFSecurityISOCountryByISOCodeIdxKey keyISOCodeIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountry() .newISOCodeIdxKey(); keyISOCodeIdx.setRequiredISOCode(keepObj.getRequiredISOCode()); indexByISOCodeIdx.put(keyISOCodeIdx, keepObj); } if (indexByNameIdx != null) { CFSecurityISOCountryByNameIdxKey keyNameIdx = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newNameIdxKey(); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.put(keyNameIdx, keepObj); } if (allISOCountry != null) { allISOCountry.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 (allISOCountry != null) { allISOCountry.put(keepObj.getPKey(), keepObj); } if (indexByISOCodeIdx != null) { CFSecurityISOCountryByISOCodeIdxKey keyISOCodeIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountry() .newISOCodeIdxKey(); keyISOCodeIdx.setRequiredISOCode(keepObj.getRequiredISOCode()); indexByISOCodeIdx.put(keyISOCodeIdx, keepObj); } if (indexByNameIdx != null) { CFSecurityISOCountryByNameIdxKey keyNameIdx = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newNameIdxKey(); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.put(keyNameIdx, keepObj); } } return (keepObj); }