public void forgetSecDevice(ICFSecuritySecDeviceObj Obj, boolean forgetSubObjects) { ICFSecuritySecDeviceObj obj = Obj; CFSecuritySecDevicePKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecuritySecDeviceObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByUserIdx != null) { CFSecuritySecDeviceByUserIdxKey keyUserIdx = ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey(); keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId()); Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx = indexByUserIdx.get(keyUserIdx); if (mapUserIdx != null) { mapUserIdx.remove(keepObj.getPKey()); } } if (allSecDevice != null) { allSecDevice.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) {} } }
public CFSecuritySecDeviceBuff lockDerived( CFSecurityAuthorization Authorization, CFSecuritySecDevicePKey PKey) { final String S_ProcName = "CFAsteriskRamSecDevice.readDerived"; CFSecuritySecDevicePKey key = schema.getFactorySecDevice().newPKey(); key.setRequiredSecUserId(PKey.getRequiredSecUserId()); key.setRequiredDevName(PKey.getRequiredDevName()); CFSecuritySecDeviceBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); }
public void forgetSecDeviceByIdIdx(UUID SecUserId, String DevName) { if (members == null) { return; } CFSecuritySecDevicePKey key = ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newPKey(); key.setRequiredSecUserId(SecUserId); key.setRequiredDevName(DevName); if (members.containsKey(key)) { ICFSecuritySecDeviceObj probed = members.get(key); if (probed != null) { probed.forget(true); } } }
public void createSecDevice(CFSecurityAuthorization Authorization, CFSecuritySecDeviceBuff Buff) { final String S_ProcName = "createSecDevice"; CFSecuritySecDevicePKey pkey = schema.getFactorySecDevice().newPKey(); pkey.setRequiredSecUserId(Buff.getRequiredSecUserId()); pkey.setRequiredDevName(Buff.getRequiredDevName()); Buff.setRequiredSecUserId(pkey.getRequiredSecUserId()); Buff.setRequiredDevName(pkey.getRequiredDevName()); CFSecuritySecDeviceByUserIdxKey keyUserIdx = schema.getFactorySecDevice().newUserIdxKey(); keyUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema .getTableSecUser() .readDerivedByIdIdx(Authorization, Buff.getRequiredSecUserId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Container", "SecDeviceSecUser", "SecUser", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); Map<CFSecuritySecDevicePKey, CFSecuritySecDeviceBuff> subdictUserIdx; if (dictByUserIdx.containsKey(keyUserIdx)) { subdictUserIdx = dictByUserIdx.get(keyUserIdx); } else { subdictUserIdx = new HashMap<CFSecuritySecDevicePKey, CFSecuritySecDeviceBuff>(); dictByUserIdx.put(keyUserIdx, subdictUserIdx); } subdictUserIdx.put(pkey, Buff); }
public ICFSecuritySecDeviceObj readSecDevice(CFSecuritySecDevicePKey pkey, boolean forceRead) { ICFSecuritySecDeviceObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFSecuritySecDeviceBuff readBuff = ((ICFAsteriskSchema) schema.getBackingStore()) .getTableSecDevice() .readDerivedByIdIdx( schema.getAuthorization(), pkey.getRequiredSecUserId(), pkey.getRequiredDevName()); if (readBuff != null) { obj = schema.getSecDeviceTableObj().newInstance(); obj.setPKey(((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newPKey()); obj.setBuff(readBuff); obj = (ICFSecuritySecDeviceObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
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 = ((ICFAsteriskSchema) 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 = ((ICFAsteriskSchema) 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 = ((ICFAsteriskSchema) 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); }