net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BoolDefTable.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BoolDefTable.java

Source

// Description: Java 6 PostgreSQL Jdbc DbIO implementation for BoolDef.

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

import java.math.*;
import java.sql.*;
import java.text.*;
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.*;

/*
 *   MSSBamPg8BoolDefTable PostgreSQL Jdbc DbIO implementation
 *   for BoolDef.
 *
 *   Data redaction is the responsibility of another layer.  The raw database
 *   interface returns everything regardless of whether the end user is
 *   authorized to see the data.  A redaction layer replaces protected/redacted
 *   buffs with default values.  They should not be included in client-side
 *   filter sets, and the network redaction layer should actually eliminate them
 *   before transmitting data to the client.  The client should never see
 *   redacted data in order to comply with data privacy regulations in Canada
 *   and the US.
 */
public class MSSBamPg8BoolDefTable implements IMSSBamBoolDefTable {
    private MSSBamPg8Schema schema;

    public MSSBamPg8BoolDefTable(MSSBamPg8Schema argSchema) {
        schema = argSchema;
    }

    public void createBoolDef(MSSBamAuthorization Authorization, MSSBamBoolDefBuff Buff) {
        final String S_ProcName = "createBoolDef ";
        try {
            Connection cnx = schema.getCnx();
            long Id = Buff.getRequiredId();
            Boolean InitValue = Buff.getOptionalInitValue();
            Boolean DefaultValue = Buff.getOptionalDefaultValue();
            String FalseString = Buff.getOptionalFalseString();
            String TrueString = Buff.getOptionalTrueString();
            String NullString = Buff.getOptionalNullString();
            String sql = "INSERT INTO mssbam110.bool_def( " + "id, " + "initval, " + "defval, " + "falsestring, "
                    + "truestring, " + "nullstring" + " )" + "VALUES ( " + Id + ", "
                    + ((InitValue == null) ? "null" : (InitValue ? "true" : "false")) + ", "
                    + ((DefaultValue == null) ? "null" : (DefaultValue ? "true" : "false")) + ", "
                    + MSSBamPg8Schema.getQuotedString(FalseString) + ", "
                    + MSSBamPg8Schema.getQuotedString(TrueString) + ", "
                    + MSSBamPg8Schema.getQuotedString(NullString) + " )";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            int rowsAffected = stmt.executeUpdate(sql);
            if (rowsAffected != 1) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected 1 row to be affected by insert, not " + rowsAffected);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public final static String S_sqlSelectBoolDefDistinctClassCode = "SELECT " + "DISTINCT anyo.ClassCode "
            + "FROM mssbam110.any_obj AS anyo " + "INNER JOIN mssbam110.scope scp ON " + "scp.Id = anyo.Id "
            + "INNER JOIN mssbam110.valuedef val ON " + "val.Id = anyo.Id "
            + "INNER JOIN mssbam110.atom_def atm ON " + "atm.Id = anyo.Id "
            + "INNER JOIN mssbam110.bool_def bln ON " + "bln.Id = anyo.Id ";

    public final static String S_sqlSelectBoolDefBuff = "SELECT " + "anyo.ClassCode, " + "anyo.Id, "
            + "anyo.TenantId, " + "anyo.ScopeId, " + "anyo.Name, " + "anyo.short_name, " + "anyo.Label, "
            + "anyo.short_descr, " + "anyo.descr, " + "anyo.AuthorId, " + "val.ValueContainerId, "
            + "val.IsNullable, " + "val.GenerateId, " + "val.DataScopeId, " + "val.ViewAccessSecurityId, "
            + "val.EditAccessSecurityId, " + "val.ViewAccessFrequencyId, " + "val.EditAccessFrequencyId, "
            + "val.PrevId, " + "val.NextId, " + "atm.DbName, " + "bln.InitVal, " + "bln.DefVal, "
            + "bln.FalseString, " + "bln.TrueString, " + "bln.NullString, " + "anyo.Revision "
            + "FROM mssbam110.any_obj AS anyo " + "INNER JOIN mssbam110.scope scp ON " + "scp.Id = anyo.Id "
            + "INNER JOIN mssbam110.valuedef val ON " + "val.Id = anyo.Id "
            + "INNER JOIN mssbam110.atom_def atm ON " + "atm.Id = anyo.Id "
            + "INNER JOIN mssbam110.bool_def bln ON " + "bln.Id = anyo.Id ";

    protected MSSBamBoolDefBuff unpackBoolDefResultSetToBuff(ResultSet resultSet) throws SQLException {
        final String S_ProcName = "unpackBoolDefResultSetToBuff";
        int idxcol = 1;
        String classCode = resultSet.getString(idxcol);
        idxcol++;
        MSSBamBoolDefBuff buff;
        if (classCode.equals("BLN")) {
            buff = schema.getFactoryBoolDef().newBuff();
        } else if (classCode.equals("TBLN")) {
            buff = schema.getFactoryTableBool().newBuff();
        } else if (classCode.equals("SBLN")) {
            buff = schema.getFactorySchemaBool().newBuff();
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Unrecognized class code \"" + classCode + "\"");
        }
        buff.setRequiredId(resultSet.getLong(idxcol));
        idxcol++;
        buff.setRequiredTenantId(resultSet.getLong(idxcol));
        idxcol++;
        {
            long colVal = resultSet.getLong(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalScopeId(null);
            } else {
                buff.setOptionalScopeId(colVal);
            }
        }
        idxcol++;
        buff.setRequiredName(resultSet.getString(idxcol));
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalShortName(null);
            } else {
                buff.setOptionalShortName(colVal);
            }
        }
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalLabel(null);
            } else {
                buff.setOptionalLabel(colVal);
            }
        }
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalShortDescription(null);
            } else {
                buff.setOptionalShortDescription(colVal);
            }
        }
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalDescription(null);
            } else {
                buff.setOptionalDescription(colVal);
            }
        }
        idxcol++;
        {
            long colVal = resultSet.getLong(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalAuthorId(null);
            } else {
                buff.setOptionalAuthorId(colVal);
            }
        }
        idxcol++;
        buff.setRequiredValueContainerId(resultSet.getLong(idxcol));
        idxcol++;
        buff.setRequiredIsNullable(resultSet.getBoolean(idxcol));
        idxcol++;
        {
            boolean colVal = resultSet.getBoolean(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalGenerateId(null);
            } else {
                buff.setOptionalGenerateId(colVal);
            }
        }
        idxcol++;
        {
            short colVal = resultSet.getShort(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalDataScopeId(null);
            } else {
                buff.setOptionalDataScopeId(colVal);
            }
        }
        idxcol++;
        {
            short colVal = resultSet.getShort(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalViewAccessSecurityId(null);
            } else {
                buff.setOptionalViewAccessSecurityId(colVal);
            }
        }
        idxcol++;
        {
            short colVal = resultSet.getShort(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalEditAccessSecurityId(null);
            } else {
                buff.setOptionalEditAccessSecurityId(colVal);
            }
        }
        idxcol++;
        {
            short colVal = resultSet.getShort(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalViewAccessFrequencyId(null);
            } else {
                buff.setOptionalViewAccessFrequencyId(colVal);
            }
        }
        idxcol++;
        {
            short colVal = resultSet.getShort(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalEditAccessFrequencyId(null);
            } else {
                buff.setOptionalEditAccessFrequencyId(colVal);
            }
        }
        idxcol++;
        {
            long colVal = resultSet.getLong(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalPrevId(null);
            } else {
                buff.setOptionalPrevId(colVal);
            }
        }
        idxcol++;
        {
            long colVal = resultSet.getLong(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalNextId(null);
            } else {
                buff.setOptionalNextId(colVal);
            }
        }
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalDbName(null);
            } else {
                buff.setOptionalDbName(colVal);
            }
        }
        idxcol++;
        {
            boolean colVal = resultSet.getBoolean(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalInitValue(null);
            } else {
                buff.setOptionalInitValue(colVal);
            }
        }
        idxcol++;
        {
            boolean colVal = resultSet.getBoolean(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalDefaultValue(null);
            } else {
                buff.setOptionalDefaultValue(colVal);
            }
        }
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalFalseString(null);
            } else {
                buff.setOptionalFalseString(colVal);
            }
        }
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalTrueString(null);
            } else {
                buff.setOptionalTrueString(colVal);
            }
        }
        idxcol++;
        {
            String colVal = resultSet.getString(idxcol);
            if (resultSet.wasNull()) {
                buff.setOptionalNullString(null);
            } else {
                buff.setOptionalNullString(colVal);
            }
        }
        idxcol++;
        buff.setRequiredRevision(resultSet.getInt(idxcol));
        return (buff);
    }

    public MSSBamBoolDefBuff readDerived(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) {
        final String S_ProcName = "readDerived()";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        MSSBamBoolDefBuff buff;
        long Id = PKey.getRequiredId();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE " + "bln.Id = " + Long.toString(Id) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            if (resultSet.next()) {
                classCode = resultSet.getString(1);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-buff response, " + resultSet.getRow() + " rows selected");
                }
            } else {
                return (null);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        if (classCode.equals("BLN")) {
            buff = readBuff(Authorization, PKey);
        } else if (classCode.equals("TBLN")) {
            buff = schema.getTableTableBool().readBuffByIdIdx(Authorization, PKey.getRequiredId());
        } else if (classCode.equals("SBLN")) {
            buff = schema.getTableSchemaBool().readBuffByIdIdx(Authorization, PKey.getRequiredId());
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Did not expect ClassCode \"" + classCode + "\"");
        }
        return (buff);
    }

    public MSSBamBoolDefBuff[] readAllDerived(MSSBamAuthorization Authorization) {
        final String S_ProcName = "readAllDerived";
        MSSBamBoolDefBuff[] buffArray;
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        String classCode;
        ArrayList<String> classCodeList = new ArrayList<String>();
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode;
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        for (int classCodeIdx = 0; classCodeIdx < classCodeList.size(); classCodeIdx++) {
            MSSBamBoolDefBuff[] subList;
            classCode = classCodeList.get(classCodeIdx);
            if (classCode.equals("BLN")) {
                subList = readAllBuff(Authorization);
            } else if (classCode.equals("TBLN")) {
                subList = schema.getTableTableBool().readAllBuff(Authorization);
            } else if (classCode.equals("SBLN")) {
                subList = schema.getTableSchemaBool().readAllBuff(Authorization);
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
            for (int idxSubList = 0; idxSubList < subList.length; idxSubList++) {
                resultList.add(subList[idxSubList]);
            }
        }
        buffArray = resultList.toArray(new MSSBamBoolDefBuff[0]);
        return (buffArray);
    }

    public MSSBamBoolDefBuff readDerivedByIdIdx(MSSBamAuthorization Authorization, long Id) {
        final String S_ProcName = "MSSBamPg8BoolDefTable.readDerivedByIdIdx() ";
        MSSBamBoolDefBuff buff;
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE " + "anyo.Id = " + Long.toString(Id) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            if (resultSet.next()) {
                classCode = resultSet.getString(1);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-buff response, " + resultSet.getRow() + " rows selected");
                }
            } else {
                return (null);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        if (classCode.equals("BLN")) {
            buff = readBuffByIdIdx(Authorization, Id);
        } else if (classCode.equals("TBLN")) {
            buff = schema.getTableTableBool().readBuffByIdIdx(Authorization, Id);
        } else if (classCode.equals("SBLN")) {
            buff = schema.getTableSchemaBool().readBuffByIdIdx(Authorization, Id);
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Did not expect ClassCode \"" + classCode + "\"");
        }
        return (buff);
    }

    public MSSBamBoolDefBuff[] readDerivedByTenantIdx(MSSBamAuthorization Authorization, long TenantId) {
        final String S_ProcName = "readDerivedByTenantIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE " + "anyo.TenantId = "
                    + Long.toString(TenantId) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByTenantIdx(Authorization, TenantId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByTenantIdx(Authorization,
                        TenantId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByTenantIdx(Authorization,
                        TenantId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) {
        final String S_ProcName = "readDerivedByScopeIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((ScopeId == null) ? "anyo.ScopeId is null " : "anyo.ScopeId = " + ScopeId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByScopeIdx(Authorization, ScopeId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByScopeIdx(Authorization,
                        ScopeId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByScopeIdx(Authorization,
                        ScopeId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
        final String S_ProcName = "readDerivedByAuthorIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((AuthorId == null) ? "anyo.AuthorId is null "
                            : "anyo.AuthorId = " + AuthorId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByAuthorIdx(Authorization, AuthorId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByAuthorIdx(Authorization,
                        AuthorId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByAuthorIdx(Authorization,
                        AuthorId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff readDerivedByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) {
        final String S_ProcName = "MSSBamPg8BoolDefTable.readDerivedByUNameIdx() ";
        MSSBamBoolDefBuff buff;
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((ScopeId == null) ? "anyo.ScopeId is null " : "anyo.ScopeId = " + ScopeId.toString() + " ")
                    + "AND " + "anyo.Name = " + MSSBamPg8Schema.getQuotedString(Name) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            if (resultSet.next()) {
                classCode = resultSet.getString(1);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-buff response, " + resultSet.getRow() + " rows selected");
                }
            } else {
                return (null);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        if (classCode.equals("BLN")) {
            buff = readBuffByUNameIdx(Authorization, ScopeId, Name);
        } else if (classCode.equals("TBLN")) {
            buff = schema.getTableTableBool().readBuffByUNameIdx(Authorization, ScopeId, Name);
        } else if (classCode.equals("SBLN")) {
            buff = schema.getTableSchemaBool().readBuffByUNameIdx(Authorization, ScopeId, Name);
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Did not expect ClassCode \"" + classCode + "\"");
        }
        return (buff);
    }

    public MSSBamBoolDefBuff[] readDerivedByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) {
        final String S_ProcName = "readDerivedByVContIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE " + "val.ValueContainerId = "
                    + Long.toString(ValueContainerId) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByVContIdx(Authorization, ValueContainerId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByVContIdx(Authorization,
                        ValueContainerId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByVContIdx(Authorization,
                        ValueContainerId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) {
        final String S_ProcName = "readDerivedByDataScopeIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((DataScopeId == null) ? "val.DataScopeId is null "
                            : "val.DataScopeId = " + DataScopeId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByDataScopeIdx(Authorization, DataScopeId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByDataScopeIdx(Authorization,
                        DataScopeId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByDataScopeIdx(Authorization,
                        DataScopeId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByVAccSecIdx(MSSBamAuthorization Authorization,
            Short ViewAccessSecurityId) {
        final String S_ProcName = "readDerivedByVAccSecIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((ViewAccessSecurityId == null) ? "val.ViewAccessSecurityId is null "
                            : "val.ViewAccessSecurityId = " + ViewAccessSecurityId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByVAccSecIdx(Authorization, ViewAccessSecurityId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByVAccSecIdx(Authorization,
                        ViewAccessSecurityId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByVAccSecIdx(Authorization,
                        ViewAccessSecurityId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByVAccFreqIdx(MSSBamAuthorization Authorization,
            Short ViewAccessFrequencyId) {
        final String S_ProcName = "readDerivedByVAccFreqIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((ViewAccessFrequencyId == null) ? "val.ViewAccessFrequencyId is null "
                            : "val.ViewAccessFrequencyId = " + ViewAccessFrequencyId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByVAccFreqIdx(Authorization, ViewAccessFrequencyId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByVAccFreqIdx(Authorization,
                        ViewAccessFrequencyId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByVAccFreqIdx(Authorization,
                        ViewAccessFrequencyId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByEAccSecIdx(MSSBamAuthorization Authorization,
            Short EditAccessSecurityId) {
        final String S_ProcName = "readDerivedByEAccSecIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((EditAccessSecurityId == null) ? "val.EditAccessSecurityId is null "
                            : "val.EditAccessSecurityId = " + EditAccessSecurityId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByEAccSecIdx(Authorization, EditAccessSecurityId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByEAccSecIdx(Authorization,
                        EditAccessSecurityId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByEAccSecIdx(Authorization,
                        EditAccessSecurityId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByEAccFreqIdx(MSSBamAuthorization Authorization,
            Short EditAccessFrequencyId) {
        final String S_ProcName = "readDerivedByEAccFreqIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((EditAccessFrequencyId == null) ? "val.EditAccessFrequencyId is null "
                            : "val.EditAccessFrequencyId = " + EditAccessFrequencyId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByEAccFreqIdx(Authorization, EditAccessFrequencyId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByEAccFreqIdx(Authorization,
                        EditAccessFrequencyId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByEAccFreqIdx(Authorization,
                        EditAccessFrequencyId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) {
        final String S_ProcName = "readDerivedByPrevIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByPrevIdx(Authorization, PrevId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByPrevIdx(Authorization, PrevId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByPrevIdx(Authorization,
                        PrevId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByNextIdx(MSSBamAuthorization Authorization, Long NextId) {
        final String S_ProcName = "readDerivedByNextIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                    + ((NextId == null) ? "val.NextId is null " : "val.NextId = " + NextId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByNextIdx(Authorization, NextId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByNextIdx(Authorization, NextId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByNextIdx(Authorization,
                        NextId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long PrevId) {
        final String S_ProcName = "readDerivedByContPrevIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE " + "val.ValueContainerId = "
                    + Long.toString(ValueContainerId) + " " + "AND "
                    + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByContPrevIdx(Authorization, ValueContainerId, PrevId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByContPrevIdx(Authorization,
                        ValueContainerId, PrevId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByContPrevIdx(Authorization,
                        ValueContainerId, PrevId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff[] readDerivedByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long NextId) {
        final String S_ProcName = "readDerivedByContNextIdx";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        ArrayList<String> classCodeList = new ArrayList<String>();
        String classCode;
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE " + "val.ValueContainerId = "
                    + Long.toString(ValueContainerId) + " " + "AND "
                    + ((NextId == null) ? "val.NextId is null " : "val.NextId = " + NextId.toString() + " ");
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            while (resultSet.next()) {
                classCode = resultSet.getString(1);
                classCodeList.add(classCode);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
        ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>();
        ListIterator<String> classCodeIter = classCodeList.listIterator();
        while (classCodeIter.hasNext()) {
            classCode = classCodeIter.next();
            if (classCode.equals("BLN")) {
                MSSBamBoolDefBuff[] subList = readBuffByContNextIdx(Authorization, ValueContainerId, NextId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("TBLN")) {
                MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByContNextIdx(Authorization,
                        ValueContainerId, NextId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else if (classCode.equals("SBLN")) {
                MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByContNextIdx(Authorization,
                        ValueContainerId, NextId);
                for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                    resultList.add(subList[subListIdx]);
                }
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect ClassCode \"" + classCode + "\"");
            }
        }
        return (resultList.toArray(new MSSBamBoolDefBuff[0]));

    }

    public MSSBamBoolDefBuff readBuff(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) {
        final String S_ProcName = "readBuff";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        try {
            Connection cnx = schema.getCnx();
            long Id = PKey.getRequiredId();
            String sql = S_sqlSelectBoolDefBuff + "WHERE " + "anyo.Id = " + Long.toString(Id) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            if (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-buff response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readAllBuff(MSSBamAuthorization Authorization) {
        final String S_ProcName = "readAllBuff";
        if (!schema.isTransactionOpen()) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Transaction not open");
        }
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE " + "anyo.ClassCode = 'BLN' " + "ORDER BY "
                    + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff readBuffByIdIdx(MSSBamAuthorization Authorization, long Id) {
        final String S_ProcName = "readBuffByIdIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE " + "anyo.Id = " + Long.toString(Id) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            if (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-buff response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByTenantIdx(MSSBamAuthorization Authorization, long TenantId) {
        final String S_ProcName = "readBuffByTenantIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE " + "anyo.TenantId = " + Long.toString(TenantId) + " "
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) {
        final String S_ProcName = "readBuffByScopeIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE "
                    + ((ScopeId == null) ? "anyo.ScopeId is null " : "anyo.ScopeId = " + ScopeId.toString() + " ")
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
        final String S_ProcName = "readBuffByAuthorIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE " + ((AuthorId == null) ? "anyo.AuthorId is null "
                    : "anyo.AuthorId = " + AuthorId.toString() + " ") + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff readBuffByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) {
        final String S_ProcName = "readBuffByUNameIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE "
                    + ((ScopeId == null) ? "anyo.ScopeId is null " : "anyo.ScopeId = " + ScopeId.toString() + " ")
                    + "AND " + "anyo.Name = " + MSSBamPg8Schema.getQuotedString(Name) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            if (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-buff response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) {
        final String S_ProcName = "readBuffByVContIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE " + "val.ValueContainerId = "
                    + Long.toString(ValueContainerId) + " " + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) {
        final String S_ProcName = "readBuffByDataScopeIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE " + ((DataScopeId == null) ? "val.DataScopeId is null "
                    : "val.DataScopeId = " + DataScopeId.toString() + " ") + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByVAccSecIdx(MSSBamAuthorization Authorization, Short ViewAccessSecurityId) {
        final String S_ProcName = "readBuffByVAccSecIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE "
                    + ((ViewAccessSecurityId == null) ? "val.ViewAccessSecurityId is null "
                            : "val.ViewAccessSecurityId = " + ViewAccessSecurityId.toString() + " ")
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByVAccFreqIdx(MSSBamAuthorization Authorization,
            Short ViewAccessFrequencyId) {
        final String S_ProcName = "readBuffByVAccFreqIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE "
                    + ((ViewAccessFrequencyId == null) ? "val.ViewAccessFrequencyId is null "
                            : "val.ViewAccessFrequencyId = " + ViewAccessFrequencyId.toString() + " ")
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) {
        final String S_ProcName = "readBuffByEAccSecIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE "
                    + ((EditAccessSecurityId == null) ? "val.EditAccessSecurityId is null "
                            : "val.EditAccessSecurityId = " + EditAccessSecurityId.toString() + " ")
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByEAccFreqIdx(MSSBamAuthorization Authorization,
            Short EditAccessFrequencyId) {
        final String S_ProcName = "readBuffByEAccFreqIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE "
                    + ((EditAccessFrequencyId == null) ? "val.EditAccessFrequencyId is null "
                            : "val.EditAccessFrequencyId = " + EditAccessFrequencyId.toString() + " ")
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) {
        final String S_ProcName = "readBuffByPrevIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE "
                    + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " ")
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByNextIdx(MSSBamAuthorization Authorization, Long NextId) {
        final String S_ProcName = "readBuffByNextIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE "
                    + ((NextId == null) ? "val.NextId is null " : "val.NextId = " + NextId.toString() + " ")
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long PrevId) {
        final String S_ProcName = "readBuffByContPrevIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE " + "val.ValueContainerId = "
                    + Long.toString(ValueContainerId) + " " + "AND "
                    + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " ")
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff[] readBuffByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId,
            Long NextId) {
        final String S_ProcName = "readBuffByContNextIdx";
        try {
            Connection cnx = schema.getCnx();
            String sql = S_sqlSelectBoolDefBuff + "WHERE " + "val.ValueContainerId = "
                    + Long.toString(ValueContainerId) + " " + "AND "
                    + ((NextId == null) ? "val.NextId is null " : "val.NextId = " + NextId.toString() + " ")
                    + "ORDER BY " + "anyo.Id ASC";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            ResultSet resultSet = stmt.executeQuery(sql);
            List<MSSBamBoolDefBuff> buffList = new ArrayList<MSSBamBoolDefBuff>();
            while (resultSet.next()) {
                MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
                buffList.add(buff);
            }
            return (buffList.toArray(new MSSBamBoolDefBuff[0]));
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public void updateBoolDef(MSSBamAuthorization Authorization, MSSBamBoolDefBuff Buff) {
        final String S_ProcName = "updateBoolDef";
        try {
            Connection cnx = schema.getCnx();
            long Id = Buff.getRequiredId();
            Boolean InitValue = Buff.getOptionalInitValue();
            Boolean DefaultValue = Buff.getOptionalDefaultValue();
            String FalseString = Buff.getOptionalFalseString();
            String TrueString = Buff.getOptionalTrueString();
            String NullString = Buff.getOptionalNullString();

            String sql = "UPDATE mssbam110.bool_def " + "SET " + "Id = " + MSSBamPg8Schema.getInt64String(Id) + ", "
                    + "InitVal = " + ((InitValue != null) ? MSSBamPg8Schema.getBoolString(InitValue) : "null")
                    + ", " + "DefVal = "
                    + ((DefaultValue != null) ? MSSBamPg8Schema.getBoolString(DefaultValue) : "null") + ", "
                    + "FalseString = "
                    + ((FalseString != null) ? MSSBamPg8Schema.getQuotedString(FalseString) : "null") + ", "
                    + "TrueString = "
                    + ((TrueString != null) ? MSSBamPg8Schema.getQuotedString(TrueString) : "null") + ", "
                    + "NullString = "
                    + ((NullString != null) ? MSSBamPg8Schema.getQuotedString(NullString) : "null") + " " + "WHERE "
                    + "Id = " + Long.toString(Id) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            int rowsAffected = stmt.executeUpdate(sql);
            if (rowsAffected != 1) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected 1 row to be affected by update, not " + rowsAffected);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public void deleteBoolDef(MSSBamAuthorization Authorization, MSSBamBoolDefBuff Buff) {
        final String S_ProcName = "deleteBoolDef";
        try {
            Connection cnx = schema.getCnx();
            long Id = Buff.getRequiredId();
            Boolean InitValue = Buff.getOptionalInitValue();
            Boolean DefaultValue = Buff.getOptionalDefaultValue();
            String FalseString = Buff.getOptionalFalseString();
            String TrueString = Buff.getOptionalTrueString();
            String NullString = Buff.getOptionalNullString();

            String sql = "DELETE FROM mssbam110.bool_def " + "WHERE " + "Id = " + Long.toString(Id) + " ";
            Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            int rowsAffected = stmt.executeUpdate(sql);
            if (rowsAffected != 1) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected 1 row to be affected by delete, not " + rowsAffected);
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamCursor openBoolDefCursorAll(MSSBamAuthorization Authorization) {
        String sql = "SELECT " + "anyo.ClassCode, " + "bln.Id, " + "bln.InitVal, " + "bln.DefVal, "
                + "bln.FalseString, " + "bln.TrueString, " + "bln.NullString, " + "bln.Revision "
                + "FROM mssbam110.bool_def AS bln " + "INNER JOIN mssbam110.any_obj anyo ON "

                + "bln.Id = anyo.Id " + "ORDER BY " + "anyo.Id ASC";
        MSSBamCursor cursor = new MSSBamPg8Cursor(Authorization, schema, sql);
        return (cursor);
    }

    public void closeBoolDefCursor(MSSBamCursor Cursor) {
        try {
            Cursor.getResultSet().close();
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "closeBoolDefCursor", e);
        }
    }

    public MSSBamBoolDefBuff nextBoolDefCursor(MSSBamCursor Cursor) {
        final String S_ProcName = "nextBoolDefCursor";
        try {
            ResultSet resultSet = Cursor.getResultSet();
            if (!resultSet.next()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "No more results available");
            }
            MSSBamBoolDefBuff buff = unpackBoolDefResultSetToBuff(resultSet);
            return (buff);
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
        }
    }

    public MSSBamBoolDefBuff prevBoolDefCursor(MSSBamCursor Cursor) {
        int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1;
        MSSBamBoolDefBuff buff = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            buff = nextBoolDefCursor(Cursor);
        }
        return (buff);
    }

    public MSSBamBoolDefBuff firstBoolDefCursor(MSSBamCursor Cursor) {
        int targetRowIdx = 1;
        MSSBamBoolDefBuff buff = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            buff = nextBoolDefCursor(Cursor);
        }
        return (buff);
    }

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

    public MSSBamBoolDefBuff nthBoolDefCursor(MSSBamCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        MSSBamBoolDefBuff buff = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            buff = nextBoolDefCursor(Cursor);
        }
        return (buff);
    }
}