public void forgetTenant(ICFSecurityTenantObj Obj, boolean forgetSubObjects) { ICFSecurityTenantObj obj = Obj; CFSecurityTenantPKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecurityTenantObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByClusterIdx != null) { CFSecurityTenantByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFSecurityTenantByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName()); indexByUNameIdx.remove(keyUNameIdx); } if (allTenant != null) { allTenant.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { ((ICFSecuritySchemaObj) schema) .getTSecGroupTableObj() .forgetTSecGroupByTenantIdx(keepObj.getRequiredId()); } } }
public ICFSecurityTenantObj realizeTenant(ICFSecurityTenantObj Obj) { ICFSecurityTenantObj obj = Obj; CFSecurityTenantPKey pkey = obj.getPKey(); ICFSecurityTenantObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFSecurityTenantObj 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 (indexByClusterIdx != null) { CFSecurityTenantByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFSecurityTenantByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName()); indexByUNameIdx.remove(keyUNameIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByClusterIdx != null) { CFSecurityTenantByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFSecurityTenantByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } if (allTenant != null) { allTenant.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 (allTenant != null) { allTenant.put(keepObj.getPKey(), keepObj); } if (indexByClusterIdx != null) { CFSecurityTenantByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFSecurityTenantByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } } return (keepObj); }