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 copyBuffToPKey() { getPKey().setRequiredClusterId(buff.getRequiredClusterId()); getPKey().setRequiredSecGroupFormId(buff.getRequiredSecGroupFormId()); }
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); }