public ICFSecurityISOCountryCurrencyObj readISOCountryCurrency( CFSecurityISOCountryCurrencyPKey pkey, boolean forceRead) { ICFSecurityISOCountryCurrencyObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFSecurityISOCountryCurrencyBuff readBuff = ((ICFInternetSchema) schema.getBackingStore()) .getTableISOCountryCurrency() .readDerivedByIdIdx( schema.getAuthorization(), pkey.getRequiredISOCountryId(), pkey.getRequiredISOCurrencyId()); if (readBuff != null) { obj = schema.getISOCountryCurrencyTableObj().newInstance(); obj.setPKey( ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newPKey()); obj.setBuff(readBuff); obj = (ICFSecurityISOCountryCurrencyObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
public ICFCrmMemoObj readMemoByUDescrIdx( long TenantId, long ContactId, String Description, boolean forceRead) { if (indexByUDescrIdx == null) { indexByUDescrIdx = new HashMap<CFCrmMemoByUDescrIdxKey, ICFCrmMemoObj>(); } CFCrmMemoByUDescrIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newUDescrIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContactId(ContactId); key.setRequiredDescription(Description); ICFCrmMemoObj obj = null; if ((!forceRead) && indexByUDescrIdx.containsKey(key)) { obj = indexByUDescrIdx.get(key); } else { CFCrmMemoBuff buff = ((ICFAccSchema) schema.getBackingStore()) .getTableMemo() .readDerivedByUDescrIdx(schema.getAuthorization(), TenantId, ContactId, Description); if (buff != null) { obj = schema.getMemoTableObj().newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newPKey()); obj.setBuff(buff); obj = (ICFCrmMemoObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByUDescrIdx.put(key, null); } } return (obj); }
public ICFSecurityTSecGroupMemberObj readTSecGroupMemberByUUserIdx( long TenantId, int TSecGroupId, UUID SecUserId, boolean forceRead) { if (indexByUUserIdx == null) { indexByUUserIdx = new HashMap<CFSecurityTSecGroupMemberByUUserIdxKey, ICFSecurityTSecGroupMemberObj>(); } CFSecurityTSecGroupMemberByUUserIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTSecGroupId(TSecGroupId); key.setRequiredSecUserId(SecUserId); ICFSecurityTSecGroupMemberObj obj = null; if ((!forceRead) && indexByUUserIdx.containsKey(key)) { obj = indexByUUserIdx.get(key); } else { CFSecurityTSecGroupMemberBuff buff = ((ICFBamSchema) schema.getBackingStore()) .getTableTSecGroupMember() .readDerivedByUUserIdx(schema.getAuthorization(), TenantId, TSecGroupId, SecUserId); if (buff != null) { obj = schema.getTSecGroupMemberTableObj().newInstance(); obj.setPKey( ((ICFBamSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newPKey()); obj.setBuff(buff); obj = (ICFSecurityTSecGroupMemberObj) obj.realize(); } else if (schema.getCacheMisses()) { indexByUUserIdx.put(key, null); } } return (obj); }
public ICFSecurityTSecGroupMemberObj readTSecGroupMember( CFSecurityTSecGroupMemberPKey pkey, boolean forceRead) { ICFSecurityTSecGroupMemberObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFSecurityTSecGroupMemberBuff readBuff = ((ICFBamSchema) schema.getBackingStore()) .getTableTSecGroupMember() .readDerivedByIdIdx( schema.getAuthorization(), pkey.getRequiredTenantId(), pkey.getRequiredTSecGroupMemberId()); if (readBuff != null) { obj = schema.getTSecGroupMemberTableObj().newInstance(); obj.setPKey( ((ICFBamSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newPKey()); obj.setBuff(readBuff); obj = (ICFSecurityTSecGroupMemberObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
public ICFCrmMemoObj readMemo(CFCrmMemoPKey pkey, boolean forceRead) { ICFCrmMemoObj obj = null; if ((!forceRead) && members.containsKey(pkey)) { obj = members.get(pkey); } else { CFCrmMemoBuff readBuff = ((ICFAccSchema) schema.getBackingStore()) .getTableMemo() .readDerivedByIdIdx( schema.getAuthorization(), pkey.getRequiredTenantId(), pkey.getRequiredMemoId()); if (readBuff != null) { obj = schema.getMemoTableObj().newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newPKey()); obj.setBuff(readBuff); obj = (ICFCrmMemoObj) obj.realize(); } else if (schema.getCacheMisses()) { members.put(pkey, null); } } return (obj); }
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 createNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) { final String S_ProcName = "createNumberDef"; schema.getTableAtom().createAtom(Authorization, Buff); CFDbTestValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema .getTableAtom() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Superclass", "SuperClass", "Atom", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); }
public void createTSecGroupMember( CFSecurityAuthorization Authorization, CFSecurityTSecGroupMemberBuff Buff) { final String S_ProcName = "createTSecGroupMember"; CFSecurityTSecGroupMemberPKey pkey = schema.getFactoryTSecGroupMember().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredTSecGroupMemberId( ((CFSecurityRamTenantTable) schema.getTableTenant()) .nextTSecGroupMemberIdGen(Authorization, Buff.getRequiredTenantId())); Buff.setRequiredTenantId(pkey.getRequiredTenantId()); Buff.setRequiredTSecGroupMemberId(pkey.getRequiredTSecGroupMemberId()); CFSecurityTSecGroupMemberByTenantIdxKey keyTenantIdx = schema.getFactoryTSecGroupMember().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); CFSecurityTSecGroupMemberByGroupIdxKey keyGroupIdx = schema.getFactoryTSecGroupMember().newGroupIdxKey(); keyGroupIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyGroupIdx.setRequiredTSecGroupId(Buff.getRequiredTSecGroupId()); CFSecurityTSecGroupMemberByUserIdxKey keyUserIdx = schema.getFactoryTSecGroupMember().newUserIdxKey(); keyUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); CFSecurityTSecGroupMemberByUUserIdxKey keyUUserIdx = schema.getFactoryTSecGroupMember().newUUserIdxKey(); keyUUserIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyUUserIdx.setRequiredTSecGroupId(Buff.getRequiredTSecGroupId()); keyUUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByUUserIdx.containsKey(keyUUserIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "TSecGroupMemberUUserIdx", keyUUserIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema .getTableTenant() .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Owner", "TSecGroupMemberTenant", "Tenant", null); } } } { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema .getTableTSecGroup() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredTSecGroupId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Container", "TSecGroupMemberGroup", "TSecGroup", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdictTenantIdx; if (dictByTenantIdx.containsKey(keyTenantIdx)) { subdictTenantIdx = dictByTenantIdx.get(keyTenantIdx); } else { subdictTenantIdx = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>(); dictByTenantIdx.put(keyTenantIdx, subdictTenantIdx); } subdictTenantIdx.put(pkey, Buff); Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdictGroupIdx; if (dictByGroupIdx.containsKey(keyGroupIdx)) { subdictGroupIdx = dictByGroupIdx.get(keyGroupIdx); } else { subdictGroupIdx = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>(); dictByGroupIdx.put(keyGroupIdx, subdictGroupIdx); } subdictGroupIdx.put(pkey, Buff); Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdictUserIdx; if (dictByUserIdx.containsKey(keyUserIdx)) { subdictUserIdx = dictByUserIdx.get(keyUserIdx); } else { subdictUserIdx = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>(); dictByUserIdx.put(keyUserIdx, subdictUserIdx); } subdictUserIdx.put(pkey, Buff); dictByUUserIdx.put(keyUUserIdx, Buff); }
public void updateTSecGroupMember( CFSecurityAuthorization Authorization, CFSecurityTSecGroupMemberBuff Buff) { CFSecurityTSecGroupMemberPKey pkey = schema.getFactoryTSecGroupMember().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredTSecGroupMemberId(Buff.getRequiredTSecGroupMemberId()); CFSecurityTSecGroupMemberBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateTSecGroupMember", "Existing record not found", "TSecGroupMember", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateTSecGroupMember", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecurityTSecGroupMemberByTenantIdxKey existingKeyTenantIdx = schema.getFactoryTSecGroupMember().newTenantIdxKey(); existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFSecurityTSecGroupMemberByTenantIdxKey newKeyTenantIdx = schema.getFactoryTSecGroupMember().newTenantIdxKey(); newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); CFSecurityTSecGroupMemberByGroupIdxKey existingKeyGroupIdx = schema.getFactoryTSecGroupMember().newGroupIdxKey(); existingKeyGroupIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyGroupIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId()); CFSecurityTSecGroupMemberByGroupIdxKey newKeyGroupIdx = schema.getFactoryTSecGroupMember().newGroupIdxKey(); newKeyGroupIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyGroupIdx.setRequiredTSecGroupId(Buff.getRequiredTSecGroupId()); CFSecurityTSecGroupMemberByUserIdxKey existingKeyUserIdx = schema.getFactoryTSecGroupMember().newUserIdxKey(); existingKeyUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); CFSecurityTSecGroupMemberByUserIdxKey newKeyUserIdx = schema.getFactoryTSecGroupMember().newUserIdxKey(); newKeyUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); CFSecurityTSecGroupMemberByUUserIdxKey existingKeyUUserIdx = schema.getFactoryTSecGroupMember().newUUserIdxKey(); existingKeyUUserIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyUUserIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId()); existingKeyUUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); CFSecurityTSecGroupMemberByUUserIdxKey newKeyUUserIdx = schema.getFactoryTSecGroupMember().newUUserIdxKey(); newKeyUUserIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyUUserIdx.setRequiredTSecGroupId(Buff.getRequiredTSecGroupId()); newKeyUUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); // Check unique indexes if (!existingKeyUUserIdx.equals(newKeyUUserIdx)) { if (dictByUUserIdx.containsKey(newKeyUUserIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateTSecGroupMember", "TSecGroupMemberUUserIdx", newKeyUUserIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableTenant() .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateTSecGroupMember", "Owner", "TSecGroupMemberTenant", "Tenant", null); } } } { boolean allNull = true; if (allNull) { if (null == schema .getTableTSecGroup() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredTSecGroupId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateTSecGroupMember", "Container", "TSecGroupMemberGroup", "TSecGroup", null); } } } // Update is valid Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdict; dictByPKey.remove(pkey); dictByPKey.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<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>(); dictByTenantIdx.put(newKeyTenantIdx, 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<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>(); dictByGroupIdx.put(newKeyGroupIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByUserIdx.get(existingKeyUserIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByUserIdx.containsKey(newKeyUserIdx)) { subdict = dictByUserIdx.get(newKeyUserIdx); } else { subdict = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>(); dictByUserIdx.put(newKeyUserIdx, subdict); } subdict.put(pkey, Buff); dictByUUserIdx.remove(existingKeyUUserIdx); dictByUUserIdx.put(newKeyUUserIdx, 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 void createHostNode(CFSecurityAuthorization Authorization, CFSecurityHostNodeBuff Buff) { final String S_ProcName = "createHostNode"; CFSecurityHostNodePKey pkey = schema.getFactoryHostNode().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredHostNodeId( ((CFAccRamClusterTable) schema.getTableCluster()) .nextHostNodeIdGen(Authorization, Buff.getRequiredClusterId())); Buff.setRequiredClusterId(pkey.getRequiredClusterId()); Buff.setRequiredHostNodeId(pkey.getRequiredHostNodeId()); CFSecurityHostNodeByClusterIdxKey keyClusterIdx = schema.getFactoryHostNode().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFSecurityHostNodeByUDescrIdxKey keyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey(); keyUDescrIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); CFSecurityHostNodeByHostNameIdxKey keyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey(); keyHostNameIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keyHostNameIdx.setRequiredHostName(Buff.getRequiredHostName()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByUDescrIdx.containsKey(keyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "HostNodeUDescrIdx", keyUDescrIdx); } if (dictByHostNameIdx.containsKey(keyHostNameIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "HostNodeUHostNameIdx", keyHostNameIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema .getTableCluster() .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Container", "HostNodeCluster", "Cluster", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); Map<CFSecurityHostNodePKey, CFSecurityHostNodeBuff> subdictClusterIdx; if (dictByClusterIdx.containsKey(keyClusterIdx)) { subdictClusterIdx = dictByClusterIdx.get(keyClusterIdx); } else { subdictClusterIdx = new HashMap<CFSecurityHostNodePKey, CFSecurityHostNodeBuff>(); dictByClusterIdx.put(keyClusterIdx, subdictClusterIdx); } subdictClusterIdx.put(pkey, Buff); dictByUDescrIdx.put(keyUDescrIdx, Buff); dictByHostNameIdx.put(keyHostNameIdx, Buff); }
public void updateHostNode(CFSecurityAuthorization Authorization, CFSecurityHostNodeBuff Buff) { CFSecurityHostNodePKey pkey = schema.getFactoryHostNode().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); CFSecurityHostNodeBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateHostNode", "Existing record not found", "HostNode", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateHostNode", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecurityHostNodeByClusterIdxKey existingKeyClusterIdx = schema.getFactoryHostNode().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecurityHostNodeByClusterIdxKey newKeyClusterIdx = schema.getFactoryHostNode().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFSecurityHostNodeByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey(); existingKeyUDescrIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFSecurityHostNodeByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryHostNode().newUDescrIdxKey(); newKeyUDescrIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); CFSecurityHostNodeByHostNameIdxKey existingKeyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey(); existingKeyHostNameIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyHostNameIdx.setRequiredHostName(existing.getRequiredHostName()); CFSecurityHostNodeByHostNameIdxKey newKeyHostNameIdx = schema.getFactoryHostNode().newHostNameIdxKey(); newKeyHostNameIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyHostNameIdx.setRequiredHostName(Buff.getRequiredHostName()); // Check unique indexes if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) { if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateHostNode", "HostNodeUDescrIdx", newKeyUDescrIdx); } } if (!existingKeyHostNameIdx.equals(newKeyHostNameIdx)) { if (dictByHostNameIdx.containsKey(newKeyHostNameIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateHostNode", "HostNodeUHostNameIdx", newKeyHostNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableCluster() .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateHostNode", "Container", "HostNodeCluster", "Cluster", null); } } } // Update is valid Map<CFSecurityHostNodePKey, CFSecurityHostNodeBuff> 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<CFSecurityHostNodePKey, CFSecurityHostNodeBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); dictByUDescrIdx.remove(existingKeyUDescrIdx); dictByUDescrIdx.put(newKeyUDescrIdx, Buff); dictByHostNameIdx.remove(existingKeyHostNameIdx); dictByHostNameIdx.put(newKeyHostNameIdx, Buff); }
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 createSecGroupForm( CFSecurityAuthorization Authorization, CFSecuritySecGroupFormBuff Buff) { final String S_ProcName = "createSecGroupForm"; CFSecuritySecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecGroupFormId( ((CFInternetRamClusterTable) schema.getTableCluster()) .nextSecGroupFormIdGen(Authorization, Buff.getRequiredClusterId())); Buff.setRequiredClusterId(pkey.getRequiredClusterId()); Buff.setRequiredSecGroupFormId(pkey.getRequiredSecGroupFormId()); CFSecuritySecGroupFormByClusterIdxKey keyClusterIdx = schema.getFactorySecGroupForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFSecuritySecGroupFormByGroupIdxKey keyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey(); keyGroupIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId()); CFSecuritySecGroupFormByAppIdxKey keyAppIdx = schema.getFactorySecGroupForm().newAppIdxKey(); keyAppIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keyAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFSecuritySecGroupFormByFormIdxKey keyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey(); keyFormIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keyFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFSecuritySecGroupFormByUFormIdxKey keyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey(); keyUFormIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keyUFormIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId()); keyUFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByUFormIdx.containsKey(keyUFormIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "SecGroupFormUFormIdx", keyUFormIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema .getTableCluster() .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Owner", "SecGroupFormCluster", "Cluster", null); } } } { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema .getTableSecGroup() .readDerivedByIdIdx( Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecGroupId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Container", "SecGroupFormGroup", "SecGroup", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictClusterIdx; if (dictByClusterIdx.containsKey(keyClusterIdx)) { subdictClusterIdx = dictByClusterIdx.get(keyClusterIdx); } else { subdictClusterIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>(); dictByClusterIdx.put(keyClusterIdx, subdictClusterIdx); } subdictClusterIdx.put(pkey, Buff); Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictGroupIdx; if (dictByGroupIdx.containsKey(keyGroupIdx)) { subdictGroupIdx = dictByGroupIdx.get(keyGroupIdx); } else { subdictGroupIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>(); dictByGroupIdx.put(keyGroupIdx, subdictGroupIdx); } subdictGroupIdx.put(pkey, Buff); Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictAppIdx; if (dictByAppIdx.containsKey(keyAppIdx)) { subdictAppIdx = dictByAppIdx.get(keyAppIdx); } else { subdictAppIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>(); dictByAppIdx.put(keyAppIdx, subdictAppIdx); } subdictAppIdx.put(pkey, Buff); Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictFormIdx; if (dictByFormIdx.containsKey(keyFormIdx)) { subdictFormIdx = dictByFormIdx.get(keyFormIdx); } else { subdictFormIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>(); dictByFormIdx.put(keyFormIdx, subdictFormIdx); } subdictFormIdx.put(pkey, Buff); dictByUFormIdx.put(keyUFormIdx, Buff); }