public CFSecurityHostNodeBuff lockBuff( CFSecurityAuthorization Authorization, CFSecurityHostNodePKey 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(); long ClusterId = PKey.getRequiredClusterId(); long HostNodeId = PKey.getRequiredHostNodeId(); String sql = "SELECT * FROM " + schema.getLowerDbSchemaName() + ".sp_lock_hostnode( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; 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.setLong(argIdx++, ClusterId); stmtLockBuffByPKey.setLong(argIdx++, HostNodeId); resultSet = stmtLockBuffByPKey.executeQuery(); if (resultSet.next()) { CFSecurityHostNodeBuff buff = unpackHostNodeResultSetToBuff(resultSet); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } 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 CFSecurityHostNodeBuff[] readDerivedByClusterIdx( CFSecurityAuthorization Authorization, long ClusterId) { final String S_ProcName = "readDerivedByClusterIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFSecurityHostNodeBuff[] buffList = readBuffByClusterIdx(Authorization, ClusterId); return (buffList); }
public CFSecurityHostNodeBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "readAllDerived"; CFSecurityHostNodeBuff[] buffArray; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } buffArray = readAllBuff(Authorization); return (buffArray); }
public CFSecurityHostNodeBuff readDerivedByHostNameIdx( CFSecurityAuthorization Authorization, long ClusterId, String HostName) { final String S_ProcName = "CFSecurityPgSqlHostNodeTable.readDerivedByHostNameIdx() "; CFSecurityHostNodeBuff buff; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } buff = readBuffByHostNameIdx(Authorization, ClusterId, HostName); return (buff); }
public CFSecurityHostNodeBuff lockDerived( CFSecurityAuthorization Authorization, CFSecurityHostNodePKey PKey) { final String S_ProcName = "lockDerived"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } CFSecurityHostNodeBuff buff; buff = lockBuff(Authorization, PKey); return (buff); }
public CFSecurityHostNodeBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "readAllBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "SELECT * FROM " + schema.getLowerDbSchemaName() + ".sp_read_hostnode_all( ?, ?, ?, ?, ? )"; if (stmtReadAllBuff == null) { stmtReadAllBuff = cnx.prepareStatement(sql); } int argIdx = 1; 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()); resultSet = stmtReadAllBuff.executeQuery(); List<CFSecurityHostNodeBuff> buffList = new LinkedList<CFSecurityHostNodeBuff>(); while (resultSet.next()) { CFSecurityHostNodeBuff buff = unpackHostNodeResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFSecurityHostNodeBuff[] retBuff = new CFSecurityHostNodeBuff[buffList.size()]; Iterator<CFSecurityHostNodeBuff> 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; } } }
public void createHostNode(CFSecurityAuthorization Authorization, CFSecurityHostNodeBuff Buff) { final String S_ProcName = "createHostNode"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { long ClusterId = Buff.getRequiredClusterId(); String Description = Buff.getRequiredDescription(); String HostName = Buff.getRequiredHostName(); Connection cnx = schema.getCnx(); String sql = "select * from " + schema.getLowerDbSchemaName() + ".sp_create_hostnode( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; 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++, "HSND"); stmtCreateByPKey.setLong(argIdx++, ClusterId); stmtCreateByPKey.setString(argIdx++, Description); stmtCreateByPKey.setString(argIdx++, HostName); resultSet = stmtCreateByPKey.executeQuery(); if (resultSet.next()) { CFSecurityHostNodeBuff createdBuff = unpackHostNodeResultSetToBuff(resultSet); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } Buff.setRequiredClusterId(createdBuff.getRequiredClusterId()); Buff.setRequiredHostNodeId(createdBuff.getRequiredHostNodeId()); Buff.setRequiredDescription(createdBuff.getRequiredDescription()); Buff.setRequiredHostName(createdBuff.getRequiredHostName()); 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().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }