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

public void createSecUser(CFSecurityAuthorization Authorization, CFSecuritySecUserBuff Buff) {
    final String S_ProcName = "createSecUser";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from w  ww. ja v  a  2s.  c om
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        String LoginId = Buff.getRequiredLoginId();
        String EMailAddress = Buff.getRequiredEMailAddress();
        UUID EMailConfirmationUuid = Buff.getOptionalEMailConfirmationUuid();
        UUID DefaultDevSecUserId = Buff.getOptionalDefaultDevSecUserId();
        String DefaultDevName = Buff.getOptionalDefaultDevName();
        String PasswordHash = Buff.getRequiredPasswordHash();
        UUID PasswordResetUuid = Buff.getOptionalPasswordResetUuid();

        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++, LoginId);
        stmtCreateByPKey.setString(argIdx++, EMailAddress);
        if (EMailConfirmationUuid != null) {
            stmtCreateByPKey.setString(argIdx++, EMailConfirmationUuid.toString());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        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++, PasswordHash);
        if (PasswordResetUuid != null) {
            stmtCreateByPKey.setString(argIdx++, PasswordResetUuid.toString());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        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()) {
                CFSecuritySecUserBuff 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.setRequiredLoginId(createdBuff.getRequiredLoginId());
                Buff.setRequiredEMailAddress(createdBuff.getRequiredEMailAddress());
                Buff.setOptionalEMailConfirmationUuid(createdBuff.getOptionalEMailConfirmationUuid());
                Buff.setOptionalDefaultDevSecUserId(createdBuff.getOptionalDefaultDevSecUserId());
                Buff.setOptionalDefaultDevName(createdBuff.getOptionalDefaultDevName());
                Buff.setRequiredPasswordHash(createdBuff.getRequiredPasswordHash());
                Buff.setOptionalPasswordResetUuid(createdBuff.getOptionalPasswordResetUuid());
                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.cfasterisk.v2_1.CFAstOracle.CFAstOracleSecSessionTable.java

public void updateSecSession(CFAstAuthorization Authorization, CFAstSecSessionBuff Buff) {
    final String S_ProcName = "updateSecSession";
    ResultSet resultSet = null;/* w  ww . j ava2s.  c  om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAstSecSessionBuff> buffList = new LinkedList<CFAstSecSessionBuff>();
    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++, CFAstOracleSchema.getTimestampString(Start));
        if (Finish != null) {
            stmtUpdateByPKey.setString(argIdx++, CFAstOracleSchema.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()) {
                    CFAstSecSessionBuff 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.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSecSessionTable.java

public void updateSecSession(CFSecurityAuthorization Authorization, CFSecuritySecSessionBuff Buff) {
    final String S_ProcName = "updateSecSession";
    ResultSet resultSet = null;/*from   w w  w.j  a  va 2 s  . c o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFSecuritySecSessionBuff> buffList = new LinkedList<CFSecuritySecSessionBuff>();
    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++, CFAsteriskOracleSchema.getTimestampString(Start));
        if (Finish != null) {
            stmtUpdateByPKey.setString(argIdx++, CFAsteriskOracleSchema.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()) {
                    CFSecuritySecSessionBuff 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.cfasterisk.v2_2.CFAstOracle.CFAstOracleSecUserTable.java

public void createSecUser(CFAstAuthorization Authorization, CFAstSecUserBuff Buff) {
    final String S_ProcName = "createSecUser";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from ww w  .  j av a 2s.  co  m*/
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        String LoginId = Buff.getRequiredLoginId();
        String EMailAddress = Buff.getRequiredEMailAddress();
        UUID EMailConfirmationUuid = Buff.getOptionalEMailConfirmationUuid();
        UUID DefaultDevSecUserId = Buff.getOptionalDefaultDevSecUserId();
        String DefaultDevName = Buff.getOptionalDefaultDevName();
        String PasswordHash = Buff.getRequiredPasswordHash();
        UUID PasswordResetUuid = Buff.getOptionalPasswordResetUuid();

        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++, LoginId);
        stmtCreateByPKey.setString(argIdx++, EMailAddress);
        if (EMailConfirmationUuid != null) {
            stmtCreateByPKey.setString(argIdx++, EMailConfirmationUuid.toString());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        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++, PasswordHash);
        if (PasswordResetUuid != null) {
            stmtCreateByPKey.setString(argIdx++, PasswordResetUuid.toString());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        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()) {
                CFAstSecUserBuff 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.setRequiredLoginId(createdBuff.getRequiredLoginId());
                Buff.setRequiredEMailAddress(createdBuff.getRequiredEMailAddress());
                Buff.setOptionalEMailConfirmationUuid(createdBuff.getOptionalEMailConfirmationUuid());
                Buff.setOptionalDefaultDevSecUserId(createdBuff.getOptionalDefaultDevSecUserId());
                Buff.setOptionalDefaultDevName(createdBuff.getOptionalDefaultDevName());
                Buff.setRequiredPasswordHash(createdBuff.getRequiredPasswordHash());
                Buff.setOptionalPasswordResetUuid(createdBuff.getOptionalPasswordResetUuid());
                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.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSecUserTable.java

public void updateSecUser(CFSecurityAuthorization Authorization, CFSecuritySecUserBuff Buff) {
    final String S_ProcName = "updateSecUser";
    ResultSet resultSet = null;/*from   w w  w  .  java2 s  .c  o  m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFSecuritySecUserBuff> buffList = new LinkedList<CFSecuritySecUserBuff>();
    try {
        UUID SecUserId = Buff.getRequiredSecUserId();
        String LoginId = Buff.getRequiredLoginId();
        String EMailAddress = Buff.getRequiredEMailAddress();
        UUID EMailConfirmationUuid = Buff.getOptionalEMailConfirmationUuid();
        UUID DefaultDevSecUserId = Buff.getOptionalDefaultDevSecUserId();
        String DefaultDevName = Buff.getOptionalDefaultDevName();
        String PasswordHash = Buff.getRequiredPasswordHash();
        UUID PasswordResetUuid = Buff.getOptionalPasswordResetUuid();
        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++, LoginId);
        stmtUpdateByPKey.setString(argIdx++, EMailAddress);
        if (EMailConfirmationUuid != null) {
            stmtUpdateByPKey.setString(argIdx++, EMailConfirmationUuid.toString());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        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++, PasswordHash);
        if (PasswordResetUuid != null) {
            stmtUpdateByPKey.setString(argIdx++, PasswordResetUuid.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()) {
                    CFSecuritySecUserBuff 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.setRequiredLoginId(updatedBuff.getRequiredLoginId());
                    Buff.setRequiredEMailAddress(updatedBuff.getRequiredEMailAddress());
                    Buff.setOptionalEMailConfirmationUuid(updatedBuff.getOptionalEMailConfirmationUuid());
                    Buff.setOptionalDefaultDevSecUserId(updatedBuff.getOptionalDefaultDevSecUserId());
                    Buff.setOptionalDefaultDevName(updatedBuff.getOptionalDefaultDevName());
                    Buff.setRequiredPasswordHash(updatedBuff.getRequiredPasswordHash());
                    Buff.setOptionalPasswordResetUuid(updatedBuff.getOptionalPasswordResetUuid());
                    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.cfasterisk.v2_2.CFAstOracle.CFAstOracleSecUserTable.java

public void updateSecUser(CFAstAuthorization Authorization, CFAstSecUserBuff Buff) {
    final String S_ProcName = "updateSecUser";
    ResultSet resultSet = null;/*from w w w . j ava2 s. c om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAstSecUserBuff> buffList = new LinkedList<CFAstSecUserBuff>();
    try {
        UUID SecUserId = Buff.getRequiredSecUserId();
        String LoginId = Buff.getRequiredLoginId();
        String EMailAddress = Buff.getRequiredEMailAddress();
        UUID EMailConfirmationUuid = Buff.getOptionalEMailConfirmationUuid();
        UUID DefaultDevSecUserId = Buff.getOptionalDefaultDevSecUserId();
        String DefaultDevName = Buff.getOptionalDefaultDevName();
        String PasswordHash = Buff.getRequiredPasswordHash();
        UUID PasswordResetUuid = Buff.getOptionalPasswordResetUuid();
        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++, LoginId);
        stmtUpdateByPKey.setString(argIdx++, EMailAddress);
        if (EMailConfirmationUuid != null) {
            stmtUpdateByPKey.setString(argIdx++, EMailConfirmationUuid.toString());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        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++, PasswordHash);
        if (PasswordResetUuid != null) {
            stmtUpdateByPKey.setString(argIdx++, PasswordResetUuid.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()) {
                    CFAstSecUserBuff 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.setRequiredLoginId(updatedBuff.getRequiredLoginId());
                    Buff.setRequiredEMailAddress(updatedBuff.getRequiredEMailAddress());
                    Buff.setOptionalEMailConfirmationUuid(updatedBuff.getOptionalEMailConfirmationUuid());
                    Buff.setOptionalDefaultDevSecUserId(updatedBuff.getOptionalDefaultDevSecUserId());
                    Buff.setOptionalDefaultDevName(updatedBuff.getOptionalDefaultDevName());
                    Buff.setRequiredPasswordHash(updatedBuff.getRequiredPasswordHash());
                    Buff.setOptionalPasswordResetUuid(updatedBuff.getOptionalPasswordResetUuid());
                    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.cfacc.v2_0.CFAccOracle.CFAccOracleAccountTable.java

public void updateAccount(CFAccAuthorization Authorization, CFAccAccountBuff Buff) {
    final String S_ProcName = "updateAccount";
    ResultSet resultSet = null;//from ww  w .ja  v a2  s .co m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAccAccountBuff> buffList = new LinkedList<CFAccAccountBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long Id = Buff.getRequiredId();
        String AccountCode = Buff.getRequiredAccountCode();
        String Description = Buff.getRequiredDescription();
        short CurrencyId = Buff.getRequiredCurrencyId();
        BigDecimal Balance = Buff.getRequiredBalance();
        Long RollupTenantId = Buff.getOptionalRollupTenantId();
        Long RollupAccountId = Buff.getOptionalRollupAccountId();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".upd_acct( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "ACCT");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, AccountCode);
        stmtUpdateByPKey.setString(argIdx++, Description);
        stmtUpdateByPKey.setShort(argIdx++, CurrencyId);
        stmtUpdateByPKey.setBigDecimal(argIdx++, Balance);
        if (RollupTenantId != null) {
            stmtUpdateByPKey.setLong(argIdx++, RollupTenantId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (RollupAccountId != null) {
            stmtUpdateByPKey.setLong(argIdx++, RollupAccountId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFAccAccountBuff updatedBuff = unpackAccountResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredAccountCode(updatedBuff.getRequiredAccountCode());
                    Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
                    Buff.setRequiredCurrencyId(updatedBuff.getRequiredCurrencyId());
                    Buff.setRequiredBalance(updatedBuff.getRequiredBalance());
                    Buff.setOptionalRollupTenantId(updatedBuff.getOptionalRollupTenantId());
                    Buff.setOptionalRollupAccountId(updatedBuff.getOptionalRollupAccountId());
                    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_acct() 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_acct() 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.cfacc.v2_0.CFAccOracle.CFAccOracleContactTable.java

public void updateContact(CFAccAuthorization Authorization, CFAccContactBuff Buff) {
    final String S_ProcName = "updateContact";
    ResultSet resultSet = null;//ww  w  .j  av a  2  s  . c om
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAccContactBuff> buffList = new LinkedList<CFAccContactBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long ContactId = Buff.getRequiredContactId();
        long ContactListId = Buff.getRequiredContactListId();
        Short ISOTimezoneId = Buff.getOptionalISOTimezoneId();
        String FullName = Buff.getRequiredFullName();
        String LastName = Buff.getOptionalLastName();
        String FirstName = Buff.getOptionalFirstName();
        String Custom = Buff.getOptionalCustom();
        String Custom2 = Buff.getOptionalCustom2();
        String Custom3 = Buff.getOptionalCustom3();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".upd_contact( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "CTC");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, ContactId);
        stmtUpdateByPKey.setLong(argIdx++, ContactListId);
        if (ISOTimezoneId != null) {
            stmtUpdateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        stmtUpdateByPKey.setString(argIdx++, FullName);
        if (LastName != null) {
            stmtUpdateByPKey.setString(argIdx++, LastName);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (FirstName != null) {
            stmtUpdateByPKey.setString(argIdx++, FirstName);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (Custom != null) {
            stmtUpdateByPKey.setString(argIdx++, Custom);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (Custom2 != null) {
            stmtUpdateByPKey.setString(argIdx++, Custom2);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (Custom3 != null) {
            stmtUpdateByPKey.setString(argIdx++, Custom3);
        } 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()) {
                    CFAccContactBuff updatedBuff = unpackContactResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredContactListId(updatedBuff.getRequiredContactListId());
                    Buff.setOptionalISOTimezoneId(updatedBuff.getOptionalISOTimezoneId());
                    Buff.setRequiredFullName(updatedBuff.getRequiredFullName());
                    Buff.setOptionalLastName(updatedBuff.getOptionalLastName());
                    Buff.setOptionalFirstName(updatedBuff.getOptionalFirstName());
                    Buff.setOptionalCustom(updatedBuff.getOptionalCustom());
                    Buff.setOptionalCustom2(updatedBuff.getOptionalCustom2());
                    Buff.setOptionalCustom3(updatedBuff.getOptionalCustom3());
                    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_contact() 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_contact() 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.cfacc.v2_0.CFAccOracle.CFAccOracleAddressTable.java

public void updateAddress(CFAccAuthorization Authorization, CFAccAddressBuff Buff) {
    final String S_ProcName = "updateAddress";
    ResultSet resultSet = null;// w  w  w . j a v a 2 s .  com
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAccAddressBuff> buffList = new LinkedList<CFAccAddressBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long AddressId = Buff.getRequiredAddressId();
        long ContactId = Buff.getRequiredContactId();
        String Description = Buff.getRequiredDescription();
        String AddrLine1 = Buff.getOptionalAddrLine1();
        String AddrLine2 = Buff.getOptionalAddrLine2();
        String City = Buff.getOptionalCity();
        String State = Buff.getOptionalState();
        Short CountryId = Buff.getOptionalCountryId();
        String Zip = Buff.getOptionalZip();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".upd_address( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "ADR");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, AddressId);
        stmtUpdateByPKey.setLong(argIdx++, ContactId);
        stmtUpdateByPKey.setString(argIdx++, Description);
        if (AddrLine1 != null) {
            stmtUpdateByPKey.setString(argIdx++, AddrLine1);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AddrLine2 != null) {
            stmtUpdateByPKey.setString(argIdx++, AddrLine2);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (City != null) {
            stmtUpdateByPKey.setString(argIdx++, City);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (State != null) {
            stmtUpdateByPKey.setString(argIdx++, State);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (CountryId != null) {
            stmtUpdateByPKey.setShort(argIdx++, CountryId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Zip != null) {
            stmtUpdateByPKey.setString(argIdx++, Zip);
        } 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()) {
                    CFAccAddressBuff updatedBuff = unpackAddressResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredContactId(updatedBuff.getRequiredContactId());
                    Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
                    Buff.setOptionalAddrLine1(updatedBuff.getOptionalAddrLine1());
                    Buff.setOptionalAddrLine2(updatedBuff.getOptionalAddrLine2());
                    Buff.setOptionalCity(updatedBuff.getOptionalCity());
                    Buff.setOptionalState(updatedBuff.getOptionalState());
                    Buff.setOptionalCountryId(updatedBuff.getOptionalCountryId());
                    Buff.setOptionalZip(updatedBuff.getOptionalZip());
                    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_address() 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_address() 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.cfacc.v2_0.CFAccOracle.CFAccOracleAccountConfigTable.java

public void createAccountConfig(CFAccAuthorization Authorization, CFAccAccountConfigBuff Buff) {
    final String S_ProcName = "createAccountConfig";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from  ww  w. j  a  v  a 2 s  .c o m*/
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        long TenantId = Buff.getRequiredTenantId();
        short DefaultCurrencyId = Buff.getRequiredDefaultCurrencyId();
        Long CustContactListTenantId = Buff.getOptionalCustContactListTenantId();
        Long CustContactListId = Buff.getOptionalCustContactListId();
        Long EmpContactListTenantId = Buff.getOptionalEmpContactListTenantId();
        Long EmpContactListId = Buff.getOptionalEmpContactListId();
        Long VendContactListTenantId = Buff.getOptionalVendContactListTenantId();
        Long VendContactListId = Buff.getOptionalVendContactListId();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".crt_acct_cfg( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "ACFG");
        stmtCreateByPKey.setLong(argIdx++, TenantId);
        stmtCreateByPKey.setShort(argIdx++, DefaultCurrencyId);
        if (CustContactListTenantId != null) {
            stmtCreateByPKey.setLong(argIdx++, CustContactListTenantId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (CustContactListId != null) {
            stmtCreateByPKey.setLong(argIdx++, CustContactListId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (EmpContactListTenantId != null) {
            stmtCreateByPKey.setLong(argIdx++, EmpContactListTenantId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (EmpContactListId != null) {
            stmtCreateByPKey.setLong(argIdx++, EmpContactListId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (VendContactListTenantId != null) {
            stmtCreateByPKey.setLong(argIdx++, VendContactListTenantId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (VendContactListId != null) {
            stmtCreateByPKey.setLong(argIdx++, VendContactListId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_acct_cfg() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFAccAccountConfigBuff createdBuff = unpackAccountConfigResultSetToBuff(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.setRequiredDefaultCurrencyId(createdBuff.getRequiredDefaultCurrencyId());
                Buff.setOptionalCustContactListTenantId(createdBuff.getOptionalCustContactListTenantId());
                Buff.setOptionalCustContactListId(createdBuff.getOptionalCustContactListId());
                Buff.setOptionalEmpContactListTenantId(createdBuff.getOptionalEmpContactListTenantId());
                Buff.setOptionalEmpContactListId(createdBuff.getOptionalEmpContactListId());
                Buff.setOptionalVendContactListTenantId(createdBuff.getOptionalVendContactListTenantId());
                Buff.setOptionalVendContactListId(createdBuff.getOptionalVendContactListId());
                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_acct_cfg() 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;
        }
    }
}