public void forgetSecGroup(ICFSecuritySecGroupObj Obj, boolean forgetSubObjects) { ICFSecuritySecGroupObj obj = Obj; CFSecuritySecGroupPKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecuritySecGroupObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByClusterIdx != null) { CFSecuritySecGroupByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFSecuritySecGroupByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } if (allSecGroup != null) { allSecGroup.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { ((ICFSecuritySchemaObj) schema) .getSecGroupIncludeTableObj() .forgetSecGroupIncludeByGroupIdx( keepObj.getRequiredClusterId(), keepObj.getRequiredSecGroupId()); ((ICFSecuritySchemaObj) schema) .getSecGroupMemberTableObj() .forgetSecGroupMemberByGroupIdx( keepObj.getRequiredClusterId(), keepObj.getRequiredSecGroupId()); ((ICFSecuritySchemaObj) schema) .getSecGroupIncludeTableObj() .forgetSecGroupIncludeByIncludeIdx( keepObj.getRequiredClusterId(), keepObj.getRequiredSecGroupId()); ((ICFSecuritySchemaObj) schema) .getSecGroupFormTableObj() .forgetSecGroupFormByGroupIdx( keepObj.getRequiredClusterId(), keepObj.getRequiredSecGroupId()); } } }
public ICFSecuritySecGroupObj realizeSecGroup(ICFSecuritySecGroupObj Obj) { ICFSecuritySecGroupObj obj = Obj; CFSecuritySecGroupPKey pkey = obj.getPKey(); ICFSecuritySecGroupObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFSecuritySecGroupObj 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) { CFSecuritySecGroupByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFSecuritySecGroupByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByClusterIdx != null) { CFSecuritySecGroupByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFSecuritySecGroupByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } if (allSecGroup != null) { allSecGroup.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 (allSecGroup != null) { allSecGroup.put(keepObj.getPKey(), keepObj); } if (indexByClusterIdx != null) { CFSecuritySecGroupByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFSecuritySecGroupByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } } return (keepObj); }