public void deleteISOCountryByIdIdx(short Id) { CFSecurityISOCountryPKey pkey = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newPKey(); pkey.setRequiredId(Id); ICFSecurityISOCountryObj obj = readISOCountry(pkey); if (obj != null) { ICFSecurityISOCountryEditObj editObj = (ICFSecurityISOCountryEditObj) obj.getEdit(); boolean editStarted; if (editObj == null) { editObj = (ICFSecurityISOCountryEditObj) obj.beginEdit(); if (editObj != null) { editStarted = true; } else { editStarted = false; } } else { editStarted = false; } if (editObj != null) { editObj.delete(); if (editStarted) { editObj.endEdit(); } } obj.forget(true); } }
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 void deleteISOCountry(ICFSecurityISOCountryObj Obj) { ICFSecurityISOCountryObj obj = Obj; ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountry() .deleteISOCountry(schema.getAuthorization(), obj.getISOCountryBuff()); obj.forget(true); }
public ICFSecurityISOCountryObj updateISOCountry(ICFSecurityISOCountryObj Obj) { ICFSecurityISOCountryObj obj = Obj; ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountry() .updateISOCountry(schema.getAuthorization(), Obj.getISOCountryBuff()); obj = (ICFSecurityISOCountryObj) Obj.realize(); return (obj); }
public ICFSecurityISOCountryObj createISOCountry(ICFSecurityISOCountryObj Obj) { ICFSecurityISOCountryObj obj = Obj; CFSecurityISOCountryBuff buff = obj.getISOCountryBuff(); ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountry() .createISOCountry(schema.getAuthorization(), buff); obj.copyBuffToPKey(); obj = obj.realize(); return (obj); }
public void forgetISOCountryByIdIdx(short Id) { if (members == null) { return; } CFSecurityISOCountryPKey key = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newPKey(); key.setRequiredId(Id); if (members.containsKey(key)) { ICFSecurityISOCountryObj probed = members.get(key); if (probed != null) { probed.forget(true); } } }
public void forgetISOCountryByNameIdx(String Name) { if (indexByNameIdx == null) { return; } CFSecurityISOCountryByNameIdxKey key = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newNameIdxKey(); key.setRequiredName(Name); if (indexByNameIdx.containsKey(key)) { ICFSecurityISOCountryObj probed = indexByNameIdx.get(key); if (probed != null) { probed.forget(true); } indexByNameIdx.remove(key); } }
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 void minimizeMemory() { allISOCountry = null; indexByISOCodeIdx = null; indexByNameIdx = null; List<ICFSecurityISOCountryObj> toForget = new LinkedList<ICFSecurityISOCountryObj>(); ICFSecurityISOCountryObj cur = null; Iterator<ICFSecurityISOCountryObj> iter = members.values().iterator(); while (iter.hasNext()) { cur = iter.next(); if (cur.getEdit() == null) { toForget.add(cur); } } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(); } }
public void deleteISOCountryByNameIdx(String Name) { if (indexByNameIdx == null) { indexByNameIdx = new HashMap<CFSecurityISOCountryByNameIdxKey, ICFSecurityISOCountryObj>(); } CFSecurityISOCountryByNameIdxKey key = ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newNameIdxKey(); key.setRequiredName(Name); ICFSecurityISOCountryObj obj = null; if (indexByNameIdx.containsKey(key)) { obj = indexByNameIdx.get(key); ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountry() .deleteISOCountryByNameIdx(schema.getAuthorization(), Name); obj.forget(true); } else { ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountry() .deleteISOCountryByNameIdx(schema.getAuthorization(), Name); } }
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 void forgetISOCountry(ICFSecurityISOCountryObj Obj, boolean forgetSubObjects) { ICFSecurityISOCountryObj obj = Obj; CFSecurityISOCountryPKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecurityISOCountryObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes 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); } if (allISOCountry != null) { allISOCountry.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { ((ICFSecuritySchemaObj) schema) .getISOCountryCurrencyTableObj() .forgetISOCountryCurrencyByCountryIdx(keepObj.getRequiredId()); ((ICFSecuritySchemaObj) schema) .getISOCountryLanguageTableObj() .forgetISOCountryLanguageByCountryIdx(keepObj.getRequiredId()); } } }
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); }