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

Java tutorial

Introduction

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

Source

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

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

/*
 *   MSSBamRamSecGroupFormTable in-memory RAM DbIO implementation
 *   for SecGroupForm.
 */
public class MSSBamRamSecGroupFormTable implements IMSSBamSecGroupFormTable {
    private MSSBamBLRamSchema schema;
    private Map<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff> dictByPKey = new HashMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>();
    private SortedMap<MSSBamSecGroupFormByGroupIdxKey, SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>> dictByGroupIdx = new TreeMap<MSSBamSecGroupFormByGroupIdxKey, SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>>();
    private SortedMap<MSSBamSecGroupFormByFormIdxKey, SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>> dictByFormIdx = new TreeMap<MSSBamSecGroupFormByFormIdxKey, SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>>();
    private SortedMap<MSSBamSecGroupFormByUFormIdxKey, MSSBamSecGroupFormBuff> dictByUFormIdx = new TreeMap<MSSBamSecGroupFormByUFormIdxKey, MSSBamSecGroupFormBuff>();

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

    public void createSecGroupForm(MSSBamAuthorization Authorization, MSSBamSecGroupFormBuff Buff) {
        MSSBamSecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey();

        pkey.setRequiredSecGroupFormId(schema.nextSecGroupFormIdGen());
        Buff.setRequiredSecGroupFormId(pkey.getRequiredSecGroupFormId());

        MSSBamSecGroupFormByGroupIdxKey keyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey();
        keyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());

        MSSBamSecGroupFormByFormIdxKey keyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
        keyFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

        MSSBamSecGroupFormByUFormIdxKey keyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey();
        keyUFormIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
        keyUFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

        // Validate unique indexes

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

        if (dictByUFormIdx.containsKey(keyUFormIdx)) {
            throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                    "createSecGroupForm", "SecGroupFormUFormIdx", keyUFormIdx);
        }

        // Validate foreign keys

        {
            boolean allNull = true;
            allNull = false;
            if (!allNull) {
                if (null == schema.getTableSecGroup().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredSecGroupId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "createSecGroupForm", "Container", "SecGroupFormGroup", "SecGroup", null);
                }
            }
        }

        {
            boolean allNull = true;
            allNull = false;
            if (!allNull) {
                if (null == schema.getTableSecForm().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredSecFormId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "createSecGroupForm", "Lookup", "SecGroupFormForm", "SecForm", null);
                }
            }
        }

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff> subdictGroupIdx;
        if (dictByGroupIdx.containsKey(keyGroupIdx)) {
            subdictGroupIdx = dictByGroupIdx.get(keyGroupIdx);
        } else {
            subdictGroupIdx = new TreeMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>();
            dictByGroupIdx.put(keyGroupIdx, subdictGroupIdx);
        }
        subdictGroupIdx.put(pkey, Buff);

        SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff> subdictFormIdx;
        if (dictByFormIdx.containsKey(keyFormIdx)) {
            subdictFormIdx = dictByFormIdx.get(keyFormIdx);
        } else {
            subdictFormIdx = new TreeMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>();
            dictByFormIdx.put(keyFormIdx, subdictFormIdx);
        }
        subdictFormIdx.put(pkey, Buff);

        dictByUFormIdx.put(keyUFormIdx, Buff);

    }

    public MSSBamSecGroupFormBuff readDerived(MSSBamAuthorization Authorization, MSSBamSecGroupFormPKey PKey) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readDerived() ";
        MSSBamSecGroupFormPKey key = schema.getFactorySecGroupForm().newPKey();
        key.setRequiredSecGroupFormId(PKey.getRequiredSecGroupFormId());
        MSSBamSecGroupFormBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

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

    public MSSBamSecGroupFormBuff[] readDerivedByGroupIdx(MSSBamAuthorization Authorization, int SecGroupId) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readDerivedByGroupIdx() ";
        MSSBamSecGroupFormByGroupIdxKey key = schema.getFactorySecGroupForm().newGroupIdxKey();
        key.setRequiredSecGroupId(SecGroupId);

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

    public MSSBamSecGroupFormBuff[] readDerivedByFormIdx(MSSBamAuthorization Authorization, int SecFormId) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readDerivedByFormIdx() ";
        MSSBamSecGroupFormByFormIdxKey key = schema.getFactorySecGroupForm().newFormIdxKey();
        key.setRequiredSecFormId(SecFormId);

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

    public MSSBamSecGroupFormBuff readDerivedByUFormIdx(MSSBamAuthorization Authorization, int SecGroupId,
            int SecFormId) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readDerivedByUFormIdx() ";
        MSSBamSecGroupFormByUFormIdxKey key = schema.getFactorySecGroupForm().newUFormIdxKey();
        key.setRequiredSecGroupId(SecGroupId);
        key.setRequiredSecFormId(SecFormId);

        MSSBamSecGroupFormBuff buff;
        if (dictByUFormIdx.containsKey(key)) {
            buff = dictByUFormIdx.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public MSSBamSecGroupFormBuff readDerivedByIdIdx(MSSBamAuthorization Authorization, long SecGroupFormId) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readDerivedByIdIdx() ";
        MSSBamSecGroupFormPKey key = schema.getFactorySecGroupForm().newPKey();
        key.setRequiredSecGroupFormId(SecGroupFormId);

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

    public MSSBamSecGroupFormBuff readBuff(MSSBamAuthorization Authorization, MSSBamSecGroupFormPKey PKey) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readBuff() ";
        MSSBamSecGroupFormBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("SGFM"))) {
            buff = null;
        }
        return (buff);
    }

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

    public MSSBamSecGroupFormBuff readBuffByIdIdx(MSSBamAuthorization Authorization, long SecGroupFormId) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readBuffByIdIdx() ";
        MSSBamSecGroupFormBuff buff = readDerivedByIdIdx(Authorization, SecGroupFormId);
        if ((buff != null) && buff.getClassCode().equals("SGFM")) {
            return ((MSSBamSecGroupFormBuff) buff);
        } else {
            return (null);
        }
    }

    public MSSBamSecGroupFormBuff[] readBuffByGroupIdx(MSSBamAuthorization Authorization, int SecGroupId) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readBuffByGroupIdx() ";
        MSSBamSecGroupFormBuff buff;
        ArrayList<MSSBamSecGroupFormBuff> filteredList = new ArrayList<MSSBamSecGroupFormBuff>();
        MSSBamSecGroupFormBuff[] buffList = readDerivedByGroupIdx(Authorization, SecGroupId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("SGFM")) {
                filteredList.add((MSSBamSecGroupFormBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamSecGroupFormBuff[0]));
    }

    public MSSBamSecGroupFormBuff[] readBuffByFormIdx(MSSBamAuthorization Authorization, int SecFormId) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readBuffByFormIdx() ";
        MSSBamSecGroupFormBuff buff;
        ArrayList<MSSBamSecGroupFormBuff> filteredList = new ArrayList<MSSBamSecGroupFormBuff>();
        MSSBamSecGroupFormBuff[] buffList = readDerivedByFormIdx(Authorization, SecFormId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("SGFM")) {
                filteredList.add((MSSBamSecGroupFormBuff) buff);
            }
        }
        return (filteredList.toArray(new MSSBamSecGroupFormBuff[0]));
    }

    public MSSBamSecGroupFormBuff readBuffByUFormIdx(MSSBamAuthorization Authorization, int SecGroupId,
            int SecFormId) {
        final String S_ProcName = "MSSBamRamSecGroupForm.readBuffByUFormIdx() ";
        MSSBamSecGroupFormBuff buff = readDerivedByUFormIdx(Authorization, SecGroupId, SecFormId);
        if ((buff != null) && buff.getClassCode().equals("SGFM")) {
            return ((MSSBamSecGroupFormBuff) buff);
        } else {
            return (null);
        }
    }

    public void updateSecGroupForm(MSSBamAuthorization Authorization, MSSBamSecGroupFormBuff Buff) {
        MSSBamSecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey();
        pkey.setRequiredSecGroupFormId(Buff.getRequiredSecGroupFormId());
        MSSBamSecGroupFormBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                    "updateSecGroupForm", "Existing record not found", "SecGroupForm", pkey);
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecGroupForm",
                    pkey);
        }
        Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
        MSSBamSecGroupFormByGroupIdxKey existingKeyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey();
        existingKeyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

        MSSBamSecGroupFormByGroupIdxKey newKeyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey();
        newKeyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());

        MSSBamSecGroupFormByFormIdxKey existingKeyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
        existingKeyFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

        MSSBamSecGroupFormByFormIdxKey newKeyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
        newKeyFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

        MSSBamSecGroupFormByUFormIdxKey existingKeyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey();
        existingKeyUFormIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
        existingKeyUFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

        MSSBamSecGroupFormByUFormIdxKey newKeyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey();
        newKeyUFormIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
        newKeyUFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

        // Check unique indexes

        if (!existingKeyUFormIdx.equals(newKeyUFormIdx)) {
            if (dictByUFormIdx.containsKey(newKeyUFormIdx)) {
                throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                        "updateSecGroupForm", "SecGroupFormUFormIdx", newKeyUFormIdx);
            }
        }

        // Validate foreign keys

        {
            boolean allNull = true;

            if (allNull) {
                if (null == schema.getTableSecGroup().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredSecGroupId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "updateSecGroupForm", "Container", "SecGroupFormGroup", "SecGroup", null);
                }
            }
        }

        {
            boolean allNull = true;

            if (allNull) {
                if (null == schema.getTableSecForm().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredSecFormId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "updateSecGroupForm", "Lookup", "SecGroupFormForm", "SecForm", null);
                }
            }
        }

        // Update is valid

        SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff> subdict;

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

        subdict = dictByGroupIdx.get(existingKeyGroupIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByGroupIdx.containsKey(newKeyGroupIdx)) {
            subdict = dictByGroupIdx.get(newKeyGroupIdx);
        } else {
            subdict = new TreeMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>();
            dictByGroupIdx.put(newKeyGroupIdx, subdict);
        }
        subdict.put(pkey, Buff);

        subdict = dictByFormIdx.get(existingKeyFormIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByFormIdx.containsKey(newKeyFormIdx)) {
            subdict = dictByFormIdx.get(newKeyFormIdx);
        } else {
            subdict = new TreeMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff>();
            dictByFormIdx.put(newKeyFormIdx, subdict);
        }
        subdict.put(pkey, Buff);

        dictByUFormIdx.remove(existingKeyUFormIdx);
        dictByUFormIdx.put(newKeyUFormIdx, Buff);

    }

    public void deleteSecGroupForm(MSSBamAuthorization Authorization, MSSBamSecGroupFormBuff Buff) {
        final String S_ProcName = "MSSBamRamSecGroupFormTable.deleteSecGroupForm() ";
        MSSBamSecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey();

        pkey.setRequiredSecGroupFormId(schema.nextSecGroupFormIdGen());
        MSSBamSecGroupFormBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                    "deleteSecGroupForm", "Existing record not found", "SecGroupForm", pkey);
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecGroupForm",
                    pkey);
        }
        MSSBamSecGroupFormByGroupIdxKey keyGroupIdx = schema.getFactorySecGroupForm().newGroupIdxKey();
        keyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

        MSSBamSecGroupFormByFormIdxKey keyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
        keyFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

        MSSBamSecGroupFormByUFormIdxKey keyUFormIdx = schema.getFactorySecGroupForm().newUFormIdxKey();
        keyUFormIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
        keyUFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

        // Validate reverse foreign keys

        // Delete is valid

        SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff> subdict;

        dictByPKey.remove(pkey);

        subdict = dictByGroupIdx.get(keyGroupIdx);
        subdict.remove(pkey);

        subdict = dictByFormIdx.get(keyFormIdx);
        subdict.remove(pkey);

        dictByUFormIdx.remove(keyUFormIdx);

    }

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

    public MSSBamCursor openSecGroupFormCursorByGroupIdx(MSSBamAuthorization Authorization, int SecGroupId) {
        MSSBamCursor cursor;
        MSSBamSecGroupFormByGroupIdxKey key = schema.getFactorySecGroupForm().newGroupIdxKey();
        key.setRequiredSecGroupId(SecGroupId);

        if (dictByGroupIdx.containsKey(key)) {
            SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff> subdictGroupIdx = dictByGroupIdx.get(key);
            cursor = new MSSBamRamSecGroupFormCursor(Authorization, schema, subdictGroupIdx.values());
        } else {
            cursor = new MSSBamRamSecGroupFormCursor(Authorization, schema,
                    new ArrayList<MSSBamSecGroupFormBuff>());
        }
        return (cursor);
    }

    public MSSBamCursor openSecGroupFormCursorByFormIdx(MSSBamAuthorization Authorization, int SecFormId) {
        MSSBamCursor cursor;
        MSSBamSecGroupFormByFormIdxKey key = schema.getFactorySecGroupForm().newFormIdxKey();
        key.setRequiredSecFormId(SecFormId);

        if (dictByFormIdx.containsKey(key)) {
            SortedMap<MSSBamSecGroupFormPKey, MSSBamSecGroupFormBuff> subdictFormIdx = dictByFormIdx.get(key);
            cursor = new MSSBamRamSecGroupFormCursor(Authorization, schema, subdictFormIdx.values());
        } else {
            cursor = new MSSBamRamSecGroupFormCursor(Authorization, schema,
                    new ArrayList<MSSBamSecGroupFormBuff>());
        }
        return (cursor);
    }

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

    public MSSBamSecGroupFormBuff nextSecGroupFormCursor(MSSBamCursor Cursor) {
        MSSBamRamSecGroupFormCursor cursor = (MSSBamRamSecGroupFormCursor) Cursor;
        MSSBamSecGroupFormBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

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

    public MSSBamSecGroupFormBuff firstSecGroupFormCursor(MSSBamCursor Cursor) {
        int targetRowIdx = 1;
        MSSBamSecGroupFormBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextSecGroupFormCursor(Cursor);
        }
        return (rec);
    }

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

    public MSSBamSecGroupFormBuff nthSecGroupFormCursor(MSSBamCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        MSSBamSecGroupFormBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextSecGroupFormCursor(Cursor);
        }
        return (rec);
    }
}