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

Java tutorial

Introduction

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

Source

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

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

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

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

/*
 *   CFAstRamExtConfigConfTable in-memory RAM DbIO implementation
 *   for ExtConfigConf.
 */
public class CFAstRamExtConfigConfTable implements ICFAstExtConfigConfTable {
    private CFAstRamSchema schema;
    private Map<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff> dictByPKey = new HashMap<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff>();
    private SortedMap<CFAstExtConfigConfByExtCnfClusIdxKey, SortedMap<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff>> dictByExtCnfClusIdx = new TreeMap<CFAstExtConfigConfByExtCnfClusIdxKey, SortedMap<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff>>();

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

    public void createExtConfigConf(CFAstAuthorization Authorization, CFAstExtConfigConfBuff Buff) {
        schema.getTableConfigurationFile().createConfigurationFile(Authorization, Buff);
        CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
        pkey.setClassCode(Buff.getClassCode());
        pkey.setRequiredClusterId(Buff.getRequiredClusterId());
        pkey.setRequiredId(Buff.getRequiredId());
        CFAstExtConfigConfByExtCnfClusIdxKey keyExtCnfClusIdx = schema.getFactoryExtConfigConf()
                .newExtCnfClusIdxKey();
        keyExtCnfClusIdx.setRequiredClusterId(Buff.getRequiredClusterId());

        // Validate unique indexes

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

        // Validate foreign keys

        {
            boolean allNull = true;
            allNull = false;
            allNull = false;
            if (!allNull) {
                if (null == schema.getTableConfigurationFile().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredClusterId(), Buff.getRequiredId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "createExtConfigConf", "Superclass", "SuperClass", "ConfigurationFile", null);
                }
            }
        }

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        SortedMap<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff> subdictExtCnfClusIdx;
        if (dictByExtCnfClusIdx.containsKey(keyExtCnfClusIdx)) {
            subdictExtCnfClusIdx = dictByExtCnfClusIdx.get(keyExtCnfClusIdx);
        } else {
            subdictExtCnfClusIdx = new TreeMap<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff>();
            dictByExtCnfClusIdx.put(keyExtCnfClusIdx, subdictExtCnfClusIdx);
        }
        subdictExtCnfClusIdx.put(pkey, Buff);

    }

    public CFAstExtConfigConfBuff readDerived(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) {
        final String S_ProcName = "CFAstRamExtConfigConf.readDerived() ";
        CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey();
        key.setRequiredClusterId(PKey.getRequiredClusterId());
        key.setRequiredId(PKey.getRequiredId());
        CFAstExtConfigConfBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFAstExtConfigConfBuff lockDerived(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) {
        final String S_ProcName = "CFAstRamExtConfigConf.readDerived() ";
        CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey();
        key.setRequiredClusterId(PKey.getRequiredClusterId());
        key.setRequiredId(PKey.getRequiredId());
        CFAstExtConfigConfBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

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

    public CFAstExtConfigConfBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByClusterIdx() ";
        CFAstConfigurationFileBuff buffList[] = schema.getTableConfigurationFile()
                .readDerivedByClusterIdx(Authorization, ClusterId);
        if (buffList == null) {
            return (null);
        } else {
            CFAstConfigurationFileBuff buff;
            ArrayList<CFAstExtConfigConfBuff> filteredList = new ArrayList<CFAstExtConfigConfBuff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof CFAstExtConfigConfBuff)) {
                    filteredList.add((CFAstExtConfigConfBuff) buff);
                }
            }
            return (filteredList.toArray(new CFAstExtConfigConfBuff[0]));
        }
    }

    public CFAstExtConfigConfBuff[] readDerivedByHostIdx(CFAstAuthorization Authorization, long ClusterId,
            long HostNodeId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByHostIdx() ";
        CFAstConfigurationFileBuff buffList[] = schema.getTableConfigurationFile()
                .readDerivedByHostIdx(Authorization, ClusterId, HostNodeId);
        if (buffList == null) {
            return (null);
        } else {
            CFAstConfigurationFileBuff buff;
            ArrayList<CFAstExtConfigConfBuff> filteredList = new ArrayList<CFAstExtConfigConfBuff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof CFAstExtConfigConfBuff)) {
                    filteredList.add((CFAstExtConfigConfBuff) buff);
                }
            }
            return (filteredList.toArray(new CFAstExtConfigConfBuff[0]));
        }
    }

    public CFAstExtConfigConfBuff readDerivedByUNameIdx(CFAstAuthorization Authorization, long ClusterId,
            long HostNodeId, String FileFullName) {
        final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByUNameIdx() ";
        CFAstConfigurationFileBuff buff = schema.getTableConfigurationFile().readDerivedByUNameIdx(Authorization,
                ClusterId, HostNodeId, FileFullName);
        if (buff == null) {
            return (null);
        } else if (buff instanceof CFAstExtConfigConfBuff) {
            return ((CFAstExtConfigConfBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAstExtConfigConfBuff[] readDerivedByExtCnfClusIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamExtConfigConf.readDerivedByExtCnfClusIdx() ";
        CFAstExtConfigConfByExtCnfClusIdxKey key = schema.getFactoryExtConfigConf().newExtCnfClusIdxKey();
        key.setRequiredClusterId(ClusterId);

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

    public CFAstExtConfigConfBuff readDerivedByIdIdx(CFAstAuthorization Authorization, long ClusterId, long Id) {
        final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByIdIdx() ";
        CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey();
        key.setRequiredClusterId(ClusterId);
        key.setRequiredId(Id);

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

    public CFAstExtConfigConfBuff readBuff(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) {
        final String S_ProcName = "CFAstRamExtConfigConf.readBuff() ";
        CFAstExtConfigConfBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("CECC"))) {
            buff = null;
        }
        return (buff);
    }

    public CFAstExtConfigConfBuff lockBuff(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) {
        final String S_ProcName = "CFAstRamExtConfigConf.readBuff() ";
        CFAstExtConfigConfBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("CECC"))) {
            buff = null;
        }
        return (buff);
    }

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

    public CFAstExtConfigConfBuff readBuffByIdIdx(CFAstAuthorization Authorization, long ClusterId, long Id) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByIdIdx() ";
        CFAstConfigurationFileBuff buff = readDerivedByIdIdx(Authorization, ClusterId, Id);
        if ((buff != null) && buff.getClassCode().equals("CONF")) {
            return ((CFAstExtConfigConfBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAstExtConfigConfBuff[] readBuffByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByClusterIdx() ";
        CFAstConfigurationFileBuff buff;
        ArrayList<CFAstExtConfigConfBuff> filteredList = new ArrayList<CFAstExtConfigConfBuff>();
        CFAstConfigurationFileBuff[] buffList = readDerivedByClusterIdx(Authorization, ClusterId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("CONF")) {
                filteredList.add((CFAstExtConfigConfBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAstExtConfigConfBuff[0]));
    }

    public CFAstExtConfigConfBuff[] readBuffByHostIdx(CFAstAuthorization Authorization, long ClusterId,
            long HostNodeId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByHostIdx() ";
        CFAstConfigurationFileBuff buff;
        ArrayList<CFAstExtConfigConfBuff> filteredList = new ArrayList<CFAstExtConfigConfBuff>();
        CFAstConfigurationFileBuff[] buffList = readDerivedByHostIdx(Authorization, ClusterId, HostNodeId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("CONF")) {
                filteredList.add((CFAstExtConfigConfBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAstExtConfigConfBuff[0]));
    }

    public CFAstExtConfigConfBuff readBuffByUNameIdx(CFAstAuthorization Authorization, long ClusterId,
            long HostNodeId, String FileFullName) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByUNameIdx() ";
        CFAstConfigurationFileBuff buff = readDerivedByUNameIdx(Authorization, ClusterId, HostNodeId, FileFullName);
        if ((buff != null) && buff.getClassCode().equals("CONF")) {
            return ((CFAstExtConfigConfBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAstExtConfigConfBuff[] readBuffByExtCnfClusIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamExtConfigConf.readBuffByExtCnfClusIdx() ";
        CFAstExtConfigConfBuff buff;
        ArrayList<CFAstExtConfigConfBuff> filteredList = new ArrayList<CFAstExtConfigConfBuff>();
        CFAstExtConfigConfBuff[] buffList = readDerivedByExtCnfClusIdx(Authorization, ClusterId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("CECC")) {
                filteredList.add((CFAstExtConfigConfBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAstExtConfigConfBuff[0]));
    }

    public void updateExtConfigConf(CFAstAuthorization Authorization, CFAstExtConfigConfBuff Buff) {
        schema.getTableConfigurationFile().updateConfigurationFile(Authorization, Buff);
        CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
        pkey.setRequiredClusterId(Buff.getRequiredClusterId());
        pkey.setRequiredId(Buff.getRequiredId());
        CFAstExtConfigConfBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                    "updateExtConfigConf", "Existing record not found", "ExtConfigConf", pkey);
        }
        CFAstExtConfigConfByExtCnfClusIdxKey existingKeyExtCnfClusIdx = schema.getFactoryExtConfigConf()
                .newExtCnfClusIdxKey();
        existingKeyExtCnfClusIdx.setRequiredClusterId(existing.getRequiredClusterId());

        CFAstExtConfigConfByExtCnfClusIdxKey newKeyExtCnfClusIdx = schema.getFactoryExtConfigConf()
                .newExtCnfClusIdxKey();
        newKeyExtCnfClusIdx.setRequiredClusterId(Buff.getRequiredClusterId());

        // Check unique indexes

        // Validate foreign keys

        {
            boolean allNull = true;

            if (allNull) {
                if (null == schema.getTableConfigurationFile().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredClusterId(), Buff.getRequiredId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "updateExtConfigConf", "Superclass", "SuperClass", "ConfigurationFile", null);
                }
            }
        }

        // Update is valid

        SortedMap<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff> subdict;

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

        subdict = dictByExtCnfClusIdx.get(existingKeyExtCnfClusIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByExtCnfClusIdx.containsKey(newKeyExtCnfClusIdx)) {
            subdict = dictByExtCnfClusIdx.get(newKeyExtCnfClusIdx);
        } else {
            subdict = new TreeMap<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff>();
            dictByExtCnfClusIdx.put(newKeyExtCnfClusIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

    public void deleteExtConfigConf(CFAstAuthorization Authorization, CFAstExtConfigConfBuff Buff) {
        final String S_ProcName = "CFAstRamExtConfigConfTable.deleteExtConfigConf() ";
        CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
        pkey.setRequiredClusterId(Buff.getRequiredClusterId());
        pkey.setRequiredId(Buff.getRequiredId());
        CFAstExtConfigConfBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            return;
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                    "deleteExtConfigConf", pkey);
        }
        CFAstExtConfigConfByExtCnfClusIdxKey keyExtCnfClusIdx = schema.getFactoryExtConfigConf()
                .newExtCnfClusIdxKey();
        keyExtCnfClusIdx.setRequiredClusterId(existing.getRequiredClusterId());

        // Validate reverse foreign keys

        // Delete is valid

        SortedMap<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff> subdict;

        dictByPKey.remove(pkey);

        subdict = dictByExtCnfClusIdx.get(keyExtCnfClusIdx);
        subdict.remove(pkey);

        schema.getTableConfigurationFile().deleteConfigurationFile(Authorization, Buff);
    }

    public void deleteExtConfigConfByExtCnfClusIdx(CFAstAuthorization Authorization, long argClusterId) {
        CFAstExtConfigConfByExtCnfClusIdxKey key = schema.getFactoryExtConfigConf().newExtCnfClusIdxKey();
        key.setRequiredClusterId(argClusterId);
        deleteExtConfigConfByExtCnfClusIdx(Authorization, key);
    }

    public void deleteExtConfigConfByExtCnfClusIdx(CFAstAuthorization Authorization,
            CFAstExtConfigConfByExtCnfClusIdxKey argKey) {
        CFAstExtConfigConfBuff cur;
        LinkedList<CFAstExtConfigConfBuff> matchSet = new LinkedList<CFAstExtConfigConfBuff>();
        Iterator<CFAstExtConfigConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtConfigConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtConfigConf(Authorization, cur);
        }
    }

    public void deleteExtConfigConfByIdIdx(CFAstAuthorization Authorization, long argClusterId, long argId) {
        CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey();
        key.setRequiredClusterId(argClusterId);
        key.setRequiredId(argId);
        deleteExtConfigConfByIdIdx(Authorization, key);
    }

    public void deleteExtConfigConfByIdIdx(CFAstAuthorization Authorization, CFAstConfigurationFilePKey argKey) {
        CFAstExtConfigConfBuff cur;
        LinkedList<CFAstExtConfigConfBuff> matchSet = new LinkedList<CFAstExtConfigConfBuff>();
        Iterator<CFAstExtConfigConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtConfigConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtConfigConf(Authorization, cur);
        }
    }

    public void deleteExtConfigConfByClusterIdx(CFAstAuthorization Authorization, long argClusterId) {
        CFAstConfigurationFileByClusterIdxKey key = schema.getFactoryConfigurationFile().newClusterIdxKey();
        key.setRequiredClusterId(argClusterId);
        deleteExtConfigConfByClusterIdx(Authorization, key);
    }

    public void deleteExtConfigConfByClusterIdx(CFAstAuthorization Authorization,
            CFAstConfigurationFileByClusterIdxKey argKey) {
        CFAstExtConfigConfBuff cur;
        LinkedList<CFAstExtConfigConfBuff> matchSet = new LinkedList<CFAstExtConfigConfBuff>();
        Iterator<CFAstExtConfigConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtConfigConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtConfigConf(Authorization, cur);
        }
    }

    public void deleteExtConfigConfByHostIdx(CFAstAuthorization Authorization, long argClusterId,
            long argHostNodeId) {
        CFAstConfigurationFileByHostIdxKey key = schema.getFactoryConfigurationFile().newHostIdxKey();
        key.setRequiredClusterId(argClusterId);
        key.setRequiredHostNodeId(argHostNodeId);
        deleteExtConfigConfByHostIdx(Authorization, key);
    }

    public void deleteExtConfigConfByHostIdx(CFAstAuthorization Authorization,
            CFAstConfigurationFileByHostIdxKey argKey) {
        CFAstExtConfigConfBuff cur;
        LinkedList<CFAstExtConfigConfBuff> matchSet = new LinkedList<CFAstExtConfigConfBuff>();
        Iterator<CFAstExtConfigConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtConfigConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtConfigConf(Authorization, cur);
        }
    }

    public void deleteExtConfigConfByUNameIdx(CFAstAuthorization Authorization, long argClusterId,
            long argHostNodeId, String argFileFullName) {
        CFAstConfigurationFileByUNameIdxKey key = schema.getFactoryConfigurationFile().newUNameIdxKey();
        key.setRequiredClusterId(argClusterId);
        key.setRequiredHostNodeId(argHostNodeId);
        key.setRequiredFileFullName(argFileFullName);
        deleteExtConfigConfByUNameIdx(Authorization, key);
    }

    public void deleteExtConfigConfByUNameIdx(CFAstAuthorization Authorization,
            CFAstConfigurationFileByUNameIdxKey argKey) {
        CFAstExtConfigConfBuff cur;
        LinkedList<CFAstExtConfigConfBuff> matchSet = new LinkedList<CFAstExtConfigConfBuff>();
        Iterator<CFAstExtConfigConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtConfigConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtConfigConf(Authorization, cur);
        }
    }

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

    public CFAstCursor openExtConfigConfCursorByExtCnfClusIdx(CFAstAuthorization Authorization, long ClusterId) {
        CFAstCursor cursor;
        CFAstExtConfigConfByExtCnfClusIdxKey key = schema.getFactoryExtConfigConf().newExtCnfClusIdxKey();
        key.setRequiredClusterId(ClusterId);

        if (dictByExtCnfClusIdx.containsKey(key)) {
            SortedMap<CFAstConfigurationFilePKey, CFAstExtConfigConfBuff> subdictExtCnfClusIdx = dictByExtCnfClusIdx
                    .get(key);
            cursor = new CFAstRamExtConfigConfCursor(Authorization, schema, subdictExtCnfClusIdx.values());
        } else {
            cursor = new CFAstRamExtConfigConfCursor(Authorization, schema,
                    new ArrayList<CFAstExtConfigConfBuff>());
        }
        return (cursor);
    }

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

    public CFAstExtConfigConfBuff nextExtConfigConfCursor(CFAstCursor Cursor) {
        CFAstRamExtConfigConfCursor cursor = (CFAstRamExtConfigConfCursor) Cursor;
        CFAstExtConfigConfBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

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

    public CFAstExtConfigConfBuff firstExtConfigConfCursor(CFAstCursor Cursor) {
        int targetRowIdx = 1;
        CFAstExtConfigConfBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextExtConfigConfCursor(Cursor);
        }
        return (rec);
    }

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

    public CFAstExtConfigConfBuff nthExtConfigConfCursor(CFAstCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        CFAstExtConfigConfBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextExtConfigConfCursor(Cursor);
        }
        return (rec);
    }

    public void releasePreparedStatements() {
    }
}