net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamISOCountryLanguageTable.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamISOCountryLanguageTable.java

Source

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

/*
 *   MSS Code Factory Accounting Business Application Model
 *
 *   Copyright (c) 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.cfacc.v2_0.CFAccRam;

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.cfacc.v2_0.CFAcc.*;
import net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.*;

/*
 *   CFAccRamISOCountryLanguageTable in-memory RAM DbIO implementation
 *   for ISOCountryLanguage.
 */
public class CFAccRamISOCountryLanguageTable implements ICFAccISOCountryLanguageTable {
    private CFAccRamSchema schema;
    private Map<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff> dictByPKey = new HashMap<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff>();
    private SortedMap<CFAccISOCountryLanguageByCountryIdxKey, SortedMap<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff>> dictByCountryIdx = new TreeMap<CFAccISOCountryLanguageByCountryIdxKey, SortedMap<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff>>();
    private SortedMap<CFAccISOCountryLanguageByLanguageIdxKey, SortedMap<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff>> dictByLanguageIdx = new TreeMap<CFAccISOCountryLanguageByLanguageIdxKey, SortedMap<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff>>();

    public CFAccRamISOCountryLanguageTable(CFAccRamSchema argSchema) {
        schema = argSchema;
    }

    public void createISOCountryLanguage(CFAccAuthorization Authorization, CFAccISOCountryLanguageBuff Buff) {
        CFAccISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
        Buff.setRequiredISOCountryId(pkey.getRequiredISOCountryId());
        Buff.setRequiredISOLanguageId(pkey.getRequiredISOLanguageId());
        CFAccISOCountryLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryLanguage()
                .newCountryIdxKey();
        keyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

        CFAccISOCountryLanguageByLanguageIdxKey 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<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff> subdictCountryIdx;
        if (dictByCountryIdx.containsKey(keyCountryIdx)) {
            subdictCountryIdx = dictByCountryIdx.get(keyCountryIdx);
        } else {
            subdictCountryIdx = new TreeMap<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff>();
            dictByCountryIdx.put(keyCountryIdx, subdictCountryIdx);
        }
        subdictCountryIdx.put(pkey, Buff);

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

    }

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

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

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

    public CFAccISOCountryLanguageBuff[] readDerivedByCountryIdx(CFAccAuthorization Authorization,
            short ISOCountryId) {
        final String S_ProcName = "CFAccRamISOCountryLanguage.readDerivedByCountryIdx() ";
        CFAccISOCountryLanguageByCountryIdxKey key = schema.getFactoryISOCountryLanguage().newCountryIdxKey();
        key.setRequiredISOCountryId(ISOCountryId);

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

    public CFAccISOCountryLanguageBuff[] readDerivedByLanguageIdx(CFAccAuthorization Authorization,
            short ISOLanguageId) {
        final String S_ProcName = "CFAccRamISOCountryLanguage.readDerivedByLanguageIdx() ";
        CFAccISOCountryLanguageByLanguageIdxKey key = schema.getFactoryISOCountryLanguage().newLanguageIdxKey();
        key.setRequiredISOLanguageId(ISOLanguageId);

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

    public CFAccISOCountryLanguageBuff readDerivedByIdIdx(CFAccAuthorization Authorization, short ISOCountryId,
            short ISOLanguageId) {
        final String S_ProcName = "CFAccRamISOCountryLanguage.readDerivedByIdIdx() ";
        CFAccISOCountryLanguagePKey key = schema.getFactoryISOCountryLanguage().newPKey();
        key.setRequiredISOCountryId(ISOCountryId);
        key.setRequiredISOLanguageId(ISOLanguageId);

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

    public CFAccISOCountryLanguageBuff readBuff(CFAccAuthorization Authorization,
            CFAccISOCountryLanguagePKey PKey) {
        final String S_ProcName = "CFAccRamISOCountryLanguage.readBuff() ";
        CFAccISOCountryLanguageBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ISCL"))) {
            buff = null;
        }
        return (buff);
    }

    public CFAccISOCountryLanguageBuff lockBuff(CFAccAuthorization Authorization,
            CFAccISOCountryLanguagePKey PKey) {
        final String S_ProcName = "CFAccRamISOCountryLanguage.readBuff() ";
        CFAccISOCountryLanguageBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ISCL"))) {
            buff = null;
        }
        return (buff);
    }

    public CFAccISOCountryLanguageBuff[] readAllBuff(CFAccAuthorization Authorization) {
        final String S_ProcName = "CFAccRamISOCountryLanguage.readAllBuff() ";
        CFAccISOCountryLanguageBuff buff;
        ArrayList<CFAccISOCountryLanguageBuff> filteredList = new ArrayList<CFAccISOCountryLanguageBuff>();
        CFAccISOCountryLanguageBuff[] 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 CFAccISOCountryLanguageBuff[0]));
    }

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

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

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

    public void updateISOCountryLanguage(CFAccAuthorization Authorization, CFAccISOCountryLanguageBuff Buff) {
        CFAccISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
        CFAccISOCountryLanguageBuff 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);
        CFAccISOCountryLanguageByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOCountryLanguage()
                .newCountryIdxKey();
        existingKeyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

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

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

        CFAccISOCountryLanguageByLanguageIdxKey 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<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff> 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<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff>();
            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<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff>();
            dictByLanguageIdx.put(newKeyLanguageIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

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

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

        // Validate reverse foreign keys

        // Delete is valid

        SortedMap<CFAccISOCountryLanguagePKey, CFAccISOCountryLanguageBuff> subdict;

        dictByPKey.remove(pkey);

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

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

    }

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

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

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

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

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

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

    public CFAccCursor openISOCountryLanguageCursorAll(CFAccAuthorization Authorization) {
        CFAccCursor cursor = new CFAccRamISOCountryLanguageCursor(Authorization, schema, dictByPKey.values());
        return (cursor);
    }

    public CFAccCursor openISOCountryLanguageCursorByCountryIdx(CFAccAuthorization Authorization,
            short ISOCountryId) {
        CFAccCursor cursor;
        CFAccISOCountryLanguageByCountryIdxKey key = schema.getFactoryISOCountryLanguage().newCountryIdxKey();
        key.setRequiredISOCountryId(ISOCountryId);

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

    public CFAccCursor openISOCountryLanguageCursorByLanguageIdx(CFAccAuthorization Authorization,
            short ISOLanguageId) {
        CFAccCursor cursor;
        CFAccISOCountryLanguageByLanguageIdxKey key = schema.getFactoryISOCountryLanguage().newLanguageIdxKey();
        key.setRequiredISOLanguageId(ISOLanguageId);

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

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

    public CFAccISOCountryLanguageBuff nextISOCountryLanguageCursor(CFAccCursor Cursor) {
        CFAccRamISOCountryLanguageCursor cursor = (CFAccRamISOCountryLanguageCursor) Cursor;
        CFAccISOCountryLanguageBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

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

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

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

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

    public void releasePreparedStatements() {
    }
}