public void deleteNumberDefByNextIdx( CFSecurityAuthorization Authorization, CFDbTestValueByNextIdxKey argKey) { final String S_ProcName = "deleteNumberDefByNextIdx"; CFDbTestNumberDefBuff cur; LinkedList<CFDbTestNumberDefBuff> matchSet = new LinkedList<CFDbTestNumberDefBuff>(); Iterator<CFDbTestNumberDefBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFDbTestNumberDefBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); String subClassCode = cur.getClassCode(); if ("NUMD".equals(subClassCode)) { schema.getTableNumberDef().deleteNumberDef(Authorization, cur); } else if ("NUMC".equals(subClassCode)) { schema.getTableNumberCol().deleteNumberCol(Authorization, (CFDbTestNumberColBuff) cur); } else if ("NUMT".equals(subClassCode)) { schema.getTableNumberType().deleteNumberType(Authorization, (CFDbTestNumberTypeBuff) cur); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "subClassCode", cur, "Instance of or subclass of NumberDef must not be \"" + subClassCode + "\""); } } }
public void deleteNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) { final String S_ProcName = "CFDbTestRamNumberDefTable.deleteNumberDef() "; CFDbTestValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestNumberDefBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteNumberDef", pkey); } // Validate reverse foreign keys if (schema .getTableNumberCol() .readDerivedByIdIdx( Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory() .newDependentsDetectedException( getClass(), "deleteNumberDef", "Superclass", "SuperClass", "NumberCol", pkey); } if (schema .getTableNumberType() .readDerivedByIdIdx( Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory() .newDependentsDetectedException( getClass(), "deleteNumberDef", "Superclass", "SuperClass", "NumberType", pkey); } // Delete is valid Map<CFDbTestValuePKey, CFDbTestNumberDefBuff> subdict; dictByPKey.remove(pkey); schema.getTableAtom().deleteAtom(Authorization, Buff); }