public void forgetMemo(ICFCrmMemoObj Obj, boolean forgetSubObjects) { ICFCrmMemoObj obj = Obj; CFCrmMemoPKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFCrmMemoObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByTenantIdx != null) { CFCrmMemoByTenantIdxKey keyTenantIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFCrmMemoPKey, ICFCrmMemoObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.remove(keepObj.getPKey()); } } if (indexByMemoContactIdx != null) { CFCrmMemoByMemoContactIdxKey keyMemoContactIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newMemoContactIdxKey(); keyMemoContactIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyMemoContactIdx.setRequiredContactId(keepObj.getRequiredContactId()); Map<CFCrmMemoPKey, ICFCrmMemoObj> mapMemoContactIdx = indexByMemoContactIdx.get(keyMemoContactIdx); if (mapMemoContactIdx != null) { mapMemoContactIdx.remove(keepObj.getPKey()); } } if (indexByUDescrIdx != null) { CFCrmMemoByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUDescrIdx.setRequiredContactId(keepObj.getRequiredContactId()); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.remove(keyUDescrIdx); } if (allMemo != null) { allMemo.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { ((ICFCrmSchemaObj) schema) .getMemoTagTableObj() .forgetMemoTagByMemoIdx(keepObj.getRequiredTenantId(), keepObj.getRequiredMemoId()); } } }
public void deleteHostNode(CFSecurityAuthorization Authorization, CFSecurityHostNodeBuff Buff) { final String S_ProcName = "CFAccRamHostNodeTable.deleteHostNode() "; CFSecurityHostNodePKey pkey = schema.getFactoryHostNode().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); CFSecurityHostNodeBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteHostNode", pkey); } CFSecurityHostNodeByClusterIdxKey keyClusterIdx = schema.getFactoryHostNode().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecurityHostNodeByUDescrIdxKey keyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey(); keyUDescrIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFSecurityHostNodeByHostNameIdxKey keyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey(); keyHostNameIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyHostNameIdx.setRequiredHostName(existing.getRequiredHostName()); // Validate reverse foreign keys // Delete is valid schema .getTableService() .deleteServiceByHostIdx( Authorization, Buff.getRequiredClusterId(), Buff.getRequiredHostNodeId()); Map<CFSecurityHostNodePKey, CFSecurityHostNodeBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); dictByUDescrIdx.remove(keyUDescrIdx); dictByHostNameIdx.remove(keyHostNameIdx); }
public void forgetISOCountryCurrency( ICFSecurityISOCountryCurrencyObj Obj, boolean forgetSubObjects) { ICFSecurityISOCountryCurrencyObj obj = Obj; CFSecurityISOCountryCurrencyPKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecurityISOCountryCurrencyObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByCountryIdx != null) { CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(keepObj.getRequiredISOCountryId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCountryIdx = indexByCountryIdx.get(keyCountryIdx); if (mapCountryIdx != null) { mapCountryIdx.remove(keepObj.getPKey()); } } if (indexByCurrencyIdx != null) { CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(keepObj.getRequiredISOCurrencyId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(keyCurrencyIdx); if (mapCurrencyIdx != null) { mapCurrencyIdx.remove(keepObj.getPKey()); } } if (allISOCountryCurrency != null) { allISOCountryCurrency.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) {} } }
public void deleteSecGroupForm( CFSecurityAuthorization Authorization, CFSecuritySecGroupFormBuff Buff) { final String S_ProcName = "CFInternetRamSecGroupFormTable.deleteSecGroupForm() "; CFSecuritySecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecGroupFormId(Buff.getRequiredSecGroupFormId()); CFSecuritySecGroupFormBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteSecGroupForm", pkey); } CFSecuritySecGroupFormByClusterIdxKey keyClusterIdx = schema.getFactorySecGroupForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecuritySecGroupFormByGroupIdxKey keyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey(); keyGroupIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId()); CFSecuritySecGroupFormByAppIdxKey keyAppIdx = schema.getFactorySecGroupForm().newAppIdxKey(); keyAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFSecuritySecGroupFormByFormIdxKey keyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey(); keyFormIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId()); CFSecuritySecGroupFormByUFormIdxKey keyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey(); keyUFormIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUFormIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId()); keyUFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId()); // Validate reverse foreign keys // Delete is valid Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); subdict = dictByGroupIdx.get(keyGroupIdx); subdict.remove(pkey); subdict = dictByAppIdx.get(keyAppIdx); subdict.remove(pkey); subdict = dictByFormIdx.get(keyFormIdx); subdict.remove(pkey); dictByUFormIdx.remove(keyUFormIdx); }
public void forgetTSecGroupMember(ICFSecurityTSecGroupMemberObj Obj, boolean forgetSubObjects) { ICFSecurityTSecGroupMemberObj obj = Obj; CFSecurityTSecGroupMemberPKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecurityTSecGroupMemberObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByTenantIdx != null) { CFSecurityTSecGroupMemberByTenantIdxKey keyTenantIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.remove(keepObj.getPKey()); } } if (indexByGroupIdx != null) { CFSecurityTSecGroupMemberByGroupIdxKey keyGroupIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newGroupIdxKey(); keyGroupIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyGroupIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId()); Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapGroupIdx = indexByGroupIdx.get(keyGroupIdx); if (mapGroupIdx != null) { mapGroupIdx.remove(keepObj.getPKey()); } } if (indexByUserIdx != null) { CFSecurityTSecGroupMemberByUserIdxKey keyUserIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUserIdxKey(); keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId()); Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapUserIdx = indexByUserIdx.get(keyUserIdx); if (mapUserIdx != null) { mapUserIdx.remove(keepObj.getPKey()); } } if (indexByUUserIdx != null) { CFSecurityTSecGroupMemberByUUserIdxKey keyUUserIdx = ((ICFBamSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey(); keyUUserIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUUserIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId()); keyUUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId()); indexByUUserIdx.remove(keyUUserIdx); } if (allTSecGroupMember != null) { allTSecGroupMember.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) {} } }
public void deleteReqMinMaxValue( CFSecurityAuthorization Authorization, CFDbTestReqMinMaxValueBuff Buff) { final String S_ProcName = "CFDbTestRamReqMinMaxValueTable.deleteReqMinMaxValue() "; CFDbTestReqMinMaxValuePKey pkey = schema.getFactoryReqMinMaxValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestReqMinMaxValueBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteReqMinMaxValue", pkey); } CFDbTestReqMinMaxValueByUDescrIdxKey keyUDescrIdx = schema.getFactoryReqMinMaxValue().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFDbTestReqMinMaxValueByTenantIdxKey keyTenantIdx = schema.getFactoryReqMinMaxValue().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); // Validate reverse foreign keys // Delete is valid Map<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff> subdict; dictByPKey.remove(pkey); dictByUDescrIdx.remove(keyUDescrIdx); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); }
public void forgetMemoByUDescrIdx(long TenantId, long ContactId, String Description) { if (indexByUDescrIdx == null) { return; } CFCrmMemoByUDescrIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newUDescrIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContactId(ContactId); key.setRequiredDescription(Description); if (indexByUDescrIdx.containsKey(key)) { ICFCrmMemoObj probed = indexByUDescrIdx.get(key); if (probed != null) { probed.forget(true); } indexByUDescrIdx.remove(key); } }
public void forgetTSecGroupMemberByUUserIdx(long TenantId, int TSecGroupId, UUID SecUserId) { if (indexByUUserIdx == null) { return; } CFSecurityTSecGroupMemberByUUserIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTSecGroupId(TSecGroupId); key.setRequiredSecUserId(SecUserId); if (indexByUUserIdx.containsKey(key)) { ICFSecurityTSecGroupMemberObj probed = indexByUUserIdx.get(key); if (probed != null) { probed.forget(true); } indexByUUserIdx.remove(key); } }
public void deleteNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) { final String S_ProcName = "CFDbTestRamNumberDefTable.deleteNumberDef() "; CFDbTestValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestNumberDefBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteNumberDef", pkey); } // Validate reverse foreign keys if (schema .getTableNumberCol() .readDerivedByIdIdx( Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory() .newDependentsDetectedException( getClass(), "deleteNumberDef", "Superclass", "SuperClass", "NumberCol", pkey); } if (schema .getTableNumberType() .readDerivedByIdIdx( Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory() .newDependentsDetectedException( getClass(), "deleteNumberDef", "Superclass", "SuperClass", "NumberType", pkey); } // Delete is valid Map<CFDbTestValuePKey, CFDbTestNumberDefBuff> subdict; dictByPKey.remove(pkey); schema.getTableAtom().deleteAtom(Authorization, Buff); }
public void updateNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) { schema.getTableAtom().updateAtom(Authorization, Buff); CFDbTestValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestNumberDefBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateNumberDef", "Existing record not found", "NumberDef", pkey); } // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableAtom() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateNumberDef", "Superclass", "SuperClass", "Atom", null); } } } // Update is valid Map<CFDbTestValuePKey, CFDbTestNumberDefBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); }
public void updateReqMinMaxValue( CFSecurityAuthorization Authorization, CFDbTestReqMinMaxValueBuff Buff) { CFDbTestReqMinMaxValuePKey pkey = schema.getFactoryReqMinMaxValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestReqMinMaxValueBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateReqMinMaxValue", "Existing record not found", "ReqMinMaxValue", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateReqMinMaxValue", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFDbTestReqMinMaxValueByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryReqMinMaxValue().newUDescrIdxKey(); existingKeyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFDbTestReqMinMaxValueByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryReqMinMaxValue().newUDescrIdxKey(); newKeyUDescrIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); CFDbTestReqMinMaxValueByTenantIdxKey existingKeyTenantIdx = schema.getFactoryReqMinMaxValue().newTenantIdxKey(); existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFDbTestReqMinMaxValueByTenantIdxKey newKeyTenantIdx = schema.getFactoryReqMinMaxValue().newTenantIdxKey(); newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); // Check unique indexes if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) { if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateReqMinMaxValue", "ReqMinMaxValueUDescrIdx", newKeyUDescrIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableTenant() .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateReqMinMaxValue", "Container", "Tenant", "Tenant", null); } } } // Update is valid Map<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUDescrIdx.remove(existingKeyUDescrIdx); dictByUDescrIdx.put(newKeyUDescrIdx, Buff); subdict = dictByTenantIdx.get(existingKeyTenantIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTenantIdx.containsKey(newKeyTenantIdx)) { subdict = dictByTenantIdx.get(newKeyTenantIdx); } else { subdict = new HashMap<CFDbTestReqMinMaxValuePKey, CFDbTestReqMinMaxValueBuff>(); dictByTenantIdx.put(newKeyTenantIdx, subdict); } subdict.put(pkey, Buff); }
public ICFSecurityISOCountryCurrencyObj realizeISOCountryCurrency( ICFSecurityISOCountryCurrencyObj Obj) { ICFSecurityISOCountryCurrencyObj obj = Obj; CFSecurityISOCountryCurrencyPKey pkey = obj.getPKey(); ICFSecurityISOCountryCurrencyObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFSecurityISOCountryCurrencyObj 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 (indexByCountryIdx != null) { CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(keepObj.getRequiredISOCountryId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCountryIdx = indexByCountryIdx.get(keyCountryIdx); if (mapCountryIdx != null) { mapCountryIdx.remove(keepObj.getPKey()); } } if (indexByCurrencyIdx != null) { CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(keepObj.getRequiredISOCurrencyId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(keyCurrencyIdx); if (mapCurrencyIdx != null) { mapCurrencyIdx.remove(keepObj.getPKey()); } } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByCountryIdx != null) { CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(keepObj.getRequiredISOCountryId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCountryIdx = indexByCountryIdx.get(keyCountryIdx); if (mapCountryIdx != null) { mapCountryIdx.put(keepObj.getPKey(), keepObj); } } if (indexByCurrencyIdx != null) { CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(keepObj.getRequiredISOCurrencyId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(keyCurrencyIdx); if (mapCurrencyIdx != null) { mapCurrencyIdx.put(keepObj.getPKey(), keepObj); } } if (allISOCountryCurrency != null) { allISOCountryCurrency.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 (allISOCountryCurrency != null) { allISOCountryCurrency.put(keepObj.getPKey(), keepObj); } if (indexByCountryIdx != null) { CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCountryIdxKey(); keyCountryIdx.setRequiredISOCountryId(keepObj.getRequiredISOCountryId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCountryIdx = indexByCountryIdx.get(keyCountryIdx); if (mapCountryIdx != null) { mapCountryIdx.put(keepObj.getPKey(), keepObj); } } if (indexByCurrencyIdx != null) { CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); keyCurrencyIdx.setRequiredISOCurrencyId(keepObj.getRequiredISOCurrencyId()); Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(keyCurrencyIdx); if (mapCurrencyIdx != null) { mapCurrencyIdx.put(keepObj.getPKey(), keepObj); } } } return (keepObj); }
public ICFCrmMemoObj realizeMemo(ICFCrmMemoObj Obj) { ICFCrmMemoObj obj = Obj; CFCrmMemoPKey pkey = obj.getPKey(); ICFCrmMemoObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFCrmMemoObj 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) { CFCrmMemoByTenantIdxKey keyTenantIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFCrmMemoPKey, ICFCrmMemoObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.remove(keepObj.getPKey()); } } if (indexByMemoContactIdx != null) { CFCrmMemoByMemoContactIdxKey keyMemoContactIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newMemoContactIdxKey(); keyMemoContactIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyMemoContactIdx.setRequiredContactId(keepObj.getRequiredContactId()); Map<CFCrmMemoPKey, ICFCrmMemoObj> mapMemoContactIdx = indexByMemoContactIdx.get(keyMemoContactIdx); if (mapMemoContactIdx != null) { mapMemoContactIdx.remove(keepObj.getPKey()); } } if (indexByUDescrIdx != null) { CFCrmMemoByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUDescrIdx.setRequiredContactId(keepObj.getRequiredContactId()); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.remove(keyUDescrIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByTenantIdx != null) { CFCrmMemoByTenantIdxKey keyTenantIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFCrmMemoPKey, ICFCrmMemoObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexByMemoContactIdx != null) { CFCrmMemoByMemoContactIdxKey keyMemoContactIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newMemoContactIdxKey(); keyMemoContactIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyMemoContactIdx.setRequiredContactId(keepObj.getRequiredContactId()); Map<CFCrmMemoPKey, ICFCrmMemoObj> mapMemoContactIdx = indexByMemoContactIdx.get(keyMemoContactIdx); if (mapMemoContactIdx != null) { mapMemoContactIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUDescrIdx != null) { CFCrmMemoByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUDescrIdx.setRequiredContactId(keepObj.getRequiredContactId()); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.put(keyUDescrIdx, keepObj); } if (allMemo != null) { allMemo.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 (allMemo != null) { allMemo.put(keepObj.getPKey(), keepObj); } if (indexByTenantIdx != null) { CFCrmMemoByTenantIdxKey keyTenantIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); Map<CFCrmMemoPKey, ICFCrmMemoObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx); if (mapTenantIdx != null) { mapTenantIdx.put(keepObj.getPKey(), keepObj); } } if (indexByMemoContactIdx != null) { CFCrmMemoByMemoContactIdxKey keyMemoContactIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newMemoContactIdxKey(); keyMemoContactIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyMemoContactIdx.setRequiredContactId(keepObj.getRequiredContactId()); Map<CFCrmMemoPKey, ICFCrmMemoObj> mapMemoContactIdx = indexByMemoContactIdx.get(keyMemoContactIdx); if (mapMemoContactIdx != null) { mapMemoContactIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUDescrIdx != null) { CFCrmMemoByUDescrIdxKey keyUDescrIdx = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(keepObj.getRequiredTenantId()); keyUDescrIdx.setRequiredContactId(keepObj.getRequiredContactId()); keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription()); indexByUDescrIdx.put(keyUDescrIdx, keepObj); } } return (keepObj); }
public void updateSecGroupForm( CFSecurityAuthorization Authorization, CFSecuritySecGroupFormBuff Buff) { CFSecuritySecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecGroupFormId(Buff.getRequiredSecGroupFormId()); CFSecuritySecGroupFormBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateSecGroupForm", "Existing record not found", "SecGroupForm", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateSecGroupForm", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecuritySecGroupFormByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecGroupForm().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecuritySecGroupFormByClusterIdxKey newKeyClusterIdx = schema.getFactorySecGroupForm().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFSecuritySecGroupFormByGroupIdxKey existingKeyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey(); existingKeyGroupIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId()); CFSecuritySecGroupFormByGroupIdxKey newKeyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey(); newKeyGroupIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId()); CFSecuritySecGroupFormByAppIdxKey existingKeyAppIdx = schema.getFactorySecGroupForm().newAppIdxKey(); existingKeyAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFSecuritySecGroupFormByAppIdxKey newKeyAppIdx = schema.getFactorySecGroupForm().newAppIdxKey(); newKeyAppIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFSecuritySecGroupFormByFormIdxKey existingKeyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey(); existingKeyFormIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId()); CFSecuritySecGroupFormByFormIdxKey newKeyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey(); newKeyFormIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFSecuritySecGroupFormByUFormIdxKey existingKeyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey(); existingKeyUFormIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUFormIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId()); existingKeyUFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId()); CFSecuritySecGroupFormByUFormIdxKey newKeyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey(); newKeyUFormIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUFormIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId()); newKeyUFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId()); // Check unique indexes if (!existingKeyUFormIdx.equals(newKeyUFormIdx)) { if (dictByUFormIdx.containsKey(newKeyUFormIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateSecGroupForm", "SecGroupFormUFormIdx", newKeyUFormIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableCluster() .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateSecGroupForm", "Owner", "SecGroupFormCluster", "Cluster", null); } } } { boolean allNull = true; if (allNull) { if (null == schema .getTableSecGroup() .readDerivedByIdIdx( Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecGroupId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateSecGroupForm", "Container", "SecGroupFormGroup", "SecGroup", null); } } } // Update is valid Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByClusterIdx.get(existingKeyClusterIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByClusterIdx.containsKey(newKeyClusterIdx)) { subdict = dictByClusterIdx.get(newKeyClusterIdx); } else { subdict = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByGroupIdx.get(existingKeyGroupIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByGroupIdx.containsKey(newKeyGroupIdx)) { subdict = dictByGroupIdx.get(newKeyGroupIdx); } else { subdict = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>(); dictByGroupIdx.put(newKeyGroupIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByAppIdx.get(existingKeyAppIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByAppIdx.containsKey(newKeyAppIdx)) { subdict = dictByAppIdx.get(newKeyAppIdx); } else { subdict = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>(); dictByAppIdx.put(newKeyAppIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByFormIdx.get(existingKeyFormIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByFormIdx.containsKey(newKeyFormIdx)) { subdict = dictByFormIdx.get(newKeyFormIdx); } else { subdict = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>(); dictByFormIdx.put(newKeyFormIdx, subdict); } subdict.put(pkey, Buff); dictByUFormIdx.remove(existingKeyUFormIdx); dictByUFormIdx.put(newKeyUFormIdx, Buff); }