public ICFSecuritySecDeviceObj realizeSecDevice(ICFSecuritySecDeviceObj Obj) { ICFSecuritySecDeviceObj obj = Obj; CFSecuritySecDevicePKey pkey = obj.getPKey(); ICFSecuritySecDeviceObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFSecuritySecDeviceObj 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 (indexByUserIdx != null) { CFSecuritySecDeviceByUserIdxKey keyUserIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey(); keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId()); Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx = indexByUserIdx.get(keyUserIdx); if (mapUserIdx != null) { mapUserIdx.remove(keepObj.getPKey()); } } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByUserIdx != null) { CFSecuritySecDeviceByUserIdxKey keyUserIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey(); keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId()); Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx = indexByUserIdx.get(keyUserIdx); if (mapUserIdx != null) { mapUserIdx.put(keepObj.getPKey(), keepObj); } } if (allSecDevice != null) { allSecDevice.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 (allSecDevice != null) { allSecDevice.put(keepObj.getPKey(), keepObj); } if (indexByUserIdx != null) { CFSecuritySecDeviceByUserIdxKey keyUserIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey(); keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId()); Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx = indexByUserIdx.get(keyUserIdx); if (mapUserIdx != null) { mapUserIdx.put(keepObj.getPKey(), keepObj); } } } return (keepObj); }