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

Java tutorial

Introduction

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

Source

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

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

/*
 *   CFAstRamSipConfTable in-memory RAM DbIO implementation
 *   for SipConf.
 */
public class CFAstRamSipConfTable implements ICFAstSipConfTable {
    private CFAstRamSchema schema;
    private Map<CFAstConfigurationFilePKey, CFAstSipConfBuff> dictByPKey = new HashMap<CFAstConfigurationFilePKey, CFAstSipConfBuff>();
    private SortedMap<CFAstSipConfBySipClusterIdxKey, SortedMap<CFAstConfigurationFilePKey, CFAstSipConfBuff>> dictBySipClusterIdx = new TreeMap<CFAstSipConfBySipClusterIdxKey, SortedMap<CFAstConfigurationFilePKey, CFAstSipConfBuff>>();

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

    public void createSipConf(CFAstAuthorization Authorization, CFAstSipConfBuff Buff) {
        schema.getTableConfigurationFile().createConfigurationFile(Authorization, Buff);
        CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
        pkey.setClassCode(Buff.getClassCode());
        pkey.setRequiredClusterId(Buff.getRequiredClusterId());
        pkey.setRequiredId(Buff.getRequiredId());
        CFAstSipConfBySipClusterIdxKey keySipClusterIdx = schema.getFactorySipConf().newSipClusterIdxKey();
        keySipClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

        // Validate unique indexes

        if (dictByPKey.containsKey(pkey)) {
            throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createSipConf",
                    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(),
                            "createSipConf", "Superclass", "SuperClass", "ConfigurationFile", null);
                }
            }
        }

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        SortedMap<CFAstConfigurationFilePKey, CFAstSipConfBuff> subdictSipClusterIdx;
        if (dictBySipClusterIdx.containsKey(keySipClusterIdx)) {
            subdictSipClusterIdx = dictBySipClusterIdx.get(keySipClusterIdx);
        } else {
            subdictSipClusterIdx = new TreeMap<CFAstConfigurationFilePKey, CFAstSipConfBuff>();
            dictBySipClusterIdx.put(keySipClusterIdx, subdictSipClusterIdx);
        }
        subdictSipClusterIdx.put(pkey, Buff);

    }

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

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

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

    public CFAstSipConfBuff[] 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<CFAstSipConfBuff> filteredList = new ArrayList<CFAstSipConfBuff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof CFAstSipConfBuff)) {
                    filteredList.add((CFAstSipConfBuff) buff);
                }
            }
            return (filteredList.toArray(new CFAstSipConfBuff[0]));
        }
    }

    public CFAstSipConfBuff[] 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<CFAstSipConfBuff> filteredList = new ArrayList<CFAstSipConfBuff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof CFAstSipConfBuff)) {
                    filteredList.add((CFAstSipConfBuff) buff);
                }
            }
            return (filteredList.toArray(new CFAstSipConfBuff[0]));
        }
    }

    public CFAstSipConfBuff 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 CFAstSipConfBuff) {
            return ((CFAstSipConfBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAstSipConfBuff[] readDerivedBySipClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamSipConf.readDerivedBySipClusterIdx() ";
        CFAstSipConfBySipClusterIdxKey key = schema.getFactorySipConf().newSipClusterIdxKey();
        key.setRequiredClusterId(ClusterId);

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

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

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

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

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

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

    public CFAstSipConfBuff 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 ((CFAstSipConfBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAstSipConfBuff[] readBuffByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByClusterIdx() ";
        CFAstConfigurationFileBuff buff;
        ArrayList<CFAstSipConfBuff> filteredList = new ArrayList<CFAstSipConfBuff>();
        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((CFAstSipConfBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAstSipConfBuff[0]));
    }

    public CFAstSipConfBuff[] readBuffByHostIdx(CFAstAuthorization Authorization, long ClusterId, long HostNodeId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByHostIdx() ";
        CFAstConfigurationFileBuff buff;
        ArrayList<CFAstSipConfBuff> filteredList = new ArrayList<CFAstSipConfBuff>();
        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((CFAstSipConfBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAstSipConfBuff[0]));
    }

    public CFAstSipConfBuff 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 ((CFAstSipConfBuff) buff);
        } else {
            return (null);
        }
    }

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

    public void updateSipConf(CFAstAuthorization Authorization, CFAstSipConfBuff Buff) {
        schema.getTableConfigurationFile().updateConfigurationFile(Authorization, Buff);
        CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
        pkey.setRequiredClusterId(Buff.getRequiredClusterId());
        pkey.setRequiredId(Buff.getRequiredId());
        CFAstSipConfBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSipConf",
                    "Existing record not found", "SipConf", pkey);
        }
        CFAstSipConfBySipClusterIdxKey existingKeySipClusterIdx = schema.getFactorySipConf().newSipClusterIdxKey();
        existingKeySipClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

        CFAstSipConfBySipClusterIdxKey newKeySipClusterIdx = schema.getFactorySipConf().newSipClusterIdxKey();
        newKeySipClusterIdx.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(),
                            "updateSipConf", "Superclass", "SuperClass", "ConfigurationFile", null);
                }
            }
        }

        // Update is valid

        SortedMap<CFAstConfigurationFilePKey, CFAstSipConfBuff> subdict;

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

        subdict = dictBySipClusterIdx.get(existingKeySipClusterIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictBySipClusterIdx.containsKey(newKeySipClusterIdx)) {
            subdict = dictBySipClusterIdx.get(newKeySipClusterIdx);
        } else {
            subdict = new TreeMap<CFAstConfigurationFilePKey, CFAstSipConfBuff>();
            dictBySipClusterIdx.put(newKeySipClusterIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

    public void deleteSipConf(CFAstAuthorization Authorization, CFAstSipConfBuff Buff) {
        final String S_ProcName = "CFAstRamSipConfTable.deleteSipConf() ";
        CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
        pkey.setRequiredClusterId(Buff.getRequiredClusterId());
        pkey.setRequiredId(Buff.getRequiredId());
        CFAstSipConfBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            return;
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSipConf",
                    pkey);
        }
        CFAstSipConfBySipClusterIdxKey keySipClusterIdx = schema.getFactorySipConf().newSipClusterIdxKey();
        keySipClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

        // Validate reverse foreign keys

        // Delete is valid

        SortedMap<CFAstConfigurationFilePKey, CFAstSipConfBuff> subdict;

        dictByPKey.remove(pkey);

        subdict = dictBySipClusterIdx.get(keySipClusterIdx);
        subdict.remove(pkey);

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

    public void deleteSipConfBySipClusterIdx(CFAstAuthorization Authorization, long argClusterId) {
        CFAstSipConfBySipClusterIdxKey key = schema.getFactorySipConf().newSipClusterIdxKey();
        key.setRequiredClusterId(argClusterId);
        deleteSipConfBySipClusterIdx(Authorization, key);
    }

    public void deleteSipConfBySipClusterIdx(CFAstAuthorization Authorization,
            CFAstSipConfBySipClusterIdxKey argKey) {
        CFAstSipConfBuff cur;
        LinkedList<CFAstSipConfBuff> matchSet = new LinkedList<CFAstSipConfBuff>();
        Iterator<CFAstSipConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstSipConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteSipConf(Authorization, cur);
        }
    }

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

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

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

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

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

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

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

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

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

    public CFAstCursor openSipConfCursorBySipClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        CFAstCursor cursor;
        CFAstSipConfBySipClusterIdxKey key = schema.getFactorySipConf().newSipClusterIdxKey();
        key.setRequiredClusterId(ClusterId);

        if (dictBySipClusterIdx.containsKey(key)) {
            SortedMap<CFAstConfigurationFilePKey, CFAstSipConfBuff> subdictSipClusterIdx = dictBySipClusterIdx
                    .get(key);
            cursor = new CFAstRamSipConfCursor(Authorization, schema, subdictSipClusterIdx.values());
        } else {
            cursor = new CFAstRamSipConfCursor(Authorization, schema, new ArrayList<CFAstSipConfBuff>());
        }
        return (cursor);
    }

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

    public CFAstSipConfBuff nextSipConfCursor(CFAstCursor Cursor) {
        CFAstRamSipConfCursor cursor = (CFAstRamSipConfCursor) Cursor;
        CFAstSipConfBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

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

    public CFAstSipConfBuff firstSipConfCursor(CFAstCursor Cursor) {
        int targetRowIdx = 1;
        CFAstSipConfBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextSipConfCursor(Cursor);
        }
        return (rec);
    }

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

    public CFAstSipConfBuff nthSipConfCursor(CFAstCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        CFAstSipConfBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextSipConfCursor(Cursor);
        }
        return (rec);
    }

    public void releasePreparedStatements() {
    }
}