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

Java tutorial

Introduction

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

Source

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

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

/*
 *   MSSBamRamTableId32GenTable in-memory RAM DbIO implementation
 *   for TableId32Gen.
 */
public class MSSBamRamTableId32GenTable implements IMSSBamTableId32GenTable {
    private MSSBamBLRamSchema schema;
    private Map<MSSBamAnyObjPKey, MSSBamTableId32GenBuff> dictByPKey = new HashMap<MSSBamAnyObjPKey, MSSBamTableId32GenBuff>();
    private SortedMap<MSSBamTableId32GenByContainerIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamTableId32GenBuff>> dictByContainerIdx = new TreeMap<MSSBamTableId32GenByContainerIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamTableId32GenBuff>>();

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

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

        pkey.setClassCode(Buff.getClassCode());

        pkey.setRequiredId(Buff.getRequiredId());

        MSSBamTableId32GenByContainerIdxKey keyContainerIdx = schema.getFactoryTableId32Gen().newContainerIdxKey();
        keyContainerIdx.setRequiredContainerId(Buff.getRequiredContainerId());

        // Validate unique indexes

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

        // Validate foreign keys

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

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

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

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

    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    public MSSBamTableId32GenBuff[] readDerivedByDispIdx(MSSBamAuthorization Authorization, Long DispenserId) {
        final String S_ProcName = "MSSBamRamId32GenDef.readDerivedByDispIdx() ";
        MSSBamId32GenDefBuff buffList[] = schema.getTableId32GenDef().readDerivedByDispIdx(Authorization,
                DispenserId);
        if (buffList == null) {
            return (null);
        } else {
            MSSBamId32GenDefBuff buff;
            ArrayList<MSSBamTableId32GenBuff> filteredList = new ArrayList<MSSBamTableId32GenBuff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof MSSBamTableId32GenBuff)) {
                    filteredList.add((MSSBamTableId32GenBuff) buff);
                }
            }
            return (filteredList.toArray(new MSSBamTableId32GenBuff[0]));
        }
    }

    public MSSBamTableId32GenBuff[] readDerivedByContainerIdx(MSSBamAuthorization Authorization, long ContainerId) {
        final String S_ProcName = "MSSBamRamTableId32Gen.readDerivedByContainerIdx() ";
        MSSBamTableId32GenByContainerIdxKey key = schema.getFactoryTableId32Gen().newContainerIdxKey();
        key.setRequiredContainerId(ContainerId);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    public void updateTableId32Gen(MSSBamAuthorization Authorization, MSSBamTableId32GenBuff Buff) {
        MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();
        pkey.setRequiredId(Buff.getRequiredId());
        MSSBamTableId32GenBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                    "updateTableId32Gen", "Existing record not found", "TableId32Gen", pkey);
        }
        MSSBamTableId32GenByContainerIdxKey existingKeyContainerIdx = schema.getFactoryTableId32Gen()
                .newContainerIdxKey();
        existingKeyContainerIdx.setRequiredContainerId(existing.getRequiredContainerId());

        MSSBamTableId32GenByContainerIdxKey newKeyContainerIdx = schema.getFactoryTableId32Gen()
                .newContainerIdxKey();
        newKeyContainerIdx.setRequiredContainerId(Buff.getRequiredContainerId());

        // Check unique indexes

        // Validate foreign keys

        {
            boolean allNull = true;

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

        {
            boolean allNull = true;

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

        // Update is valid

        SortedMap<MSSBamAnyObjPKey, MSSBamTableId32GenBuff> 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, MSSBamTableId32GenBuff>();
            dictByContainerIdx.put(newKeyContainerIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

    public void deleteTableId32Gen(MSSBamAuthorization Authorization, MSSBamTableId32GenBuff Buff) {
        final String S_ProcName = "MSSBamRamTableId32GenTable.deleteTableId32Gen() ";
        MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey();

        pkey.setRequiredId(schema.nextAnyObjIdGen());
        MSSBamTableId32GenBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                    "deleteTableId32Gen", "Existing record not found", "TableId32Gen", pkey);
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTableId32Gen",
                    pkey);
        }
        MSSBamTableId32GenByContainerIdxKey keyContainerIdx = schema.getFactoryTableId32Gen().newContainerIdxKey();
        keyContainerIdx.setRequiredContainerId(existing.getRequiredContainerId());

        // Validate reverse foreign keys

        // Delete is valid

        SortedMap<MSSBamAnyObjPKey, MSSBamTableId32GenBuff> subdict;

        dictByPKey.remove(pkey);

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

    }

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

    public MSSBamCursor openTableId32GenCursorByContainerIdx(MSSBamAuthorization Authorization, long ContainerId) {
        MSSBamCursor cursor;
        MSSBamTableId32GenByContainerIdxKey key = schema.getFactoryTableId32Gen().newContainerIdxKey();
        key.setRequiredContainerId(ContainerId);

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

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

    public MSSBamTableId32GenBuff nextTableId32GenCursor(MSSBamCursor Cursor) {
        MSSBamRamTableId32GenCursor cursor = (MSSBamRamTableId32GenCursor) Cursor;
        MSSBamTableId32GenBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

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

    public MSSBamTableId32GenBuff firstTableId32GenCursor(MSSBamCursor Cursor) {
        int targetRowIdx = 1;
        MSSBamTableId32GenBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextTableId32GenCursor(Cursor);
        }
        return (rec);
    }

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

    public MSSBamTableId32GenBuff nthTableId32GenCursor(MSSBamCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        MSSBamTableId32GenBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextTableId32GenCursor(Cursor);
        }
        return (rec);
    }
}