List of usage examples for java.util SortedMap remove
V remove(Object key);
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamSecGroupTable.java
public void updateSecGroup(CFAccAuthorization Authorization, CFAccSecGroupBuff Buff) { CFAccSecGroupPKey pkey = schema.getFactorySecGroup().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecGroupId(Buff.getRequiredSecGroupId()); CFAccSecGroupBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecGroup", "Existing record not found", "SecGroup", pkey); }// www. j a v a2 s . c o m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecGroup", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAccSecGroupByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAccSecGroupByClusterIdxKey newKeyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFAccSecGroupByUNameIdxKey existingKeyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey(); existingKeyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUNameIdx.setRequiredName(existing.getRequiredName()); CFAccSecGroupByUNameIdxKey newKeyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey(); newKeyUNameIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecGroup", "SecGroupUNameIdx", newKeyUNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecGroup", "Container", "SecGroupCluster", "Cluster", null); } } } // Update is valid SortedMap<CFAccSecGroupPKey, CFAccSecGroupBuff> 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 TreeMap<CFAccSecGroupPKey, CFAccSecGroupBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamSecGroupTable.java
public void updateSecGroup(CFAstAuthorization Authorization, CFAstSecGroupBuff Buff) { CFAstSecGroupPKey pkey = schema.getFactorySecGroup().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecGroupId(Buff.getRequiredSecGroupId()); CFAstSecGroupBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecGroup", "Existing record not found", "SecGroup", pkey); }/*from ww w. ja v a 2 s . c om*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecGroup", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAstSecGroupByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAstSecGroupByClusterIdxKey newKeyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFAstSecGroupByUNameIdxKey existingKeyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey(); existingKeyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUNameIdx.setRequiredName(existing.getRequiredName()); CFAstSecGroupByUNameIdxKey newKeyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey(); newKeyUNameIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecGroup", "SecGroupUNameIdx", newKeyUNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecGroup", "Container", "SecGroupCluster", "Cluster", null); } } } // Update is valid SortedMap<CFAstSecGroupPKey, CFAstSecGroupBuff> 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 TreeMap<CFAstSecGroupPKey, CFAstSecGroupBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamContactListTable.java
public void updateContactList(CFAccAuthorization Authorization, CFAccContactListBuff Buff) { CFAccContactListPKey pkey = schema.getFactoryContactList().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredContactListId(Buff.getRequiredContactListId()); CFAccContactListBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateContactList", "Existing record not found", "ContactList", pkey); }/*from ww w .j a v a 2 s . c o m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateContactList", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAccContactListByTenantIdxKey existingKeyTenantIdx = schema.getFactoryContactList().newTenantIdxKey(); existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccContactListByTenantIdxKey newKeyTenantIdx = schema.getFactoryContactList().newTenantIdxKey(); newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); CFAccContactListByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryContactList().newUDescrIdxKey(); existingKeyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFAccContactListByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryContactList().newUDescrIdxKey(); newKeyUDescrIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); // Check unique indexes if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) { if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateContactList", "ContactListUDescrIdx", newKeyUDescrIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableTenant().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateContactList", "Container", "ContactListTenant", "Tenant", null); } } } // Update is valid SortedMap<CFAccContactListPKey, CFAccContactListBuff> 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 TreeMap<CFAccContactListPKey, CFAccContactListBuff>(); dictByTenantIdx.put(newKeyTenantIdx, subdict); } subdict.put(pkey, Buff); dictByUDescrIdx.remove(existingKeyUDescrIdx); dictByUDescrIdx.put(newKeyUDescrIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmRam.CFCrmRamSecFormTable.java
public void deleteSecForm(CFCrmAuthorization Authorization, CFCrmSecFormBuff Buff) { final String S_ProcName = "CFCrmRamSecFormTable.deleteSecForm() "; CFCrmSecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFCrmSecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/*from w ww .j a va 2 s . c om*/ } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecForm", pkey); } CFCrmSecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFCrmSecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFCrmSecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); keyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); keyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); // Validate reverse foreign keys // Delete is valid SortedMap<CFCrmSecFormPKey, CFCrmSecFormBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); subdict = dictBySecAppIdx.get(keySecAppIdx); subdict.remove(pkey); dictByUJEEServletIdx.remove(keyUJEEServletIdx); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamMemoTable.java
public void deleteMemo(CFAccAuthorization Authorization, CFAccMemoBuff Buff) { final String S_ProcName = "CFAccRamMemoTable.deleteMemo() "; CFAccMemoPKey pkey = schema.getFactoryMemo().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredMemoId(Buff.getRequiredMemoId()); CFAccMemoBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/*from ww w. jav a2 s .c om*/ } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteMemo", pkey); } CFAccMemoByTenantIdxKey keyTenantIdx = schema.getFactoryMemo().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccMemoByMemoContactIdxKey keyMemoContactIdx = schema.getFactoryMemo().newMemoContactIdxKey(); keyMemoContactIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyMemoContactIdx.setRequiredContactId(existing.getRequiredContactId()); CFAccMemoByUDescrIdxKey keyUDescrIdx = schema.getFactoryMemo().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyUDescrIdx.setRequiredContactId(existing.getRequiredContactId()); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); // Validate reverse foreign keys // Delete is valid schema.getTableMemoTag().deleteMemoTagByMemoIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredMemoId()); SortedMap<CFAccMemoPKey, CFAccMemoBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); subdict = dictByMemoContactIdx.get(keyMemoContactIdx); subdict.remove(pkey); dictByUDescrIdx.remove(keyUDescrIdx); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamSecFormTable.java
public void deleteSecForm(CFAccAuthorization Authorization, CFAccSecFormBuff Buff) { final String S_ProcName = "CFAccRamSecFormTable.deleteSecForm() "; CFAccSecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFAccSecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { return;// w w w. ja va 2 s.co m } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecForm", pkey); } CFAccSecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAccSecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFAccSecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); keyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); keyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); // Validate reverse foreign keys // Delete is valid SortedMap<CFAccSecFormPKey, CFAccSecFormBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); subdict = dictBySecAppIdx.get(keySecAppIdx); subdict.remove(pkey); dictByUJEEServletIdx.remove(keyUJEEServletIdx); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamSecFormTable.java
public void deleteSecForm(CFAstAuthorization Authorization, CFAstSecFormBuff Buff) { final String S_ProcName = "CFAstRamSecFormTable.deleteSecForm() "; CFAstSecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFAstSecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/* ww w.j a va2 s. c om*/ } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecForm", pkey); } CFAstSecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAstSecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFAstSecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); keyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); keyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); // Validate reverse foreign keys // Delete is valid SortedMap<CFAstSecFormPKey, CFAstSecFormBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); subdict = dictBySecAppIdx.get(keySecAppIdx); subdict.remove(pkey); dictByUJEEServletIdx.remove(keyUJEEServletIdx); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTenantTable.java
public void deleteTenant(CFAccAuthorization Authorization, CFAccTenantBuff Buff) { final String S_ProcName = "CFAccRamTenantTable.deleteTenant() "; CFAccTenantPKey pkey = schema.getFactoryTenant().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFAccTenantBuff existing = dictByPKey.get(pkey); if (existing == null) { return;//from w w w . j a v a2 s .c om } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTenant", pkey); } CFAccTenantByClusterIdxKey keyClusterIdx = schema.getFactoryTenant().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAccTenantByUNameIdxKey keyUNameIdx = schema.getFactoryTenant().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUNameIdx.setRequiredTenantName(existing.getRequiredTenantName()); // Validate reverse foreign keys // Delete is valid schema.getTableTSecGroup().deleteTSecGroupByTenantIdx(Authorization, Buff.getRequiredId()); schema.getTableDomainBase().deleteDomainBaseByTenantIdx(Authorization, Buff.getRequiredId()); schema.getTableTld().deleteTldByTenantIdx(Authorization, Buff.getRequiredId()); schema.getTableContactList().deleteContactListByTenantIdx(Authorization, Buff.getRequiredId()); schema.getTableTag().deleteTagByTenantIdx(Authorization, Buff.getRequiredId()); schema.getTableAccountConfig().deleteAccountConfigByIdIdx(Authorization, Buff.getRequiredId()); schema.getTableAccount().deleteAccountByTenantIdx(Authorization, Buff.getRequiredId()); SortedMap<CFAccTenantPKey, CFAccTenantBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); dictByUNameIdx.remove(keyUNameIdx); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamURLProtocolTable.java
public void updateURLProtocol(CFAccAuthorization Authorization, CFAccURLProtocolBuff Buff) { CFAccURLProtocolPKey pkey = schema.getFactoryURLProtocol().newPKey(); pkey.setRequiredURLProtocolId(Buff.getRequiredURLProtocolId()); CFAccURLProtocolBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateURLProtocol", "Existing record not found", "URLProtocol", pkey); }//from www . j av a 2 s. c om if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateURLProtocol", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAccURLProtocolByUNameIdxKey existingKeyUNameIdx = schema.getFactoryURLProtocol().newUNameIdxKey(); existingKeyUNameIdx.setRequiredName(existing.getRequiredName()); CFAccURLProtocolByUNameIdxKey newKeyUNameIdx = schema.getFactoryURLProtocol().newUNameIdxKey(); newKeyUNameIdx.setRequiredName(Buff.getRequiredName()); CFAccURLProtocolByIsSecureIdxKey existingKeyIsSecureIdx = schema.getFactoryURLProtocol() .newIsSecureIdxKey(); existingKeyIsSecureIdx.setRequiredIsSecure(existing.getRequiredIsSecure()); CFAccURLProtocolByIsSecureIdxKey newKeyIsSecureIdx = schema.getFactoryURLProtocol().newIsSecureIdxKey(); newKeyIsSecureIdx.setRequiredIsSecure(Buff.getRequiredIsSecure()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateURLProtocol", "URLProtocolUNameIdx", newKeyUNameIdx); } } // Validate foreign keys // Update is valid SortedMap<CFAccURLProtocolPKey, CFAccURLProtocolBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); subdict = dictByIsSecureIdx.get(existingKeyIsSecureIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByIsSecureIdx.containsKey(newKeyIsSecureIdx)) { subdict = dictByIsSecureIdx.get(newKeyIsSecureIdx); } else { subdict = new TreeMap<CFAccURLProtocolPKey, CFAccURLProtocolBuff>(); dictByIsSecureIdx.put(newKeyIsSecureIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamURLProtocolTable.java
public void updateURLProtocol(CFAstAuthorization Authorization, CFAstURLProtocolBuff Buff) { CFAstURLProtocolPKey pkey = schema.getFactoryURLProtocol().newPKey(); pkey.setRequiredURLProtocolId(Buff.getRequiredURLProtocolId()); CFAstURLProtocolBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateURLProtocol", "Existing record not found", "URLProtocol", pkey); }//from ww w . java 2 s .co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateURLProtocol", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAstURLProtocolByUNameIdxKey existingKeyUNameIdx = schema.getFactoryURLProtocol().newUNameIdxKey(); existingKeyUNameIdx.setRequiredName(existing.getRequiredName()); CFAstURLProtocolByUNameIdxKey newKeyUNameIdx = schema.getFactoryURLProtocol().newUNameIdxKey(); newKeyUNameIdx.setRequiredName(Buff.getRequiredName()); CFAstURLProtocolByIsSecureIdxKey existingKeyIsSecureIdx = schema.getFactoryURLProtocol() .newIsSecureIdxKey(); existingKeyIsSecureIdx.setRequiredIsSecure(existing.getRequiredIsSecure()); CFAstURLProtocolByIsSecureIdxKey newKeyIsSecureIdx = schema.getFactoryURLProtocol().newIsSecureIdxKey(); newKeyIsSecureIdx.setRequiredIsSecure(Buff.getRequiredIsSecure()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateURLProtocol", "URLProtocolUNameIdx", newKeyUNameIdx); } } // Validate foreign keys // Update is valid SortedMap<CFAstURLProtocolPKey, CFAstURLProtocolBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); subdict = dictByIsSecureIdx.get(existingKeyIsSecureIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByIsSecureIdx.containsKey(newKeyIsSecureIdx)) { subdict = dictByIsSecureIdx.get(newKeyIsSecureIdx); } else { subdict = new TreeMap<CFAstURLProtocolPKey, CFAstURLProtocolBuff>(); dictByIsSecureIdx.put(newKeyIsSecureIdx, subdict); } subdict.put(pkey, Buff); }