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

Java tutorial

Introduction

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

Source

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

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

/*
 *   MSSBamRamId64GenDefTable in-memory RAM DbIO implementation
 *   for Id64GenDef.
 */
public class MSSBamRamId64GenDefTable implements IMSSBamId64GenDefTable {
    private MSSBamBLRamSchema schema;
    private Map<MSSBamAnyObjPKey, MSSBamId64GenDefBuff> dictByPKey = new HashMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff>();
    private SortedMap<MSSBamId64GenDefByDispIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff>> dictByDispIdx = new TreeMap<MSSBamId64GenDefByDispIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff>>();

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

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

        pkey.setClassCode(Buff.getClassCode());

        pkey.setRequiredId(Buff.getRequiredId());

        MSSBamId64GenDefByDispIdxKey keyDispIdx = schema.getFactoryId64GenDef().newDispIdxKey();
        keyDispIdx.setOptionalDispenserId(Buff.getOptionalDispenserId());

        // Validate unique indexes

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

        // Validate foreign keys

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

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        SortedMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff> subdictDispIdx;
        if (dictByDispIdx.containsKey(keyDispIdx)) {
            subdictDispIdx = dictByDispIdx.get(keyDispIdx);
        } else {
            subdictDispIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff>();
            dictByDispIdx.put(keyDispIdx, subdictDispIdx);
        }
        subdictDispIdx.put(pkey, Buff);

    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    public MSSBamId64GenDefBuff[] readDerivedByDispIdx(MSSBamAuthorization Authorization, Long DispenserId) {
        final String S_ProcName = "MSSBamRamId64GenDef.readDerivedByDispIdx() ";
        MSSBamId64GenDefByDispIdxKey key = schema.getFactoryId64GenDef().newDispIdxKey();
        key.setOptionalDispenserId(DispenserId);

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

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

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

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

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

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

    public MSSBamId64GenDefBuff[] readBuffByTenantIdx(MSSBamAuthorization Authorization, long TenantId) {
        final String S_ProcName = "MSSBamRamAnyObj.readBuffByTenantIdx() ";
        MSSBamAnyObjBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) {
        final String S_ProcName = "MSSBamRamAnyObj.readBuffByScopeIdx() ";
        MSSBamAnyObjBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
        final String S_ProcName = "MSSBamRamAnyObj.readBuffByAuthorIdx() ";
        MSSBamAnyObjBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

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

    public MSSBamId64GenDefBuff[] readBuffByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByVContIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByDataScopeIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByVAccSecIdx(MSSBamAuthorization Authorization,
            Short ViewAccessSecurityId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByVAccSecIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByVAccFreqIdx(MSSBamAuthorization Authorization,
            Short ViewAccessFrequencyId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByVAccFreqIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByEAccSecIdx(MSSBamAuthorization Authorization,
            Short EditAccessSecurityId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByEAccSecIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByEAccFreqIdx(MSSBamAuthorization Authorization,
            Short EditAccessFrequencyId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByEAccFreqIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByPrevIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByNextIdx(MSSBamAuthorization Authorization, Long NextId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByNextIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long PrevId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByContPrevIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long NextId) {
        final String S_ProcName = "MSSBamRamValue.readBuffByContNextIdx() ";
        MSSBamValueBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        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((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public MSSBamId64GenDefBuff[] readBuffByDispIdx(MSSBamAuthorization Authorization, Long DispenserId) {
        final String S_ProcName = "MSSBamRamId64GenDef.readBuffByDispIdx() ";
        MSSBamId64GenDefBuff buff;
        ArrayList<MSSBamId64GenDefBuff> filteredList = new ArrayList<MSSBamId64GenDefBuff>();
        MSSBamId64GenDefBuff[] buffList = readDerivedByDispIdx(Authorization, DispenserId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("G64")) {
                filteredList.add((MSSBamId64GenDefBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamId64GenDefBuff[0]));
    }

    public void updateId64GenDef(MSSBamAuthorization Authorization, MSSBamId64GenDefBuff Buff) {
        MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
        pkey.setRequiredId(Buff.getRequiredId());
        MSSBamId64GenDefBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateId64GenDef",
                    "Existing record not found", "Id64GenDef", pkey);
        }
        MSSBamId64GenDefByDispIdxKey existingKeyDispIdx = schema.getFactoryId64GenDef().newDispIdxKey();
        existingKeyDispIdx.setOptionalDispenserId(existing.getOptionalDispenserId());

        MSSBamId64GenDefByDispIdxKey newKeyDispIdx = schema.getFactoryId64GenDef().newDispIdxKey();
        newKeyDispIdx.setOptionalDispenserId(Buff.getOptionalDispenserId());

        // Check unique indexes

        // Validate foreign keys

        {
            boolean allNull = true;

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

        // Update is valid

        SortedMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff> subdict;

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

        subdict = dictByDispIdx.get(existingKeyDispIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByDispIdx.containsKey(newKeyDispIdx)) {
            subdict = dictByDispIdx.get(newKeyDispIdx);
        } else {
            subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff>();
            dictByDispIdx.put(newKeyDispIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

    public void deleteId64GenDef(MSSBamAuthorization Authorization, MSSBamId64GenDefBuff Buff) {
        final String S_ProcName = "MSSBamRamId64GenDefTable.deleteId64GenDef() ";
        MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

        pkey.setRequiredId(schema.nextAnyObjIdGen());
        MSSBamId64GenDefBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteId64GenDef",
                    "Existing record not found", "Id64GenDef", pkey);
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteId64GenDef",
                    pkey);
        }
        MSSBamId64GenDefByDispIdxKey keyDispIdx = schema.getFactoryId64GenDef().newDispIdxKey();
        keyDispIdx.setOptionalDispenserId(existing.getOptionalDispenserId());

        // Validate reverse foreign keys

        if (schema.getTableTableId64Gen().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) {
            throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteId64GenDef",
                    "Superclass", "SuperClass", "TableId64Gen", pkey);
        }

        if (schema.getTableSchemaId64Gen().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) {
            throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteId64GenDef",
                    "Superclass", "SuperClass", "SchemaId64Gen", pkey);
        }

        // Delete is valid

        SortedMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff> subdict;

        dictByPKey.remove(pkey);

        subdict = dictByDispIdx.get(keyDispIdx);
        subdict.remove(pkey);

    }

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

    public MSSBamCursor openId64GenDefCursorByDispIdx(MSSBamAuthorization Authorization, Long DispenserId) {
        MSSBamCursor cursor;
        MSSBamId64GenDefByDispIdxKey key = schema.getFactoryId64GenDef().newDispIdxKey();
        key.setOptionalDispenserId(DispenserId);

        if (dictByDispIdx.containsKey(key)) {
            SortedMap<MSSBamAnyObjPKey, MSSBamId64GenDefBuff> subdictDispIdx = dictByDispIdx.get(key);
            cursor = new MSSBamRamId64GenDefCursor(Authorization, schema, subdictDispIdx.values());
        } else {
            cursor = new MSSBamRamId64GenDefCursor(Authorization, schema, new ArrayList<MSSBamId64GenDefBuff>());
        }
        return (cursor);
    }

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

    public MSSBamId64GenDefBuff nextId64GenDefCursor(MSSBamCursor Cursor) {
        MSSBamRamId64GenDefCursor cursor = (MSSBamRamId64GenDefCursor) Cursor;
        MSSBamId64GenDefBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

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

    public MSSBamId64GenDefBuff firstId64GenDefCursor(MSSBamCursor Cursor) {
        int targetRowIdx = 1;
        MSSBamId64GenDefBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextId64GenDefCursor(Cursor);
        }
        return (rec);
    }

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

    public MSSBamId64GenDefBuff nthId64GenDefCursor(MSSBamCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        MSSBamId64GenDefBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextId64GenDefCursor(Cursor);
        }
        return (rec);
    }
}