net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamISOCountryLanguageTable.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamISOCountryLanguageTable.java

Source

// Description: Java7 in-memory RAM DbIO implementation for ISOCountryLanguage.

/*
 *   CF Asterisk 11 Configuration Model
 *
 *   Copyright (c) 2013-2014 Mark Sobkow
 *   
 *   This program is available as free software under the GNU GPL v3, or
 *   under a commercial license from Mark Sobkow.  For commercial licensing
 *   details, please contact msobkow@sasktel.net.
 *   
 *   Under the terms of the GPL:
 *   
 *      This program is free software: you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation, either version 3 of the License, or
 *      (at your option) any later version.
 *     
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *     
 *      You should have received a copy of the GNU General Public License
 *      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *   
 *      This source code incorporates modified modules originally licensed
 *      under the Apache 2.0 license by MSS Code Factory including CFSecurity
 *      (net-sourceforge-msscodefactory-2.0-cfsecurity.xml),
 *      CFInternet (net-sourceforge-msscodefactory-2.0-cfinternet.xml), and
 *      CFCrm 2.0 (net-sourceforge-msscodefactory-2.0-cfcrm.xml), with all of the
 *      required models being available as part of the MSS Code Factory 1.11
 *      distribution source and install zips.
 *   
 *      You can download installations of MSS Code Factory 1.11 from
 *      http://msscodefactory.sourceforge.net/
 *   
 * ***********************************************************************
 *
 *   Code manufactured by MSS Code Factory
 */

package net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam;

import java.sql.*;
import java.util.*;
import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*;
import org.apache.commons.codec.binary.Base64;
import net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAst.*;
import net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.*;

/*
 *   CFAstRamISOCountryLanguageTable in-memory RAM DbIO implementation
 *   for ISOCountryLanguage.
 */
public class CFAstRamISOCountryLanguageTable implements ICFAstISOCountryLanguageTable {
    private CFAstRamSchema schema;
    private Map<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff> dictByPKey = new HashMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff>();
    private SortedMap<CFAstISOCountryLanguageByCountryIdxKey, SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff>> dictByCountryIdx = new TreeMap<CFAstISOCountryLanguageByCountryIdxKey, SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff>>();
    private SortedMap<CFAstISOCountryLanguageByLanguageIdxKey, SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff>> dictByLanguageIdx = new TreeMap<CFAstISOCountryLanguageByLanguageIdxKey, SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff>>();

    public CFAstRamISOCountryLanguageTable(CFAstRamSchema argSchema) {
        schema = argSchema;
    }

    public void createISOCountryLanguage(CFAstAuthorization Authorization, CFAstISOCountryLanguageBuff Buff) {
        CFAstISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
        Buff.setRequiredISOCountryId(pkey.getRequiredISOCountryId());
        Buff.setRequiredISOLanguageId(pkey.getRequiredISOLanguageId());
        CFAstISOCountryLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryLanguage()
                .newCountryIdxKey();
        keyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

        CFAstISOCountryLanguageByLanguageIdxKey keyLanguageIdx = schema.getFactoryISOCountryLanguage()
                .newLanguageIdxKey();
        keyLanguageIdx.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());

        // Validate unique indexes

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

        // Validate foreign keys

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

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff> subdictCountryIdx;
        if (dictByCountryIdx.containsKey(keyCountryIdx)) {
            subdictCountryIdx = dictByCountryIdx.get(keyCountryIdx);
        } else {
            subdictCountryIdx = new TreeMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff>();
            dictByCountryIdx.put(keyCountryIdx, subdictCountryIdx);
        }
        subdictCountryIdx.put(pkey, Buff);

        SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff> subdictLanguageIdx;
        if (dictByLanguageIdx.containsKey(keyLanguageIdx)) {
            subdictLanguageIdx = dictByLanguageIdx.get(keyLanguageIdx);
        } else {
            subdictLanguageIdx = new TreeMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff>();
            dictByLanguageIdx.put(keyLanguageIdx, subdictLanguageIdx);
        }
        subdictLanguageIdx.put(pkey, Buff);

    }

    public CFAstISOCountryLanguageBuff readDerived(CFAstAuthorization Authorization,
            CFAstISOCountryLanguagePKey PKey) {
        final String S_ProcName = "CFAstRamISOCountryLanguage.readDerived() ";
        CFAstISOCountryLanguagePKey key = schema.getFactoryISOCountryLanguage().newPKey();
        key.setRequiredISOCountryId(PKey.getRequiredISOCountryId());
        key.setRequiredISOLanguageId(PKey.getRequiredISOLanguageId());
        CFAstISOCountryLanguageBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFAstISOCountryLanguageBuff lockDerived(CFAstAuthorization Authorization,
            CFAstISOCountryLanguagePKey PKey) {
        final String S_ProcName = "CFAstRamISOCountryLanguage.readDerived() ";
        CFAstISOCountryLanguagePKey key = schema.getFactoryISOCountryLanguage().newPKey();
        key.setRequiredISOCountryId(PKey.getRequiredISOCountryId());
        key.setRequiredISOLanguageId(PKey.getRequiredISOLanguageId());
        CFAstISOCountryLanguageBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

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

    public CFAstISOCountryLanguageBuff[] readDerivedByCountryIdx(CFAstAuthorization Authorization,
            short ISOCountryId) {
        final String S_ProcName = "CFAstRamISOCountryLanguage.readDerivedByCountryIdx() ";
        CFAstISOCountryLanguageByCountryIdxKey key = schema.getFactoryISOCountryLanguage().newCountryIdxKey();
        key.setRequiredISOCountryId(ISOCountryId);

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

    public CFAstISOCountryLanguageBuff[] readDerivedByLanguageIdx(CFAstAuthorization Authorization,
            short ISOLanguageId) {
        final String S_ProcName = "CFAstRamISOCountryLanguage.readDerivedByLanguageIdx() ";
        CFAstISOCountryLanguageByLanguageIdxKey key = schema.getFactoryISOCountryLanguage().newLanguageIdxKey();
        key.setRequiredISOLanguageId(ISOLanguageId);

        CFAstISOCountryLanguageBuff[] recArray;
        if (dictByLanguageIdx.containsKey(key)) {
            SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff> subdictLanguageIdx = dictByLanguageIdx
                    .get(key);
            recArray = new CFAstISOCountryLanguageBuff[subdictLanguageIdx.size()];
            Iterator<CFAstISOCountryLanguageBuff> iter = subdictLanguageIdx.values().iterator();
            int idx = 0;
            while (iter.hasNext()) {
                recArray[idx++] = iter.next();
            }
        } else {
            recArray = new CFAstISOCountryLanguageBuff[0];
        }
        return (recArray);
    }

    public CFAstISOCountryLanguageBuff readDerivedByIdIdx(CFAstAuthorization Authorization, short ISOCountryId,
            short ISOLanguageId) {
        final String S_ProcName = "CFAstRamISOCountryLanguage.readDerivedByIdIdx() ";
        CFAstISOCountryLanguagePKey key = schema.getFactoryISOCountryLanguage().newPKey();
        key.setRequiredISOCountryId(ISOCountryId);
        key.setRequiredISOLanguageId(ISOLanguageId);

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

    public CFAstISOCountryLanguageBuff readBuff(CFAstAuthorization Authorization,
            CFAstISOCountryLanguagePKey PKey) {
        final String S_ProcName = "CFAstRamISOCountryLanguage.readBuff() ";
        CFAstISOCountryLanguageBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ISCL"))) {
            buff = null;
        }
        return (buff);
    }

    public CFAstISOCountryLanguageBuff lockBuff(CFAstAuthorization Authorization,
            CFAstISOCountryLanguagePKey PKey) {
        final String S_ProcName = "CFAstRamISOCountryLanguage.readBuff() ";
        CFAstISOCountryLanguageBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ISCL"))) {
            buff = null;
        }
        return (buff);
    }

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

    public CFAstISOCountryLanguageBuff readBuffByIdIdx(CFAstAuthorization Authorization, short ISOCountryId,
            short ISOLanguageId) {
        final String S_ProcName = "CFAstRamISOCountryLanguage.readBuffByIdIdx() ";
        CFAstISOCountryLanguageBuff buff = readDerivedByIdIdx(Authorization, ISOCountryId, ISOLanguageId);
        if ((buff != null) && buff.getClassCode().equals("ISCL")) {
            return ((CFAstISOCountryLanguageBuff) buff);
        } else {
            return (null);
        }
    }

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

    public CFAstISOCountryLanguageBuff[] readBuffByLanguageIdx(CFAstAuthorization Authorization,
            short ISOLanguageId) {
        final String S_ProcName = "CFAstRamISOCountryLanguage.readBuffByLanguageIdx() ";
        CFAstISOCountryLanguageBuff buff;
        ArrayList<CFAstISOCountryLanguageBuff> filteredList = new ArrayList<CFAstISOCountryLanguageBuff>();
        CFAstISOCountryLanguageBuff[] buffList = readDerivedByLanguageIdx(Authorization, ISOLanguageId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ISCL")) {
                filteredList.add((CFAstISOCountryLanguageBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAstISOCountryLanguageBuff[0]));
    }

    public void updateISOCountryLanguage(CFAstAuthorization Authorization, CFAstISOCountryLanguageBuff Buff) {
        CFAstISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
        CFAstISOCountryLanguageBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                    "updateISOCountryLanguage", "Existing record not found", "ISOCountryLanguage", pkey);
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                    "updateISOCountryLanguage", pkey);
        }
        Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
        CFAstISOCountryLanguageByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOCountryLanguage()
                .newCountryIdxKey();
        existingKeyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

        CFAstISOCountryLanguageByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOCountryLanguage()
                .newCountryIdxKey();
        newKeyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

        CFAstISOCountryLanguageByLanguageIdxKey existingKeyLanguageIdx = schema.getFactoryISOCountryLanguage()
                .newLanguageIdxKey();
        existingKeyLanguageIdx.setRequiredISOLanguageId(existing.getRequiredISOLanguageId());

        CFAstISOCountryLanguageByLanguageIdxKey newKeyLanguageIdx = schema.getFactoryISOCountryLanguage()
                .newLanguageIdxKey();
        newKeyLanguageIdx.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());

        // Check unique indexes

        // Validate foreign keys

        {
            boolean allNull = true;

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

        // Update is valid

        SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff> 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 TreeMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff>();
            dictByCountryIdx.put(newKeyCountryIdx, subdict);
        }
        subdict.put(pkey, Buff);

        subdict = dictByLanguageIdx.get(existingKeyLanguageIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByLanguageIdx.containsKey(newKeyLanguageIdx)) {
            subdict = dictByLanguageIdx.get(newKeyLanguageIdx);
        } else {
            subdict = new TreeMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff>();
            dictByLanguageIdx.put(newKeyLanguageIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

    public void deleteISOCountryLanguage(CFAstAuthorization Authorization, CFAstISOCountryLanguageBuff Buff) {
        final String S_ProcName = "CFAstRamISOCountryLanguageTable.deleteISOCountryLanguage() ";
        CFAstISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
        CFAstISOCountryLanguageBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            return;
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                    "deleteISOCountryLanguage", pkey);
        }
        CFAstISOCountryLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryLanguage()
                .newCountryIdxKey();
        keyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

        CFAstISOCountryLanguageByLanguageIdxKey keyLanguageIdx = schema.getFactoryISOCountryLanguage()
                .newLanguageIdxKey();
        keyLanguageIdx.setRequiredISOLanguageId(existing.getRequiredISOLanguageId());

        // Validate reverse foreign keys

        // Delete is valid

        SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff> subdict;

        dictByPKey.remove(pkey);

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

        subdict = dictByLanguageIdx.get(keyLanguageIdx);
        subdict.remove(pkey);

    }

    public void deleteISOCountryLanguageByIdIdx(CFAstAuthorization Authorization, short argISOCountryId,
            short argISOLanguageId) {
        CFAstISOCountryLanguagePKey key = schema.getFactoryISOCountryLanguage().newPKey();
        key.setRequiredISOCountryId(argISOCountryId);
        key.setRequiredISOLanguageId(argISOLanguageId);
        deleteISOCountryLanguageByIdIdx(Authorization, key);
    }

    public void deleteISOCountryLanguageByIdIdx(CFAstAuthorization Authorization,
            CFAstISOCountryLanguagePKey argKey) {
        CFAstISOCountryLanguageBuff cur;
        LinkedList<CFAstISOCountryLanguageBuff> matchSet = new LinkedList<CFAstISOCountryLanguageBuff>();
        Iterator<CFAstISOCountryLanguageBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstISOCountryLanguageBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOCountryLanguage(Authorization, cur);
        }
    }

    public void deleteISOCountryLanguageByCountryIdx(CFAstAuthorization Authorization, short argISOCountryId) {
        CFAstISOCountryLanguageByCountryIdxKey key = schema.getFactoryISOCountryLanguage().newCountryIdxKey();
        key.setRequiredISOCountryId(argISOCountryId);
        deleteISOCountryLanguageByCountryIdx(Authorization, key);
    }

    public void deleteISOCountryLanguageByCountryIdx(CFAstAuthorization Authorization,
            CFAstISOCountryLanguageByCountryIdxKey argKey) {
        CFAstISOCountryLanguageBuff cur;
        LinkedList<CFAstISOCountryLanguageBuff> matchSet = new LinkedList<CFAstISOCountryLanguageBuff>();
        Iterator<CFAstISOCountryLanguageBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstISOCountryLanguageBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOCountryLanguage(Authorization, cur);
        }
    }

    public void deleteISOCountryLanguageByLanguageIdx(CFAstAuthorization Authorization, short argISOLanguageId) {
        CFAstISOCountryLanguageByLanguageIdxKey key = schema.getFactoryISOCountryLanguage().newLanguageIdxKey();
        key.setRequiredISOLanguageId(argISOLanguageId);
        deleteISOCountryLanguageByLanguageIdx(Authorization, key);
    }

    public void deleteISOCountryLanguageByLanguageIdx(CFAstAuthorization Authorization,
            CFAstISOCountryLanguageByLanguageIdxKey argKey) {
        CFAstISOCountryLanguageBuff cur;
        LinkedList<CFAstISOCountryLanguageBuff> matchSet = new LinkedList<CFAstISOCountryLanguageBuff>();
        Iterator<CFAstISOCountryLanguageBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstISOCountryLanguageBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOCountryLanguage(Authorization, cur);
        }
    }

    public CFAstCursor openISOCountryLanguageCursorAll(CFAstAuthorization Authorization) {
        CFAstCursor cursor = new CFAstRamISOCountryLanguageCursor(Authorization, schema, dictByPKey.values());
        return (cursor);
    }

    public CFAstCursor openISOCountryLanguageCursorByCountryIdx(CFAstAuthorization Authorization,
            short ISOCountryId) {
        CFAstCursor cursor;
        CFAstISOCountryLanguageByCountryIdxKey key = schema.getFactoryISOCountryLanguage().newCountryIdxKey();
        key.setRequiredISOCountryId(ISOCountryId);

        if (dictByCountryIdx.containsKey(key)) {
            SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff> subdictCountryIdx = dictByCountryIdx
                    .get(key);
            cursor = new CFAstRamISOCountryLanguageCursor(Authorization, schema, subdictCountryIdx.values());
        } else {
            cursor = new CFAstRamISOCountryLanguageCursor(Authorization, schema,
                    new ArrayList<CFAstISOCountryLanguageBuff>());
        }
        return (cursor);
    }

    public CFAstCursor openISOCountryLanguageCursorByLanguageIdx(CFAstAuthorization Authorization,
            short ISOLanguageId) {
        CFAstCursor cursor;
        CFAstISOCountryLanguageByLanguageIdxKey key = schema.getFactoryISOCountryLanguage().newLanguageIdxKey();
        key.setRequiredISOLanguageId(ISOLanguageId);

        if (dictByLanguageIdx.containsKey(key)) {
            SortedMap<CFAstISOCountryLanguagePKey, CFAstISOCountryLanguageBuff> subdictLanguageIdx = dictByLanguageIdx
                    .get(key);
            cursor = new CFAstRamISOCountryLanguageCursor(Authorization, schema, subdictLanguageIdx.values());
        } else {
            cursor = new CFAstRamISOCountryLanguageCursor(Authorization, schema,
                    new ArrayList<CFAstISOCountryLanguageBuff>());
        }
        return (cursor);
    }

    public void closeISOCountryLanguageCursor(CFAstCursor Cursor) {
        // Cursor.DataReader.Close();
    }

    public CFAstISOCountryLanguageBuff nextISOCountryLanguageCursor(CFAstCursor Cursor) {
        CFAstRamISOCountryLanguageCursor cursor = (CFAstRamISOCountryLanguageCursor) Cursor;
        CFAstISOCountryLanguageBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

    public CFAstISOCountryLanguageBuff prevISOCountryLanguageCursor(CFAstCursor Cursor) {
        int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1;
        CFAstISOCountryLanguageBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOCountryLanguageCursor(Cursor);
        }
        return (rec);
    }

    public CFAstISOCountryLanguageBuff firstISOCountryLanguageCursor(CFAstCursor Cursor) {
        int targetRowIdx = 1;
        CFAstISOCountryLanguageBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOCountryLanguageCursor(Cursor);
        }
        return (rec);
    }

    public CFAstISOCountryLanguageBuff lastISOCountryLanguageCursor(CFAstCursor Cursor) {
        throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(),
                "lastISOCountryLanguageCursor");
    }

    public CFAstISOCountryLanguageBuff nthISOCountryLanguageCursor(CFAstCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        CFAstISOCountryLanguageBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOCountryLanguageCursor(Cursor);
        }
        return (rec);
    }

    public void releasePreparedStatements() {
    }
}