net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamTableInt64Table.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamTableInt64Table.java

Source

// Description: Java6 in-memory RAM DbIO implementation for TableInt64.

/*
 *   MSS Code Factory 1.10
 *
 *   Copyright (c) 2012 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/>.
 *   
 * ***********************************************************************
 *
 *   Code manufactured
 *   by MSS Code Factory version 1.9.3294
 *
 *   $Revision: 26 $
 */

package net.sourceforge.msscodefactory.v1_10.MSSBamRam;

import java.sql.*;
import java.util.*;
import net.sourceforge.msscodefactory.cflib.v1_9.CFLib.*;
import org.apache.commons.codec.binary.Base64;
import net.sourceforge.msscodefactory.v1_10.MSSBam.*;
import net.sourceforge.msscodefactory.v1_10.MSSBamBL.*;
import net.sourceforge.msscodefactory.v1_10.MSSBamBLRam.*;

/*
 *   MSSBamRamTableInt64Table in-memory RAM DbIO implementation
 *   for TableInt64.
 */
public class MSSBamRamTableInt64Table implements IMSSBamTableInt64Table {
    private MSSBamBLRamSchema schema;
    private Map<MSSBamAnyObjPKey, MSSBamTableInt64Buff> dictByPKey = new HashMap<MSSBamAnyObjPKey, MSSBamTableInt64Buff>();
    private SortedMap<MSSBamTableInt64ByContainerIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamTableInt64Buff>> dictByContainerIdx = new TreeMap<MSSBamTableInt64ByContainerIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamTableInt64Buff>>();

    public MSSBamRamTableInt64Table(MSSBamBLRamSchema argSchema) {
        schema = argSchema;
    }

    public void createTableInt64(MSSBamAuthorization Authorization, MSSBamTableInt64Buff Buff) {
        MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

        pkey.setClassCode(Buff.getClassCode());

        pkey.setRequiredId(Buff.getRequiredId());

        MSSBamTableInt64ByContainerIdxKey keyContainerIdx = schema.getFactoryTableInt64().newContainerIdxKey();
        keyContainerIdx.setRequiredContainerId(Buff.getRequiredContainerId());

        // Validate unique indexes

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

        // Validate foreign keys

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

        {
            boolean allNull = true;
            allNull = false;
            if (!allNull) {
                if (null == schema.getTableTable().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredContainerId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "createTableInt64", "Container", "CTable", "Table", null);
                }
            }
        }

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        SortedMap<MSSBamAnyObjPKey, MSSBamTableInt64Buff> subdictContainerIdx;
        if (dictByContainerIdx.containsKey(keyContainerIdx)) {
            subdictContainerIdx = dictByContainerIdx.get(keyContainerIdx);
        } else {
            subdictContainerIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamTableInt64Buff>();
            dictByContainerIdx.put(keyContainerIdx, subdictContainerIdx);
        }
        subdictContainerIdx.put(pkey, Buff);

    }

    public MSSBamTableInt64Buff readDerived(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) {
        final String S_ProcName = "MSSBamRamTableInt64.readDerived() ";
        MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey();
        key.setRequiredId(PKey.getRequiredId());
        MSSBamTableInt64Buff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

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

    public MSSBamTableInt64Buff[] readDerivedByTenantIdx(MSSBamAuthorization Authorization, long TenantId) {
        final String S_ProcName = "MSSBamRamAnyObj.readDerivedByTenantIdx() ";
        MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByTenantIdx(Authorization, TenantId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamAnyObjBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) {
        final String S_ProcName = "MSSBamRamAnyObj.readDerivedByScopeIdx() ";
        MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByScopeIdx(Authorization, ScopeId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamAnyObjBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
        final String S_ProcName = "MSSBamRamAnyObj.readDerivedByAuthorIdx() ";
        MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByAuthorIdx(Authorization, AuthorId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamAnyObjBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff readDerivedByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId,
            String Name) {
        final String S_ProcName = "MSSBamRamAnyObj.readDerivedByUNameIdx() ";
        MSSBamAnyObjBuff buff = schema.getTableAnyObj().readDerivedByUNameIdx(Authorization, ScopeId, Name);
        if (buff == null) {
            return (null);
        } else if (buff instanceof MSSBamTableInt64Buff) {
            return ((MSSBamTableInt64Buff) buff);
        } else {
            return (null);
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByVContIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByVContIdx(Authorization, ValueContainerId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByDataScopeIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByDataScopeIdx(Authorization, DataScopeId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByVAccSecIdx(MSSBamAuthorization Authorization,
            Short ViewAccessSecurityId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByVAccSecIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByVAccSecIdx(Authorization,
                ViewAccessSecurityId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByVAccFreqIdx(MSSBamAuthorization Authorization,
            Short ViewAccessFrequencyId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByVAccFreqIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByVAccFreqIdx(Authorization,
                ViewAccessFrequencyId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByEAccSecIdx(MSSBamAuthorization Authorization,
            Short EditAccessSecurityId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByEAccSecIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByEAccSecIdx(Authorization,
                EditAccessSecurityId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByEAccFreqIdx(MSSBamAuthorization Authorization,
            Short EditAccessFrequencyId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByEAccFreqIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByEAccFreqIdx(Authorization,
                EditAccessFrequencyId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByPrevIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByPrevIdx(Authorization, PrevId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByNextIdx(MSSBamAuthorization Authorization, Long NextId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByNextIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByNextIdx(Authorization, NextId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long PrevId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByContPrevIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByContPrevIdx(Authorization,
                ValueContainerId, PrevId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long NextId) {
        final String S_ProcName = "MSSBamRamValue.readDerivedByContNextIdx() ";
        MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByContNextIdx(Authorization,
                ValueContainerId, NextId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamValueBuff buff;
            ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableInt64Buff)) {
                    filteredList.add((MSSBamTableInt64Buff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
        }
    }

    public MSSBamTableInt64Buff[] readDerivedByContainerIdx(MSSBamAuthorization Authorization, long ContainerId) {
        final String S_ProcName = "MSSBamRamTableInt64.readDerivedByContainerIdx() ";
        MSSBamTableInt64ByContainerIdxKey key = schema.getFactoryTableInt64().newContainerIdxKey();
        key.setRequiredContainerId(ContainerId);

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

    public MSSBamTableInt64Buff readDerivedByIdIdx(MSSBamAuthorization Authorization, long Id) {
        final String S_ProcName = "MSSBamRamAnyObj.readDerivedByIdIdx() ";
        MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey();
        key.setRequiredId(Id);

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

    public MSSBamTableInt64Buff readBuff(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) {
        final String S_ProcName = "MSSBamRamTableInt64.readBuff() ";
        MSSBamTableInt64Buff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("TI64"))) {
            buff = null;
        }
        return (buff);
    }

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

    public MSSBamTableInt64Buff readBuffByIdIdx(MSSBamAuthorization Authorization, long Id) {
        final String S_ProcName = "MSSBamRamAnyObj.readBuffByIdIdx() ";
        MSSBamAnyObjBuff buff = readDerivedByIdIdx(Authorization, Id);
        if ((buff != null) && buff.getClassCode().equals("ANYO")) {
            return ((MSSBamTableInt64Buff) buff);
        } else {
            return (null);
        }
    }

    public MSSBamTableInt64Buff[] readBuffByTenantIdx(MSSBamAuthorization Authorization, long TenantId) {
        final String S_ProcName = "MSSBamRamAnyObj.readBuffByTenantIdx() ";
        MSSBamAnyObjBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamAnyObjBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ANYO")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) {
        final String S_ProcName = "MSSBamRamAnyObj.readBuffByScopeIdx() ";
        MSSBamAnyObjBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamAnyObjBuff[] buffList = readDerivedByScopeIdx(Authorization, ScopeId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ANYO")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
        final String S_ProcName = "MSSBamRamAnyObj.readBuffByAuthorIdx() ";
        MSSBamAnyObjBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamAnyObjBuff[] buffList = readDerivedByAuthorIdx(Authorization, AuthorId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("ANYO")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff readBuffByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) {
        final String S_ProcName = "MSSBamRamAnyObj.readBuffByUNameIdx() ";
        MSSBamAnyObjBuff buff = readDerivedByUNameIdx(Authorization, ScopeId, Name);
        if ((buff != null) && buff.getClassCode().equals("ANYO")) {
            return ((MSSBamTableInt64Buff) buff);
        } else {
            return (null);
        }
    }

    public MSSBamTableInt64Buff[] readBuffByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByVContIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByVContIdx(Authorization, ValueContainerId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByDataScopeIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByDataScopeIdx(Authorization, DataScopeId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByVAccSecIdx(MSSBamAuthorization Authorization,
            Short ViewAccessSecurityId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByVAccSecIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByVAccSecIdx(Authorization, ViewAccessSecurityId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByVAccFreqIdx(MSSBamAuthorization Authorization,
            Short ViewAccessFrequencyId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByVAccFreqIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByVAccFreqIdx(Authorization, ViewAccessFrequencyId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByEAccSecIdx(MSSBamAuthorization Authorization,
            Short EditAccessSecurityId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByEAccSecIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByEAccSecIdx(Authorization, EditAccessSecurityId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByEAccFreqIdx(MSSBamAuthorization Authorization,
            Short EditAccessFrequencyId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByEAccFreqIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByEAccFreqIdx(Authorization, EditAccessFrequencyId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByPrevIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByPrevIdx(Authorization, PrevId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByNextIdx(MSSBamAuthorization Authorization, Long NextId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByNextIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByNextIdx(Authorization, NextId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long PrevId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByContPrevIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByContPrevIdx(Authorization, ValueContainerId, PrevId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long NextId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByContNextIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamValueBuff[] buffList = readDerivedByContNextIdx(Authorization, ValueContainerId, NextId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("VAL")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public MSSBamTableInt64Buff[] readBuffByContainerIdx(MSSBamAuthorization Authorization, long ContainerId) {
        final String S_ProcName = "MSSBamRamTableInt64.readBuffByContainerIdx() ";
        MSSBamTableInt64Buff buff;
        ArrayList<MSSBamTableInt64Buff> filteredList = new ArrayList<MSSBamTableInt64Buff>();
        MSSBamTableInt64Buff[] buffList = readDerivedByContainerIdx(Authorization, ContainerId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("TI64")) {
                filteredList.add((MSSBamTableInt64Buff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamTableInt64Buff[0]));
    }

    public void updateTableInt64(MSSBamAuthorization Authorization, MSSBamTableInt64Buff Buff) {
        MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
        pkey.setRequiredId(Buff.getRequiredId());
        MSSBamTableInt64Buff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTableInt64",
                    "Existing record not found", "TableInt64", pkey);
        }
        MSSBamTableInt64ByContainerIdxKey existingKeyContainerIdx = schema.getFactoryTableInt64()
                .newContainerIdxKey();
        existingKeyContainerIdx.setRequiredContainerId(existing.getRequiredContainerId());

        MSSBamTableInt64ByContainerIdxKey newKeyContainerIdx = schema.getFactoryTableInt64().newContainerIdxKey();
        newKeyContainerIdx.setRequiredContainerId(Buff.getRequiredContainerId());

        // Check unique indexes

        // Validate foreign keys

        {
            boolean allNull = true;

            if (allNull) {
                if (null == schema.getTableInt64Def().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "updateTableInt64", "Superclass", "SuperClass", "Int64Def", null);
                }
            }
        }

        {
            boolean allNull = true;

            if (allNull) {
                if (null == schema.getTableTable().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredContainerId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "updateTableInt64", "Container", "CTable", "Table", null);
                }
            }
        }

        // Update is valid

        SortedMap<MSSBamAnyObjPKey, MSSBamTableInt64Buff> subdict;

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

        subdict = dictByContainerIdx.get(existingKeyContainerIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByContainerIdx.containsKey(newKeyContainerIdx)) {
            subdict = dictByContainerIdx.get(newKeyContainerIdx);
        } else {
            subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableInt64Buff>();
            dictByContainerIdx.put(newKeyContainerIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

    public void deleteTableInt64(MSSBamAuthorization Authorization, MSSBamTableInt64Buff Buff) {
        final String S_ProcName = "MSSBamRamTableInt64Table.deleteTableInt64() ";
        MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

        pkey.setRequiredId(schema.nextAnyObjIdGen());
        MSSBamTableInt64Buff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteTableInt64",
                    "Existing record not found", "TableInt64", pkey);
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTableInt64",
                    pkey);
        }
        MSSBamTableInt64ByContainerIdxKey keyContainerIdx = schema.getFactoryTableInt64().newContainerIdxKey();
        keyContainerIdx.setRequiredContainerId(existing.getRequiredContainerId());

        // Validate reverse foreign keys

        // Delete is valid

        SortedMap<MSSBamAnyObjPKey, MSSBamTableInt64Buff> subdict;

        dictByPKey.remove(pkey);

        subdict = dictByContainerIdx.get(keyContainerIdx);
        subdict.remove(pkey);

    }

    public MSSBamCursor openTableInt64CursorAll(MSSBamAuthorization Authorization) {
        MSSBamCursor cursor = new MSSBamRamTableInt64Cursor(Authorization, schema, dictByPKey.values());
        return (cursor);
    }

    public MSSBamCursor openTableInt64CursorByContainerIdx(MSSBamAuthorization Authorization, long ContainerId) {
        MSSBamCursor cursor;
        MSSBamTableInt64ByContainerIdxKey key = schema.getFactoryTableInt64().newContainerIdxKey();
        key.setRequiredContainerId(ContainerId);

        if (dictByContainerIdx.containsKey(key)) {
            SortedMap<MSSBamAnyObjPKey, MSSBamTableInt64Buff> subdictContainerIdx = dictByContainerIdx.get(key);
            cursor = new MSSBamRamTableInt64Cursor(Authorization, schema, subdictContainerIdx.values());
        } else {
            cursor = new MSSBamRamTableInt64Cursor(Authorization, schema, new ArrayList<MSSBamTableInt64Buff>());
        }
        return (cursor);
    }

    public void closeTableInt64Cursor(MSSBamCursor Cursor) {
        // Cursor.DataReader.Close();
    }

    public MSSBamTableInt64Buff nextTableInt64Cursor(MSSBamCursor Cursor) {
        MSSBamRamTableInt64Cursor cursor = (MSSBamRamTableInt64Cursor) Cursor;
        MSSBamTableInt64Buff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

    public MSSBamTableInt64Buff prevTableInt64Cursor(MSSBamCursor Cursor) {
        int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1;
        MSSBamTableInt64Buff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextTableInt64Cursor(Cursor);
        }
        return (rec);
    }

    public MSSBamTableInt64Buff firstTableInt64Cursor(MSSBamCursor Cursor) {
        int targetRowIdx = 1;
        MSSBamTableInt64Buff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextTableInt64Cursor(Cursor);
        }
        return (rec);
    }

    public MSSBamTableInt64Buff lastTableInt64Cursor(MSSBamCursor Cursor) {
        throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastTableInt64Cursor");
    }

    public MSSBamTableInt64Buff nthTableInt64Cursor(MSSBamCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        MSSBamTableInt64Buff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextTableInt64Cursor(Cursor);
        }
        return (rec);
    }
}