public void deleteAuditAction( CFSecurityAuthorization Authorization, CFSecurityAuditActionBuff Buff) { final String S_ProcName = "deleteAuditAction"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); ICFSecuritySchema.AuditActionEnum AuditActionId = Buff.getRequiredAuditActionId(); final String sql = "CALL sp_delete_auditaction( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByPKey == null) { stmtDeleteByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setShort(argIdx++, (short) AuditActionId.ordinal()); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; resultSet = stmtDeleteByPKey.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } else { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Expected 1 record result set to be returned by delete, not 0 rows"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
public CFSecurityAuditActionBuff lockBuff( CFSecurityAuthorization Authorization, CFSecurityAuditActionPKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); ICFSecuritySchema.AuditActionEnum AuditActionId = PKey.getRequiredAuditActionId(); final String sql = "CALL sp_lock_auditaction( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtLockBuffByPKey == null) { stmtLockBuffByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtLockBuffByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtLockBuffByPKey.setShort(argIdx++, (short) AuditActionId.ordinal()); resultSet = stmtLockBuffByPKey.executeQuery(); if (resultSet.next()) { CFSecurityAuditActionBuff buff = unpackAuditActionResultSetToBuff(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) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
public void deleteAuditAction( CFSecurityAuthorization Authorization, CFSecurityAuditActionBuff Buff) { final String S_ProcName = "deleteAuditAction"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try { ICFSecuritySchema.AuditActionEnum AuditActionId = Buff.getRequiredAuditActionId(); stmtDeleteByPKey = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".dl_auditaction( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByPKey.setShort(argIdx++, (short) AuditActionId.ordinal()); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; stmtDeleteByPKey.execute(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtDeleteByPKey != null) { try { stmtDeleteByPKey.close(); } catch (SQLException e) { } stmtDeleteByPKey = null; } } }
public void deleteAuditActionByIdIdx( CFSecurityAuthorization Authorization, ICFSecuritySchema.AuditActionEnum argAuditActionId) { final String S_ProcName = "deleteAuditActionByIdIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "begin call " + schema.getLowerDbSchemaName() + ".dl_auditactionbyididx( ?, ?, ?, ?, ?" + ", " + "?" + " ); end"; if (stmtDeleteByIdIdx == null) { stmtDeleteByIdIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByIdIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByIdIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByIdIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByIdIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByIdIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByIdIdx.setShort(argIdx++, (short) argAuditActionId.ordinal()); int rowsUpdated = stmtDeleteByIdIdx.executeUpdate(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
public void updateAuditAction( CFSecurityAuthorization Authorization, CFSecurityAuditActionBuff Buff) { final String S_ProcName = "updateAuditAction"; ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFSecurityAuditActionBuff> buffList = new LinkedList<CFSecurityAuditActionBuff>(); try { ICFSecuritySchema.AuditActionEnum AuditActionId = Buff.getRequiredAuditActionId(); String Description = Buff.getRequiredDescription(); int Revision = Buff.getRequiredRevision(); stmtUpdateByPKey = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".upd_auditaction( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "AUDT"); stmtUpdateByPKey.setShort(argIdx++, (short) AuditActionId.ordinal()); stmtUpdateByPKey.setString(argIdx++, Description); stmtUpdateByPKey.setInt(argIdx++, Revision); stmtUpdateByPKey.execute(); resultSet = (ResultSet) stmtUpdateByPKey.getObject(1); if (resultSet != null) { try { if (resultSet.next()) { CFSecurityAuditActionBuff updatedBuff = unpackAuditActionResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredDescription(updatedBuff.getRequiredDescription()); 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_auditaction() 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_auditaction() 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; } } }
public CFSecurityAuditActionBuff readBuffByIdIdx( CFSecurityAuthorization Authorization, ICFSecuritySchema.AuditActionEnum AuditActionId) { final String S_ProcName = "readBuffByIdIdx"; ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByIdIdx = null; try { stmtReadBuffByIdIdx = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".rd_auditactionbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByIdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByIdIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByIdIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByIdIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByIdIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByIdIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByIdIdx.setShort(argIdx++, (short) AuditActionId.ordinal()); stmtReadBuffByIdIdx.execute(); resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFSecurityAuditActionBuff buff = unpackAuditActionResultSetToBuff(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 (stmtReadBuffByIdIdx != null) { try { stmtReadBuffByIdIdx.close(); } catch (SQLException e) { } stmtReadBuffByIdIdx = null; } } }
public void updateAuditAction( CFSecurityAuthorization Authorization, CFSecurityAuditActionBuff Buff) { final String S_ProcName = "updateAuditAction"; if ("AUDT".equals(Buff.getClassCode()) && (!schema.isSystemUser(Authorization))) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Permission denied -- only system user can modify AuditAction data"); } ResultSet resultSet = null; try { ICFSecuritySchema.AuditActionEnum AuditActionId = Buff.getRequiredAuditActionId(); String Description = Buff.getRequiredDescription(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_update_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtUpdateByPKey == null) { stmtUpdateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; 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++, "AUDT"); stmtUpdateByPKey.setShort(argIdx++, (short) AuditActionId.ordinal()); stmtUpdateByPKey.setString(argIdx++, Description); stmtUpdateByPKey.setInt(argIdx++, Revision); resultSet = stmtUpdateByPKey.executeQuery(); if (resultSet.next()) { CFSecurityAuditActionBuff updatedBuff = unpackAuditActionResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredDescription(updatedBuff.getRequiredDescription()); 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().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }