List of usage examples for java.util SortedMap remove
V remove(Object key);
From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamISOLanguageTable.java
public void deleteISOLanguage(CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) { final String S_ProcName = "CFSecurityRamISOLanguageTable.deleteISOLanguage() "; CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFSecurityISOLanguageBuff existing = dictByPKey.get(pkey); if (existing == null) { return;// ww w. ja va2 s .co m } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOLanguage", pkey); } CFSecurityISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey(); keyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode()); CFSecurityISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey(); keyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId()); CFSecurityISOLanguageByCodeIdxKey keyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey(); keyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode()); // Validate reverse foreign keys // Delete is valid schema.getTableISOCountryLanguage().deleteISOCountryLanguageByLanguageIdx(Authorization, Buff.getRequiredId()); SortedMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdict; dictByPKey.remove(pkey); subdict = dictByBaseIdx.get(keyBaseIdx); subdict.remove(pkey); subdict = dictByCountryIdx.get(keyCountryIdx); subdict.remove(pkey); dictByCodeIdx.remove(keyCodeIdx); }
From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamISOTimezoneTable.java
public void updateISOTimezone(CFSecurityAuthorization Authorization, CFSecurityISOTimezoneBuff Buff) { CFSecurityISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey(); pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId()); CFSecurityISOTimezoneBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOTimezone", "Existing record not found", "ISOTimezone", pkey); }/*from w w w . j a v a 2 s .co m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOTimezone", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecurityISOTimezoneByOffsetIdxKey existingKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey(); existingKeyOffsetIdx.setRequiredTZHourOffset(existing.getRequiredTZHourOffset()); existingKeyOffsetIdx.setRequiredTZMinOffset(existing.getRequiredTZMinOffset()); CFSecurityISOTimezoneByOffsetIdxKey newKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey(); newKeyOffsetIdx.setRequiredTZHourOffset(Buff.getRequiredTZHourOffset()); newKeyOffsetIdx.setRequiredTZMinOffset(Buff.getRequiredTZMinOffset()); CFSecurityISOTimezoneByUTZNameIdxKey existingKeyUTZNameIdx = schema.getFactoryISOTimezone() .newUTZNameIdxKey(); existingKeyUTZNameIdx.setRequiredTZName(existing.getRequiredTZName()); CFSecurityISOTimezoneByUTZNameIdxKey newKeyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey(); newKeyUTZNameIdx.setRequiredTZName(Buff.getRequiredTZName()); CFSecurityISOTimezoneByIso8601IdxKey existingKeyIso8601Idx = schema.getFactoryISOTimezone() .newIso8601IdxKey(); existingKeyIso8601Idx.setRequiredIso8601(existing.getRequiredIso8601()); CFSecurityISOTimezoneByIso8601IdxKey newKeyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey(); newKeyIso8601Idx.setRequiredIso8601(Buff.getRequiredIso8601()); // Check unique indexes if (!existingKeyUTZNameIdx.equals(newKeyUTZNameIdx)) { if (dictByUTZNameIdx.containsKey(newKeyUTZNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateISOTimezone", "ISOTimezoneUTZNameIdx", newKeyUTZNameIdx); } } // Validate foreign keys // Update is valid SortedMap<CFSecurityISOTimezonePKey, CFSecurityISOTimezoneBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByOffsetIdx.get(existingKeyOffsetIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByOffsetIdx.containsKey(newKeyOffsetIdx)) { subdict = dictByOffsetIdx.get(newKeyOffsetIdx); } else { subdict = new TreeMap<CFSecurityISOTimezonePKey, CFSecurityISOTimezoneBuff>(); dictByOffsetIdx.put(newKeyOffsetIdx, subdict); } subdict.put(pkey, Buff); dictByUTZNameIdx.remove(existingKeyUTZNameIdx); dictByUTZNameIdx.put(newKeyUTZNameIdx, Buff); subdict = dictByIso8601Idx.get(existingKeyIso8601Idx); if (subdict != null) { subdict.remove(pkey); } if (dictByIso8601Idx.containsKey(newKeyIso8601Idx)) { subdict = dictByIso8601Idx.get(newKeyIso8601Idx); } else { subdict = new TreeMap<CFSecurityISOTimezonePKey, CFSecurityISOTimezoneBuff>(); dictByIso8601Idx.put(newKeyIso8601Idx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamISOTimezoneTable.java
public void deleteISOTimezone(CFSecurityAuthorization Authorization, CFSecurityISOTimezoneBuff Buff) { final String S_ProcName = "CFSecurityRamISOTimezoneTable.deleteISOTimezone() "; CFSecurityISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey(); pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId()); CFSecurityISOTimezoneBuff existing = dictByPKey.get(pkey); if (existing == null) { return;// w ww .j a va 2s . c o m } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOTimezone", pkey); } CFSecurityISOTimezoneByOffsetIdxKey keyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey(); keyOffsetIdx.setRequiredTZHourOffset(existing.getRequiredTZHourOffset()); keyOffsetIdx.setRequiredTZMinOffset(existing.getRequiredTZMinOffset()); CFSecurityISOTimezoneByUTZNameIdxKey keyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey(); keyUTZNameIdx.setRequiredTZName(existing.getRequiredTZName()); CFSecurityISOTimezoneByIso8601IdxKey keyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey(); keyIso8601Idx.setRequiredIso8601(existing.getRequiredIso8601()); // Validate reverse foreign keys // Delete is valid SortedMap<CFSecurityISOTimezonePKey, CFSecurityISOTimezoneBuff> subdict; dictByPKey.remove(pkey); subdict = dictByOffsetIdx.get(keyOffsetIdx); subdict.remove(pkey); dictByUTZNameIdx.remove(keyUTZNameIdx); subdict = dictByIso8601Idx.get(keyIso8601Idx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamSecAppTable.java
public void updateSecApp(CFSecurityAuthorization Authorization, CFSecuritySecAppBuff Buff) { CFSecuritySecAppPKey pkey = schema.getFactorySecApp().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFSecuritySecAppBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecApp", "Existing record not found", "SecApp", pkey); }//from w w w. jav a 2 s. co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecApp", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecuritySecAppByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecApp().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecuritySecAppByClusterIdxKey newKeyClusterIdx = schema.getFactorySecApp().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFSecuritySecAppByUJEEMountIdxKey existingKeyUJEEMountIdx = schema.getFactorySecApp().newUJEEMountIdxKey(); existingKeyUJEEMountIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUJEEMountIdx.setRequiredJEEMountName(existing.getRequiredJEEMountName()); CFSecuritySecAppByUJEEMountIdxKey newKeyUJEEMountIdx = schema.getFactorySecApp().newUJEEMountIdxKey(); newKeyUJEEMountIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUJEEMountIdx.setRequiredJEEMountName(Buff.getRequiredJEEMountName()); // Check unique indexes if (!existingKeyUJEEMountIdx.equals(newKeyUJEEMountIdx)) { if (dictByUJEEMountIdx.containsKey(newKeyUJEEMountIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecApp", "SecAppUJEEMountIdx", newKeyUJEEMountIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecApp", "Container", "SecAppCluster", "Cluster", null); } } } // Update is valid SortedMap<CFSecuritySecAppPKey, CFSecuritySecAppBuff> 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<CFSecuritySecAppPKey, CFSecuritySecAppBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); dictByUJEEMountIdx.remove(existingKeyUJEEMountIdx); dictByUJEEMountIdx.put(newKeyUJEEMountIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamSecAppTable.java
public void deleteSecApp(CFSecurityAuthorization Authorization, CFSecuritySecAppBuff Buff) { final String S_ProcName = "CFSecurityRamSecAppTable.deleteSecApp() "; CFSecuritySecAppPKey pkey = schema.getFactorySecApp().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFSecuritySecAppBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/*from w w w.ja va2 s. co m*/ } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecApp", pkey); } CFSecuritySecAppByClusterIdxKey keyClusterIdx = schema.getFactorySecApp().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecuritySecAppByUJEEMountIdxKey keyUJEEMountIdx = schema.getFactorySecApp().newUJEEMountIdxKey(); keyUJEEMountIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUJEEMountIdx.setRequiredJEEMountName(existing.getRequiredJEEMountName()); // Validate reverse foreign keys // Delete is valid schema.getTableSecForm().deleteSecFormBySecAppIdx(Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecAppId()); SortedMap<CFSecuritySecAppPKey, CFSecuritySecAppBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); dictByUJEEMountIdx.remove(keyUJEEMountIdx); }
From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamSecFormTable.java
public void updateSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { CFSecuritySecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFSecuritySecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecForm", "Existing record not found", "SecForm", pkey); }//w w w . j a v a2s. co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecForm", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecuritySecFormByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecuritySecFormByClusterIdxKey newKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFSecuritySecFormBySecAppIdxKey existingKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); existingKeySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFSecuritySecFormBySecAppIdxKey newKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); newKeySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFSecuritySecFormByUJEEServletIdxKey existingKeyUJEEServletIdx = schema.getFactorySecForm() .newUJEEServletIdxKey(); existingKeyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); existingKeyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); CFSecuritySecFormByUJEEServletIdxKey newKeyUJEEServletIdx = schema.getFactorySecForm() .newUJEEServletIdxKey(); newKeyUJEEServletIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUJEEServletIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); newKeyUJEEServletIdx.setRequiredJEEServletMapName(Buff.getRequiredJEEServletMapName()); // Check unique indexes if (!existingKeyUJEEServletIdx.equals(newKeyUJEEServletIdx)) { if (dictByUJEEServletIdx.containsKey(newKeyUJEEServletIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecForm", "SecFormUJEEServletIdx", newKeyUJEEServletIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecForm", "Owner", "SecFormCluster", "Cluster", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableSecApp().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecAppId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecForm", "Container", "SecFormApplication", "SecApp", null); } } } // Update is valid SortedMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff> 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<CFSecuritySecFormPKey, CFSecuritySecFormBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); subdict = dictBySecAppIdx.get(existingKeySecAppIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySecAppIdx.containsKey(newKeySecAppIdx)) { subdict = dictBySecAppIdx.get(newKeySecAppIdx); } else { subdict = new TreeMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>(); dictBySecAppIdx.put(newKeySecAppIdx, subdict); } subdict.put(pkey, Buff); dictByUJEEServletIdx.remove(existingKeyUJEEServletIdx); dictByUJEEServletIdx.put(newKeyUJEEServletIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamSecFormTable.java
public void deleteSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) { final String S_ProcName = "CFSecurityRamSecFormTable.deleteSecForm() "; CFSecuritySecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFSecuritySecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/*from w ww . ja v a 2 s.co m*/ } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecForm", pkey); } CFSecuritySecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecuritySecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFSecuritySecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); keyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); keyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); // Validate reverse foreign keys // Delete is valid SortedMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff> 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.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamSecGroupFormTable.java
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); }/*w w w. j a va2 s .c o m*/ 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 SortedMap<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 TreeMap<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 TreeMap<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 TreeMap<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 TreeMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>(); dictByFormIdx.put(newKeyFormIdx, subdict); } subdict.put(pkey, Buff); dictByUFormIdx.remove(existingKeyUFormIdx); dictByUFormIdx.put(newKeyUFormIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamSecGroupFormTable.java
public void deleteSecGroupForm(CFSecurityAuthorization Authorization, CFSecuritySecGroupFormBuff Buff) { final String S_ProcName = "CFSecurityRamSecGroupFormTable.deleteSecGroupForm() "; CFSecuritySecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecGroupFormId(Buff.getRequiredSecGroupFormId()); CFSecuritySecGroupFormBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/*from w w w . j a va 2 s.co m*/ } 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 SortedMap<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); }
From source file:net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamSecGroupIncludeTable.java
public void updateSecGroupInclude(CFSecurityAuthorization Authorization, CFSecuritySecGroupIncludeBuff Buff) { CFSecuritySecGroupIncludePKey pkey = schema.getFactorySecGroupInclude().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecGroupIncludeId(Buff.getRequiredSecGroupIncludeId()); CFSecuritySecGroupIncludeBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecGroupInclude", "Existing record not found", "SecGroupInclude", pkey); }//from w ww. j av a2 s . co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecGroupInclude", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecuritySecGroupIncludeByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecGroupInclude() .newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFSecuritySecGroupIncludeByClusterIdxKey newKeyClusterIdx = schema.getFactorySecGroupInclude() .newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFSecuritySecGroupIncludeByGroupIdxKey existingKeyGroupIdx = schema.getFactorySecGroupInclude() .newGroupIdxKey(); existingKeyGroupIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId()); CFSecuritySecGroupIncludeByGroupIdxKey newKeyGroupIdx = schema.getFactorySecGroupInclude().newGroupIdxKey(); newKeyGroupIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId()); CFSecuritySecGroupIncludeByIncludeIdxKey existingKeyIncludeIdx = schema.getFactorySecGroupInclude() .newIncludeIdxKey(); existingKeyIncludeIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId()); CFSecuritySecGroupIncludeByIncludeIdxKey newKeyIncludeIdx = schema.getFactorySecGroupInclude() .newIncludeIdxKey(); newKeyIncludeIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyIncludeIdx.setRequiredIncludeGroupId(Buff.getRequiredIncludeGroupId()); CFSecuritySecGroupIncludeByUIncludeIdxKey existingKeyUIncludeIdx = schema.getFactorySecGroupInclude() .newUIncludeIdxKey(); existingKeyUIncludeIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUIncludeIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId()); existingKeyUIncludeIdx.setRequiredIncludeGroupId(existing.getRequiredIncludeGroupId()); CFSecuritySecGroupIncludeByUIncludeIdxKey newKeyUIncludeIdx = schema.getFactorySecGroupInclude() .newUIncludeIdxKey(); newKeyUIncludeIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUIncludeIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId()); newKeyUIncludeIdx.setRequiredIncludeGroupId(Buff.getRequiredIncludeGroupId()); // Check unique indexes if (!existingKeyUIncludeIdx.equals(newKeyUIncludeIdx)) { if (dictByUIncludeIdx.containsKey(newKeyUIncludeIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecGroupInclude", "SecGroupIncludeUIncludeIdx", newKeyUIncludeIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecGroupInclude", "Owner", "SecGroupIncludeCluster", "Cluster", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableSecGroup().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecGroupId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecGroupInclude", "Container", "SecGroupIncludeGroup", "SecGroup", null); } } } // Update is valid SortedMap<CFSecuritySecGroupIncludePKey, CFSecuritySecGroupIncludeBuff> 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<CFSecuritySecGroupIncludePKey, CFSecuritySecGroupIncludeBuff>(); 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 TreeMap<CFSecuritySecGroupIncludePKey, CFSecuritySecGroupIncludeBuff>(); dictByGroupIdx.put(newKeyGroupIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByIncludeIdx.get(existingKeyIncludeIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByIncludeIdx.containsKey(newKeyIncludeIdx)) { subdict = dictByIncludeIdx.get(newKeyIncludeIdx); } else { subdict = new TreeMap<CFSecuritySecGroupIncludePKey, CFSecuritySecGroupIncludeBuff>(); dictByIncludeIdx.put(newKeyIncludeIdx, subdict); } subdict.put(pkey, Buff); dictByUIncludeIdx.remove(existingKeyUIncludeIdx); dictByUIncludeIdx.put(newKeyUIncludeIdx, Buff); }