net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamISOTimezoneTable.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamISOTimezoneTable.java

Source

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

/*
 *   MSS Code Factory Accounting Business Application Model
 *
 *   Copyright (c) 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.cfacc.v2_0.CFAccRam;

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.cfacc.v2_0.CFAcc.*;
import net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.*;

/*
 *   CFAccRamISOTimezoneTable in-memory RAM DbIO implementation
 *   for ISOTimezone.
 */
public class CFAccRamISOTimezoneTable implements ICFAccISOTimezoneTable {
    private CFAccRamSchema schema;
    private Map<CFAccISOTimezonePKey, CFAccISOTimezoneBuff> dictByPKey = new HashMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>();
    private SortedMap<CFAccISOTimezoneByOffsetIdxKey, SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>> dictByOffsetIdx = new TreeMap<CFAccISOTimezoneByOffsetIdxKey, SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>>();
    private SortedMap<CFAccISOTimezoneByUTZNameIdxKey, CFAccISOTimezoneBuff> dictByUTZNameIdx = new TreeMap<CFAccISOTimezoneByUTZNameIdxKey, CFAccISOTimezoneBuff>();
    private SortedMap<CFAccISOTimezoneByIso8601IdxKey, SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>> dictByIso8601Idx = new TreeMap<CFAccISOTimezoneByIso8601IdxKey, SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>>();

    public CFAccRamISOTimezoneTable(CFAccRamSchema argSchema) {
        schema = argSchema;
    }

    public void createISOTimezone(CFAccAuthorization Authorization, CFAccISOTimezoneBuff Buff) {
        CFAccISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey();
        pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId());
        Buff.setRequiredISOTimezoneId(pkey.getRequiredISOTimezoneId());
        CFAccISOTimezoneByOffsetIdxKey keyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
        keyOffsetIdx.setRequiredTZHourOffset(Buff.getRequiredTZHourOffset());
        keyOffsetIdx.setRequiredTZMinOffset(Buff.getRequiredTZMinOffset());

        CFAccISOTimezoneByUTZNameIdxKey keyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
        keyUTZNameIdx.setRequiredTZName(Buff.getRequiredTZName());

        CFAccISOTimezoneByIso8601IdxKey keyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
        keyIso8601Idx.setRequiredIso8601(Buff.getRequiredIso8601());

        // Validate unique indexes

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

        if (dictByUTZNameIdx.containsKey(keyUTZNameIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "createISOTimezone", "ISOTimezoneUTZNameIdx", keyUTZNameIdx);
        }

        // Validate foreign keys

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff> subdictOffsetIdx;
        if (dictByOffsetIdx.containsKey(keyOffsetIdx)) {
            subdictOffsetIdx = dictByOffsetIdx.get(keyOffsetIdx);
        } else {
            subdictOffsetIdx = new TreeMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>();
            dictByOffsetIdx.put(keyOffsetIdx, subdictOffsetIdx);
        }
        subdictOffsetIdx.put(pkey, Buff);

        dictByUTZNameIdx.put(keyUTZNameIdx, Buff);

        SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff> subdictIso8601Idx;
        if (dictByIso8601Idx.containsKey(keyIso8601Idx)) {
            subdictIso8601Idx = dictByIso8601Idx.get(keyIso8601Idx);
        } else {
            subdictIso8601Idx = new TreeMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>();
            dictByIso8601Idx.put(keyIso8601Idx, subdictIso8601Idx);
        }
        subdictIso8601Idx.put(pkey, Buff);

    }

    public CFAccISOTimezoneBuff readDerived(CFAccAuthorization Authorization, CFAccISOTimezonePKey PKey) {
        final String S_ProcName = "CFAccRamISOTimezone.readDerived() ";
        CFAccISOTimezonePKey key = schema.getFactoryISOTimezone().newPKey();
        key.setRequiredISOTimezoneId(PKey.getRequiredISOTimezoneId());
        CFAccISOTimezoneBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFAccISOTimezoneBuff lockDerived(CFAccAuthorization Authorization, CFAccISOTimezonePKey PKey) {
        final String S_ProcName = "CFAccRamISOTimezone.readDerived() ";
        CFAccISOTimezonePKey key = schema.getFactoryISOTimezone().newPKey();
        key.setRequiredISOTimezoneId(PKey.getRequiredISOTimezoneId());
        CFAccISOTimezoneBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

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

    public CFAccISOTimezoneBuff[] readDerivedByOffsetIdx(CFAccAuthorization Authorization, short TZHourOffset,
            short TZMinOffset) {
        final String S_ProcName = "CFAccRamISOTimezone.readDerivedByOffsetIdx() ";
        CFAccISOTimezoneByOffsetIdxKey key = schema.getFactoryISOTimezone().newOffsetIdxKey();
        key.setRequiredTZHourOffset(TZHourOffset);
        key.setRequiredTZMinOffset(TZMinOffset);

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

    public CFAccISOTimezoneBuff readDerivedByUTZNameIdx(CFAccAuthorization Authorization, String TZName) {
        final String S_ProcName = "CFAccRamISOTimezone.readDerivedByUTZNameIdx() ";
        CFAccISOTimezoneByUTZNameIdxKey key = schema.getFactoryISOTimezone().newUTZNameIdxKey();
        key.setRequiredTZName(TZName);

        CFAccISOTimezoneBuff buff;
        if (dictByUTZNameIdx.containsKey(key)) {
            buff = dictByUTZNameIdx.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFAccISOTimezoneBuff[] readDerivedByIso8601Idx(CFAccAuthorization Authorization, String Iso8601) {
        final String S_ProcName = "CFAccRamISOTimezone.readDerivedByIso8601Idx() ";
        CFAccISOTimezoneByIso8601IdxKey key = schema.getFactoryISOTimezone().newIso8601IdxKey();
        key.setRequiredIso8601(Iso8601);

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

    public CFAccISOTimezoneBuff readDerivedByIdIdx(CFAccAuthorization Authorization, short ISOTimezoneId) {
        final String S_ProcName = "CFAccRamISOTimezone.readDerivedByIdIdx() ";
        CFAccISOTimezonePKey key = schema.getFactoryISOTimezone().newPKey();
        key.setRequiredISOTimezoneId(ISOTimezoneId);

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

    public CFAccISOTimezoneBuff readBuff(CFAccAuthorization Authorization, CFAccISOTimezonePKey PKey) {
        final String S_ProcName = "CFAccRamISOTimezone.readBuff() ";
        CFAccISOTimezoneBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ITZN"))) {
            buff = null;
        }
        return (buff);
    }

    public CFAccISOTimezoneBuff lockBuff(CFAccAuthorization Authorization, CFAccISOTimezonePKey PKey) {
        final String S_ProcName = "CFAccRamISOTimezone.readBuff() ";
        CFAccISOTimezoneBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("ITZN"))) {
            buff = null;
        }
        return (buff);
    }

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

    public CFAccISOTimezoneBuff readBuffByIdIdx(CFAccAuthorization Authorization, short ISOTimezoneId) {
        final String S_ProcName = "CFAccRamISOTimezone.readBuffByIdIdx() ";
        CFAccISOTimezoneBuff buff = readDerivedByIdIdx(Authorization, ISOTimezoneId);
        if ((buff != null) && buff.getClassCode().equals("ITZN")) {
            return ((CFAccISOTimezoneBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAccISOTimezoneBuff[] readBuffByOffsetIdx(CFAccAuthorization Authorization, short TZHourOffset,
            short TZMinOffset) {
        final String S_ProcName = "CFAccRamISOTimezone.readBuffByOffsetIdx() ";
        CFAccISOTimezoneBuff buff;
        ArrayList<CFAccISOTimezoneBuff> filteredList = new ArrayList<CFAccISOTimezoneBuff>();
        CFAccISOTimezoneBuff[] buffList = readDerivedByOffsetIdx(Authorization, TZHourOffset, TZMinOffset);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ITZN")) {
                filteredList.add((CFAccISOTimezoneBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAccISOTimezoneBuff[0]));
    }

    public CFAccISOTimezoneBuff readBuffByUTZNameIdx(CFAccAuthorization Authorization, String TZName) {
        final String S_ProcName = "CFAccRamISOTimezone.readBuffByUTZNameIdx() ";
        CFAccISOTimezoneBuff buff = readDerivedByUTZNameIdx(Authorization, TZName);
        if ((buff != null) && buff.getClassCode().equals("ITZN")) {
            return ((CFAccISOTimezoneBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAccISOTimezoneBuff[] readBuffByIso8601Idx(CFAccAuthorization Authorization, String Iso8601) {
        final String S_ProcName = "CFAccRamISOTimezone.readBuffByIso8601Idx() ";
        CFAccISOTimezoneBuff buff;
        ArrayList<CFAccISOTimezoneBuff> filteredList = new ArrayList<CFAccISOTimezoneBuff>();
        CFAccISOTimezoneBuff[] buffList = readDerivedByIso8601Idx(Authorization, Iso8601);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ITZN")) {
                filteredList.add((CFAccISOTimezoneBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAccISOTimezoneBuff[0]));
    }

    public void updateISOTimezone(CFAccAuthorization Authorization, CFAccISOTimezoneBuff Buff) {
        CFAccISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey();
        pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId());
        CFAccISOTimezoneBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOTimezone",
                    "Existing record not found", "ISOTimezone", pkey);
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOTimezone",
                    pkey);
        }
        Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
        CFAccISOTimezoneByOffsetIdxKey existingKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
        existingKeyOffsetIdx.setRequiredTZHourOffset(existing.getRequiredTZHourOffset());
        existingKeyOffsetIdx.setRequiredTZMinOffset(existing.getRequiredTZMinOffset());

        CFAccISOTimezoneByOffsetIdxKey newKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
        newKeyOffsetIdx.setRequiredTZHourOffset(Buff.getRequiredTZHourOffset());
        newKeyOffsetIdx.setRequiredTZMinOffset(Buff.getRequiredTZMinOffset());

        CFAccISOTimezoneByUTZNameIdxKey existingKeyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
        existingKeyUTZNameIdx.setRequiredTZName(existing.getRequiredTZName());

        CFAccISOTimezoneByUTZNameIdxKey newKeyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
        newKeyUTZNameIdx.setRequiredTZName(Buff.getRequiredTZName());

        CFAccISOTimezoneByIso8601IdxKey existingKeyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
        existingKeyIso8601Idx.setRequiredIso8601(existing.getRequiredIso8601());

        CFAccISOTimezoneByIso8601IdxKey newKeyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
        newKeyIso8601Idx.setRequiredIso8601(Buff.getRequiredIso8601());

        // Check unique indexes

        if (!existingKeyUTZNameIdx.equals(newKeyUTZNameIdx)) {
            if (dictByUTZNameIdx.containsKey(newKeyUTZNameIdx)) {
                throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                        "updateISOTimezone", "ISOTimezoneUTZNameIdx", newKeyUTZNameIdx);
            }
        }

        // Validate foreign keys

        // Update is valid

        SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff> subdict;

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

        subdict = dictByOffsetIdx.get(existingKeyOffsetIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByOffsetIdx.containsKey(newKeyOffsetIdx)) {
            subdict = dictByOffsetIdx.get(newKeyOffsetIdx);
        } else {
            subdict = new TreeMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>();
            dictByOffsetIdx.put(newKeyOffsetIdx, subdict);
        }
        subdict.put(pkey, Buff);

        dictByUTZNameIdx.remove(existingKeyUTZNameIdx);
        dictByUTZNameIdx.put(newKeyUTZNameIdx, Buff);

        subdict = dictByIso8601Idx.get(existingKeyIso8601Idx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByIso8601Idx.containsKey(newKeyIso8601Idx)) {
            subdict = dictByIso8601Idx.get(newKeyIso8601Idx);
        } else {
            subdict = new TreeMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff>();
            dictByIso8601Idx.put(newKeyIso8601Idx, subdict);
        }
        subdict.put(pkey, Buff);

    }

    public void deleteISOTimezone(CFAccAuthorization Authorization, CFAccISOTimezoneBuff Buff) {
        final String S_ProcName = "CFAccRamISOTimezoneTable.deleteISOTimezone() ";
        CFAccISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey();
        pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId());
        CFAccISOTimezoneBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            return;
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOTimezone",
                    pkey);
        }
        CFAccISOTimezoneByOffsetIdxKey keyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey();
        keyOffsetIdx.setRequiredTZHourOffset(existing.getRequiredTZHourOffset());
        keyOffsetIdx.setRequiredTZMinOffset(existing.getRequiredTZMinOffset());

        CFAccISOTimezoneByUTZNameIdxKey keyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey();
        keyUTZNameIdx.setRequiredTZName(existing.getRequiredTZName());

        CFAccISOTimezoneByIso8601IdxKey keyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey();
        keyIso8601Idx.setRequiredIso8601(existing.getRequiredIso8601());

        // Validate reverse foreign keys

        // Delete is valid

        SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff> subdict;

        dictByPKey.remove(pkey);

        subdict = dictByOffsetIdx.get(keyOffsetIdx);
        subdict.remove(pkey);

        dictByUTZNameIdx.remove(keyUTZNameIdx);

        subdict = dictByIso8601Idx.get(keyIso8601Idx);
        subdict.remove(pkey);

    }

    public void deleteISOTimezoneByIdIdx(CFAccAuthorization Authorization, short argISOTimezoneId) {
        CFAccISOTimezonePKey key = schema.getFactoryISOTimezone().newPKey();
        key.setRequiredISOTimezoneId(argISOTimezoneId);
        deleteISOTimezoneByIdIdx(Authorization, key);
    }

    public void deleteISOTimezoneByIdIdx(CFAccAuthorization Authorization, CFAccISOTimezonePKey argKey) {
        CFAccISOTimezoneBuff cur;
        LinkedList<CFAccISOTimezoneBuff> matchSet = new LinkedList<CFAccISOTimezoneBuff>();
        Iterator<CFAccISOTimezoneBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAccISOTimezoneBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOTimezone(Authorization, cur);
        }
    }

    public void deleteISOTimezoneByOffsetIdx(CFAccAuthorization Authorization, short argTZHourOffset,
            short argTZMinOffset) {
        CFAccISOTimezoneByOffsetIdxKey key = schema.getFactoryISOTimezone().newOffsetIdxKey();
        key.setRequiredTZHourOffset(argTZHourOffset);
        key.setRequiredTZMinOffset(argTZMinOffset);
        deleteISOTimezoneByOffsetIdx(Authorization, key);
    }

    public void deleteISOTimezoneByOffsetIdx(CFAccAuthorization Authorization,
            CFAccISOTimezoneByOffsetIdxKey argKey) {
        CFAccISOTimezoneBuff cur;
        LinkedList<CFAccISOTimezoneBuff> matchSet = new LinkedList<CFAccISOTimezoneBuff>();
        Iterator<CFAccISOTimezoneBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAccISOTimezoneBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOTimezone(Authorization, cur);
        }
    }

    public void deleteISOTimezoneByUTZNameIdx(CFAccAuthorization Authorization, String argTZName) {
        CFAccISOTimezoneByUTZNameIdxKey key = schema.getFactoryISOTimezone().newUTZNameIdxKey();
        key.setRequiredTZName(argTZName);
        deleteISOTimezoneByUTZNameIdx(Authorization, key);
    }

    public void deleteISOTimezoneByUTZNameIdx(CFAccAuthorization Authorization,
            CFAccISOTimezoneByUTZNameIdxKey argKey) {
        CFAccISOTimezoneBuff cur;
        LinkedList<CFAccISOTimezoneBuff> matchSet = new LinkedList<CFAccISOTimezoneBuff>();
        Iterator<CFAccISOTimezoneBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAccISOTimezoneBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOTimezone(Authorization, cur);
        }
    }

    public void deleteISOTimezoneByIso8601Idx(CFAccAuthorization Authorization, String argIso8601) {
        CFAccISOTimezoneByIso8601IdxKey key = schema.getFactoryISOTimezone().newIso8601IdxKey();
        key.setRequiredIso8601(argIso8601);
        deleteISOTimezoneByIso8601Idx(Authorization, key);
    }

    public void deleteISOTimezoneByIso8601Idx(CFAccAuthorization Authorization,
            CFAccISOTimezoneByIso8601IdxKey argKey) {
        CFAccISOTimezoneBuff cur;
        LinkedList<CFAccISOTimezoneBuff> matchSet = new LinkedList<CFAccISOTimezoneBuff>();
        Iterator<CFAccISOTimezoneBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAccISOTimezoneBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteISOTimezone(Authorization, cur);
        }
    }

    public CFAccCursor openISOTimezoneCursorAll(CFAccAuthorization Authorization) {
        CFAccCursor cursor = new CFAccRamISOTimezoneCursor(Authorization, schema, dictByPKey.values());
        return (cursor);
    }

    public CFAccCursor openISOTimezoneCursorByOffsetIdx(CFAccAuthorization Authorization, short TZHourOffset,
            short TZMinOffset) {
        CFAccCursor cursor;
        CFAccISOTimezoneByOffsetIdxKey key = schema.getFactoryISOTimezone().newOffsetIdxKey();
        key.setRequiredTZHourOffset(TZHourOffset);
        key.setRequiredTZMinOffset(TZMinOffset);

        if (dictByOffsetIdx.containsKey(key)) {
            SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff> subdictOffsetIdx = dictByOffsetIdx.get(key);
            cursor = new CFAccRamISOTimezoneCursor(Authorization, schema, subdictOffsetIdx.values());
        } else {
            cursor = new CFAccRamISOTimezoneCursor(Authorization, schema, new ArrayList<CFAccISOTimezoneBuff>());
        }
        return (cursor);
    }

    public CFAccCursor openISOTimezoneCursorByIso8601Idx(CFAccAuthorization Authorization, String Iso8601) {
        CFAccCursor cursor;
        CFAccISOTimezoneByIso8601IdxKey key = schema.getFactoryISOTimezone().newIso8601IdxKey();
        key.setRequiredIso8601(Iso8601);

        if (dictByIso8601Idx.containsKey(key)) {
            SortedMap<CFAccISOTimezonePKey, CFAccISOTimezoneBuff> subdictIso8601Idx = dictByIso8601Idx.get(key);
            cursor = new CFAccRamISOTimezoneCursor(Authorization, schema, subdictIso8601Idx.values());
        } else {
            cursor = new CFAccRamISOTimezoneCursor(Authorization, schema, new ArrayList<CFAccISOTimezoneBuff>());
        }
        return (cursor);
    }

    public void closeISOTimezoneCursor(CFAccCursor Cursor) {
        // Cursor.DataReader.Close();
    }

    public CFAccISOTimezoneBuff nextISOTimezoneCursor(CFAccCursor Cursor) {
        CFAccRamISOTimezoneCursor cursor = (CFAccRamISOTimezoneCursor) Cursor;
        CFAccISOTimezoneBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

    public CFAccISOTimezoneBuff prevISOTimezoneCursor(CFAccCursor Cursor) {
        int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1;
        CFAccISOTimezoneBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOTimezoneCursor(Cursor);
        }
        return (rec);
    }

    public CFAccISOTimezoneBuff firstISOTimezoneCursor(CFAccCursor Cursor) {
        int targetRowIdx = 1;
        CFAccISOTimezoneBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOTimezoneCursor(Cursor);
        }
        return (rec);
    }

    public CFAccISOTimezoneBuff lastISOTimezoneCursor(CFAccCursor Cursor) {
        throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastISOTimezoneCursor");
    }

    public CFAccISOTimezoneBuff nthISOTimezoneCursor(CFAccCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        CFAccISOTimezoneBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextISOTimezoneCursor(Cursor);
        }
        return (rec);
    }

    public void releasePreparedStatements() {
    }
}