Example usage for java.util ArrayList listIterator

List of usage examples for java.util ArrayList listIterator

Introduction

In this page you can find the example usage for java.util ArrayList listIterator.

Prototype

public ListIterator<E> listIterator() 

Source Link

Document

Returns a list iterator over the elements in this list (in proper sequence).

Usage

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8TimestampDefTable.java

public MSSBamTimestampDefBuff[] readDerivedByEAccSecIdx(MSSBamAuthorization Authorization,
        Short EditAccessSecurityId) {
    final String S_ProcName = "readDerivedByEAccSecIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from  ww w  .j av a2 s.  co  m
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectTimestampDefDistinctClassCode + "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<MSSBamTimestampDefBuff> resultList = new ArrayList<MSSBamTimestampDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("TSP")) {
            MSSBamTimestampDefBuff[] subList = readBuffByEAccSecIdx(Authorization, EditAccessSecurityId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TTSM")) {
            MSSBamTableTimestampBuff[] subList = schema.getTableTableTimestamp()
                    .readBuffByEAccSecIdx(Authorization, EditAccessSecurityId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("STSM")) {
            MSSBamSchemaTimestampBuff[] subList = schema.getTableSchemaTimestamp()
                    .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 MSSBamTimestampDefBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8NumberDefTable.java

public MSSBamNumberDefBuff[] readDerivedByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId,
        Long PrevId) {/*from w  ww .  j  ava 2  s.  com*/
    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_sqlSelectNumberDefDistinctClassCode + "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<MSSBamNumberDefBuff> resultList = new ArrayList<MSSBamNumberDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("NUM")) {
            MSSBamNumberDefBuff[] subList = readBuffByContPrevIdx(Authorization, ValueContainerId, PrevId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TNUM")) {
            MSSBamTableNumberBuff[] subList = schema.getTableTableNumber().readBuffByContPrevIdx(Authorization,
                    ValueContainerId, PrevId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SNUM")) {
            MSSBamSchemaNumberBuff[] subList = schema.getTableSchemaNumber()
                    .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 MSSBamNumberDefBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8NumberDefTable.java

public MSSBamNumberDefBuff[] readDerivedByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId,
        Long NextId) {/*from   w  ww .jav  a 2  s .co  m*/
    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_sqlSelectNumberDefDistinctClassCode + "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<MSSBamNumberDefBuff> resultList = new ArrayList<MSSBamNumberDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("NUM")) {
            MSSBamNumberDefBuff[] subList = readBuffByContNextIdx(Authorization, ValueContainerId, NextId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TNUM")) {
            MSSBamTableNumberBuff[] subList = schema.getTableTableNumber().readBuffByContNextIdx(Authorization,
                    ValueContainerId, NextId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SNUM")) {
            MSSBamSchemaNumberBuff[] subList = schema.getTableSchemaNumber()
                    .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 MSSBamNumberDefBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8Id16GenDefTable.java

public MSSBamId16GenDefBuff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
    final String S_ProcName = "readDerivedByAuthorIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from  w  w  w  .j  a  va 2 s  .  c  o m*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectId16GenDefDistinctClassCode + "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<MSSBamId16GenDefBuff> resultList = new ArrayList<MSSBamId16GenDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("G16")) {
            MSSBamId16GenDefBuff[] subList = readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TG16")) {
            MSSBamTableId16GenBuff[] subList = schema.getTableTableId16Gen().readBuffByAuthorIdx(Authorization,
                    AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SG16")) {
            MSSBamSchemaId16GenBuff[] subList = schema.getTableSchemaId16Gen()
                    .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 MSSBamId16GenDefBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8Id32GenDefTable.java

public MSSBamId32GenDefBuff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
    final String S_ProcName = "readDerivedByAuthorIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//  ww  w  .  j a v  a 2  s . c  o  m
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectId32GenDefDistinctClassCode + "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<MSSBamId32GenDefBuff> resultList = new ArrayList<MSSBamId32GenDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("G32")) {
            MSSBamId32GenDefBuff[] subList = readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TG32")) {
            MSSBamTableId32GenBuff[] subList = schema.getTableTableId32Gen().readBuffByAuthorIdx(Authorization,
                    AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SG32")) {
            MSSBamSchemaId32GenBuff[] subList = schema.getTableSchemaId32Gen()
                    .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 MSSBamId32GenDefBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8Id64GenDefTable.java

public MSSBamId64GenDefBuff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
    final String S_ProcName = "readDerivedByAuthorIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*w  ww.j  a va  2 s .c o  m*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectId64GenDefDistinctClassCode + "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<MSSBamId64GenDefBuff> resultList = new ArrayList<MSSBamId64GenDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("G64")) {
            MSSBamId64GenDefBuff[] subList = readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TG64")) {
            MSSBamTableId64GenBuff[] subList = schema.getTableTableId64Gen().readBuffByAuthorIdx(Authorization,
                    AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SG64")) {
            MSSBamSchemaId64GenBuff[] subList = schema.getTableSchemaId64Gen()
                    .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 MSSBamId64GenDefBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8TimestampDefTable.java

public MSSBamTimestampDefBuff[] readDerivedByVAccFreqIdx(MSSBamAuthorization Authorization,
        Short ViewAccessFrequencyId) {
    final String S_ProcName = "readDerivedByVAccFreqIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*  w  ww .j  av a2  s  . c o m*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectTimestampDefDistinctClassCode + "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<MSSBamTimestampDefBuff> resultList = new ArrayList<MSSBamTimestampDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("TSP")) {
            MSSBamTimestampDefBuff[] subList = readBuffByVAccFreqIdx(Authorization, ViewAccessFrequencyId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TTSM")) {
            MSSBamTableTimestampBuff[] subList = schema.getTableTableTimestamp()
                    .readBuffByVAccFreqIdx(Authorization, ViewAccessFrequencyId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("STSM")) {
            MSSBamSchemaTimestampBuff[] subList = schema.getTableSchemaTimestamp()
                    .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 MSSBamTimestampDefBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8TimestampDefTable.java

public MSSBamTimestampDefBuff[] readDerivedByEAccFreqIdx(MSSBamAuthorization Authorization,
        Short EditAccessFrequencyId) {
    final String S_ProcName = "readDerivedByEAccFreqIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from www .ja  v  a  2 s  .c  om*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectTimestampDefDistinctClassCode + "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<MSSBamTimestampDefBuff> resultList = new ArrayList<MSSBamTimestampDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("TSP")) {
            MSSBamTimestampDefBuff[] subList = readBuffByEAccFreqIdx(Authorization, EditAccessFrequencyId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TTSM")) {
            MSSBamTableTimestampBuff[] subList = schema.getTableTableTimestamp()
                    .readBuffByEAccFreqIdx(Authorization, EditAccessFrequencyId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("STSM")) {
            MSSBamSchemaTimestampBuff[] subList = schema.getTableSchemaTimestamp()
                    .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 MSSBamTimestampDefBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8Id16GenDefTable.java

public MSSBamId16GenDefBuff[] readDerivedByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) {
    final String S_ProcName = "readDerivedByDataScopeIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }// ww  w.  j  a v  a 2  s .  c  o m
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectId16GenDefDistinctClassCode + "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<MSSBamId16GenDefBuff> resultList = new ArrayList<MSSBamId16GenDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("G16")) {
            MSSBamId16GenDefBuff[] subList = readBuffByDataScopeIdx(Authorization, DataScopeId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TG16")) {
            MSSBamTableId16GenBuff[] subList = schema.getTableTableId16Gen()
                    .readBuffByDataScopeIdx(Authorization, DataScopeId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SG16")) {
            MSSBamSchemaId16GenBuff[] subList = schema.getTableSchemaId16Gen()
                    .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 MSSBamId16GenDefBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8Id16GenDefTable.java

public MSSBamId16GenDefBuff[] readDerivedByDispIdx(MSSBamAuthorization Authorization, Long DispenserId) {
    final String S_ProcName = "readDerivedByDispIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }// w w w  .  j  av  a  2s .com
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectId16GenDefDistinctClassCode + "WHERE "
                + ((DispenserId == null) ? "g16.DispenserId is null "
                        : "g16.DispenserId = " + DispenserId.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<MSSBamId16GenDefBuff> resultList = new ArrayList<MSSBamId16GenDefBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("G16")) {
            MSSBamId16GenDefBuff[] subList = readBuffByDispIdx(Authorization, DispenserId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TG16")) {
            MSSBamTableId16GenBuff[] subList = schema.getTableTableId16Gen().readBuffByDispIdx(Authorization,
                    DispenserId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SG16")) {
            MSSBamSchemaId16GenBuff[] subList = schema.getTableSchemaId16Gen().readBuffByDispIdx(Authorization,
                    DispenserId);
            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 MSSBamId16GenDefBuff[0]));

}