public CFBamISOCurrencyBuff readBuffByCcyNmIdx(CFBamAuthorization Authorization, String Name) { final String S_ProcName = "CFBamRamISOCurrency.readBuffByCcyNmIdx() "; CFBamISOCurrencyBuff buff = readDerivedByCcyNmIdx(Authorization, Name); if ((buff != null) && buff.getClassCode().equals("ISCY")) { return ((CFBamISOCurrencyBuff) buff); } else { return (null); } }
public CFBamISOCurrencyBuff lockBuff( CFBamAuthorization Authorization, CFBamISOCurrencyPKey PKey) { final String S_ProcName = "CFBamRamISOCurrency.readBuff() "; CFBamISOCurrencyBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("ISCY"))) { buff = null; } return (buff); }
public CFBamISOCurrencyBuff[] readAllBuff(CFBamAuthorization Authorization) { final String S_ProcName = "CFBamRamISOCurrency.readAllBuff() "; CFBamISOCurrencyBuff buff; ArrayList<CFBamISOCurrencyBuff> filteredList = new ArrayList<CFBamISOCurrencyBuff>(); CFBamISOCurrencyBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ISCY")) { filteredList.add(buff); } } return (filteredList.toArray(new CFBamISOCurrencyBuff[0])); }
public void deleteISOCurrency(CFBamAuthorization Authorization, CFBamISOCurrencyBuff Buff) { final String S_ProcName = "CFBamRamISOCurrencyTable.deleteISOCurrency() "; CFBamISOCurrencyPKey pkey = schema.getFactoryISOCurrency().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFBamISOCurrencyBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteISOCurrency", pkey); } CFBamISOCurrencyByCcyCdIdxKey keyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey(); keyCcyCdIdx.setRequiredISOCode(existing.getRequiredISOCode()); CFBamISOCurrencyByCcyNmIdxKey keyCcyNmIdx = schema.getFactoryISOCurrency().newCcyNmIdxKey(); keyCcyNmIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid schema .getTableISOCountryCurrency() .deleteISOCountryCurrencyByCurrencyIdx(Authorization, Buff.getRequiredId()); Map<CFBamISOCurrencyPKey, CFBamISOCurrencyBuff> subdict; dictByPKey.remove(pkey); dictByCcyCdIdx.remove(keyCcyCdIdx); dictByCcyNmIdx.remove(keyCcyNmIdx); }
public void createISOCurrency(CFBamAuthorization Authorization, CFBamISOCurrencyBuff Buff) { final String S_ProcName = "createISOCurrency"; CFBamISOCurrencyPKey pkey = schema.getFactoryISOCurrency().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); Buff.setRequiredId(pkey.getRequiredId()); CFBamISOCurrencyByCcyCdIdxKey keyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey(); keyCcyCdIdx.setRequiredISOCode(Buff.getRequiredISOCode()); CFBamISOCurrencyByCcyNmIdxKey keyCcyNmIdx = schema.getFactoryISOCurrency().newCcyNmIdxKey(); keyCcyNmIdx.setRequiredName(Buff.getRequiredName()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByCcyCdIdx.containsKey(keyCcyCdIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "ISOCurrencyCodeIdx", keyCcyCdIdx); } if (dictByCcyNmIdx.containsKey(keyCcyNmIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "ISOCurrencyNameIdx", keyCcyNmIdx); } // Validate foreign keys // Proceed with adding the new record dictByPKey.put(pkey, Buff); dictByCcyCdIdx.put(keyCcyCdIdx, Buff); dictByCcyNmIdx.put(keyCcyNmIdx, Buff); }
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); }