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

Java tutorial

Introduction

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

Source

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

/*
 *   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.*;

/*
 *   CFAsteriskRamISOCountryLanguageTable in-memory RAM DbIO implementation
 *   for ISOCountryLanguage.
 */
public class CFAsteriskRamISOCountryLanguageTable implements ICFAsteriskISOCountryLanguageTable {
    private ICFAsteriskSchema schema;
    private Map<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff> dictByPKey = new HashMap<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff>();
    private Map<CFSecurityISOCountryLanguageByCountryIdxKey, Map<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff>> dictByCountryIdx = new HashMap<CFSecurityISOCountryLanguageByCountryIdxKey, Map<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff>>();
    private Map<CFSecurityISOCountryLanguageByLanguageIdxKey, Map<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff>> dictByLanguageIdx = new HashMap<CFSecurityISOCountryLanguageByLanguageIdxKey, Map<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff>>();

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

    public void createISOCountryLanguage(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryLanguageBuff Buff) {
        final String S_ProcName = "createISOCountryLanguage";
        CFSecurityISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
        Buff.setRequiredISOCountryId(pkey.getRequiredISOCountryId());
        Buff.setRequiredISOLanguageId(pkey.getRequiredISOLanguageId());
        CFSecurityISOCountryLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOCountryLanguage()
                .newCountryIdxKey();
        keyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

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

        // 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", "ISOCountryLanguageCountry", "ISOCountry", null);
                }
            }
        }

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

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

        Map<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff> subdictLanguageIdx;
        if (dictByLanguageIdx.containsKey(keyLanguageIdx)) {
            subdictLanguageIdx = dictByLanguageIdx.get(keyLanguageIdx);
        } else {
            subdictLanguageIdx = new HashMap<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff>();
            dictByLanguageIdx.put(keyLanguageIdx, subdictLanguageIdx);
        }
        subdictLanguageIdx.put(pkey, Buff);

    }

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

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

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

    public CFSecurityISOCountryLanguageBuff[] readDerivedByCountryIdx(CFSecurityAuthorization Authorization,
            short ISOCountryId) {
        final String S_ProcName = "CFAsteriskRamISOCountryLanguage.readDerivedByCountryIdx";
        CFSecurityISOCountryLanguageByCountryIdxKey key = schema.getFactoryISOCountryLanguage().newCountryIdxKey();
        key.setRequiredISOCountryId(ISOCountryId);

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

    public CFSecurityISOCountryLanguageBuff[] readDerivedByLanguageIdx(CFSecurityAuthorization Authorization,
            short ISOLanguageId) {
        final String S_ProcName = "CFAsteriskRamISOCountryLanguage.readDerivedByLanguageIdx";
        CFSecurityISOCountryLanguageByLanguageIdxKey key = schema.getFactoryISOCountryLanguage()
                .newLanguageIdxKey();
        key.setRequiredISOLanguageId(ISOLanguageId);

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

    public CFSecurityISOCountryLanguageBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization,
            short ISOCountryId, short ISOLanguageId) {
        final String S_ProcName = "CFAsteriskRamISOCountryLanguage.readDerivedByIdIdx() ";
        CFSecurityISOCountryLanguagePKey key = schema.getFactoryISOCountryLanguage().newPKey();
        key.setRequiredISOCountryId(ISOCountryId);
        key.setRequiredISOLanguageId(ISOLanguageId);

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

    public CFSecurityISOCountryLanguageBuff readBuff(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryLanguagePKey PKey) {
        final String S_ProcName = "CFAsteriskRamISOCountryLanguage.readBuff";
        CFSecurityISOCountryLanguageBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ISCL"))) {
            buff = null;
        }
        return (buff);
    }

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

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

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

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

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

    public void updateISOCountryLanguage(CFSecurityAuthorization Authorization,
            CFSecurityISOCountryLanguageBuff Buff) {
        CFSecurityISOCountryLanguagePKey pkey = schema.getFactoryISOCountryLanguage().newPKey();
        pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
        pkey.setRequiredISOLanguageId(Buff.getRequiredISOLanguageId());
        CFSecurityISOCountryLanguageBuff 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);
        CFSecurityISOCountryLanguageByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOCountryLanguage()
                .newCountryIdxKey();
        existingKeyCountryIdx.setRequiredISOCountryId(existing.getRequiredISOCountryId());

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

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

        CFSecurityISOCountryLanguageByLanguageIdxKey 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

        Map<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff> 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<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff>();
            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 HashMap<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff>();
            dictByLanguageIdx.put(newKeyLanguageIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

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

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

        // Validate reverse foreign keys

        // Delete is valid

        Map<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff> subdict;

        dictByPKey.remove(pkey);

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

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

    }

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

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

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

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

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

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

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

    public CFSecurityCursor openISOCountryLanguageCursorByCountryIdx(CFSecurityAuthorization Authorization,
            short ISOCountryId) {
        CFSecurityCursor cursor;
        CFSecurityISOCountryLanguageByCountryIdxKey key = schema.getFactoryISOCountryLanguage().newCountryIdxKey();
        key.setRequiredISOCountryId(ISOCountryId);

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

    public CFSecurityCursor openISOCountryLanguageCursorByLanguageIdx(CFSecurityAuthorization Authorization,
            short ISOLanguageId) {
        CFSecurityCursor cursor;
        CFSecurityISOCountryLanguageByLanguageIdxKey key = schema.getFactoryISOCountryLanguage()
                .newLanguageIdxKey();
        key.setRequiredISOLanguageId(ISOLanguageId);

        if (dictByLanguageIdx.containsKey(key)) {
            Map<CFSecurityISOCountryLanguagePKey, CFSecurityISOCountryLanguageBuff> subdictLanguageIdx = dictByLanguageIdx
                    .get(key);
            cursor = new CFAsteriskRamISOCountryLanguageCursor(Authorization, schema, subdictLanguageIdx.values());
        } else {
            cursor = new CFAsteriskRamISOCountryLanguageCursor(Authorization, schema,
                    new ArrayList<CFSecurityISOCountryLanguageBuff>());
        }
        return (cursor);
    }

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

    public CFSecurityISOCountryLanguageBuff nextISOCountryLanguageCursor(CFSecurityCursor Cursor) {
        CFAsteriskRamISOCountryLanguageCursor cursor = (CFAsteriskRamISOCountryLanguageCursor) Cursor;
        CFSecurityISOCountryLanguageBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

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

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

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

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

    public void releasePreparedStatements() {
    }
}