protected CFSecuritySecAppBuff unpackSecAppResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackSecAppResultSetToBuff"; int idxcol = 1; CFSecuritySecAppBuff buff = schema.getFactorySecApp().newBuff(); { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFFreeSwitchOracleSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFFreeSwitchOracleSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredClusterId(resultSet.getLong(idxcol)); idxcol++; buff.setRequiredSecAppId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredJEEMountName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
public void deleteSecApp(CFSecurityAuthorization Authorization, CFSecuritySecAppBuff Buff) { final String S_ProcName = "deleteSecApp"; Connection cnx = schema.getCnx(); CallableStatement stmtDeleteByPKey = null; try { long ClusterId = Buff.getRequiredClusterId(); int SecAppId = Buff.getRequiredSecAppId(); stmtDeleteByPKey = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".dl_secapp( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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.setLong(argIdx++, ClusterId); stmtDeleteByPKey.setInt(argIdx++, SecAppId); 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 deleteSecAppByIdIdx( CFSecurityAuthorization Authorization, long argClusterId, int argSecAppId) { final String S_ProcName = "deleteSecAppByIdIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "begin call " + schema.getLowerDbSchemaName() + ".dl_secappbyididx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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.setLong(argIdx++, argClusterId); stmtDeleteByIdIdx.setInt(argIdx++, argSecAppId); 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 CFSecuritySecAppBuff[] readDerivedByClusterIdx( CFSecurityAuthorization Authorization, long ClusterId) { final String S_ProcName = "readDerivedByClusterIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFSecuritySecAppBuff[] buffList = readBuffByClusterIdx(Authorization, ClusterId); return (buffList); }
public CFSecuritySecAppBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "readAllDerived"; CFSecuritySecAppBuff[] buffArray; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } buffArray = readAllBuff(Authorization); return (buffArray); }
public CFSecuritySecAppBuff readDerivedByUJEEMountIdx( CFSecurityAuthorization Authorization, long ClusterId, String JEEMountName) { final String S_ProcName = "CFFreeSwitchOracleSecAppTable.readDerivedByUJEEMountIdx() "; CFSecuritySecAppBuff buff; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } buff = readBuffByUJEEMountIdx(Authorization, ClusterId, JEEMountName); return (buff); }
public CFSecuritySecAppBuff lockDerived( CFSecurityAuthorization Authorization, CFSecuritySecAppPKey PKey) { final String S_ProcName = "lockDerived"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFSecuritySecAppBuff buff; buff = lockBuff(Authorization, PKey); return (buff); }
public String getSqlSelectSecAppDistinctClassCode() { if (S_sqlSelectSecAppDistinctClassCode == null) { S_sqlSelectSecAppDistinctClassCode = "SELECT " + "DISTINCT sapp.ClassCode " + "FROM " + schema.getLowerDbSchemaName() + ".SecApp sapp "; } return (S_sqlSelectSecAppDistinctClassCode); }
public String getSqlSelectSecAppBuff() { if (S_sqlSelectSecAppBuff == null) { S_sqlSelectSecAppBuff = "SELECT " + "sapp.ClusterId, " + "sapp.SecAppId, " + "sapp.JEEMountName, " + "sapp.Revision " + "FROM " + schema.getLowerDbSchemaName() + ".SecApp sapp "; } return (S_sqlSelectSecAppBuff); }
public void updateSecApp(CFSecurityAuthorization Authorization, CFSecuritySecAppBuff Buff) { final String S_ProcName = "updateSecApp"; ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFSecuritySecAppBuff> buffList = new LinkedList<CFSecuritySecAppBuff>(); try { long ClusterId = Buff.getRequiredClusterId(); int SecAppId = Buff.getRequiredSecAppId(); String JEEMountName = Buff.getRequiredJEEMountName(); int Revision = Buff.getRequiredRevision(); stmtUpdateByPKey = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".upd_secapp( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "SAPP"); stmtUpdateByPKey.setLong(argIdx++, ClusterId); stmtUpdateByPKey.setInt(argIdx++, SecAppId); stmtUpdateByPKey.setString(argIdx++, JEEMountName); stmtUpdateByPKey.setInt(argIdx++, Revision); stmtUpdateByPKey.execute(); resultSet = (ResultSet) stmtUpdateByPKey.getObject(1); if (resultSet != null) { try { if (resultSet.next()) { CFSecuritySecAppBuff updatedBuff = unpackSecAppResultSetToBuff(resultSet); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } Buff.setRequiredJEEMountName(updatedBuff.getRequiredJEEMountName()); 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_secapp() 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_secapp() 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 CFSecuritySecAppBuff readBuffByUJEEMountIdx( CFSecurityAuthorization Authorization, long ClusterId, String JEEMountName) { final String S_ProcName = "readBuffByUJEEMountIdx"; ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByUJEEMountIdx = null; try { stmtReadBuffByUJEEMountIdx = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".rd_secappbyujeemountidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByUJEEMountIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByUJEEMountIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUJEEMountIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByUJEEMountIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByUJEEMountIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUJEEMountIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByUJEEMountIdx.setLong(argIdx++, ClusterId); stmtReadBuffByUJEEMountIdx.setString(argIdx++, JEEMountName); stmtReadBuffByUJEEMountIdx.execute(); resultSet = (ResultSet) stmtReadBuffByUJEEMountIdx.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFSecuritySecAppBuff buff = unpackSecAppResultSetToBuff(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 (stmtReadBuffByUJEEMountIdx != null) { try { stmtReadBuffByUJEEMountIdx.close(); } catch (SQLException e) { } stmtReadBuffByUJEEMountIdx = null; } } }
public CFSecuritySecAppBuff[] readBuffByClusterIdx( CFSecurityAuthorization Authorization, long ClusterId) { final String S_ProcName = "readBuffByClusterIdx"; ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByClusterIdx = null; List<CFSecuritySecAppBuff> buffList = new LinkedList<CFSecuritySecAppBuff>(); try { stmtReadBuffByClusterIdx = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".rd_secappbyclusteridx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByClusterIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByClusterIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByClusterIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByClusterIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByClusterIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByClusterIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByClusterIdx.setLong(argIdx++, ClusterId); stmtReadBuffByClusterIdx.execute(); resultSet = (ResultSet) stmtReadBuffByClusterIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFSecuritySecAppBuff buff = unpackSecAppResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFSecuritySecAppBuff[] retBuff = new CFSecuritySecAppBuff[buffList.size()]; Iterator<CFSecuritySecAppBuff> 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 (stmtReadBuffByClusterIdx != null) { try { stmtReadBuffByClusterIdx.close(); } catch (SQLException e) { } stmtReadBuffByClusterIdx = null; } } }
public CFSecuritySecAppBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "readAllBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtReadAllBuff = null; try { CFSecuritySecAppBuff buff = null; List<CFSecuritySecAppBuff> buffList = new LinkedList<CFSecuritySecAppBuff>(); stmtReadAllBuff = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".rd_secappall( ?, ?, ?, ?, ?, ? ) ); end;"); int argIdx = 1; stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadAllBuff.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadAllBuff.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadAllBuff.execute(); resultSet = (ResultSet) stmtReadAllBuff.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { buff = unpackSecAppResultSetToBuff(resultSet); buffList.add(buff); } } catch (SQLException e) { // Oracle may return an invalid resultSet if the rowset is empty } } int idx = 0; CFSecuritySecAppBuff[] retBuff = new CFSecuritySecAppBuff[buffList.size()]; Iterator<CFSecuritySecAppBuff> 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 (stmtReadAllBuff != null) { try { stmtReadAllBuff.close(); } catch (SQLException e) { } stmtReadAllBuff = null; } } }
public CFSecuritySecAppBuff lockBuff( CFSecurityAuthorization Authorization, CFSecuritySecAppPKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtLockBuffByPKey = null; try { long ClusterId = PKey.getRequiredClusterId(); int SecAppId = PKey.getRequiredSecAppId(); stmtLockBuffByPKey = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".lck_secapp( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtLockBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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.setLong(argIdx++, ClusterId); stmtLockBuffByPKey.setInt(argIdx++, SecAppId); stmtLockBuffByPKey.execute(); resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFSecuritySecAppBuff buff = unpackSecAppResultSetToBuff(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 (stmtLockBuffByPKey != null) { try { stmtLockBuffByPKey.close(); } catch (SQLException e) { } stmtLockBuffByPKey = null; } } }