public void deleteDelSubDep3ByUNameIdx( CFBamAuthorization Authorization, CFBamDelSubDep3ByUNameIdxKey argKey) { CFBamDelSubDep3Buff cur; LinkedList<CFBamDelSubDep3Buff> matchSet = new LinkedList<CFBamDelSubDep3Buff>(); Iterator<CFBamDelSubDep3Buff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFBamDelSubDep3Buff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteDelSubDep3(Authorization, cur); } }
public void updateDelSubDep3(CFBamAuthorization Authorization, CFBamDelSubDep3Buff Buff) { schema.getTableDelDep().updateDelDep(Authorization, Buff); CFBamScopePKey pkey = schema.getFactoryScope().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFBamDelSubDep3Buff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateDelSubDep3", "Existing record not found", "DelSubDep3", pkey); } CFBamDelSubDep3ByContDelDep2IdxKey existingKeyContDelDep2Idx = schema.getFactoryDelSubDep3().newContDelDep2IdxKey(); existingKeyContDelDep2Idx.setRequiredContTenantId(existing.getRequiredContTenantId()); existingKeyContDelDep2Idx.setRequiredContDelDep2Id(existing.getRequiredContDelDep2Id()); CFBamDelSubDep3ByContDelDep2IdxKey newKeyContDelDep2Idx = schema.getFactoryDelSubDep3().newContDelDep2IdxKey(); newKeyContDelDep2Idx.setRequiredContTenantId(Buff.getRequiredContTenantId()); newKeyContDelDep2Idx.setRequiredContDelDep2Id(Buff.getRequiredContDelDep2Id()); CFBamDelSubDep3ByUNameIdxKey existingKeyUNameIdx = schema.getFactoryDelSubDep3().newUNameIdxKey(); existingKeyUNameIdx.setRequiredContTenantId(existing.getRequiredContTenantId()); existingKeyUNameIdx.setRequiredContDelDep2Id(existing.getRequiredContDelDep2Id()); existingKeyUNameIdx.setRequiredName(existing.getRequiredName()); CFBamDelSubDep3ByUNameIdxKey newKeyUNameIdx = schema.getFactoryDelSubDep3().newUNameIdxKey(); newKeyUNameIdx.setRequiredContTenantId(Buff.getRequiredContTenantId()); newKeyUNameIdx.setRequiredContDelDep2Id(Buff.getRequiredContDelDep2Id()); newKeyUNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateDelSubDep3", "DelSubDep3UNameIdx", newKeyUNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableDelDep() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateDelSubDep3", "Superclass", "SuperClass", "DelDep", null); } } } { boolean allNull = true; if (allNull) { if (null == schema .getTableDelSubDep2() .readDerivedByIdIdx( Authorization, Buff.getRequiredContTenantId(), Buff.getRequiredContDelDep2Id())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateDelSubDep3", "Container", "ContDelSubDep3", "DelSubDep2", null); } } } // Update is valid Map<CFBamScopePKey, CFBamDelSubDep3Buff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByContDelDep2Idx.get(existingKeyContDelDep2Idx); if (subdict != null) { subdict.remove(pkey); } if (dictByContDelDep2Idx.containsKey(newKeyContDelDep2Idx)) { subdict = dictByContDelDep2Idx.get(newKeyContDelDep2Idx); } else { subdict = new HashMap<CFBamScopePKey, CFBamDelSubDep3Buff>(); dictByContDelDep2Idx.put(newKeyContDelDep2Idx, subdict); } subdict.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); }