public void forgetServiceType(ICFSecurityServiceTypeObj Obj, boolean forgetSubObjects) { ICFSecurityServiceTypeObj obj = Obj; CFSecurityServiceTypePKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecurityServiceTypeObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByUDescrIdx != null) { CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.remove(keyUDescrIdx); } if (allServiceType != null) { allServiceType.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { ((ICFSecuritySchemaObj) schema) .getServiceTableObj() .forgetServiceByTypeIdx(keepObj.getRequiredServiceTypeId()); } } }
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 deleteFee(CFSecurityAuthorization Authorization, CFAccFeeBuff Buff) { final String S_ProcName = "CFAccRamFeeTable.deleteFee() "; CFAccFeePKey pkey = schema.getFactoryFee().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredFeeId(Buff.getRequiredFeeId()); CFAccFeeBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteFee", pkey); } CFAccFeeByDateIdxKey keyDateIdx = schema.getFactoryFee().newDateIdxKey(); keyDateIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyDateIdx.setRequiredAccountId(existing.getRequiredAccountId()); keyDateIdx.setRequiredFeeDate(existing.getRequiredFeeDate()); CFAccFeeByTenantIdxKey keyTenantIdx = schema.getFactoryFee().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccFeeByAcctIdxKey keyAcctIdx = schema.getFactoryFee().newAcctIdxKey(); keyAcctIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyAcctIdx.setRequiredAccountId(existing.getRequiredAccountId()); CFAccFeeByLedgerIdxKey keyLedgerIdx = schema.getFactoryFee().newLedgerIdxKey(); keyLedgerIdx.setOptionalLedgerTenantId(existing.getOptionalLedgerTenantId()); keyLedgerIdx.setOptionalLedgerId(existing.getOptionalLedgerId()); // Validate reverse foreign keys // Delete is valid schema .getTableFeeDetail() .deleteFeeDetailByFeeIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredFeeId()); Map<CFAccFeePKey, CFAccFeeBuff> subdict; dictByPKey.remove(pkey); subdict = dictByDateIdx.get(keyDateIdx); subdict.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); subdict = dictByAcctIdx.get(keyAcctIdx); subdict.remove(pkey); subdict = dictByLedgerIdx.get(keyLedgerIdx); subdict.remove(pkey); }
public ICFSecurityServiceTypeObj realizeServiceType(ICFSecurityServiceTypeObj Obj) { ICFSecurityServiceTypeObj obj = Obj; CFSecurityServiceTypePKey pkey = obj.getPKey(); ICFSecurityServiceTypeObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFSecurityServiceTypeObj 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 (indexByUDescrIdx != null) { CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.remove(keyUDescrIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByUDescrIdx != null) { CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.put(keyUDescrIdx, keepObj); } if (allServiceType != null) { allServiceType.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 (allServiceType != null) { allServiceType.put(keepObj.getPKey(), keepObj); } if (indexByUDescrIdx != null) { CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.put(keyUDescrIdx, keepObj); } } return (keepObj); }
public void forgetServiceTypeByUDescrIdx(String Description) { if (indexByUDescrIdx == null) { return; } CFSecurityServiceTypeByUDescrIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey(); key.setRequiredDescription(Description); if (indexByUDescrIdx.containsKey(key)) { ICFSecurityServiceTypeObj probed = indexByUDescrIdx.get(key); if (probed != null) { probed.forget(true); } indexByUDescrIdx.remove(key); } }
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 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 updateFee(CFSecurityAuthorization Authorization, CFAccFeeBuff Buff) { CFAccFeePKey pkey = schema.getFactoryFee().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredFeeId(Buff.getRequiredFeeId()); CFAccFeeBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateFee", "Existing record not found", "Fee", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateFee", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAccFeeByDateIdxKey existingKeyDateIdx = schema.getFactoryFee().newDateIdxKey(); existingKeyDateIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyDateIdx.setRequiredAccountId(existing.getRequiredAccountId()); existingKeyDateIdx.setRequiredFeeDate(existing.getRequiredFeeDate()); CFAccFeeByDateIdxKey newKeyDateIdx = schema.getFactoryFee().newDateIdxKey(); newKeyDateIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyDateIdx.setRequiredAccountId(Buff.getRequiredAccountId()); newKeyDateIdx.setRequiredFeeDate(Buff.getRequiredFeeDate()); CFAccFeeByTenantIdxKey existingKeyTenantIdx = schema.getFactoryFee().newTenantIdxKey(); existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccFeeByTenantIdxKey newKeyTenantIdx = schema.getFactoryFee().newTenantIdxKey(); newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); CFAccFeeByAcctIdxKey existingKeyAcctIdx = schema.getFactoryFee().newAcctIdxKey(); existingKeyAcctIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyAcctIdx.setRequiredAccountId(existing.getRequiredAccountId()); CFAccFeeByAcctIdxKey newKeyAcctIdx = schema.getFactoryFee().newAcctIdxKey(); newKeyAcctIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyAcctIdx.setRequiredAccountId(Buff.getRequiredAccountId()); CFAccFeeByLedgerIdxKey existingKeyLedgerIdx = schema.getFactoryFee().newLedgerIdxKey(); existingKeyLedgerIdx.setOptionalLedgerTenantId(existing.getOptionalLedgerTenantId()); existingKeyLedgerIdx.setOptionalLedgerId(existing.getOptionalLedgerId()); CFAccFeeByLedgerIdxKey newKeyLedgerIdx = schema.getFactoryFee().newLedgerIdxKey(); newKeyLedgerIdx.setOptionalLedgerTenantId(Buff.getOptionalLedgerTenantId()); newKeyLedgerIdx.setOptionalLedgerId(Buff.getOptionalLedgerId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableAccount() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredAccountId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateFee", "Container", "Account", "Account", null); } } } { boolean allNull = true; if (allNull) { if (null == schema .getTableTenant() .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateFee", "Owner", "Tenant", "Tenant", null); } } } // Update is valid Map<CFAccFeePKey, CFAccFeeBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByDateIdx.get(existingKeyDateIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDateIdx.containsKey(newKeyDateIdx)) { subdict = dictByDateIdx.get(newKeyDateIdx); } else { subdict = new HashMap<CFAccFeePKey, CFAccFeeBuff>(); dictByDateIdx.put(newKeyDateIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByTenantIdx.get(existingKeyTenantIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTenantIdx.containsKey(newKeyTenantIdx)) { subdict = dictByTenantIdx.get(newKeyTenantIdx); } else { subdict = new HashMap<CFAccFeePKey, CFAccFeeBuff>(); dictByTenantIdx.put(newKeyTenantIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByAcctIdx.get(existingKeyAcctIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByAcctIdx.containsKey(newKeyAcctIdx)) { subdict = dictByAcctIdx.get(newKeyAcctIdx); } else { subdict = new HashMap<CFAccFeePKey, CFAccFeeBuff>(); dictByAcctIdx.put(newKeyAcctIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByLedgerIdx.get(existingKeyLedgerIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByLedgerIdx.containsKey(newKeyLedgerIdx)) { subdict = dictByLedgerIdx.get(newKeyLedgerIdx); } else { subdict = new HashMap<CFAccFeePKey, CFAccFeeBuff>(); dictByLedgerIdx.put(newKeyLedgerIdx, subdict); } subdict.put(pkey, Buff); }