public void forgetDomain(ICFInternetDomainObj Obj, boolean forgetSubObjects) { ICFInternetDomainObj obj = Obj; CFInternetDomainBasePKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFInternetDomainObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByTenantIdx != null) { CFInternetDomainBaseByTenantIdxKey keyTenantIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { indexByTenantIdx.remove(keyTenantIdx); } } if (indexBySubDomIdx != null) { CFInternetDomainBySubDomIdxKey keySubDomIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(keySubDomIdx); if (mapSubDomIdx != null) { mapSubDomIdx.remove(keepObj.getPKey()); } } if (indexByNameIdx != null) { CFInternetDomainByNameIdxKey keyNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.remove(keyNameIdx); } if (allDomain != null) { allDomain.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { ((ICFInternetSchemaObj) schema) .getTopProjectTableObj() .forgetTopProjectByDomainIdx(keepObj.getRequiredTenantId(), keepObj.getRequiredId()); } } ((ICFBamSchemaObj) schema).getDomainBaseTableObj().forgetDomainBase(obj); }
public ICFInternetDomainObj realizeDomain(ICFInternetDomainObj Obj) { ICFInternetDomainObj obj = Obj; CFInternetDomainBasePKey pkey = obj.getPKey(); ICFInternetDomainObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFInternetDomainObj 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 (indexByTenantIdx != null) { CFInternetDomainBaseByTenantIdxKey keyTenantIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { indexByTenantIdx.remove(keyTenantIdx); } } if (indexBySubDomIdx != null) { CFInternetDomainBySubDomIdxKey keySubDomIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(keySubDomIdx); if (mapSubDomIdx != null) { mapSubDomIdx.remove(keepObj.getPKey()); } } if (indexByNameIdx != null) { CFInternetDomainByNameIdxKey keyNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.remove(keyNameIdx); } // Keep passing the new object because it's the one with the buffer // that the base table needs to copy to the existing object from // the cache. keepObj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().realizeDomainBase(Obj); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByTenantIdx != null) { CFInternetDomainBaseByTenantIdxKey keyTenantIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexBySubDomIdx != null) { CFInternetDomainBySubDomIdxKey keySubDomIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(keySubDomIdx); if (mapSubDomIdx != null) { mapSubDomIdx.put(keepObj.getPKey(), keepObj); } } if (indexByNameIdx != null) { CFInternetDomainByNameIdxKey keyNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.put(keyNameIdx, keepObj); } if (allDomain != null) { allDomain.put(keepObj.getPKey(), keepObj); } } else { keepObj = obj; keepObj = (ICFInternetDomainObj) schema.getDomainBaseTableObj().realizeDomainBase(keepObj); // Attach new object to PKey, all, alternate, and duplicate indexes members.put(keepObj.getPKey(), keepObj); if (allDomain != null) { allDomain.put(keepObj.getPKey(), keepObj); } if (indexByTenantIdx != null) { CFInternetDomainBaseByTenantIdxKey keyTenantIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexBySubDomIdx != null) { CFInternetDomainBySubDomIdxKey keySubDomIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(keySubDomIdx); if (mapSubDomIdx != null) { mapSubDomIdx.put(keepObj.getPKey(), keepObj); } } if (indexByNameIdx != null) { CFInternetDomainByNameIdxKey keyNameIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(keepObj.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(keepObj.getRequiredName()); indexByNameIdx.put(keyNameIdx, keepObj); } } return (keepObj); }