public void deleteSecFormByUJEEServletIdx( CFSecurityAuthorization Authorization, CFSecuritySecFormByUJEEServletIdxKey argKey) { CFSecuritySecFormBuff cur; LinkedList<CFSecuritySecFormBuff> matchSet = new LinkedList<CFSecuritySecFormBuff>(); Iterator<CFSecuritySecFormBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFSecuritySecFormBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecForm(Authorization, cur); } }
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); } 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 Map<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 HashMap<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 HashMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>(); dictBySecAppIdx.put(newKeySecAppIdx, subdict); } subdict.put(pkey, Buff); dictByUJEEServletIdx.remove(existingKeyUJEEServletIdx); dictByUJEEServletIdx.put(newKeyUJEEServletIdx, Buff); }