Example usage for java.sql CallableStatement setNull

List of usage examples for java.sql CallableStatement setNull

Introduction

In this page you can find the example usage for java.sql CallableStatement setNull.

Prototype

void setNull(String parameterName, int sqlType) throws SQLException;

Source Link

Document

Sets the designated parameter to SQL NULL.

Usage

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

public CFInternetSecSessionBuff[] readBuffBySecDevIdx(CFInternetAuthorization Authorization, UUID SecUserId,
        String SecDevName) {// ww w. j a  v  a  2s. c  o  m
    final String S_ProcName = "readBuffBySecDevIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffBySecDevIdx = null;
    List<CFInternetSecSessionBuff> buffList = new LinkedList<CFInternetSecSessionBuff>();
    try {
        stmtReadBuffBySecDevIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secsessbysecdevidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffBySecDevIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffBySecDevIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffBySecDevIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffBySecDevIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffBySecDevIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffBySecDevIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffBySecDevIdx.setString(argIdx++, SecUserId.toString());
        if (SecDevName != null) {
            stmtReadBuffBySecDevIdx.setString(argIdx++, SecDevName);
        } else {
            stmtReadBuffBySecDevIdx.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtReadBuffBySecDevIdx.execute();
        resultSet = (ResultSet) stmtReadBuffBySecDevIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFInternetSecSessionBuff buff = unpackSecSessionResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFInternetSecSessionBuff[] retBuff = new CFInternetSecSessionBuff[buffList.size()];
        Iterator<CFInternetSecSessionBuff> iter = buffList.iterator();
        while (iter.hasNext()) {
            retBuff[idx++] = iter.next();
        }
        return (retBuff);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffBySecDevIdx != null) {
            try {
                stmtReadBuffBySecDevIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffBySecDevIdx = null;
        }
    }
}

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

public CFInternetSecSessionBuff[] readBuffByFinishIdx(CFInternetAuthorization Authorization, UUID SecUserId,
        Calendar Finish) {//from   ww w  .  j a  v a  2  s  .  c  om
    final String S_ProcName = "readBuffByFinishIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByFinishIdx = null;
    List<CFInternetSecSessionBuff> buffList = new LinkedList<CFInternetSecSessionBuff>();
    try {
        stmtReadBuffByFinishIdx = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".rd_secsessbyfinishidx( ?, ?, ?, ?, ?, ?" + ", "
                        + "?" + ", " + "to_timestamp( ?, 'YYYY-MM-DD HH24:MI:SS' )" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByFinishIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByFinishIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByFinishIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByFinishIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByFinishIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByFinishIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByFinishIdx.setString(argIdx++, SecUserId.toString());
        if (Finish != null) {
            stmtReadBuffByFinishIdx.setString(argIdx++, CFInternetOracleSchema.getTimestampString(Finish));
        } else {
            stmtReadBuffByFinishIdx.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtReadBuffByFinishIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByFinishIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFInternetSecSessionBuff buff = unpackSecSessionResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFInternetSecSessionBuff[] retBuff = new CFInternetSecSessionBuff[buffList.size()];
        Iterator<CFInternetSecSessionBuff> iter = buffList.iterator();
        while (iter.hasNext()) {
            retBuff[idx++] = iter.next();
        }
        return (retBuff);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByFinishIdx != null) {
            try {
                stmtReadBuffByFinishIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByFinishIdx = null;
        }
    }
}

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

public CFInternetSecSessionBuff[] readBuffBySecProxyIdx(CFInternetAuthorization Authorization,
        UUID SecProxyId) {// ww  w  .j a  v a2 s.  c o m
    final String S_ProcName = "readBuffBySecProxyIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffBySecProxyIdx = null;
    List<CFInternetSecSessionBuff> buffList = new LinkedList<CFInternetSecSessionBuff>();
    try {
        stmtReadBuffBySecProxyIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secsessbysecproxyidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffBySecProxyIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffBySecProxyIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffBySecProxyIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffBySecProxyIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffBySecProxyIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffBySecProxyIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (SecProxyId != null) {
            stmtReadBuffBySecProxyIdx.setString(argIdx++, SecProxyId.toString());
        } else {
            stmtReadBuffBySecProxyIdx.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtReadBuffBySecProxyIdx.execute();
        resultSet = (ResultSet) stmtReadBuffBySecProxyIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFInternetSecSessionBuff buff = unpackSecSessionResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFInternetSecSessionBuff[] retBuff = new CFInternetSecSessionBuff[buffList.size()];
        Iterator<CFInternetSecSessionBuff> iter = buffList.iterator();
        while (iter.hasNext()) {
            retBuff[idx++] = iter.next();
        }
        return (retBuff);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffBySecProxyIdx != null) {
            try {
                stmtReadBuffBySecProxyIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffBySecProxyIdx = null;
        }
    }
}

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

public void updateSecSession(CFInternetAuthorization Authorization, CFInternetSecSessionBuff Buff) {
    final String S_ProcName = "updateSecSession";
    ResultSet resultSet = null;/*from   w  w w  .  j  a v  a2s.com*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFInternetSecSessionBuff> buffList = new LinkedList<CFInternetSecSessionBuff>();
    try {
        UUID SecSessionId = Buff.getRequiredSecSessionId();
        UUID SecUserId = Buff.getRequiredSecUserId();
        String SecDevName = Buff.getOptionalSecDevName();
        Calendar Start = Buff.getRequiredStart();
        Calendar Finish = Buff.getOptionalFinish();
        UUID SecProxyId = Buff.getOptionalSecProxyId();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".upd_secsess( ?, ?, ?, ?, ?, ?, ?" + ", " + "?"
                        + ", " + "?" + ", " + "?" + ", " + "to_timestamp( ?, 'YYYY-MM-DD HH24:MI:SS' )" + ", "
                        + "to_timestamp( ?, 'YYYY-MM-DD HH24:MI:SS' )" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "SESS");
        stmtUpdateByPKey.setString(argIdx++, SecSessionId.toString());
        stmtUpdateByPKey.setString(argIdx++, SecUserId.toString());
        if (SecDevName != null) {
            stmtUpdateByPKey.setString(argIdx++, SecDevName);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setString(argIdx++, CFInternetOracleSchema.getTimestampString(Start));
        if (Finish != null) {
            stmtUpdateByPKey.setString(argIdx++, CFInternetOracleSchema.getTimestampString(Finish));
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (SecProxyId != null) {
            stmtUpdateByPKey.setString(argIdx++, SecProxyId.toString());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFInternetSecSessionBuff updatedBuff = unpackSecSessionResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredSecUserId(updatedBuff.getRequiredSecUserId());
                    Buff.setOptionalSecDevName(updatedBuff.getOptionalSecDevName());
                    Buff.setRequiredStart(updatedBuff.getRequiredStart());
                    Buff.setOptionalFinish(updatedBuff.getOptionalFinish());
                    Buff.setOptionalSecProxyId(updatedBuff.getOptionalSecProxyId());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_secsess() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_secsess() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public void createSecUser(CFInternetAuthorization Authorization, CFInternetSecUserBuff Buff) {
    final String S_ProcName = "createSecUser";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }// ww  w  .j av  a2s  .c om
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        String EMailAddress = Buff.getRequiredEMailAddress();
        UUID DefaultDevSecUserId = Buff.getOptionalDefaultDevSecUserId();
        String DefaultDevName = Buff.getOptionalDefaultDevName();
        String HtmlPwHexHash = Buff.getRequiredHtmlPwHexHash();
        String HtmlResetPwHexHash = Buff.getOptionalHtmlResetPwHexHash();
        String AppPwHexHash = Buff.getOptionalAppPwHexHash();
        String AppResetPwHexHash = Buff.getOptionalAppResetPwHexHash();
        String MailtoEMailAddress = Buff.getRequiredMailtoEMailAddress();

        UUID SecUserId = UUID.randomUUID();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_secuser( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, "SUSR");
        stmtCreateByPKey.setString(argIdx++, SecUserId.toString());
        stmtCreateByPKey.setString(argIdx++, EMailAddress);
        if (DefaultDevSecUserId != null) {
            stmtCreateByPKey.setString(argIdx++, DefaultDevSecUserId.toString());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (DefaultDevName != null) {
            stmtCreateByPKey.setString(argIdx++, DefaultDevName);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setString(argIdx++, HtmlPwHexHash);
        if (HtmlResetPwHexHash != null) {
            stmtCreateByPKey.setString(argIdx++, HtmlResetPwHexHash);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AppPwHexHash != null) {
            stmtCreateByPKey.setString(argIdx++, AppPwHexHash);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AppResetPwHexHash != null) {
            stmtCreateByPKey.setString(argIdx++, AppResetPwHexHash);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setString(argIdx++, MailtoEMailAddress);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_secuser() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFInternetSecUserBuff createdBuff = unpackSecUserResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredSecUserId(createdBuff.getRequiredSecUserId());
                Buff.setRequiredEMailAddress(createdBuff.getRequiredEMailAddress());
                Buff.setOptionalDefaultDevSecUserId(createdBuff.getOptionalDefaultDevSecUserId());
                Buff.setOptionalDefaultDevName(createdBuff.getOptionalDefaultDevName());
                Buff.setRequiredHtmlPwHexHash(createdBuff.getRequiredHtmlPwHexHash());
                Buff.setOptionalHtmlResetPwHexHash(createdBuff.getOptionalHtmlResetPwHexHash());
                Buff.setOptionalAppPwHexHash(createdBuff.getOptionalAppPwHexHash());
                Buff.setOptionalAppResetPwHexHash(createdBuff.getOptionalAppResetPwHexHash());
                Buff.setRequiredMailtoEMailAddress(createdBuff.getRequiredMailtoEMailAddress());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
                Buff.setCreatedByUserId(createdBuff.getCreatedByUserId());
                Buff.setCreatedAt(createdBuff.getCreatedAt());
                Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId());
                Buff.setUpdatedAt(createdBuff.getUpdatedAt());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_secuser() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}

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

public CFInternetSecUserBuff readBuffByDefDevIdx(CFInternetAuthorization Authorization,
        UUID DefaultDevSecUserId, String DefaultDevName) {
    final String S_ProcName = "readBuffByDefDevIdx";
    ResultSet resultSet = null;// w w  w  . j  a  v a  2s  . co m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByDefDevIdx = null;
    try {
        stmtReadBuffByDefDevIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secuserbydefdevidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByDefDevIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByDefDevIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByDefDevIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByDefDevIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByDefDevIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByDefDevIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (DefaultDevSecUserId != null) {
            stmtReadBuffByDefDevIdx.setString(argIdx++, DefaultDevSecUserId.toString());
        } else {
            stmtReadBuffByDefDevIdx.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (DefaultDevName != null) {
            stmtReadBuffByDefDevIdx.setString(argIdx++, DefaultDevName);
        } else {
            stmtReadBuffByDefDevIdx.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtReadBuffByDefDevIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByDefDevIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetSecUserBuff buff = unpackSecUserResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByDefDevIdx != null) {
            try {
                stmtReadBuffByDefDevIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByDefDevIdx = null;
        }
    }
}

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

public void updateSecUser(CFInternetAuthorization Authorization, CFInternetSecUserBuff Buff) {
    final String S_ProcName = "updateSecUser";
    ResultSet resultSet = null;/*from w ww . ja  va  2  s. c  om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFInternetSecUserBuff> buffList = new LinkedList<CFInternetSecUserBuff>();
    try {
        UUID SecUserId = Buff.getRequiredSecUserId();
        String EMailAddress = Buff.getRequiredEMailAddress();
        UUID DefaultDevSecUserId = Buff.getOptionalDefaultDevSecUserId();
        String DefaultDevName = Buff.getOptionalDefaultDevName();
        String HtmlPwHexHash = Buff.getRequiredHtmlPwHexHash();
        String HtmlResetPwHexHash = Buff.getOptionalHtmlResetPwHexHash();
        String AppPwHexHash = Buff.getOptionalAppPwHexHash();
        String AppResetPwHexHash = Buff.getOptionalAppResetPwHexHash();
        String MailtoEMailAddress = Buff.getRequiredMailtoEMailAddress();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".upd_secuser( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "SUSR");
        stmtUpdateByPKey.setString(argIdx++, SecUserId.toString());
        stmtUpdateByPKey.setString(argIdx++, EMailAddress);
        if (DefaultDevSecUserId != null) {
            stmtUpdateByPKey.setString(argIdx++, DefaultDevSecUserId.toString());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (DefaultDevName != null) {
            stmtUpdateByPKey.setString(argIdx++, DefaultDevName);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setString(argIdx++, HtmlPwHexHash);
        if (HtmlResetPwHexHash != null) {
            stmtUpdateByPKey.setString(argIdx++, HtmlResetPwHexHash);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AppPwHexHash != null) {
            stmtUpdateByPKey.setString(argIdx++, AppPwHexHash);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AppResetPwHexHash != null) {
            stmtUpdateByPKey.setString(argIdx++, AppResetPwHexHash);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setString(argIdx++, MailtoEMailAddress);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFInternetSecUserBuff updatedBuff = unpackSecUserResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredEMailAddress(updatedBuff.getRequiredEMailAddress());
                    Buff.setOptionalDefaultDevSecUserId(updatedBuff.getOptionalDefaultDevSecUserId());
                    Buff.setOptionalDefaultDevName(updatedBuff.getOptionalDefaultDevName());
                    Buff.setRequiredHtmlPwHexHash(updatedBuff.getRequiredHtmlPwHexHash());
                    Buff.setOptionalHtmlResetPwHexHash(updatedBuff.getOptionalHtmlResetPwHexHash());
                    Buff.setOptionalAppPwHexHash(updatedBuff.getOptionalAppPwHexHash());
                    Buff.setOptionalAppResetPwHexHash(updatedBuff.getOptionalAppResetPwHexHash());
                    Buff.setRequiredMailtoEMailAddress(updatedBuff.getRequiredMailtoEMailAddress());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_secuser() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_secuser() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public void createSubProject(CFInternetAuthorization Authorization, CFInternetSubProjectBuff Buff) {
    final String S_ProcName = "createSubProject";
    ResultSet resultSet = null;/* w  w  w  . j  av a 2 s  .  c o  m*/
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        long TenantId = Buff.getRequiredTenantId();
        String Description = Buff.getOptionalDescription();
        long ParentProjectId = Buff.getRequiredParentProjectId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".crt_sprjdef( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        stmtCreateByPKey.setLong(argIdx++, TenantId);
        if (Description != null) {
            stmtCreateByPKey.setString(argIdx++, Description);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setLong(argIdx++, ParentProjectId);
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_sprjdef() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFInternetSubProjectBuff createdBuff = unpackSubProjectResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredTenantId(createdBuff.getRequiredTenantId());
                Buff.setRequiredId(createdBuff.getRequiredId());
                Buff.setOptionalDescription(createdBuff.getOptionalDescription());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
                Buff.setCreatedByUserId(createdBuff.getCreatedByUserId());
                Buff.setCreatedAt(createdBuff.getCreatedAt());
                Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId());
                Buff.setUpdatedAt(createdBuff.getUpdatedAt());
                Buff.setRequiredParentProjectId(createdBuff.getRequiredParentProjectId());
                Buff.setRequiredName(createdBuff.getRequiredName());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_sprjdef() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}

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

public void updateSubProject(CFInternetAuthorization Authorization, CFInternetSubProjectBuff Buff) {
    final String S_ProcName = "updateSubProject";
    ResultSet resultSet = null;//from  w w  w. j  ava2s.  c  o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFInternetSubProjectBuff> buffList = new LinkedList<CFInternetSubProjectBuff>();
    try {
        String ClassCode = Buff.getClassCode();
        long TenantId = Buff.getRequiredTenantId();
        long Id = Buff.getRequiredId();
        String Description = Buff.getOptionalDescription();
        long ParentProjectId = Buff.getRequiredParentProjectId();
        String Name = Buff.getRequiredName();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_sprjdef( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, ClassCode);
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, Id);
        if (Description != null) {
            stmtUpdateByPKey.setString(argIdx++, Description);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setLong(argIdx++, ParentProjectId);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFInternetSubProjectBuff updatedBuff = unpackSubProjectResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setOptionalDescription(updatedBuff.getOptionalDescription());
                    Buff.setRequiredParentProjectId(updatedBuff.getRequiredParentProjectId());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_sprjdef() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_sprjdef() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public void createTopDomain(CFInternetAuthorization Authorization, CFInternetTopDomainBuff Buff) {
    final String S_ProcName = "createTopDomain";
    ResultSet resultSet = null;/*w  w  w.  j a  va2  s  . c o m*/
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        long TenantId = Buff.getRequiredTenantId();
        String Description = Buff.getOptionalDescription();
        long TldId = Buff.getRequiredTldId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".crt_tdomdef( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, ClassCode);
        stmtCreateByPKey.setLong(argIdx++, TenantId);
        if (Description != null) {
            stmtCreateByPKey.setString(argIdx++, Description);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setLong(argIdx++, TldId);
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_tdomdef() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFInternetTopDomainBuff createdBuff = unpackTopDomainResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredTenantId(createdBuff.getRequiredTenantId());
                Buff.setRequiredId(createdBuff.getRequiredId());
                Buff.setOptionalDescription(createdBuff.getOptionalDescription());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
                Buff.setCreatedByUserId(createdBuff.getCreatedByUserId());
                Buff.setCreatedAt(createdBuff.getCreatedAt());
                Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId());
                Buff.setUpdatedAt(createdBuff.getUpdatedAt());
                Buff.setRequiredTldId(createdBuff.getRequiredTldId());
                Buff.setRequiredName(createdBuff.getRequiredName());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_tdomdef() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}