public ICFAccTaxObj readTaxByUNameIdx(long TenantId, String Name, boolean forceRead) { if (indexByUNameIdx == null) { indexByUNameIdx = new HashMap<CFAccTaxByUNameIdxKey, ICFAccTaxObj>(); } CFAccTaxByUNameIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newUNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredName(Name); ICFAccTaxObj obj = null; if ((!forceRead) && indexByUNameIdx.containsKey(key)) { obj = indexByUNameIdx.get(key); } else { CFAccTaxBuff buff = ((ICFAccSchema) schema.getBackingStore()) .getTableTax() .readDerivedByUNameIdx(schema.getAuthorization(), TenantId, Name); if (buff != null) { obj = schema.getTaxTableObj().newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newPKey()); obj.setBuff(buff); obj = (ICFAccTaxObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByUNameIdx.put(key, null); } } return (obj); }
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 void forgetTaxByUNameIdx(long TenantId, String Name) { if (indexByUNameIdx == null) { return; } CFAccTaxByUNameIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newUNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredName(Name); if (indexByUNameIdx.containsKey(key)) { ICFAccTaxObj probed = indexByUNameIdx.get(key); if (probed != null) { probed.forget(true); } indexByUNameIdx.remove(key); } }
public void deleteTaxByUNameIdx(long TenantId, String Name) { if (indexByUNameIdx == null) { indexByUNameIdx = new HashMap<CFAccTaxByUNameIdxKey, ICFAccTaxObj>(); } CFAccTaxByUNameIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newUNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredName(Name); ICFAccTaxObj obj = null; if (indexByUNameIdx.containsKey(key)) { obj = indexByUNameIdx.get(key); ((ICFAccSchema) schema.getBackingStore()) .getTableTax() .deleteTaxByUNameIdx(schema.getAuthorization(), TenantId, Name); obj.forget(true); } else { ((ICFAccSchema) schema.getBackingStore()) .getTableTax() .deleteTaxByUNameIdx(schema.getAuthorization(), TenantId, Name); } }
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); }
public void deleteTaxByUNameIdx( CFSecurityAuthorization Authorization, CFAccTaxByUNameIdxKey argKey) { deleteTaxByUNameIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredName()); }