net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamISOLanguageTable.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.CFSecurityRamISOLanguageTable.java

Source

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

/*
 *   CF Security Core Implementation
 *
 *   Copyright (c) 2010-2014 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.
 *   
 * ***********************************************************************
 *
 *   Code manufactured by MSS Code Factory
 */

package net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam;

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.cfsecurity.v2_0.CFSecurity.*;
import net.sourceforge.msscodefactory.cfsecurity.v2_0.CFSecurityRam.*;

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

    public CFSecurityRamISOLanguageTable(CFSecurityRamSchema argSchema) {
        schema = argSchema;
    }

    public void createISOLanguage(CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) {
        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(), "createISOLanguage",
                    pkey);
        }

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

        // Validate foreign keys

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

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

        SortedMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCountryIdx;
        if (dictByCountryIdx.containsKey(keyCountryIdx)) {
            subdictCountryIdx = dictByCountryIdx.get(keyCountryIdx);
        } else {
            subdictCountryIdx = new TreeMap<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 = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.readDerivedByBaseIdx() ";
        CFSecurityISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey();
        key.setRequiredBaseLanguageCode(BaseLanguageCode);

        CFSecurityISOLanguageBuff[] recArray;
        if (dictByBaseIdx.containsKey(key)) {
            SortedMap<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 {
            recArray = new CFSecurityISOLanguageBuff[0];
        }
        return (recArray);
    }

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

        CFSecurityISOLanguageBuff[] recArray;
        if (dictByCountryIdx.containsKey(key)) {
            SortedMap<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 {
            recArray = new CFSecurityISOLanguageBuff[0];
        }
        return (recArray);
    }

    public CFSecurityISOLanguageBuff readDerivedByCodeIdx(CFSecurityAuthorization Authorization, String ISOCode) {
        final String S_ProcName = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.readBuff() ";
        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 = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.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 = "CFSecurityRamISOLanguage.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

        SortedMap<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 TreeMap<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 TreeMap<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 = "CFSecurityRamISOLanguageTable.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());
        SortedMap<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 CFSecurityRamISOLanguageCursor(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)) {
            SortedMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictBaseIdx = dictByBaseIdx.get(key);
            cursor = new CFSecurityRamISOLanguageCursor(Authorization, schema, subdictBaseIdx.values());
        } else {
            cursor = new CFSecurityRamISOLanguageCursor(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)) {
            SortedMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCountryIdx = dictByCountryIdx
                    .get(key);
            cursor = new CFSecurityRamISOLanguageCursor(Authorization, schema, subdictCountryIdx.values());
        } else {
            cursor = new CFSecurityRamISOLanguageCursor(Authorization, schema,
                    new ArrayList<CFSecurityISOLanguageBuff>());
        }
        return (cursor);
    }

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

    public CFSecurityISOLanguageBuff nextISOLanguageCursor(CFSecurityCursor Cursor) {
        CFSecurityRamISOLanguageCursor cursor = (CFSecurityRamISOLanguageCursor) 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() {
    }
}