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 CFBamISOCurrencyBuff readDerivedByCcyNmIdx(CFBamAuthorization Authorization, String Name) {
    final String S_ProcName = "CFBamRamISOCurrency.readDerivedByCcyNmIdx() ";
    CFBamISOCurrencyByCcyNmIdxKey key = schema.getFactoryISOCurrency().newCcyNmIdxKey();
    key.setRequiredName(Name);

    CFBamISOCurrencyBuff buff;
    if (dictByCcyNmIdx.containsKey(key)) {
      buff = dictByCcyNmIdx.get(key);
    } else {
      buff = null;
    }
    return (buff);
  }
  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 deleteISOCurrencyByCcyNmIdx(
     CFBamAuthorization Authorization, CFBamISOCurrencyByCcyNmIdxKey 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 deleteISOCurrencyByCcyNmIdx(CFBamAuthorization Authorization, String argName) {
   CFBamISOCurrencyByCcyNmIdxKey key = schema.getFactoryISOCurrency().newCcyNmIdxKey();
   key.setRequiredName(argName);
   deleteISOCurrencyByCcyNmIdx(Authorization, key);
 }
  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);
  }