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

Java tutorial

Introduction

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

Source

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

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

/*
 *   CFAsteriskRamISOLanguageTable in-memory RAM DbIO implementation
 *   for ISOLanguage.
 */
public class CFAsteriskRamISOLanguageTable implements ICFAsteriskISOLanguageTable {
    private ICFAsteriskSchema schema;
    private Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> dictByPKey = new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>();
    private Map<CFSecurityISOLanguageByBaseIdxKey, Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>> dictByBaseIdx = new HashMap<CFSecurityISOLanguageByBaseIdxKey, Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>>();
    private Map<CFSecurityISOLanguageByCountryIdxKey, Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>> dictByCountryIdx = new HashMap<CFSecurityISOLanguageByCountryIdxKey, Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>>();
    private Map<CFSecurityISOLanguageByCodeIdxKey, CFSecurityISOLanguageBuff> dictByCodeIdx = new HashMap<CFSecurityISOLanguageByCodeIdxKey, CFSecurityISOLanguageBuff>();

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

    public void createISOLanguage(CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) {
        final String S_ProcName = "createISOLanguage";
        CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
        pkey.setRequiredId(Buff.getRequiredId());
        Buff.setRequiredId(pkey.getRequiredId());
        CFSecurityISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
        keyBaseIdx.setRequiredBaseLanguageCode(Buff.getRequiredBaseLanguageCode());

        CFSecurityISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
        keyCountryIdx.setOptionalISOCountryId(Buff.getOptionalISOCountryId());

        CFSecurityISOLanguageByCodeIdxKey keyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
        keyCodeIdx.setRequiredISOCode(Buff.getRequiredISOCode());

        // Validate unique indexes

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

        if (dictByCodeIdx.containsKey(keyCodeIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName,
                    "ISOLanguageCodeIdx", keyCodeIdx);
        }

        // Validate foreign keys

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictBaseIdx;
        if (dictByBaseIdx.containsKey(keyBaseIdx)) {
            subdictBaseIdx = dictByBaseIdx.get(keyBaseIdx);
        } else {
            subdictBaseIdx = new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>();
            dictByBaseIdx.put(keyBaseIdx, subdictBaseIdx);
        }
        subdictBaseIdx.put(pkey, Buff);

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

        dictByCodeIdx.put(keyCodeIdx, Buff);

    }

    public CFSecurityISOLanguageBuff readDerived(CFSecurityAuthorization Authorization,
            CFSecurityISOLanguagePKey PKey) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readDerived";
        CFSecurityISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey();
        key.setRequiredId(PKey.getRequiredId());
        CFSecurityISOLanguageBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFSecurityISOLanguageBuff lockDerived(CFSecurityAuthorization Authorization,
            CFSecurityISOLanguagePKey PKey) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readDerived";
        CFSecurityISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey();
        key.setRequiredId(PKey.getRequiredId());
        CFSecurityISOLanguageBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

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

    public CFSecurityISOLanguageBuff[] readDerivedByBaseIdx(CFSecurityAuthorization Authorization,
            String BaseLanguageCode) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readDerivedByBaseIdx";
        CFSecurityISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey();
        key.setRequiredBaseLanguageCode(BaseLanguageCode);

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

    public CFSecurityISOLanguageBuff[] readDerivedByCountryIdx(CFSecurityAuthorization Authorization,
            Short ISOCountryId) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readDerivedByCountryIdx";
        CFSecurityISOLanguageByCountryIdxKey key = schema.getFactoryISOLanguage().newCountryIdxKey();
        key.setOptionalISOCountryId(ISOCountryId);

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

    public CFSecurityISOLanguageBuff readDerivedByCodeIdx(CFSecurityAuthorization Authorization, String ISOCode) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readDerivedByCodeIdx";
        CFSecurityISOLanguageByCodeIdxKey key = schema.getFactoryISOLanguage().newCodeIdxKey();
        key.setRequiredISOCode(ISOCode);

        CFSecurityISOLanguageBuff buff;
        if (dictByCodeIdx.containsKey(key)) {
            buff = dictByCodeIdx.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFSecurityISOLanguageBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization, short Id) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readDerivedByIdIdx() ";
        CFSecurityISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey();
        key.setRequiredId(Id);

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

    public CFSecurityISOLanguageBuff readBuff(CFSecurityAuthorization Authorization,
            CFSecurityISOLanguagePKey PKey) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readBuff";
        CFSecurityISOLanguageBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ISLN"))) {
            buff = null;
        }
        return (buff);
    }

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

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

    public CFSecurityISOLanguageBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, short Id) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readBuffByIdIdx() ";
        CFSecurityISOLanguageBuff buff = readDerivedByIdIdx(Authorization, Id);
        if ((buff != null) && buff.getClassCode().equals("ISLN")) {
            return ((CFSecurityISOLanguageBuff) buff);
        } else {
            return (null);
        }
    }

    public CFSecurityISOLanguageBuff[] readBuffByBaseIdx(CFSecurityAuthorization Authorization,
            String BaseLanguageCode) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readBuffByBaseIdx() ";
        CFSecurityISOLanguageBuff buff;
        ArrayList<CFSecurityISOLanguageBuff> filteredList = new ArrayList<CFSecurityISOLanguageBuff>();
        CFSecurityISOLanguageBuff[] buffList = readDerivedByBaseIdx(Authorization, BaseLanguageCode);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ISLN")) {
                filteredList.add((CFSecurityISOLanguageBuff) buff);
            }
        }
        return (filteredList.toArray(new CFSecurityISOLanguageBuff[0]));
    }

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

    public CFSecurityISOLanguageBuff readBuffByCodeIdx(CFSecurityAuthorization Authorization, String ISOCode) {
        final String S_ProcName = "CFAsteriskRamISOLanguage.readBuffByCodeIdx() ";
        CFSecurityISOLanguageBuff buff = readDerivedByCodeIdx(Authorization, ISOCode);
        if ((buff != null) && buff.getClassCode().equals("ISLN")) {
            return ((CFSecurityISOLanguageBuff) buff);
        } else {
            return (null);
        }
    }

    public void updateISOLanguage(CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) {
        CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
        pkey.setRequiredId(Buff.getRequiredId());
        CFSecurityISOLanguageBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOLanguage",
                    "Existing record not found", "ISOLanguage", pkey);
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOLanguage",
                    pkey);
        }
        Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
        CFSecurityISOLanguageByBaseIdxKey existingKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
        existingKeyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode());

        CFSecurityISOLanguageByBaseIdxKey newKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
        newKeyBaseIdx.setRequiredBaseLanguageCode(Buff.getRequiredBaseLanguageCode());

        CFSecurityISOLanguageByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOLanguage()
                .newCountryIdxKey();
        existingKeyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId());

        CFSecurityISOLanguageByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
        newKeyCountryIdx.setOptionalISOCountryId(Buff.getOptionalISOCountryId());

        CFSecurityISOLanguageByCodeIdxKey existingKeyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
        existingKeyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode());

        CFSecurityISOLanguageByCodeIdxKey newKeyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
        newKeyCodeIdx.setRequiredISOCode(Buff.getRequiredISOCode());

        // Check unique indexes

        if (!existingKeyCodeIdx.equals(newKeyCodeIdx)) {
            if (dictByCodeIdx.containsKey(newKeyCodeIdx)) {
                throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                        "updateISOLanguage", "ISOLanguageCodeIdx", newKeyCodeIdx);
            }
        }

        // Validate foreign keys

        // Update is valid

        Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdict;

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

        subdict = dictByBaseIdx.get(existingKeyBaseIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByBaseIdx.containsKey(newKeyBaseIdx)) {
            subdict = dictByBaseIdx.get(newKeyBaseIdx);
        } else {
            subdict = new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>();
            dictByBaseIdx.put(newKeyBaseIdx, subdict);
        }
        subdict.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<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>();
            dictByCountryIdx.put(newKeyCountryIdx, subdict);
        }
        subdict.put(pkey, Buff);

        dictByCodeIdx.remove(existingKeyCodeIdx);
        dictByCodeIdx.put(newKeyCodeIdx, Buff);

    }

    public void deleteISOLanguage(CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) {
        final String S_ProcName = "CFAsteriskRamISOLanguageTable.deleteISOLanguage() ";
        CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
        pkey.setRequiredId(Buff.getRequiredId());
        CFSecurityISOLanguageBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            return;
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOLanguage",
                    pkey);
        }
        CFSecurityISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey();
        keyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode());

        CFSecurityISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey();
        keyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId());

        CFSecurityISOLanguageByCodeIdxKey keyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey();
        keyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode());

        // Validate reverse foreign keys

        // Delete is valid

        schema.getTableISOCountryLanguage().deleteISOCountryLanguageByLanguageIdx(Authorization,
                Buff.getRequiredId());
        Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdict;

        dictByPKey.remove(pkey);

        subdict = dictByBaseIdx.get(keyBaseIdx);
        subdict.remove(pkey);

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

        dictByCodeIdx.remove(keyCodeIdx);

    }

    public void deleteISOLanguageByIdIdx(CFSecurityAuthorization Authorization, short argId) {
        CFSecurityISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey();
        key.setRequiredId(argId);
        deleteISOLanguageByIdIdx(Authorization, key);
    }

    public void deleteISOLanguageByIdIdx(CFSecurityAuthorization Authorization, CFSecurityISOLanguagePKey argKey) {
        CFSecurityISOLanguageBuff cur;
        LinkedList<CFSecurityISOLanguageBuff> matchSet = new LinkedList<CFSecurityISOLanguageBuff>();
        Iterator<CFSecurityISOLanguageBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFSecurityISOLanguageBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOLanguage(Authorization, cur);
        }
    }

    public void deleteISOLanguageByBaseIdx(CFSecurityAuthorization Authorization, String argBaseLanguageCode) {
        CFSecurityISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey();
        key.setRequiredBaseLanguageCode(argBaseLanguageCode);
        deleteISOLanguageByBaseIdx(Authorization, key);
    }

    public void deleteISOLanguageByBaseIdx(CFSecurityAuthorization Authorization,
            CFSecurityISOLanguageByBaseIdxKey argKey) {
        CFSecurityISOLanguageBuff cur;
        LinkedList<CFSecurityISOLanguageBuff> matchSet = new LinkedList<CFSecurityISOLanguageBuff>();
        Iterator<CFSecurityISOLanguageBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFSecurityISOLanguageBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOLanguage(Authorization, cur);
        }
    }

    public void deleteISOLanguageByCountryIdx(CFSecurityAuthorization Authorization, Short argISOCountryId) {
        CFSecurityISOLanguageByCountryIdxKey key = schema.getFactoryISOLanguage().newCountryIdxKey();
        key.setOptionalISOCountryId(argISOCountryId);
        deleteISOLanguageByCountryIdx(Authorization, key);
    }

    public void deleteISOLanguageByCountryIdx(CFSecurityAuthorization Authorization,
            CFSecurityISOLanguageByCountryIdxKey argKey) {
        CFSecurityISOLanguageBuff cur;
        LinkedList<CFSecurityISOLanguageBuff> matchSet = new LinkedList<CFSecurityISOLanguageBuff>();
        Iterator<CFSecurityISOLanguageBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFSecurityISOLanguageBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOLanguage(Authorization, cur);
        }
    }

    public void deleteISOLanguageByCodeIdx(CFSecurityAuthorization Authorization, String argISOCode) {
        CFSecurityISOLanguageByCodeIdxKey key = schema.getFactoryISOLanguage().newCodeIdxKey();
        key.setRequiredISOCode(argISOCode);
        deleteISOLanguageByCodeIdx(Authorization, key);
    }

    public void deleteISOLanguageByCodeIdx(CFSecurityAuthorization Authorization,
            CFSecurityISOLanguageByCodeIdxKey argKey) {
        CFSecurityISOLanguageBuff cur;
        LinkedList<CFSecurityISOLanguageBuff> matchSet = new LinkedList<CFSecurityISOLanguageBuff>();
        Iterator<CFSecurityISOLanguageBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFSecurityISOLanguageBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOLanguage(Authorization, cur);
        }
    }

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

    public CFSecurityCursor openISOLanguageCursorByBaseIdx(CFSecurityAuthorization Authorization,
            String BaseLanguageCode) {
        CFSecurityCursor cursor;
        CFSecurityISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey();
        key.setRequiredBaseLanguageCode(BaseLanguageCode);

        if (dictByBaseIdx.containsKey(key)) {
            Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictBaseIdx = dictByBaseIdx.get(key);
            cursor = new CFAsteriskRamISOLanguageCursor(Authorization, schema, subdictBaseIdx.values());
        } else {
            cursor = new CFAsteriskRamISOLanguageCursor(Authorization, schema,
                    new ArrayList<CFSecurityISOLanguageBuff>());
        }
        return (cursor);
    }

    public CFSecurityCursor openISOLanguageCursorByCountryIdx(CFSecurityAuthorization Authorization,
            Short ISOCountryId) {
        CFSecurityCursor cursor;
        CFSecurityISOLanguageByCountryIdxKey key = schema.getFactoryISOLanguage().newCountryIdxKey();
        key.setOptionalISOCountryId(ISOCountryId);

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

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

    public CFSecurityISOLanguageBuff nextISOLanguageCursor(CFSecurityCursor Cursor) {
        CFAsteriskRamISOLanguageCursor cursor = (CFAsteriskRamISOLanguageCursor) Cursor;
        CFSecurityISOLanguageBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

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

    public CFSecurityISOLanguageBuff firstISOLanguageCursor(CFSecurityCursor Cursor) {
        int targetRowIdx = 1;
        CFSecurityISOLanguageBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOLanguageCursor(Cursor);
        }
        return (rec);
    }

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

    public CFSecurityISOLanguageBuff nthISOLanguageCursor(CFSecurityCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        CFSecurityISOLanguageBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOLanguageCursor(Cursor);
        }
        return (rec);
    }

    public void releasePreparedStatements() {
    }
}