net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskRam.CFAsteriskRamISOCountryCurrencyTable.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskRam.CFAsteriskRamISOCountryCurrencyTable.java

Source

// Description: Java 8 in-memory RAM DbIO implementation for ISOCountryCurrency.

/*
 *   Code Factory Asterisk 11 Configuration Model
 *
 *   Copyright (c) 2014-2015 Mark Sobkow
 *   
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *   
 *       http://www.apache.org/licenses/LICENSE-2.0
 *   
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *   
 */

package net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskRam;

import java.sql.*;
import java.util.*;
import org.apache.commons.codec.binary.Base64;
import net.sourceforge.msscodefactory.cflib.v2_3.CFLib.*;
import net.sourceforge.msscodefactory.cfsecurity.v2_4.CFSecurity.*;
import net.sourceforge.msscodefactory.cfinternet.v2_4.CFInternet.*;
import net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsterisk.*;
import net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskObj.*;
import net.sourceforge.msscodefactory.cfsecurity.v2_4.CFSecurityObj.*;
import net.sourceforge.msscodefactory.cfinternet.v2_4.CFInternetObj.*;
import net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskObj.*;

/*
 *   CFAsteriskRamISOCountryCurrencyTable in-memory RAM DbIO implementation
 *   for ISOCountryCurrency.
 */
public class CFAsteriskRamISOCountryCurrencyTable implements ICFAsteriskISOCountryCurrencyTable {
    private ICFAsteriskSchema schema;
    private Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> dictByPKey = new HashMap<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>();
    private Map<CFSecurityISOCountryCurrencyByCountryIdxKey, Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>> dictByCountryIdx = new HashMap<CFSecurityISOCountryCurrencyByCountryIdxKey, Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>>();
    private Map<CFSecurityISOCountryCurrencyByCurrencyIdxKey, Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>> dictByCurrencyIdx = new HashMap<CFSecurityISOCountryCurrencyByCurrencyIdxKey, Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>>();

    public CFAsteriskRamISOCountryCurrencyTable(ICFAsteriskSchema argSchema) {
        schema = argSchema;
    }

    public void createISOCountryCurrency(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyBuff Buff) {
        final String S_ProcName = "createISOCountryCurrency";
        CFSecurityISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());
        Buff.setRequiredISOCountryId(pkey.getRequiredISOCountryId());
        Buff.setRequiredISOCurrencyId(pkey.getRequiredISOCurrencyId());
        CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryCurrency()
                .newCountryIdxKey();
        keyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

        CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = schema.getFactoryISOCountryCurrency()
                .newCurrencyIdxKey();
        keyCurrencyIdx.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());

        // Validate unique indexes

        if (dictByPKey.containsKey(pkey)) {
            throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
        }

        // Validate foreign keys

        {
            boolean allNull = true;
            allNull = false;
            if (!allNull) {
                if (null == schema.getTableISOCountry().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredISOCountryId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), S_ProcName,
                            "Container", "ISOCountryCurrencyCountry", "ISOCountry", null);
                }
            }
        }

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdictCountryIdx;
        if (dictByCountryIdx.containsKey(keyCountryIdx)) {
            subdictCountryIdx = dictByCountryIdx.get(keyCountryIdx);
        } else {
            subdictCountryIdx = new HashMap<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>();
            dictByCountryIdx.put(keyCountryIdx, subdictCountryIdx);
        }
        subdictCountryIdx.put(pkey, Buff);

        Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdictCurrencyIdx;
        if (dictByCurrencyIdx.containsKey(keyCurrencyIdx)) {
            subdictCurrencyIdx = dictByCurrencyIdx.get(keyCurrencyIdx);
        } else {
            subdictCurrencyIdx = new HashMap<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>();
            dictByCurrencyIdx.put(keyCurrencyIdx, subdictCurrencyIdx);
        }
        subdictCurrencyIdx.put(pkey, Buff);

    }

    public CFSecurityISOCountryCurrencyBuff readDerived(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyPKey PKey) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readDerived";
        CFSecurityISOCountryCurrencyPKey key = schema.getFactoryISOCountryCurrency().newPKey();
        key.setRequiredISOCountryId(PKey.getRequiredISOCountryId());
        key.setRequiredISOCurrencyId(PKey.getRequiredISOCurrencyId());
        CFSecurityISOCountryCurrencyBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFSecurityISOCountryCurrencyBuff lockDerived(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyPKey PKey) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readDerived";
        CFSecurityISOCountryCurrencyPKey key = schema.getFactoryISOCountryCurrency().newPKey();
        key.setRequiredISOCountryId(PKey.getRequiredISOCountryId());
        key.setRequiredISOCurrencyId(PKey.getRequiredISOCurrencyId());
        CFSecurityISOCountryCurrencyBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFSecurityISOCountryCurrencyBuff[] readAllDerived(CFSecurityAuthorization Authorization) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readAllDerived";
        CFSecurityISOCountryCurrencyBuff[] retList = new CFSecurityISOCountryCurrencyBuff[dictByPKey.values()
                .size()];
        Iterator<CFSecurityISOCountryCurrencyBuff> iter = dictByPKey.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            retList[idx++] = iter.next();
        }
        return (retList);
    }

    public CFSecurityISOCountryCurrencyBuff[] readDerivedByCountryIdx(CFSecurityAuthorization Authorization,
            short ISOCountryId) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readDerivedByCountryIdx";
        CFSecurityISOCountryCurrencyByCountryIdxKey key = schema.getFactoryISOCountryCurrency().newCountryIdxKey();
        key.setRequiredISOCountryId(ISOCountryId);

        CFSecurityISOCountryCurrencyBuff[] recArray;
        if (dictByCountryIdx.containsKey(key)) {
            Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdictCountryIdx = dictByCountryIdx
                    .get(key);
            recArray = new CFSecurityISOCountryCurrencyBuff[subdictCountryIdx.size()];
            Iterator<CFSecurityISOCountryCurrencyBuff> iter = subdictCountryIdx.values().iterator();
            int idx = 0;
            while (iter.hasNext()) {
                recArray[idx++] = iter.next();
            }
        } else {
            Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdictCountryIdx = new HashMap<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>();
            dictByCountryIdx.put(key, subdictCountryIdx);
            recArray = new CFSecurityISOCountryCurrencyBuff[0];
        }
        return (recArray);
    }

    public CFSecurityISOCountryCurrencyBuff[] readDerivedByCurrencyIdx(CFSecurityAuthorization Authorization,
            short ISOCurrencyId) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readDerivedByCurrencyIdx";
        CFSecurityISOCountryCurrencyByCurrencyIdxKey key = schema.getFactoryISOCountryCurrency()
                .newCurrencyIdxKey();
        key.setRequiredISOCurrencyId(ISOCurrencyId);

        CFSecurityISOCountryCurrencyBuff[] recArray;
        if (dictByCurrencyIdx.containsKey(key)) {
            Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdictCurrencyIdx = dictByCurrencyIdx
                    .get(key);
            recArray = new CFSecurityISOCountryCurrencyBuff[subdictCurrencyIdx.size()];
            Iterator<CFSecurityISOCountryCurrencyBuff> iter = subdictCurrencyIdx.values().iterator();
            int idx = 0;
            while (iter.hasNext()) {
                recArray[idx++] = iter.next();
            }
        } else {
            Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdictCurrencyIdx = new HashMap<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>();
            dictByCurrencyIdx.put(key, subdictCurrencyIdx);
            recArray = new CFSecurityISOCountryCurrencyBuff[0];
        }
        return (recArray);
    }

    public CFSecurityISOCountryCurrencyBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization,
            short ISOCountryId, short ISOCurrencyId) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readDerivedByIdIdx() ";
        CFSecurityISOCountryCurrencyPKey key = schema.getFactoryISOCountryCurrency().newPKey();
        key.setRequiredISOCountryId(ISOCountryId);
        key.setRequiredISOCurrencyId(ISOCurrencyId);

        CFSecurityISOCountryCurrencyBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFSecurityISOCountryCurrencyBuff readBuff(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyPKey PKey) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readBuff";
        CFSecurityISOCountryCurrencyBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ICCY"))) {
            buff = null;
        }
        return (buff);
    }

    public CFSecurityISOCountryCurrencyBuff lockBuff(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyPKey PKey) {
        final String S_ProcName = "lockBuff";
        CFSecurityISOCountryCurrencyBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ICCY"))) {
            buff = null;
        }
        return (buff);
    }

    public CFSecurityISOCountryCurrencyBuff[] readAllBuff(CFSecurityAuthorization Authorization) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readAllBuff";
        CFSecurityISOCountryCurrencyBuff buff;
        ArrayList<CFSecurityISOCountryCurrencyBuff> filteredList = new ArrayList<CFSecurityISOCountryCurrencyBuff>();
        CFSecurityISOCountryCurrencyBuff[] buffList = readAllDerived(Authorization);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ICCY")) {
                filteredList.add(buff);
            }
        }
        return (filteredList.toArray(new CFSecurityISOCountryCurrencyBuff[0]));
    }

    public CFSecurityISOCountryCurrencyBuff readBuffByIdIdx(CFSecurityAuthorization Authorization,
            short ISOCountryId, short ISOCurrencyId) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readBuffByIdIdx() ";
        CFSecurityISOCountryCurrencyBuff buff = readDerivedByIdIdx(Authorization, ISOCountryId, ISOCurrencyId);
        if ((buff != null) && buff.getClassCode().equals("ICCY")) {
            return ((CFSecurityISOCountryCurrencyBuff) buff);
        } else {
            return (null);
        }
    }

    public CFSecurityISOCountryCurrencyBuff[] readBuffByCountryIdx(CFSecurityAuthorization Authorization,
            short ISOCountryId) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readBuffByCountryIdx() ";
        CFSecurityISOCountryCurrencyBuff buff;
        ArrayList<CFSecurityISOCountryCurrencyBuff> filteredList = new ArrayList<CFSecurityISOCountryCurrencyBuff>();
        CFSecurityISOCountryCurrencyBuff[] buffList = readDerivedByCountryIdx(Authorization, ISOCountryId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ICCY")) {
                filteredList.add((CFSecurityISOCountryCurrencyBuff) buff);
            }
        }
        return (filteredList.toArray(new CFSecurityISOCountryCurrencyBuff[0]));
    }

    public CFSecurityISOCountryCurrencyBuff[] readBuffByCurrencyIdx(CFSecurityAuthorization Authorization,
            short ISOCurrencyId) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrency.readBuffByCurrencyIdx() ";
        CFSecurityISOCountryCurrencyBuff buff;
        ArrayList<CFSecurityISOCountryCurrencyBuff> filteredList = new ArrayList<CFSecurityISOCountryCurrencyBuff>();
        CFSecurityISOCountryCurrencyBuff[] buffList = readDerivedByCurrencyIdx(Authorization, ISOCurrencyId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ICCY")) {
                filteredList.add((CFSecurityISOCountryCurrencyBuff) buff);
            }
        }
        return (filteredList.toArray(new CFSecurityISOCountryCurrencyBuff[0]));
    }

    public void updateISOCountryCurrency(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyBuff Buff) {
        CFSecurityISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());
        CFSecurityISOCountryCurrencyBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                    "updateISOCountryCurrency", "Existing record not found", "ISOCountryCurrency", pkey);
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                    "updateISOCountryCurrency", pkey);
        }
        Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
        CFSecurityISOCountryCurrencyByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOCountryCurrency()
                .newCountryIdxKey();
        existingKeyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

        CFSecurityISOCountryCurrencyByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOCountryCurrency()
                .newCountryIdxKey();
        newKeyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

        CFSecurityISOCountryCurrencyByCurrencyIdxKey existingKeyCurrencyIdx = schema.getFactoryISOCountryCurrency()
                .newCurrencyIdxKey();
        existingKeyCurrencyIdx.setRequiredISOCurrencyId(existing.getRequiredISOCurrencyId());

        CFSecurityISOCountryCurrencyByCurrencyIdxKey newKeyCurrencyIdx = schema.getFactoryISOCountryCurrency()
                .newCurrencyIdxKey();
        newKeyCurrencyIdx.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());

        // Check unique indexes

        // Validate foreign keys

        {
            boolean allNull = true;

            if (allNull) {
                if (null == schema.getTableISOCountry().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredISOCountryId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "updateISOCountryCurrency", "Container", "ISOCountryCurrencyCountry", "ISOCountry",
                            null);
                }
            }
        }

        // Update is valid

        Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdict;

        dictByPKey.remove(pkey);
        dictByPKey.put(pkey, Buff);

        subdict = dictByCountryIdx.get(existingKeyCountryIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByCountryIdx.containsKey(newKeyCountryIdx)) {
            subdict = dictByCountryIdx.get(newKeyCountryIdx);
        } else {
            subdict = new HashMap<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>();
            dictByCountryIdx.put(newKeyCountryIdx, subdict);
        }
        subdict.put(pkey, Buff);

        subdict = dictByCurrencyIdx.get(existingKeyCurrencyIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByCurrencyIdx.containsKey(newKeyCurrencyIdx)) {
            subdict = dictByCurrencyIdx.get(newKeyCurrencyIdx);
        } else {
            subdict = new HashMap<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff>();
            dictByCurrencyIdx.put(newKeyCurrencyIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

    public void deleteISOCountryCurrency(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyBuff Buff) {
        final String S_ProcName = "CFAsteriskRamISOCountryCurrencyTable.deleteISOCountryCurrency() ";
        CFSecurityISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());
        CFSecurityISOCountryCurrencyBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            return;
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                    "deleteISOCountryCurrency", pkey);
        }
        CFSecurityISOCountryCurrencyByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryCurrency()
                .newCountryIdxKey();
        keyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

        CFSecurityISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx = schema.getFactoryISOCountryCurrency()
                .newCurrencyIdxKey();
        keyCurrencyIdx.setRequiredISOCurrencyId(existing.getRequiredISOCurrencyId());

        // Validate reverse foreign keys

        // Delete is valid

        Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdict;

        dictByPKey.remove(pkey);

        subdict = dictByCountryIdx.get(keyCountryIdx);
        subdict.remove(pkey);

        subdict = dictByCurrencyIdx.get(keyCurrencyIdx);
        subdict.remove(pkey);

    }

    public void deleteISOCountryCurrencyByIdIdx(CFSecurityAuthorization Authorization, short argISOCountryId,
            short argISOCurrencyId) {
        CFSecurityISOCountryCurrencyPKey key = schema.getFactoryISOCountryCurrency().newPKey();
        key.setRequiredISOCountryId(argISOCountryId);
        key.setRequiredISOCurrencyId(argISOCurrencyId);
        deleteISOCountryCurrencyByIdIdx(Authorization, key);
    }

    public void deleteISOCountryCurrencyByIdIdx(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyPKey argKey) {
        CFSecurityISOCountryCurrencyBuff cur;
        LinkedList<CFSecurityISOCountryCurrencyBuff> matchSet = new LinkedList<CFSecurityISOCountryCurrencyBuff>();
        Iterator<CFSecurityISOCountryCurrencyBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFSecurityISOCountryCurrencyBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOCountryCurrency(Authorization, cur);
        }
    }

    public void deleteISOCountryCurrencyByCountryIdx(CFSecurityAuthorization Authorization, short argISOCountryId) {
        CFSecurityISOCountryCurrencyByCountryIdxKey key = schema.getFactoryISOCountryCurrency().newCountryIdxKey();
        key.setRequiredISOCountryId(argISOCountryId);
        deleteISOCountryCurrencyByCountryIdx(Authorization, key);
    }

    public void deleteISOCountryCurrencyByCountryIdx(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyByCountryIdxKey argKey) {
        CFSecurityISOCountryCurrencyBuff cur;
        LinkedList<CFSecurityISOCountryCurrencyBuff> matchSet = new LinkedList<CFSecurityISOCountryCurrencyBuff>();
        Iterator<CFSecurityISOCountryCurrencyBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFSecurityISOCountryCurrencyBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOCountryCurrency(Authorization, cur);
        }
    }

    public void deleteISOCountryCurrencyByCurrencyIdx(CFSecurityAuthorization Authorization,
            short argISOCurrencyId) {
        CFSecurityISOCountryCurrencyByCurrencyIdxKey key = schema.getFactoryISOCountryCurrency()
                .newCurrencyIdxKey();
        key.setRequiredISOCurrencyId(argISOCurrencyId);
        deleteISOCountryCurrencyByCurrencyIdx(Authorization, key);
    }

    public void deleteISOCountryCurrencyByCurrencyIdx(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryCurrencyByCurrencyIdxKey argKey) {
        CFSecurityISOCountryCurrencyBuff cur;
        LinkedList<CFSecurityISOCountryCurrencyBuff> matchSet = new LinkedList<CFSecurityISOCountryCurrencyBuff>();
        Iterator<CFSecurityISOCountryCurrencyBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFSecurityISOCountryCurrencyBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOCountryCurrency(Authorization, cur);
        }
    }

    public CFSecurityCursor openISOCountryCurrencyCursorAll(CFSecurityAuthorization Authorization) {
        CFSecurityCursor cursor = new CFAsteriskRamISOCountryCurrencyCursor(Authorization, schema,
                dictByPKey.values());
        return (cursor);
    }

    public CFSecurityCursor openISOCountryCurrencyCursorByCountryIdx(CFSecurityAuthorization Authorization,
            short ISOCountryId) {
        CFSecurityCursor cursor;
        CFSecurityISOCountryCurrencyByCountryIdxKey key = schema.getFactoryISOCountryCurrency().newCountryIdxKey();
        key.setRequiredISOCountryId(ISOCountryId);

        if (dictByCountryIdx.containsKey(key)) {
            Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdictCountryIdx = dictByCountryIdx
                    .get(key);
            cursor = new CFAsteriskRamISOCountryCurrencyCursor(Authorization, schema, subdictCountryIdx.values());
        } else {
            cursor = new CFAsteriskRamISOCountryCurrencyCursor(Authorization, schema,
                    new ArrayList<CFSecurityISOCountryCurrencyBuff>());
        }
        return (cursor);
    }

    public CFSecurityCursor openISOCountryCurrencyCursorByCurrencyIdx(CFSecurityAuthorization Authorization,
            short ISOCurrencyId) {
        CFSecurityCursor cursor;
        CFSecurityISOCountryCurrencyByCurrencyIdxKey key = schema.getFactoryISOCountryCurrency()
                .newCurrencyIdxKey();
        key.setRequiredISOCurrencyId(ISOCurrencyId);

        if (dictByCurrencyIdx.containsKey(key)) {
            Map<CFSecurityISOCountryCurrencyPKey, CFSecurityISOCountryCurrencyBuff> subdictCurrencyIdx = dictByCurrencyIdx
                    .get(key);
            cursor = new CFAsteriskRamISOCountryCurrencyCursor(Authorization, schema, subdictCurrencyIdx.values());
        } else {
            cursor = new CFAsteriskRamISOCountryCurrencyCursor(Authorization, schema,
                    new ArrayList<CFSecurityISOCountryCurrencyBuff>());
        }
        return (cursor);
    }

    public void closeISOCountryCurrencyCursor(CFSecurityCursor Cursor) {
        // Cursor.DataReader.Close();
    }

    public CFSecurityISOCountryCurrencyBuff nextISOCountryCurrencyCursor(CFSecurityCursor Cursor) {
        CFAsteriskRamISOCountryCurrencyCursor cursor = (CFAsteriskRamISOCountryCurrencyCursor) Cursor;
        CFSecurityISOCountryCurrencyBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

    public CFSecurityISOCountryCurrencyBuff prevISOCountryCurrencyCursor(CFSecurityCursor Cursor) {
        int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1;
        CFSecurityISOCountryCurrencyBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOCountryCurrencyCursor(Cursor);
        }
        return (rec);
    }

    public CFSecurityISOCountryCurrencyBuff firstISOCountryCurrencyCursor(CFSecurityCursor Cursor) {
        int targetRowIdx = 1;
        CFSecurityISOCountryCurrencyBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOCountryCurrencyCursor(Cursor);
        }
        return (rec);
    }

    public CFSecurityISOCountryCurrencyBuff lastISOCountryCurrencyCursor(CFSecurityCursor Cursor) {
        throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(),
                "lastISOCountryCurrencyCursor");
    }

    public CFSecurityISOCountryCurrencyBuff nthISOCountryCurrencyCursor(CFSecurityCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        CFSecurityISOCountryCurrencyBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOCountryCurrencyCursor(Cursor);
        }
        return (rec);
    }

    public void releasePreparedStatements() {
    }
}