public void forgetTax(ICFAccTaxObj Obj, boolean forgetSubObjects) { ICFAccTaxObj obj = Obj; CFAccTaxPKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFAccTaxObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByTenantIdx != null) { CFAccTaxByTenantIdxKey keyTenantIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFAccTaxPKey, ICFAccTaxObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFAccTaxByUNameIdxKey keyUNameIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newUNameIdxKey(); keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } if (allTax != null) { allTax.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) {} } }
public ICFAccTaxObj realizeTax(ICFAccTaxObj Obj) { ICFAccTaxObj obj = Obj; CFAccTaxPKey pkey = obj.getPKey(); ICFAccTaxObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFAccTaxObj 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) { CFAccTaxByTenantIdxKey keyTenantIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFAccTaxPKey, ICFAccTaxObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFAccTaxByUNameIdxKey keyUNameIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newUNameIdxKey(); keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByTenantIdx != null) { CFAccTaxByTenantIdxKey keyTenantIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFAccTaxPKey, ICFAccTaxObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFAccTaxByUNameIdxKey keyUNameIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newUNameIdxKey(); keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } if (allTax != null) { allTax.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 (allTax != null) { allTax.put(keepObj.getPKey(), keepObj); } if (indexByTenantIdx != null) { CFAccTaxByTenantIdxKey keyTenantIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFAccTaxPKey, ICFAccTaxObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFAccTaxByUNameIdxKey keyUNameIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newUNameIdxKey(); keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } } return (keepObj); }