public void deleteISOTimezone( CFSecurityAuthorization Authorization, CFSecurityISOTimezoneBuff Buff) { final String S_ProcName = "deleteISOTimezone"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); short ISOTimezoneId = Buff.getRequiredISOTimezoneId(); String sql = "SELECT " + schema.getLowerDbSchemaName() + ".sp_delete_isotz( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ) as DeletedFlag"; 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++, ISOTimezoneId); stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision()); ; resultSet = stmtDeleteByPKey.executeQuery(); if (resultSet.next()) { boolean deleteFlag = resultSet.getBoolean(1); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } } 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; } } }
/** * Get organisation's nomination rater status * * @param iOrgID * @return * @throws SQLException * @throws Exception * @author Desmond */ public boolean getNomRater(int iOrgID) throws SQLException, Exception { String query = "SELECT NominationModule FROM tblOrganization WHERE PKOrganization =" + iOrgID; boolean iNomRater = true; Connection con = null; Statement st = null; ResultSet rs = null; try { con = ConnectionBean.getConnection(); st = con.createStatement(); rs = st.executeQuery(query); if (rs.next()) { iNomRater = rs.getBoolean(1); } } catch (Exception E) { System.err.println("Organization.java - getNomRater - " + E); } finally { ConnectionBean.closeRset(rs); // Close ResultSet ConnectionBean.closeStmt(st); // Close statement ConnectionBean.close(con); // Close connection } return iNomRater; } // End getNomRater()
// Needs a connection so it can fetch more stuff lazily Copy(ResultSet rs) throws SQLException { super(); copyId = rs.getInt("copy#"); bibId = rs.getInt("bib#"); note = rs.getString("pac_note"); location = rs.getString("location"); locationName = rs.getString("location_name"); collectionDescr = rs.getString("collection_descr"); collection = rs.getString("collection"); callNumber = new CallNumber( rs.getString("call_number"), rs.getString("call_type"), rs.getString("copy_number"), rs.getString("call_type_hint")); callType = rs.getString("call_type"); callTypeHint = rs.getString("call_type_hint"); callTypeName = rs.getString("call_type_name"); mediaType = rs.getString("media_type"); mediaTypeDescr = rs.getString("media_descr"); summaryOfHoldings = rs.getBoolean("summary_of_holdings"); itemType = rs.getString("itype"); itemTypeDescr = rs.getString("idescr"); }
public void deleteTSecGroupByUNameIdx( CFSecurityAuthorization Authorization, long argTenantId, String argName) { final String S_ProcName = "deleteTSecGroupByUNameIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "SELECT " + schema.getLowerDbSchemaName() + ".sp_delete_tsecgrp_by_unameidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ) as DeletedFlag"; if (stmtDeleteByUNameIdx == null) { stmtDeleteByUNameIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByUNameIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByUNameIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByUNameIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByUNameIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByUNameIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtDeleteByUNameIdx.setLong(argIdx++, argTenantId); stmtDeleteByUNameIdx.setString(argIdx++, argName); resultSet = stmtDeleteByUNameIdx.executeQuery(); if (resultSet.next()) { boolean deleteFlag = resultSet.getBoolean(1); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } } 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; } } }
protected CFInternetURLProtocolBuff unpackURLProtocolResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackURLProtocolResultSetToBuff"; int idxcol = 1; CFInternetURLProtocolBuff buff = schema.getFactoryURLProtocol().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(CFDbTestPgSqlSchema.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(CFDbTestPgSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredURLProtocolId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredIsSecure(resultSet.getBoolean(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
/** * Get Organization * * @param iFKCompanyID * @return * @author James */ public votblOrganization getOrganization(int iOrgID) { votblOrganization vo = new votblOrganization(); Connection con = null; Statement st = null; ResultSet rs = null; String command = "SELECT * FROM tblOrganization WHERE PKOrganization= " + iOrgID; try { con = ConnectionBean.getConnection(); System.out.println("con:" + con); st = con.createStatement(); rs = st.executeQuery(command); if (rs.next()) { vo.setEmailNom(rs.getString("EmailNom")); vo.setEmailNomRemind(rs.getString("EmailNomRemind")); vo.setEmailPart(rs.getString("EmailPart")); vo.setEmailPartRemind(rs.getString("EmailPartRemind")); vo.setExtraModule(rs.getInt("ExtraModule")); vo.setFKCompanyID(rs.getInt("FKCompanyID")); vo.setNameSequence(rs.getInt("NameSequence")); vo.setOrganizationCode(rs.getString("OrganizationCode")); vo.setOrganizationLogo(rs.getString("OrganizationLogo")); vo.setOrganizationName(rs.getString("OrganizationName")); vo.setPKOrganization(rs.getInt("PKOrganization")); // Added by DeZ, 18/06/08, to add function to enable/disable Nominate Rater vo.setNomRater(rs.getBoolean("NominationModule")); } } catch (SQLException SE) { System.err.println("Organization.java - getOrganization - " + SE.getMessage()); } finally { ConnectionBean.closeRset(rs); // Close ResultSet ConnectionBean.closeStmt(st); // Close statement ConnectionBean.close(con); // Close connection } return vo; }
protected CFSecurityISOTimezoneBuff unpackISOTimezoneResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackISOTimezoneResultSetToBuff"; int idxcol = 1; CFSecurityISOTimezoneBuff buff = schema.getFactoryISOTimezone().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(CFDbTestPgSqlSchema.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(CFDbTestPgSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredISOTimezoneId(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredIso8601(resultSet.getString(idxcol)); idxcol++; buff.setRequiredTZName(resultSet.getString(idxcol)); idxcol++; buff.setRequiredTZHourOffset(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredTZMinOffset(resultSet.getShort(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredVisible(resultSet.getBoolean(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html;charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("<!DOCTYPE html>\n"); out.write("<html>\n"); out.write(" <head>\n"); out.write( " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"); out.write(" <title>Fine</title>\n"); out.write(" <link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"> \n"); out.write("\n"); out.write(" </head>\n"); out.write(" <body style = \"background-image: url(lib2.jpg)\"> \n"); out.write(" <center>\n"); out.write(" <h1>Update Fines information</h1>\n"); out.write(" <form name=\"Update\" action=\"Fines_upd.jsp\">\n"); out.write(" <table border=\"0\" width=\"3\" cellspacing=\"2\">\n"); out.write(" <thead>\n"); out.write(" <tr>\n"); out.write(" <th>Update Fines</th>\n"); out.write(" <th></th>\n"); out.write(" </tr>\n"); out.write(" </thead>\n"); out.write(" <tbody>\n"); out.write(" <tr>\n"); out.write(" <td>Update Fine table with todays Data</td>\n"); out.write( " <td><input type=\"submit\" value=\"Update / View Fines\" name=\"SUBMIT\"/></td>\n"); out.write(" </tr>\n"); out.write(" </tbody>\n"); out.write(" </table> \n"); out.write(" </form>\n"); out.write(" <h1>Check your Fines Here</h1>\n"); out.write(" <form name=\"Fines\" action=\"Fines.jsp\">\n"); out.write(" <table border=\"0\" width=\"3\" cellspacing=\"2\">\n"); out.write(" <thead>\n"); out.write(" <tr>\n"); out.write(" <th>Get Fine Details</th>\n"); out.write(" <th></th>\n"); out.write(" </tr>\n"); out.write(" </thead>\n"); out.write(" <tbody>\n"); out.write(" <tr>\n"); out.write(" <td>Card No</td>\n"); out.write( " <td><input type=\"text\" name=\"Card_no\" value=\"\"/></td>\n"); out.write(" </tr>\n"); out.write(" <tr>\n"); out.write(" <td></td>\n"); out.write( " <td><input type=\"submit\" value=\"Get Fines\" name=\"SUBMIT\" /></td>\n"); out.write(" </tr>\n"); out.write(" </tbody>\n"); out.write(" </table> \n"); out.write(" "); Connection con = null; String[] selected_Checkboxes = request.getParameterValues("chk"); PreparedStatement pst = null; ResultSet result = null; ResultSet resUpd = null; con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/lbms_db?zeroDateTimeBehavior=convertToNull", "root", "admin12"); String Card_no = request.getParameter("Card_no"); String button = null; Date dt = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); String current_date = sdf.format(dt); if (Card_no != null && selected_Checkboxes == null) { String selSql = "SELECT l.card_no, SUM(f.fine_amt) AS total_fine, f.paid " + "FROM book_loans l, fines f " + "WHERE l.loan_id = f.loan_id AND " + "l.card_no = " + Card_no + " " + "GROUP BY l.card_no"; pst = con.prepareStatement(selSql); result = pst.executeQuery(); String box = null; String paid; String pay; Boolean chk = false; out.println("<table>"); pay = "<form action='Fines.jsp'>"; out.println(pay); out.println("<tr>"); out.println("<th>Card No</th>"); out.println("<th>Fine_Amt</th>"); out.println("<th>Paid OR Not</th>"); out.println("</tr>"); while (result.next()) { chk = true; paid = "No"; if (result.getBoolean("f.paid")) { paid = "Yes"; } out.println("<tr>"); out.println( "<td>" + result.getInt("l.card_no") + "</td><td>" + result.getString("total_fine") + "</td><td>" + paid + "</td>"); out.print("<td>"); box = "<input name='chk' value=" + result.getInt("l.card_no") + " type='checkbox'>"; out.print(box); out.print("</td>"); out.print("</tr>"); } if (chk == true) { out.println("<tr>"); out.print("<td>"); button = "<input type='submit' value='Pay Fine' name='Pay'>"; out.print(button); out.print("</td>"); out.println("</tr>"); } else { out.write( "<dialog open> <font color = 'green'>No Fine information. You owe nothing! Thank You</font> </dialog>"); } out.println("</form>"); out.println("</table>"); } else if (selected_Checkboxes != null) { String sqlLoan = null; ResultSet resultLoan = null; String sqlUpdFine = null; PreparedStatement pstUpd = null; String sqlBook = null; ResultSet rsltBook = null; char chkouts = 'N'; int length_chk = selected_Checkboxes.length; for (int i = 0; i < length_chk; i++) { // Check whether the Book is returned before paying the fine. sqlBook = "SELECT COUNT(loan_id) AS no_chkouts FROM book_loans WHERE card_no = " + selected_Checkboxes[i] + " AND date_in = '0000-00-00' AND due_date < " + current_date + ""; pst = con.prepareStatement(sqlBook); rsltBook = pst.executeQuery(); while (rsltBook.next()) { if (rsltBook.getInt("no_chkouts") > 0) { chkouts = 'Y'; } } if (chkouts == 'Y') { out.write( "<dialog open> <font color = 'red'>You have outstanding due checkouts!. Please return the books and then Pay the fine</font> </dialog>"); } // Get the corresponding loan_Ids for each customer from Fines table sqlLoan = "SELECT loan_id FROM book_loans WHERE card_no = " + selected_Checkboxes[i] + " AND date_in IS NOT NULL AND due_date < date_in"; pst = con.prepareStatement(sqlLoan); resultLoan = pst.executeQuery(); while (resultLoan.next()) { sqlUpdFine = "UPDATE fines SET paid = true WHERE loan_id = " + resultLoan.getInt("loan_id") + ""; pstUpd = con.prepareStatement(sqlUpdFine); pstUpd.executeUpdate(); out.println("Payment Updated Successfully"); } } } out.write("\n"); out.write(" </form> \n"); out.write(" </center>\n"); out.write("</body>\n"); out.write("</html>\n"); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }