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.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleRealProjectTable.java

public CFInternetRealProjectBuff[] readDerivedByTenantIdx(CFSecurityAuthorization Authorization,
        long TenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from w  w  w  .j av  a 2s  . c  o m

    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    CallableStatement stmtReadClassCodeByTenantIdx = null;
    try {
        Connection cnx = schema.getCnx();
        stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_rprjdefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId);
        stmtReadClassCodeByTenantIdx.execute();
        resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    classCode = resultSet.getString(1);
                    classCodeList.add(classCode);
                }
            } catch (SQLException e) {
            }
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadClassCodeByTenantIdx != null) {
            try {
                stmtReadClassCodeByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadClassCodeByTenantIdx = null;
        }
    }
    List<CFInternetRealProjectBuff> resultList = new LinkedList<CFInternetRealProjectBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("RPRJ")) {
            CFInternetRealProjectBuff[] subList = readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TPRJ")) {
            CFInternetTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SPRJ")) {
            CFInternetSubProjectBuff[] subList = schema.getTableSubProject().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 + "\"");
        }
    }
    int idx = 0;
    CFInternetRealProjectBuff[] retBuff = new CFInternetRealProjectBuff[resultList.size()];
    Iterator<CFInternetRealProjectBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMySql.CFAstMySqlConfigurationFileTable.java

public CFAstConfigurationFileBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
    final String S_ProcName = "readDerivedByClusterIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from   ww  w  .j a  v a 2 s . co m*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName()
                + ".sp_read_conf_file_cc_by_clusteridx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtReadClassCodeByClusterIdx == null) {
            stmtReadClassCodeByClusterIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadClassCodeByClusterIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByClusterIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByClusterIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByClusterIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByClusterIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByClusterIdx.setLong(argIdx++, ClusterId);
        try {
            resultSet = stmtReadClassCodeByClusterIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        while ((resultSet != null) && resultSet.next()) {
            classCode = resultSet.getString(1);
            classCodeList.add(classCode);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
    List<CFAstConfigurationFileBuff> resultList = new LinkedList<CFAstConfigurationFileBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("CONF")) {
            CFAstConfigurationFileBuff[] subList = readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CASC")) {
            CFAstAsteriskConfBuff[] subList = schema.getTableAsteriskConf().readBuffByClusterIdx(Authorization,
                    ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CSIP")) {
            CFAstSipConfBuff[] subList = schema.getTableSipConf().readBuffByClusterIdx(Authorization,
                    ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CEXT")) {
            CFAstExtensionsConfBuff[] subList = schema.getTableExtensionsConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CVOM")) {
            CFAstVoicemailConfBuff[] subList = schema.getTableVoicemailConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CECC")) {
            CFAstExtConfigConfBuff[] subList = schema.getTableExtConfigConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            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 + "\"");
        }
    }
    int idx = 0;
    CFAstConfigurationFileBuff[] retBuff = new CFAstConfigurationFileBuff[resultList.size()];
    Iterator<CFAstConfigurationFileBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);

}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstMySql.CFAstMySqlConfigurationFileTable.java

public CFAstConfigurationFileBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
    final String S_ProcName = "readDerivedByClusterIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*www  . j  a va 2 s .c  o  m*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName()
                + ".sp_read_conf_file_cc_by_clusteridx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtReadClassCodeByClusterIdx == null) {
            stmtReadClassCodeByClusterIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadClassCodeByClusterIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByClusterIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByClusterIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByClusterIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByClusterIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByClusterIdx.setLong(argIdx++, ClusterId);
        try {
            resultSet = stmtReadClassCodeByClusterIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        while ((resultSet != null) && resultSet.next()) {
            classCode = resultSet.getString(1);
            classCodeList.add(classCode);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
    List<CFAstConfigurationFileBuff> resultList = new LinkedList<CFAstConfigurationFileBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("CONF")) {
            CFAstConfigurationFileBuff[] subList = readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CASC")) {
            CFAstAsteriskConfBuff[] subList = schema.getTableAsteriskConf().readBuffByClusterIdx(Authorization,
                    ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CSIP")) {
            CFAstSipConfBuff[] subList = schema.getTableSipConf().readBuffByClusterIdx(Authorization,
                    ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CEXT")) {
            CFAstExtensionsConfBuff[] subList = schema.getTableExtensionsConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CVOM")) {
            CFAstVoicemailConfBuff[] subList = schema.getTableVoicemailConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CECC")) {
            CFAstExtConfigConfBuff[] subList = schema.getTableExtConfigConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            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 + "\"");
        }
    }
    int idx = 0;
    CFAstConfigurationFileBuff[] retBuff = new CFAstConfigurationFileBuff[resultList.size()];
    Iterator<CFAstConfigurationFileBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);

}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMySql.CFAstMySqlConfigurationFileTable.java

public CFAstConfigurationFileBuff[] readDerivedByHostIdx(CFAstAuthorization Authorization, long ClusterId,
        long HostNodeId) {
    final String S_ProcName = "readDerivedByHostIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from  w  w  w.jav a  2 s.c o m*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".sp_read_conf_file_cc_by_hostidx( ?, ?, ?, ?, ?"
                + ", " + "?" + ", " + "?" + " )";
        if (stmtReadClassCodeByHostIdx == null) {
            stmtReadClassCodeByHostIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadClassCodeByHostIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByHostIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByHostIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByHostIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByHostIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByHostIdx.setLong(argIdx++, ClusterId);
        stmtReadClassCodeByHostIdx.setLong(argIdx++, HostNodeId);
        try {
            resultSet = stmtReadClassCodeByHostIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        while ((resultSet != null) && resultSet.next()) {
            classCode = resultSet.getString(1);
            classCodeList.add(classCode);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
    List<CFAstConfigurationFileBuff> resultList = new LinkedList<CFAstConfigurationFileBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("CONF")) {
            CFAstConfigurationFileBuff[] subList = readBuffByHostIdx(Authorization, ClusterId, HostNodeId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CASC")) {
            CFAstAsteriskConfBuff[] subList = schema.getTableAsteriskConf().readBuffByHostIdx(Authorization,
                    ClusterId, HostNodeId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CSIP")) {
            CFAstSipConfBuff[] subList = schema.getTableSipConf().readBuffByHostIdx(Authorization, ClusterId,
                    HostNodeId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CEXT")) {
            CFAstExtensionsConfBuff[] subList = schema.getTableExtensionsConf().readBuffByHostIdx(Authorization,
                    ClusterId, HostNodeId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CVOM")) {
            CFAstVoicemailConfBuff[] subList = schema.getTableVoicemailConf().readBuffByHostIdx(Authorization,
                    ClusterId, HostNodeId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CECC")) {
            CFAstExtConfigConfBuff[] subList = schema.getTableExtConfigConf().readBuffByHostIdx(Authorization,
                    ClusterId, HostNodeId);
            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 + "\"");
        }
    }
    int idx = 0;
    CFAstConfigurationFileBuff[] retBuff = new CFAstConfigurationFileBuff[resultList.size()];
    Iterator<CFAstConfigurationFileBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleProjectBaseTable.java

public CFAccProjectBaseBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long TenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*  www  .j  a  v a  2s. c om*/

    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    CallableStatement stmtReadClassCodeByTenantIdx = null;
    try {
        Connection cnx = schema.getCnx();
        stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_bprjdefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId);
        stmtReadClassCodeByTenantIdx.execute();
        resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    classCode = resultSet.getString(1);
                    classCodeList.add(classCode);
                }
            } catch (SQLException e) {
            }
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadClassCodeByTenantIdx != null) {
            try {
                stmtReadClassCodeByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadClassCodeByTenantIdx = null;
        }
    }
    List<CFAccProjectBaseBuff> resultList = new LinkedList<CFAccProjectBaseBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("BPRJ")) {
            CFAccProjectBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("RPRJ")) {
            CFAccRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TPRJ")) {
            CFAccTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SPRJ")) {
            CFAccSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("VERN")) {
            CFAccVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MJVR")) {
            CFAccMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MNVR")) {
            CFAccMinorVersionBuff[] subList = schema.getTableMinorVersion().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 + "\"");
        }
    }
    int idx = 0;
    CFAccProjectBaseBuff[] retBuff = new CFAccProjectBaseBuff[resultList.size()];
    Iterator<CFAccProjectBaseBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleProjectBaseTable.java

public CFAstProjectBaseBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long TenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w ww.  ja va2  s.c  om*/

    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    CallableStatement stmtReadClassCodeByTenantIdx = null;
    try {
        Connection cnx = schema.getCnx();
        stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_bprjdefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId);
        stmtReadClassCodeByTenantIdx.execute();
        resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    classCode = resultSet.getString(1);
                    classCodeList.add(classCode);
                }
            } catch (SQLException e) {
            }
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadClassCodeByTenantIdx != null) {
            try {
                stmtReadClassCodeByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadClassCodeByTenantIdx = null;
        }
    }
    List<CFAstProjectBaseBuff> resultList = new LinkedList<CFAstProjectBaseBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("BPRJ")) {
            CFAstProjectBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("RPRJ")) {
            CFAstRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TPRJ")) {
            CFAstTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SPRJ")) {
            CFAstSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("VERN")) {
            CFAstVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MJVR")) {
            CFAstMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MNVR")) {
            CFAstMinorVersionBuff[] subList = schema.getTableMinorVersion().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 + "\"");
        }
    }
    int idx = 0;
    CFAstProjectBaseBuff[] retBuff = new CFAstProjectBaseBuff[resultList.size()];
    Iterator<CFAstProjectBaseBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleProjectBaseTable.java

public CFAstProjectBaseBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long TenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from   w  w  w . j  a  v  a2 s .co  m*/

    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    CallableStatement stmtReadClassCodeByTenantIdx = null;
    try {
        Connection cnx = schema.getCnx();
        stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_bprjdefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId);
        stmtReadClassCodeByTenantIdx.execute();
        resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    classCode = resultSet.getString(1);
                    classCodeList.add(classCode);
                }
            } catch (SQLException e) {
            }
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadClassCodeByTenantIdx != null) {
            try {
                stmtReadClassCodeByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadClassCodeByTenantIdx = null;
        }
    }
    List<CFAstProjectBaseBuff> resultList = new LinkedList<CFAstProjectBaseBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("BPRJ")) {
            CFAstProjectBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("RPRJ")) {
            CFAstRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TPRJ")) {
            CFAstTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SPRJ")) {
            CFAstSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("VERN")) {
            CFAstVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MJVR")) {
            CFAstMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MNVR")) {
            CFAstMinorVersionBuff[] subList = schema.getTableMinorVersion().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 + "\"");
        }
    }
    int idx = 0;
    CFAstProjectBaseBuff[] retBuff = new CFAstProjectBaseBuff[resultList.size()];
    Iterator<CFAstProjectBaseBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleProjectBaseTable.java

public CFFswProjectBaseBuff[] readDerivedByTenantIdx(CFFswAuthorization Authorization, long TenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w  ww.  j ava2 s.c om*/

    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    CallableStatement stmtReadClassCodeByTenantIdx = null;
    try {
        Connection cnx = schema.getCnx();
        stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_bprjdefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId);
        stmtReadClassCodeByTenantIdx.execute();
        resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    classCode = resultSet.getString(1);
                    classCodeList.add(classCode);
                }
            } catch (SQLException e) {
            }
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadClassCodeByTenantIdx != null) {
            try {
                stmtReadClassCodeByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadClassCodeByTenantIdx = null;
        }
    }
    List<CFFswProjectBaseBuff> resultList = new LinkedList<CFFswProjectBaseBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("BPRJ")) {
            CFFswProjectBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("RPRJ")) {
            CFFswRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TPRJ")) {
            CFFswTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SPRJ")) {
            CFFswSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("VERN")) {
            CFFswVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MJVR")) {
            CFFswMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MNVR")) {
            CFFswMinorVersionBuff[] subList = schema.getTableMinorVersion().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 + "\"");
        }
    }
    int idx = 0;
    CFFswProjectBaseBuff[] retBuff = new CFFswProjectBaseBuff[resultList.size()];
    Iterator<CFFswProjectBaseBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetOracle.CFInternetOracleProjectBaseTable.java

public CFInternetProjectBaseBuff[] readDerivedByTenantIdx(CFInternetAuthorization Authorization,
        long TenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//  www .  j a v a 2s .c om

    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    CallableStatement stmtReadClassCodeByTenantIdx = null;
    try {
        Connection cnx = schema.getCnx();
        stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_bprjdefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId);
        stmtReadClassCodeByTenantIdx.execute();
        resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    classCode = resultSet.getString(1);
                    classCodeList.add(classCode);
                }
            } catch (SQLException e) {
            }
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadClassCodeByTenantIdx != null) {
            try {
                stmtReadClassCodeByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadClassCodeByTenantIdx = null;
        }
    }
    List<CFInternetProjectBaseBuff> resultList = new LinkedList<CFInternetProjectBaseBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("BPRJ")) {
            CFInternetProjectBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("RPRJ")) {
            CFInternetRealProjectBuff[] subList = schema.getTableRealProject()
                    .readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TPRJ")) {
            CFInternetTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SPRJ")) {
            CFInternetSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("VERN")) {
            CFInternetVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization,
                    TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MJVR")) {
            CFInternetMajorVersionBuff[] subList = schema.getTableMajorVersion()
                    .readBuffByTenantIdx(Authorization, TenantId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MNVR")) {
            CFInternetMinorVersionBuff[] subList = schema.getTableMinorVersion()
                    .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 + "\"");
        }
    }
    int idx = 0;
    CFInternetProjectBaseBuff[] retBuff = new CFInternetProjectBaseBuff[resultList.size()];
    Iterator<CFInternetProjectBaseBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskMySql.CFAsteriskMySqlConfigurationFileTable.java

public CFAsteriskConfigurationFileBuff[] readDerivedByClusterIdx(CFSecurityAuthorization Authorization,
        long ClusterId) {
    final String S_ProcName = "readDerivedByClusterIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from  w ww  .  ja v a 2s  .c  om*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName()
                + ".sp_read_conf_file_cc_by_clusteridx( ?, ?, ?, ?, ?" + ", " + "?" + " )";
        if (stmtReadClassCodeByClusterIdx == null) {
            stmtReadClassCodeByClusterIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadClassCodeByClusterIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByClusterIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadClassCodeByClusterIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadClassCodeByClusterIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadClassCodeByClusterIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadClassCodeByClusterIdx.setLong(argIdx++, ClusterId);
        try {
            resultSet = stmtReadClassCodeByClusterIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        while ((resultSet != null) && resultSet.next()) {
            classCode = resultSet.getString(1);
            classCodeList.add(classCode);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
    List<CFAsteriskConfigurationFileBuff> resultList = new LinkedList<CFAsteriskConfigurationFileBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("CONF")) {
            CFAsteriskConfigurationFileBuff[] subList = readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CASC")) {
            CFAsteriskAsteriskConfBuff[] subList = schema.getTableAsteriskConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CSIP")) {
            CFAsteriskSipConfBuff[] subList = schema.getTableSipConf().readBuffByClusterIdx(Authorization,
                    ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CEXT")) {
            CFAsteriskExtensionsConfBuff[] subList = schema.getTableExtensionsConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CVOM")) {
            CFAsteriskVoicemailConfBuff[] subList = schema.getTableVoicemailConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("CECC")) {
            CFAsteriskExtConfigConfBuff[] subList = schema.getTableExtConfigConf()
                    .readBuffByClusterIdx(Authorization, ClusterId);
            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 + "\"");
        }
    }
    int idx = 0;
    CFAsteriskConfigurationFileBuff[] retBuff = new CFAsteriskConfigurationFileBuff[resultList.size()];
    Iterator<CFAsteriskConfigurationFileBuff> iter = resultList.iterator();
    while (iter.hasNext()) {
        retBuff[idx++] = iter.next();
    }
    return (retBuff);

}