public void deleteISOCurrencyByCcyCdIdx( CFBamAuthorization Authorization, CFBamISOCurrencyByCcyCdIdxKey argKey) { CFBamISOCurrencyBuff cur; LinkedList<CFBamISOCurrencyBuff> matchSet = new LinkedList<CFBamISOCurrencyBuff>(); Iterator<CFBamISOCurrencyBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFBamISOCurrencyBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOCurrency(Authorization, cur); } }
public void updateISOCurrency(CFBamAuthorization Authorization, CFBamISOCurrencyBuff Buff) { CFBamISOCurrencyPKey pkey = schema.getFactoryISOCurrency().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFBamISOCurrencyBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateISOCurrency", "Existing record not found", "ISOCurrency", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateISOCurrency", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFBamISOCurrencyByCcyCdIdxKey existingKeyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey(); existingKeyCcyCdIdx.setRequiredISOCode(existing.getRequiredISOCode()); CFBamISOCurrencyByCcyCdIdxKey newKeyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey(); newKeyCcyCdIdx.setRequiredISOCode(Buff.getRequiredISOCode()); CFBamISOCurrencyByCcyNmIdxKey existingKeyCcyNmIdx = schema.getFactoryISOCurrency().newCcyNmIdxKey(); existingKeyCcyNmIdx.setRequiredName(existing.getRequiredName()); CFBamISOCurrencyByCcyNmIdxKey newKeyCcyNmIdx = schema.getFactoryISOCurrency().newCcyNmIdxKey(); newKeyCcyNmIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyCcyCdIdx.equals(newKeyCcyCdIdx)) { if (dictByCcyCdIdx.containsKey(newKeyCcyCdIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateISOCurrency", "ISOCurrencyCodeIdx", newKeyCcyCdIdx); } } if (!existingKeyCcyNmIdx.equals(newKeyCcyNmIdx)) { if (dictByCcyNmIdx.containsKey(newKeyCcyNmIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateISOCurrency", "ISOCurrencyNameIdx", newKeyCcyNmIdx); } } // Validate foreign keys // Update is valid Map<CFBamISOCurrencyPKey, CFBamISOCurrencyBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByCcyCdIdx.remove(existingKeyCcyCdIdx); dictByCcyCdIdx.put(newKeyCcyCdIdx, Buff); dictByCcyNmIdx.remove(existingKeyCcyNmIdx); dictByCcyNmIdx.put(newKeyCcyNmIdx, Buff); }