public ICFBamDataScopeObj realizeDataScope(ICFBamDataScopeObj Obj) { ICFBamDataScopeObj obj = Obj; CFBamDataScopePKey pkey = obj.getPKey(); ICFBamDataScopeObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFBamDataScopeObj 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 (indexByUNameIdx != null) { CFBamDataScopeByUNameIdxKey keyUNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByUNameIdx != null) { CFBamDataScopeByUNameIdxKey keyUNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } if (allDataScope != null) { allDataScope.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 (allDataScope != null) { allDataScope.put(keepObj.getPKey(), keepObj); } if (indexByUNameIdx != null) { CFBamDataScopeByUNameIdxKey keyUNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } } return (keepObj); }
public ICFBamDataScopeObj readDataScopeByUNameIdx(String Name, boolean forceRead) { if (indexByUNameIdx == null) { indexByUNameIdx = new HashMap<CFBamDataScopeByUNameIdxKey, ICFBamDataScopeObj>(); } CFBamDataScopeByUNameIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey(); key.setRequiredName(Name); ICFBamDataScopeObj obj = null; if ((!forceRead) && indexByUNameIdx.containsKey(key)) { obj = indexByUNameIdx.get(key); } else { CFBamDataScopeBuff buff = ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .readDerivedByUNameIdx(schema.getAuthorization(), Name); if (buff != null) { obj = schema.getDataScopeTableObj().newInstance(); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey()); obj.setBuff(buff); obj = (ICFBamDataScopeObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByUNameIdx.put(key, null); } } return (obj); }
public ICFBamDataScopeObj readDataScope(CFBamDataScopePKey pkey, boolean forceRead) { ICFBamDataScopeObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFBamDataScopeBuff readBuff = ((ICFBamSchema) schema.getBackingStore()) .getTableDataScope() .readDerivedByIdIdx(schema.getAuthorization(), pkey.getRequiredId()); if (readBuff != null) { obj = schema.getDataScopeTableObj().newInstance(); obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey()); obj.setBuff(readBuff); obj = (ICFBamDataScopeObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }