protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = DriverManager.getConnection(Utility.connection, Utility.username, Utility.password); int user_id = Integer.parseInt(request.getParameter("user_id")); int question_id = Integer.parseInt(request.getParameter("question_id")); int option = Integer.parseInt(request.getParameter("option")); System.out.println("uid: " + user_id + "\nquestion: " + question_id + "\noption: " + option); String str1 = "INSERT INTO VOTES(USER_ID, QUESTION_ID,OPTION_VOTED) VALUES (?,?,?)"; PreparedStatement prep1 = con.prepareStatement(str1); prep1.setInt(1, user_id); prep1.setInt(3, option); prep1.setInt(2, question_id); prep1.execute(); String str2 = "SELECT OPTION_" + option + " FROM ARCHIVE_VOTES WHERE QUESTION_ID=?"; PreparedStatement prep2 = con.prepareStatement(str2); prep2.setInt(1, question_id); int count = 0; ResultSet rs2 = prep2.executeQuery(); if (rs2.next()) { count = rs2.getInt("OPTION_" + option); } count++; String str3 = "UPDATE ARCHIVE_VOTES SET OPTION_" + option + "=? WHERE QUESTION_ID=?"; PreparedStatement prep3 = con.prepareStatement(str3); prep3.setInt(1, count); prep3.setInt(2, question_id); prep3.executeUpdate(); out.print("You Vote has been recorded! Thank you!"); System.out.println( "Voted for question " + question_id + ", by user " + user_id + ", for option " + option); } catch (Exception e) { e.printStackTrace(); } finally { out.close(); } }
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); Connection conn = null; PreparedStatement pstmt = null; try { System.out.println("Enrollno: 130050131049"); // STEP 2: Register JDBC driver Class.forName(JDBC_DRIVER); // STEP 3: Open a connection System.out.println("Connecting to a selected database..."); conn = DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("Connected database successfully..."); // STEP 2: Executing query String sql = "SELECT * FROM logindetails WHERE name = ?"; pstmt = conn.prepareStatement(sql); pstmt.setString(1, "Krut"); ResultSet rs = pstmt.executeQuery(); out.print("| <b>Name</b>| "); out.print("<b>Password</b>| "); out.println("</br>\n-------------------------------</br>"); while (rs.next()) { out.println(); out.print("| " + rs.getString(1)); out.print("| " + rs.getString(2) + "|"); out.println("</br>"); } } catch (SQLException se) { // Handle errors for JDBC se.printStackTrace(); } catch (Exception e) { // Handle errors for Class.forName e.printStackTrace(); } finally { // finally block used to close resources try { if (pstmt != null) conn.close(); } catch (SQLException se) { } // do nothing try { if (conn != null) conn.close(); } catch (SQLException se) { se.printStackTrace(); } // end finally try } // end try }
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = DriverManager.getConnection(Utility.connection, Utility.username, Utility.password); String email = request.getParameter("email_id"); String number = ""; boolean exists = false; String user_name = ""; int user_id = -1; String str1 = "SELECT USER_ID,NAME,PHONE_NUMBER FROM USERS WHERE EMAIL_ID=?"; PreparedStatement prep1 = con.prepareStatement(str1); prep1.setString(1, email); ResultSet rs1 = prep1.executeQuery(); if (rs1.next()) { exists = true; user_id = rs1.getInt("USER_ID"); user_name = rs1.getString("NAME"); number = rs1.getString("PHONE_NUMBER"); } int verification = 0; JSONObject data = new JSONObject(); if (exists) { verification = (int) (Math.random() * 9535641 % 999999); System.out.println("Number " + number + "\nVerification: " + verification); SMSProvider.sendSMS( number, "Your One Time Verification Code for PeopleConnect Is " + verification); } data.put("user_name", user_name); data.put("user_id", user_id); data.put("verification_code", "" + verification); data.put("phone_number", number); String toSend = data.toJSONString(); out.print(toSend); System.out.println(toSend); } catch (Exception e) { e.printStackTrace(); } finally { out.close(); } }
public void init() throws ServletException { ServletContext context = getServletContext(); String driver = context.getInitParameter("p1"); String cs = context.getInitParameter("p2"); String username = context.getInitParameter("p3"); String password = context.getInitParameter("p4"); try { Class.forName(driver); con = DriverManager.getConnection(cs, username, password); ps = con.prepareStatement( "select * from registration1 where username=? and password=? and user_type=?"); } catch (Exception e) { e.printStackTrace(); } }
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); try { String username = request.getParameter("t1"); String password = request.getParameter("t2"); String email = request.getParameter("t4"); String college = request.getParameter("t5"); String phone = request.getParameter("t6"); String country = request.getParameter("t7"); String languages = request.getParameter("t8"); Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "tiger"); PreparedStatement pst = con.prepareStatement("insert into stu_tab values(?,?,?,?,?,?,?)"); pst.setString(1, username); pst.setString(2, password); pst.setString(3, email); pst.setString(4, college); pst.setString(5, phone); pst.setString(6, country); pst.setString(7, languages); int i = pst.executeUpdate(); if (i != 0) { out.println("<html><body align=center bgcolor=#C0C0C0 text=black>"); out.println("<h3>!.. Registration Successful !..</h3>"); out.println( "<a href=Slogin1.html style=text-decoration:none>click here</a> to go back to login page"); out.println("</body></html>"); } else { out.println("<html><body align=center bgcolor=#C0C0C0 text=black>"); out.println("<h3>!.. Registration Failed !..</h3>"); out.println( "<a href=Slogin1.html style=text-decoration:none>click here</a> to go back to login page"); out.println("</body></html>"); } } catch (Exception e) { out.println(e); } }
public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try { Driver driver = new com.mysql.jdbc.Driver(); DriverManager.registerDriver(driver); Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1/school", "root", "password"); PreparedStatement preparedStatement = connection.prepareStatement("update student set name=?, per=? where roll=?"); preparedStatement.setString(1, request.getParameter("name")); preparedStatement.setFloat(2, Float.parseFloat(request.getParameter("per"))); preparedStatement.setInt(3, Integer.parseInt(request.getParameter("roll"))); preparedStatement.execute(); preparedStatement.close(); connection.close(); } catch (SQLException e) { e.printStackTrace(); } RequestDispatcher requestDispatcher = request.getRequestDispatcher("/Display"); requestDispatcher.forward(request, response); }
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // I use "session" in order to throws the object named user bean. HttpSession session = request.getSession(true); response.setContentType("text/html"); request.setCharacterEncoding("UTF-8"); UserBean ub = (UserBean) session.getAttribute("user"); if (ub == null) { String haveLogin = "******"; session.setAttribute("haveLogin", haveLogin); response.sendRedirect("cart"); } else { String mID = ub.getmID(); String iID = (String) request.getParameter("iID"); // String idx = (String)request.getParameter("idx"); Connection conn = null; try { // Getting the connection from database. Class.forName("com.mysql.jdbc.Driver"); /*conn = DriverManager .getConnection("jdbc:mysql://localhost/se?" + "user=root");*/ conn = DriverManager.getConnection( "jdbc:mysql://localhost/user_register?" + "user=sqluser&password=sqluserpw&useUnicode=true&characterEncoding=UTF-8"); String sql = "delete from cart_item_mapping where mID=? and iID = ?"; PreparedStatement pst = conn.prepareStatement(sql); // Using preparedstatement by set the parameter related to "?" symbol. pst.setString(1, mID); pst.setString(2, iID); pst.executeUpdate(); pst.close(); response.sendRedirect("ShowCartController"); } catch (Exception e) { e.printStackTrace(); } } }
public void doGet(HttpServletRequest request, HttpServletResponse response) { try { String comment = request.getParameter("comment"); int answerId = Integer.parseInt(request.getParameter("answer_id")); Connection connection = GlobalResources.getConnection(); Statement s; s = connection.createStatement(); PreparedStatement preparedStatement; PreparedStatement preparedStatement1; preparedStatement = connection.prepareStatement("insert into comment(comment,answer_id) values(?,?)"); preparedStatement.setString(1, comment); preparedStatement.setInt(2, answerId); preparedStatement.executeUpdate(); preparedStatement.close(); connection.close(); RequestDispatcher requestDispatcher; requestDispatcher = request.getRequestDispatcher("/studenthome.jsp"); requestDispatcher.forward(request, response); } catch (Exception e) { } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); PreparedStatement pstmt = null; Connection conn = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); GridParams pars = (GridParams) inputPar; BigDecimal rootProgressiveHIE01 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.ROOT_PROGRESSIVE_HIE01); BigDecimal progressiveHIE01 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_HIE01); BigDecimal progressiveHIE02 = (BigDecimal) pars.getOtherGridParams().get(ApplicationConsts.PROGRESSIVE_HIE02); Boolean productsOnly = (Boolean) pars.getOtherGridParams().get(ApplicationConsts.PRODUCTS_ONLY); Boolean compsOnly = (Boolean) pars.getOtherGridParams().get(ApplicationConsts.COMPONENTS_ONLY); HierarchyLevelVO vo = (HierarchyLevelVO) pars.getOtherGridParams().get(ApplicationConsts.TREE_FILTER); if (vo != null) { progressiveHIE01 = vo.getProgressiveHIE01(); progressiveHIE02 = vo.getProgressiveHie02HIE01(); } // retrieve companies list... ArrayList companiesList = ((JAIOUserSessionParameters) userSessionPars).getCompanyBa().getCompaniesList("ITM01"); String companies = ""; for (int i = 0; i < companiesList.size(); i++) companies += "'" + companiesList.get(i).toString() + "',"; companies = companies.substring(0, companies.length() - 1); String sql = "select ITM01_ITEMS.COMPANY_CODE_SYS01,ITM01_ITEMS.ITEM_CODE,SYS10_TRANSLATIONS.DESCRIPTION,ITM01_ITEMS.PROGRESSIVE_HIE02,ITM01_ITEMS.MIN_SELLING_QTY_UM_CODE_REG02," + "ITM01_ITEMS.PROGRESSIVE_HIE01,ITM01_ITEMS.SERIAL_NUMBER_REQUIRED,REG02_MEASURE_UNITS.DECIMALS " + " from ITM01_ITEMS,SYS10_TRANSLATIONS,REG02_MEASURE_UNITS where " + "ITM01_ITEMS.PROGRESSIVE_HIE02=? and " + "ITM01_ITEMS.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "ITM01_ITEMS.COMPANY_CODE_SYS01 in (" + companies + ") and " + "ITM01_ITEMS.ENABLED='Y' and " + "ITM01_ITEMS.MIN_SELLING_QTY_UM_CODE_REG02=REG02_MEASURE_UNITS.UM_CODE "; if (productsOnly != null && productsOnly.booleanValue()) sql += " and ITM01_ITEMS.MANUFACTURE_CODE_PRO01 is not null "; if (compsOnly != null && compsOnly.booleanValue()) sql += " and ITM01_ITEMS.MANUFACTURE_CODE_PRO01 is null "; if (rootProgressiveHIE01 == null || !rootProgressiveHIE01.equals(progressiveHIE01)) { // retrieve all subnodes of the specified node... pstmt = conn.prepareStatement( "select HIE01_LEVELS.PROGRESSIVE,HIE01_LEVELS.PROGRESSIVE_HIE01,HIE01_LEVELS.LEV from HIE01_LEVELS " + "where ENABLED='Y' and PROGRESSIVE_HIE02=? and PROGRESSIVE>=? " + "order by LEV,PROGRESSIVE_HIE01,PROGRESSIVE"); pstmt.setBigDecimal(1, progressiveHIE02); pstmt.setBigDecimal(2, progressiveHIE01); ResultSet rset = pstmt.executeQuery(); HashSet currentLevelNodes = new HashSet(); HashSet newLevelNodes = new HashSet(); String nodes = ""; int currentLevel = -1; while (rset.next()) { if (currentLevel != rset.getInt(3)) { // next level... currentLevel = rset.getInt(3); currentLevelNodes = newLevelNodes; newLevelNodes = new HashSet(); } if (rset.getBigDecimal(1).equals(progressiveHIE01)) { newLevelNodes.add(rset.getBigDecimal(1)); nodes += rset.getBigDecimal(1) + ","; } else if (currentLevelNodes.contains(rset.getBigDecimal(2))) { newLevelNodes.add(rset.getBigDecimal(1)); nodes += rset.getBigDecimal(1) + ","; } } rset.close(); pstmt.close(); if (nodes.length() > 0) nodes = nodes.substring(0, nodes.length() - 1); sql += " and PROGRESSIVE_HIE01 in (" + nodes + ")"; } Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01ITM01", "ITM01_ITEMS.COMPANY_CODE_SYS01"); attribute2dbField.put("itemCodeITM01", "ITM01_ITEMS.ITEM_CODE"); attribute2dbField.put("descriptionSYS10", "SYS10_TRANSLATIONS.DESCRIPTION"); attribute2dbField.put("progressiveHie02ITM01", "ITM01_ITEMS.PROGRESSIVE_HIE02"); attribute2dbField.put( "minSellingQtyUmCodeReg02ITM01", "ITM01_ITEMS.MIN_SELLING_QTY_UM_CODE_REG02"); attribute2dbField.put("progressiveHie01ITM01", "ITM01_ITEMS.PROGRESSIVE_HIE01"); attribute2dbField.put("serialNumberRequiredITM01", "ITM01_ITEMS.SERIAL_NUMBER_REQUIRED"); attribute2dbField.put("decimalsREG02", "REG02_MEASURE_UNITS.DECIMALS"); ArrayList values = new ArrayList(); values.add(progressiveHIE02); values.add(serverLanguageId); // read from ITM01 table... Response answer = QueryUtil.getQuery( conn, userSessionPars, sql, values, attribute2dbField, GridItemVO.class, "Y", "N", context, pars, 50, true); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching items list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
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"); pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write('\n'); out.write('\n'); Connection conn = null; Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db_shas", "root", "password"); ResultSet rsdoLogin = null; PreparedStatement psdoLogin = null; String sUserID = request.getParameter("username"); String sPassword = request.getParameter("password"); String message = "User login successfully "; try { String sqlOption = "select * FROM Users where username='******' and Password='******'"; psdoLogin = conn.prepareStatement(sqlOption); // psdoLogin.setString(1,sUserID); // psdoLogin.setString(2,sPassword); rsdoLogin = psdoLogin.executeQuery(); if (rsdoLogin.next()) { String sUserName = rsdoLogin.getString("firstname") + " " + rsdoLogin.getString("lastname"); session.setAttribute("sUserID", sUserName); // session.setAttribute("sUserID",rsdoLogin.getString("firstname")); // session.setAttribute("iUserType",rsdoLogin.getString("iUserType")); // session.setAttribute("iUserLevel",rsdoLogin.getString("iUserLevel")); // session.setAttribute("sUserName",sUserName); response.sendRedirect("success.jsp?statusmsg=" + message); } else { message = "Invalid credentials"; response.sendRedirect("Invalid.jsp?error=" + message); } } catch (Exception e) { e.printStackTrace(); } /// close object and connection try { if (psdoLogin != null) { psdoLogin.close(); } if (rsdoLogin != null) { rsdoLogin.close(); } if (conn != null) { conn.close(); } } catch (Exception e) { e.printStackTrace(); } } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) { } if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
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"); 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; out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("<!--%@ page errorPage=\"/error.jsp\" %-->\n"); response.setHeader("Pragma", "no-cache"); // HTTP 1.0 response.setDateHeader("Expires", 0); response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1 String _adminid = ""; String _adminname = ""; String _admintype = ""; String _admingroup = ""; String _approval = ""; String _adminclass = ""; String _adminmail = ""; try { _adminid = (String) session.getAttribute("adminid"); if (_adminid == null || _adminid.length() == 0 || _adminid.equals("null")) { response.sendRedirect("/admin/login_first.html"); return; } _adminname = (String) session.getAttribute("adminname"); _admintype = (String) session.getAttribute("admintype"); _admingroup = (String) session.getAttribute("admingroup"); _approval = (String) session.getAttribute("approval"); _adminclass = (String) session.getAttribute("adminclass"); _adminmail = (String) session.getAttribute("admin_email"); // session.setMaxInactiveInterval(60*60); } catch (Exception e) { response.sendRedirect("/admin/login_first.html"); return; } out.write('\n'); out.write('\n'); out.write('\n'); String password = request.getParameter("password"); String fromURL = request.getParameter("fromURL"); String oldPassword = ""; String sql = ""; int iCnt = 0; boolean isSucceeded = false; String strMsg = ""; Connection conn = null; MatrixDataSet matrix = null; DataProcess dataProcess = null; PreparedStatement pstmt = null; String targetUrl = ""; try { if (password.equals("1111")) { throw new UserDefinedException( "The new password is not acceptable. Change your password."); } Context ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/scm"); conn = ds.getConnection(); matrix = new dbconn.MatrixDataSet(); dataProcess = new DataProcess(); sql = " select password " + " from admin_01t " + " where adminid = '" + _adminid + "' "; iCnt = dataProcess.RetrieveData(sql, matrix, conn); if (iCnt > 0) { oldPassword = matrix.getRowData(0).getData(0); } else { throw new UserDefinedException("Can't find User Information."); } if (password.equals(oldPassword)) { throw new UserDefinedException( "The new password is not acceptable. Change your password."); } // update ó¸®... int idx = 0; conn.setAutoCommit(false); sql = " update admin_01t " + " set password = ?, pw_date = sysdate() " + " where adminid = ? "; pstmt = conn.prepareStatement(sql); pstmt.setString(++idx, password); pstmt.setString(++idx, _adminid); iCnt = pstmt.executeUpdate(); if (iCnt != 1) { throw new UserDefinedException("Password update failed."); } conn.commit(); isSucceeded = true; } catch (UserDefinedException ue) { try { conn.rollback(); } catch (Exception ex) { } strMsg = ue.getMessage(); } catch (Exception e) { try { conn.rollback(); } catch (Exception ex) { } System.out.println("Exception /admin/resetAdminPasswd : " + e.getMessage()); throw e; } finally { if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { } } if (conn != null) { try { conn.setAutoCommit(true); } catch (Exception e) { } conn.close(); } } // °á°ú ¸Þ½ÃÁö ó¸® if (isSucceeded) { // where to go? if (fromURL.equals("menu")) { targetUrl = ""; } else { targetUrl = "/admin/index2.jsp"; } strMsg = "The data are successfully processed."; } else { strMsg = "The operation failed.\\n" + strMsg; targetUrl = "/admin/resetAdminPasswdForm.jsp"; } out.write("\n"); out.write("<html>\n"); out.write("<head>\n"); out.write("<title></title>\n"); out.write("<link href=\"/common/css/style.css\" rel=\"stylesheet\" type=\"text/css\">\n"); out.write("</head>\n"); out.write("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>\n"); out.write("<form name=\"form1\" method=\"post\" action=\""); out.print(targetUrl); out.write("\">\n"); out.write("<input type='hidden' name='fromURL' value='"); out.print(fromURL); out.write("'>\n"); out.write("</form>\n"); out.write("<script language=\"javascript\">\n"); if (targetUrl.length() > 0) { out.write("\n"); out.write(" alert('"); out.print(strMsg); out.write("');\n"); out.write(" document.form1.submit();\n"); } out.write("\n"); out.write("</script>\n"); out.write("<table width='840' border='0' cellspacing='0' cellpadding='0'><tr><td>\n"); out.write("\n"); out.write("<table width='99%' border='0' cellspacing='0' cellpadding='0'>\n"); out.write("<tr>\n"); out.write(" <td height='15' colspan='2'></td>\n"); out.write("</tr>\n"); out.write("<tr>\n"); out.write(" <td width='3%'><img src='/img/title_icon.gif'></td>\n"); out.write(" <td width='*' class='left_title'>Password Change</td>\n"); out.write("</tr>\n"); out.write("<tr>\n"); out.write(" <td width='100%' height='2' colspan='2'><hr width='100%'></td>\n"); out.write("</tr>\n"); out.write("<tr>\n"); out.write(" <td height='10' colspan='2'></td>\n"); out.write("</tr>\n"); out.write("</table>\n"); out.write("\n"); out.write("<table width='90%' border='0' cellspacing='0' cellpadding='0' align='center'>\n"); out.write("<tr>\n"); out.write(" <td width='100%' align='center'><img border=\"0\" src=\"/img/pass.jpg\">\n"); out.write(" <br><br>\n"); out.write(" <b>The Password has been changed successfully.</b></td>\n"); out.write("</tr>\n"); out.write("</table>\n"); out.println(CopyRightLogo()); out.write("\n"); out.write("</tr></td></table>\n"); out.write("</body>\n"); out.write("</html>"); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) { } if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
public void _jspService( javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { javax.servlet.http.HttpSession session = request.getSession(true); com.caucho.server.webapp.Application _jsp_application = _caucho_getApplication(); javax.servlet.ServletContext application = _jsp_application; com.caucho.jsp.PageContextImpl pageContext = com.caucho.jsp.QJspFactory.allocatePageContext( this, _jsp_application, request, response, "/error.jsp", session, 8192, true); javax.servlet.jsp.JspWriter out = pageContext.getOut(); javax.servlet.ServletConfig config = getServletConfig(); javax.servlet.Servlet page = this; response.setContentType("text/html"); try { out.write(_jsp_string0, 0, _jsp_string0.length); out.print(((String) session.getAttribute("user"))); out.write(_jsp_string1, 0, _jsp_string1.length); out.print(((String) session.getAttribute("db"))); out.write(_jsp_string2, 0, _jsp_string2.length); // get all tables in the database ConDB dbcon = (ConDB) session.getAttribute("dbcon"); Connection conn = dbcon.get(); int total_rec = 0; int total_table = 0; String sql = "show tables"; PreparedStatement pstm = null; ResultSet rs = null; try { pstm = conn.prepareStatement(sql); rs = pstm.executeQuery(); } catch (SQLException e) { out.println(e); } // count the records of each table while (rs.next()) { String curr_tb = rs.getString(1); int curr_rec = 0; PreparedStatement pstm_rec = null; ResultSet rs_rec = null; sql = "select count(*) from " + curr_tb; try { pstm_rec = conn.prepareStatement(sql); rs_rec = pstm_rec.executeQuery(); } catch (SQLException e) { out.println(e); } try { if (rs_rec.next()) { curr_rec = rs_rec.getInt(1); total_rec += curr_rec; } } catch (SQLException e) { out.println(e.getErrorCode() + "---" + e.getSQLState()); } total_table++; out.write(_jsp_string3, 0, _jsp_string3.length); out.print((total_table & 1)); out.write(_jsp_string4, 0, _jsp_string4.length); out.print((curr_tb)); out.write(_jsp_string5, 0, _jsp_string5.length); out.print((curr_tb)); out.write(_jsp_string6, 0, _jsp_string6.length); out.print((curr_tb)); out.write(_jsp_string7, 0, _jsp_string7.length); out.print((curr_tb)); out.write(_jsp_string8, 0, _jsp_string8.length); out.print((curr_tb)); out.write(_jsp_string9, 0, _jsp_string9.length); out.print((curr_rec)); out.write(_jsp_string10, 0, _jsp_string10.length); } out.write(_jsp_string11, 0, _jsp_string11.length); out.print((total_table)); out.write(_jsp_string12, 0, _jsp_string12.length); out.print((total_rec)); out.write(_jsp_string13, 0, _jsp_string13.length); out.print((session.getAttribute("db"))); out.write(_jsp_string14, 0, _jsp_string14.length); } catch (java.lang.Throwable _jsp_e) { pageContext.handlePageException(_jsp_e); } finally { com.caucho.jsp.QJspFactory.freePageContext(pageContext); } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Connection conn = null; PreparedStatement pstmt = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); Object[] pars = (Object[]) inputPar; DetailPurchaseDocRowVO voTemplate = (DetailPurchaseDocRowVO) pars[0]; VariantsMatrixVO matrixVO = (VariantsMatrixVO) pars[1]; Object[][] cells = (Object[][]) pars[2]; BigDecimal currencyDecimals = (BigDecimal) pars[3]; Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01DOC07", "COMPANY_CODE_SYS01"); attribute2dbField.put("docTypeDOC07", "DOC_TYPE"); attribute2dbField.put("docYearDOC07", "DOC_YEAR"); attribute2dbField.put("docNumberDOC07", "DOC_NUMBER"); attribute2dbField.put("rowNumberDOC07", "ROW_NUMBER"); attribute2dbField.put("itemCodeItm01DOC07", "ITEM_CODE_ITM01"); attribute2dbField.put("supplierItemCodePur02DOC07", "SUPPLIER_ITEM_CODE_PUR02"); attribute2dbField.put("vatCodeItm01DOC07", "VAT_CODE_ITM01"); attribute2dbField.put("valuePur04DOC07", "VALUE_PUR04"); attribute2dbField.put("valueDOC07", "VALUE"); attribute2dbField.put("qtyDOC07", "QTY"); attribute2dbField.put("discountValueDOC07", "DISCOUNT_VALUE"); attribute2dbField.put("discountPercDOC07", "DISCOUNT_PERC"); attribute2dbField.put("vatValueDOC07", "VAT_VALUE"); attribute2dbField.put("vatDescriptionDOC07", "VAT_DESCRIPTION"); attribute2dbField.put("startDatePur04DOC07", "START_DATE_PUR04"); attribute2dbField.put("endDatePur04DOC07", "END_DATE_PUR04"); attribute2dbField.put("umCodePur02DOC07", "UM_CODE_PUR02"); attribute2dbField.put("decimalsReg02DOC07", "DECIMALS_REG02"); attribute2dbField.put("minPurchaseQtyPur02DOC07", "MIN_PURCHASE_QTY_PUR02"); attribute2dbField.put("multipleQtyPur02DOC07", "MULTIPLE_QTY_PUR02"); attribute2dbField.put("valueReg01DOC07", "VALUE_REG01"); attribute2dbField.put("deductibleReg01DOC07", "DEDUCTIBLE_REG01"); attribute2dbField.put("taxableIncomeDOC07", "TAXABLE_INCOME"); attribute2dbField.put("progressiveHie02DOC07", "PROGRESSIVE_HIE02"); attribute2dbField.put("deliveryDateDOC07", "DELIVERY_DATE"); attribute2dbField.put("inQtyDOC07", "IN_QTY"); attribute2dbField.put("orderQtyDOC07", "ORDER_QTY"); attribute2dbField.put("invoiceQtyDOC07", "INVOICE_QTY"); attribute2dbField.put("variantTypeItm06DOC07", "VARIANT_TYPE_ITM06"); attribute2dbField.put("variantCodeItm11DOC07", "VARIANT_CODE_ITM11"); attribute2dbField.put("variantTypeItm07DOC07", "VARIANT_TYPE_ITM07"); attribute2dbField.put("variantCodeItm12DOC07", "VARIANT_CODE_ITM12"); attribute2dbField.put("variantTypeItm08DOC07", "VARIANT_TYPE_ITM08"); attribute2dbField.put("variantCodeItm13DOC07", "VARIANT_CODE_ITM13"); attribute2dbField.put("variantTypeItm09DOC07", "VARIANT_TYPE_ITM09"); attribute2dbField.put("variantCodeItm14DOC07", "VARIANT_CODE_ITM14"); attribute2dbField.put("variantTypeItm10DOC07", "VARIANT_TYPE_ITM10"); attribute2dbField.put("variantCodeItm15DOC07", "VARIANT_CODE_ITM15"); DetailPurchaseDocRowVO vo = null; VariantsMatrixColumnVO colVO = null; VariantsMatrixRowVO rowVO = null; Response res = null; for (int i = 0; i < cells.length; i++) { rowVO = (VariantsMatrixRowVO) matrixVO.getRowDescriptors().get(i); if (matrixVO.getColumnDescriptors().size() == 0) { if (cells[i][0] != null) { vo = (DetailPurchaseDocRowVO) voTemplate.clone(); if (!containsVariant(matrixVO, "ITM11_VARIANTS_1")) { // e.g. color but not no size... vo.setVariantCodeItm11DOC07(ApplicationConsts.JOLLY); vo.setVariantTypeItm06DOC07(ApplicationConsts.JOLLY); } else { vo.setVariantCodeItm11DOC07(rowVO.getVariantCodeITM11()); vo.setVariantTypeItm06DOC07(rowVO.getVariantTypeITM06()); } if (!containsVariant(matrixVO, "ITM12_VARIANTS_2")) { vo.setVariantCodeItm12DOC07(ApplicationConsts.JOLLY); vo.setVariantTypeItm07DOC07(ApplicationConsts.JOLLY); } else { vo.setVariantCodeItm12DOC07(rowVO.getVariantCodeITM11()); vo.setVariantTypeItm07DOC07(rowVO.getVariantTypeITM06()); } if (!containsVariant(matrixVO, "ITM13_VARIANTS_3")) { vo.setVariantCodeItm13DOC07(ApplicationConsts.JOLLY); vo.setVariantTypeItm08DOC07(ApplicationConsts.JOLLY); } else { vo.setVariantCodeItm13DOC07(rowVO.getVariantCodeITM11()); vo.setVariantTypeItm08DOC07(rowVO.getVariantTypeITM06()); } if (!containsVariant(matrixVO, "ITM14_VARIANTS_4")) { vo.setVariantCodeItm14DOC07(ApplicationConsts.JOLLY); vo.setVariantTypeItm09DOC07(ApplicationConsts.JOLLY); } else { vo.setVariantCodeItm14DOC07(rowVO.getVariantCodeITM11()); vo.setVariantTypeItm09DOC07(rowVO.getVariantTypeITM06()); } if (!containsVariant(matrixVO, "ITM15_VARIANTS_5")) { vo.setVariantCodeItm15DOC07(ApplicationConsts.JOLLY); vo.setVariantTypeItm10DOC07(ApplicationConsts.JOLLY); } else { vo.setVariantCodeItm15DOC07(rowVO.getVariantCodeITM11()); vo.setVariantTypeItm10DOC07(rowVO.getVariantTypeITM06()); } vo.setQtyDOC07((BigDecimal) cells[i][0]); PurchaseUtils.updateTotals(vo, currencyDecimals.intValue()); /* vo.setVariantCodeItm12DOC07(ApplicationConsts.JOLLY); vo.setVariantCodeItm13DOC07(ApplicationConsts.JOLLY); vo.setVariantCodeItm14DOC07(ApplicationConsts.JOLLY); vo.setVariantCodeItm15DOC07(ApplicationConsts.JOLLY); vo.setVariantTypeItm07DOC07(ApplicationConsts.JOLLY); vo.setVariantTypeItm08DOC07(ApplicationConsts.JOLLY); vo.setVariantTypeItm09DOC07(ApplicationConsts.JOLLY); vo.setVariantTypeItm10DOC07(ApplicationConsts.JOLLY); */ vo.setInQtyDOC07(new BigDecimal(0)); vo.setOrderQtyDOC07(vo.getQtyDOC07()); if (vo.getInvoiceQtyDOC07() == null) vo.setInvoiceQtyDOC07(new BigDecimal(0)); vo.setRowNumberDOC07( progBean.getInternalProgressive("DOC07_PURCHASE_ITEMS", "ROW_NUMBER", conn)); // insert into DOC07... res = QueryUtil.insertTable( conn, userSessionPars, vo, "DOC07_PURCHASE_ITEMS", attribute2dbField, "Y", "N", context, true); if (res.isError()) { conn.rollback(); return res; } } // end if on not null } else for (int k = 0; k < matrixVO.getColumnDescriptors().size(); k++) { colVO = (VariantsMatrixColumnVO) matrixVO.getColumnDescriptors().get(k); if (cells[i][k] != null) { vo = (DetailPurchaseDocRowVO) voTemplate.clone(); vo.setQtyDOC07((BigDecimal) cells[i][k]); PurchaseUtils.updateTotals(vo, currencyDecimals.intValue()); vo.setVariantCodeItm11DOC07(rowVO.getVariantCodeITM11()); vo.setVariantTypeItm06DOC07(rowVO.getVariantTypeITM06()); vo.setVariantCodeItm12DOC07( colVO.getVariantCodeITM12() == null ? ApplicationConsts.JOLLY : colVO.getVariantCodeITM12()); vo.setVariantCodeItm13DOC07( colVO.getVariantCodeITM13() == null ? ApplicationConsts.JOLLY : colVO.getVariantCodeITM13()); vo.setVariantCodeItm14DOC07( colVO.getVariantCodeITM14() == null ? ApplicationConsts.JOLLY : colVO.getVariantCodeITM14()); vo.setVariantCodeItm15DOC07( colVO.getVariantCodeITM15() == null ? ApplicationConsts.JOLLY : colVO.getVariantCodeITM15()); vo.setVariantTypeItm07DOC07( colVO.getVariantTypeITM07() == null ? ApplicationConsts.JOLLY : colVO.getVariantTypeITM07()); vo.setVariantTypeItm08DOC07( colVO.getVariantTypeITM08() == null ? ApplicationConsts.JOLLY : colVO.getVariantTypeITM08()); vo.setVariantTypeItm09DOC07( colVO.getVariantTypeITM09() == null ? ApplicationConsts.JOLLY : colVO.getVariantTypeITM09()); vo.setVariantTypeItm10DOC07( colVO.getVariantTypeITM10() == null ? ApplicationConsts.JOLLY : colVO.getVariantTypeITM10()); vo.setInQtyDOC07(new BigDecimal(0)); vo.setOrderQtyDOC07(vo.getQtyDOC07()); if (vo.getInvoiceQtyDOC07() == null) vo.setInvoiceQtyDOC07(new BigDecimal(0)); vo.setRowNumberDOC07( progBean.getInternalProgressive("DOC07_PURCHASE_ITEMS", "ROW_NUMBER", conn)); // insert into DOC07... res = QueryUtil.insertTable( conn, userSessionPars, vo, "DOC07_PURCHASE_ITEMS", attribute2dbField, "Y", "N", context, true); if (res.isError()) { conn.rollback(); return res; } } // end if on not null } // end inner for } // end outer for // recalculate totals... PurchaseDocPK pk = new PurchaseDocPK( vo.getCompanyCodeSys01DOC07(), vo.getDocTypeDOC07(), vo.getDocYearDOC07(), vo.getDocNumberDOC07()); Response docResponse = docBean.loadPurchaseDoc( conn, pk, userSessionPars, request, response, userSession, context); if (docResponse.isError()) { conn.rollback(); return docResponse; } DetailPurchaseDocVO docVO = (DetailPurchaseDocVO) ((VOResponse) docResponse).getVo(); Response totalResponse = totalBean.calcDocTotals( conn, docVO, userSessionPars, request, response, userSession, context); if (totalResponse.isError()) { conn.rollback(); return totalResponse; } pstmt = conn.prepareStatement( "update DOC06_PURCHASE set TAXABLE_INCOME=?,TOTAL_VAT=?,TOTAL=?,DOC_STATE=? where COMPANY_CODE_SYS01=? and DOC_TYPE=? and DOC_YEAR=? and DOC_NUMBER=?"); pstmt.setBigDecimal(1, docVO.getTaxableIncomeDOC06()); pstmt.setBigDecimal(2, docVO.getTotalVatDOC06()); pstmt.setBigDecimal(3, docVO.getTotalDOC06()); pstmt.setString(4, ApplicationConsts.HEADER_BLOCKED); pstmt.setString(5, vo.getCompanyCodeSys01DOC07()); pstmt.setString(6, vo.getDocTypeDOC07()); pstmt.setBigDecimal(7, vo.getDocYearDOC07()); pstmt.setBigDecimal(8, vo.getDocNumberDOC07()); pstmt.execute(); Response answer = new VOResponse(vo); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); conn.commit(); // fires the GenericEvent.AFTER_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.AFTER_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while inserting new purchase order rows", ex); try { conn.rollback(); } catch (Exception ex3) { } return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
// ***************************************************** // Process the initial request from Proshop_main // ***************************************************** // public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // // Prevent caching so sessions are not mangled // resp.setHeader("Pragma", "no-cache"); // for HTTP 1.0 resp.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // for HTTP 1.1 resp.setDateHeader("Expires", 0); // prevents caching at the proxy server resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); HttpSession session = SystemUtils.verifyHotel(req, out); // check for intruder if (session == null) { return; } String club = (String) session.getAttribute("club"); // get club name String user = (String) session.getAttribute("user"); if (req.getParameter("clubswitch") != null && req.getParameter("clubswitch").equals("1") && req.getParameter("club") != null) { // // Request is to switch clubs - switch the db (TPC or Demo sites) // String newClub = req.getParameter("club"); Connection con = null; // // release the old connection // ConnHolder holder = (ConnHolder) session.getAttribute("connect"); if (holder != null) { con = holder.getConn(); // get the connection for previous club } if (con != null) { /* // abandon any unfinished transactions try { con.rollback(); } catch (Exception ignore) {} */ // close/release the connection try { con.close(); } catch (Exception ignore) { } } // // Connect to the new club // try { con = dbConn.Connect(newClub); // get connection to this club's db } catch (Exception ignore) { } holder = new ConnHolder(con); session.setAttribute("club", newClub); session.setAttribute("connect", holder); out.println("<HTML><HEAD><Title>Switching Sites</Title>"); out.println("<meta http-equiv=\"Refresh\" content=\"0; url=/" + rev + "/hotel_home.htm\">"); out.println("</HEAD>"); out.println("<BODY><CENTER><BR>"); out.println("<BR><H2>Switching Sites</H2><BR>"); out.println("<a href=\"/" + rev + "/hotel_home.htm\" target=_top>Continue</a><br>"); out.println("</CENTER></BODY></HTML>"); out.close(); return; } // // Call is to display the Home page. // out.println("<html><head>"); out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">"); out.println("<meta http-equiv=\"Content-Language\" content=\"en-us\">"); out.println("<title> \"ForeTees Hotel Home Page\"</title>"); out.println( "<script language=\"JavaScript\" src=\"/" + rev + "/web utilities/foretees.js\"></script>"); out.println( "<style type=\"text/css\"> body {text-align: center} </style>"); // so body will align on // center out.println("</head>"); out.println("<body bgcolor=\"#CCCCAA\" text=\"#000000\">"); out.println("<div style=\"align:center; margin:0px auto;\">"); if (club.startsWith("tpc") && user.startsWith("passport")) { // if TPC Passport user out.println("<br><H3>Welcome to ForeTees</H3><br>"); String clubname = ""; String fullname = ""; Connection con = null; try { con = dbConn.Connect(rev); // get connection to the Vx db // // Get the club names for each TPC club // PreparedStatement pstmt = con.prepareStatement("SELECT fullname FROM clubs WHERE clubname=?"); pstmt.clearParameters(); pstmt.setString(1, club); ResultSet rs = pstmt.executeQuery(); if (rs.next()) { fullname = rs.getString("fullname"); // get the club's full name } out.println("<p>You are currently connected to: <b>" + fullname + "</b><br><br>"); out.println("To continue with this site, simply use the navigation menus above.<br><br>"); out.println("To switch sites, click on the desired club name below.</p><br>"); // // Get the club names for each TPC club // pstmt = con.prepareStatement( "SELECT clubname, fullname FROM clubs WHERE inactive=0 AND clubname LIKE 'tpc%' ORDER BY fullname"); pstmt.clearParameters(); rs = pstmt.executeQuery(); while (rs.next()) { clubname = rs.getString("clubname"); // get a club name if (clubname.startsWith("tpc")) { fullname = rs.getString("fullname"); // get the club's full name out.println( "<a href=\"Hotel_home?clubswitch=1&club=" + clubname + "\" target=_top>" + fullname + "</a><br>"); } } pstmt.close(); } catch (Exception e) { // Error connecting to db.... out.println( "<BR><BR>Sorry, we encountered an error while trying to connect to the database."); // out.println("<br><br>Error: " + e.toString() + "<br>"); out.println("<BR><BR> <A HREF=\"Hotel_home\">Return</A>."); out.println("</BODY></HTML>"); return; } } else { out.println( "<BR><BR> You have entered here by mistake. Please contact ForeTees Support at 651-765-6006."); out.println("</BODY></HTML>"); } out.println("</div></BODY></HTML>"); } // end of doGet
/** Business logic to execute. */ public VOListResponse loadItemVariants(GridParams pars, String serverLanguageId, String username) throws Throwable { PreparedStatement pstmt = null; Connection conn = null; try { if (this.conn == null) conn = getConn(); else conn = this.conn; String tableName = (String) pars.getOtherGridParams().get(ApplicationConsts.TABLE_NAME); ItemPK pk = (ItemPK) pars.getOtherGridParams().get(ApplicationConsts.ITEM_PK); String productVariant = (String) productVariants.get(tableName); String variantType = (String) variantTypes.get(tableName); String variantTypeJoin = (String) variantTypeJoins.get(tableName); String variantCodeJoin = (String) variantCodeJoins.get(tableName); String sql = "select " + tableName + "." + variantTypeJoin + "," + tableName + ".VARIANT_CODE,A.DESCRIPTION,B.DESCRIPTION, " + tableName + ".PROGRESSIVE_SYS10," + variantType + ".PROGRESSIVE_SYS10 " + "from " + tableName + "," + variantType + ",SYS10_COMPANY_TRANSLATIONS A,SYS10_COMPANY_TRANSLATIONS B " + "where " + tableName + ".COMPANY_CODE_SYS01=? and " + tableName + ".COMPANY_CODE_SYS01=" + variantType + ".COMPANY_CODE_SYS01 and " + tableName + "." + variantTypeJoin + "=" + variantType + ".VARIANT_TYPE and " + tableName + ".COMPANY_CODE_SYS01=A.COMPANY_CODE_SYS01 and " + tableName + ".PROGRESSIVE_SYS10=A.PROGRESSIVE and A.LANGUAGE_CODE=? and " + variantType + ".COMPANY_CODE_SYS01=B.COMPANY_CODE_SYS01 and " + variantType + ".PROGRESSIVE_SYS10=B.PROGRESSIVE and B.LANGUAGE_CODE=? and " + tableName + ".ENABLED='Y' and " + variantType + ".ENABLED='Y' and " + // and not "+tableName+"."+variantTypeJoin+"=? and "+ "not " + tableName + ".VARIANT_CODE=? " + "order by " + tableName + "." + variantTypeJoin + "," + tableName + ".CODE_ORDER"; Map attribute2dbField = new HashMap(); attribute2dbField.put("variantType", tableName + "." + variantTypeJoin); attribute2dbField.put("variantCode", tableName + ".VARIANT_CODE"); attribute2dbField.put("variantDesc", "A.DESCRIPTION"); attribute2dbField.put("variantTypeDesc", "B.DESCRIPTION"); attribute2dbField.put("variantProgressiveSys10", tableName + ".PROGRESSIVE_SYS10"); attribute2dbField.put("variantTypeProgressiveSys10", variantType + ".PROGRESSIVE_SYS10"); ArrayList values = new ArrayList(); values.add(pk.getCompanyCodeSys01ITM01()); values.add(serverLanguageId); values.add(serverLanguageId); // values.add(ApplicationConsts.JOLLY); values.add(ApplicationConsts.JOLLY); // read from ITMxxx table... Response answer = QueryUtil.getQuery( conn, new UserSessionParameters(username), sql, values, attribute2dbField, ItemVariantVO.class, "Y", "N", null, pars, 50, true); if (!answer.isError()) { java.util.List vos = ((VOListResponse) answer).getRows(); HashMap map = new HashMap(); ItemVariantVO vo = null; for (int i = 0; i < vos.size(); i++) { vo = (ItemVariantVO) vos.get(i); vo.setCompanyCodeSys01(pk.getCompanyCodeSys01ITM01()); vo.setItemCodeItm01(pk.getItemCodeITM01()); vo.setTableName(tableName); map.put(vo.getVariantType() + "." + vo.getVariantCode(), vo); } pstmt = conn.prepareStatement( "select " + productVariant + "." + variantTypeJoin + "," + productVariant + "." + variantCodeJoin + " " + "from " + productVariant + " " + "where " + productVariant + ".COMPANY_CODE_SYS01=? and " + productVariant + ".ITEM_CODE_ITM01=? and " + productVariant + ".ENABLED='Y' "); pstmt.setString(1, pk.getCompanyCodeSys01ITM01()); pstmt.setString(2, pk.getItemCodeITM01()); ResultSet rset = pstmt.executeQuery(); while (rset.next()) { vo = (ItemVariantVO) map.get(rset.getString(1) + "." + rset.getString(2)); if (vo != null) vo.setSelected(Boolean.TRUE); } rset.close(); pstmt.close(); } if (answer.isError()) throw new Exception(answer.getErrorMessage()); else return (VOListResponse) answer; } catch (Throwable ex) { Logger.error( username, this.getClass().getName(), "getItemVariants", "Error while fetching item variants list", ex); throw new Exception(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { if (this.conn == null && conn != null) { // close only local connection conn.commit(); conn.close(); } } catch (Exception exx) { } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); Connection conn = null; PreparedStatement pstmt = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); // retrieve companies list... GridParams gridParams = (GridParams) inputPar; String companies = (String) gridParams .getOtherGridParams() .get(ApplicationConsts.COMPANY_CODE_SYS01); // used in lookup grid... if (companies == null) { ArrayList companiesList = ((JAIOUserSessionParameters) userSessionPars).getCompanyBa().getCompaniesList("SAL06"); companies = ""; for (int i = 0; i < companiesList.size(); i++) companies += "'" + companiesList.get(i).toString() + "',"; companies = companies.substring(0, companies.length() - 1); } else companies = "'" + companies + "'"; String sql = "select SAL06_CHARGES.COMPANY_CODE_SYS01,SAL06_CHARGES.CHARGE_CODE,SAL06_CHARGES.PROGRESSIVE_SYS10," + "SYS10_TRANSLATIONS.DESCRIPTION,SAL06_CHARGES.VALUE,SAL06_CHARGES.PERC,SAL06_CHARGES.VAT_CODE_REG01," + "SAL06_CHARGES.CURRENCY_CODE_REG03,SAL06_CHARGES.ENABLED" + " from SAL06_CHARGES,SYS10_TRANSLATIONS where " + "SAL06_CHARGES.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "SAL06_CHARGES.ENABLED='Y' and " + "SAL06_CHARGES.COMPANY_CODE_SYS01 in (" + companies + ")"; Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01SAL06", "SAL06_CHARGES.COMPANY_CODE_SYS01"); attribute2dbField.put("chargeCodeSAL06", "SAL06_CHARGES.CHARGE_CODE"); attribute2dbField.put("descriptionSYS10", "SYS10_TRANSLATIONS.DESCRIPTION"); attribute2dbField.put("progressiveSys10SAL06", "SAL06_CHARGES.PROGRESSIVE_SYS10"); attribute2dbField.put("valueSAL06", "SAL06_CHARGES.VALUE"); attribute2dbField.put("percSAL06", "SAL06_CHARGES.PERC"); attribute2dbField.put("vatCodeReg01SAL06", "SAL06_CHARGES.VAT_CODE_REG01"); attribute2dbField.put("currencyCodeReg03SAL06", "SAL06_CHARGES.CURRENCY_CODE_REG03"); attribute2dbField.put("enabledSAL06", "SAL06_CHARGES.ENABLED"); ArrayList values = new ArrayList(); values.add(serverLanguageId); // read from SAL06 table... Response res = CustomizeQueryUtil.getQuery( conn, userSessionPars, sql, values, attribute2dbField, ChargeVO.class, "Y", "N", context, gridParams, 50, true, new BigDecimal(292) // window identifier... ); if (res.isError()) return res; ArrayList list = ((VOListResponse) res).getRows(); ChargeVO vo = null; sql = "select SYS10_TRANSLATIONS.DESCRIPTION,REG01_VATS.VALUE,REG01_VATS.DEDUCTIBLE " + "from SYS10_TRANSLATIONS,REG01_VATS where " + "REG01_VATS.PROGRESSIVE_SYS10=SYS10_TRANSLATIONS.PROGRESSIVE and " + "SYS10_TRANSLATIONS.LANGUAGE_CODE=? and " + "REG01_VATS.VAT_CODE=?"; pstmt = conn.prepareStatement(sql); ResultSet rset = null; for (int i = 0; i < list.size(); i++) { vo = (ChargeVO) list.get(i); if (vo.getVatCodeReg01SAL06() != null) { // retrieve vat data from REG01... pstmt.setString(1, serverLanguageId); pstmt.setString(2, vo.getVatCodeReg01SAL06()); rset = pstmt.executeQuery(); if (rset.next()) { vo.setVatDescriptionSYS10(rset.getString(1)); vo.setVatValueREG01(rset.getBigDecimal(2)); vo.setVatDeductibleREG01(rset.getBigDecimal(3)); } rset.close(); } } Response answer = res; // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while fetching charges list", ex); return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Connection conn = null; PreparedStatement pstmt = null; try { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); ArrayList oldVOs = ((ArrayList[]) inputPar)[0]; ArrayList newVOs = ((ArrayList[]) inputPar)[1]; Map attribute2dbField = new HashMap(); attribute2dbField.put("companyCodeSys01DOC20", "COMPANY_CODE_SYS01"); attribute2dbField.put("progressiveDoc14DOC20", "PROGRESSIVE_DOC14"); attribute2dbField.put("progressiveSys10DOC20", "PROGRESSIVE_SYS10"); attribute2dbField.put("textValueDOC20", "TEXT_VALUE"); attribute2dbField.put("numValueDOC20", "NUM_VALUE"); attribute2dbField.put("dateValueDOC20", "DATE_VALUE"); HashSet pkAttributes = new HashSet(); pkAttributes.add("companyCodeSys01DOC20"); pkAttributes.add("progressiveDoc14DOC20"); pkAttributes.add("progressiveSys10DOC20"); Response res = null; DocPropertyVO oldVO = null; DocPropertyVO newVO = null; pstmt = conn.prepareStatement( "select PROGRESSIVE_DOC14 from DOC20_DOC_PROPERTIES where " + "COMPANY_CODE_SYS01=? and PROGRESSIVE_DOC14=? and PROGRESSIVE_SYS10=?"); ResultSet rset = null; for (int i = 0; i < oldVOs.size(); i++) { oldVO = (DocPropertyVO) oldVOs.get(i); newVO = (DocPropertyVO) newVOs.get(i); // check if the record already exists: if it does not exist, then insert it... pstmt.setString(1, newVO.getCompanyCodeSys01DOC20()); pstmt.setBigDecimal(2, newVO.getProgressiveDoc14DOC20()); pstmt.setBigDecimal(3, newVO.getProgressiveSys10DOC20()); rset = pstmt.executeQuery(); if (rset.next()) { // the record exixts: it will be updated... res = QueryUtil.updateTable( conn, userSessionPars, pkAttributes, oldVO, newVO, "DOC20_DOC_PROPERTIES", attribute2dbField, "Y", "N", context, true); if (res.isError()) { conn.rollback(); return res; } } else { // the record does not exixt: it will be inserted... res = QueryUtil.insertTable( conn, userSessionPars, newVO, "DOC20_DOC_PROPERTIES", attribute2dbField, "Y", "N", context, true); if (res.isError()) { conn.rollback(); return res; } } rset.close(); } Response answer = new VOListResponse(newVOs, false, newVOs.size()); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); conn.commit(); // fires the GenericEvent.AFTER_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.AFTER_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while updating property values for the specified document", ex); try { conn.rollback(); } catch (Exception ex3) { } return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
// New -- returns data in HashMap private static Map viewSignups( HttpServletRequest req, PrintWriter out, Connection con, boolean json_mode) { int wait_list_id = 0; int wait_list_signup_id = 0; int sum_players = 0; int date = 0; int pos = 1; int time = SystemUtils.getTime(con); int today_date = (int) SystemUtils.getDate(con); int start_time = 0; int end_time = 0; int count = 0; int index = 0; int player_index = 0; Map waitlist_map = new HashMap(); waitlist_map.put("options", new HashMap()); waitlist_map.put("signups", new LinkedHashMap()); String sindex = req.getParameter( "index"); // index value of day (needed by Proshop_waitlist_slot when returning) String id = req.getParameter("waitListId"); // uid of the wait list we are working with String course = (req.getParameter("course") == null) ? "" : req.getParameter("course"); String returnCourse = (req.getParameter("returnCourse") == null) ? "" : req.getParameter("returnCourse"); String sdate = (req.getParameter("sdate") == null) ? "" : req.getParameter("sdate"); String name = (req.getParameter("name") == null) ? "" : req.getParameter("name"); String day_name = (req.getParameter("day_name") == null) ? "" : req.getParameter("day_name"); String sstart_time = (req.getParameter("start_time") == null) ? "" : req.getParameter("start_time"); String send_time = (req.getParameter("end_time") == null) ? "" : req.getParameter("end_time"); // String count = (req.getParameter("count") == null) ? "" : req.getParameter("count"); String jump = req.getParameter("jump"); String fullName = ""; String cw = ""; String notes = ""; String nineHole = ""; PreparedStatement pstmt = null; PreparedStatement pstmt2 = null; boolean tmp_found = false; boolean tmp_found2 = false; boolean master = (req.getParameter("view") != null && req.getParameter("view").equals("master")); boolean show_notes = (req.getParameter("show_notes") != null && req.getParameter("show_notes").equals("yes")); boolean alt_row = false; boolean tmp_converted = false; try { date = Integer.parseInt(sdate); index = Integer.parseInt(sindex); wait_list_id = Integer.parseInt(id); start_time = Integer.parseInt(sstart_time); end_time = Integer.parseInt(send_time); } catch (NumberFormatException e) { } try { count = getWaitList.getListCount(wait_list_id, date, index, time, !master, con); } catch (Exception exp) { out.println(exp.getMessage()); } // // isolate yy, mm, dd // int yy = date / 10000; int temp = yy * 10000; int mm = date - temp; temp = mm / 100; temp = temp * 100; int dd = mm - temp; mm = mm / 100; String report_date = SystemUtils.getLongDateTime(today_date, time, " at ", con); if (!json_mode) { out.println("<br>"); out.println( "<h3 align=center>" + ((master) ? "Master Wait List Sign-up Sheet" : "Current Wait List Sign-ups") + "</h3>"); out.println("<p align=center><font size=3><b><i>\"" + name + "\"</i></b></font></p>"); out.println("<table border=0 align=center>"); out.println("<tr><td><font size=\"2\">"); out.println( "Date: <b>" + day_name + " " + mm + "/" + dd + "/" + yy + "</b></td>"); out.println("<td> </td><td>"); if (!course.equals("")) { out.println("<font size=\"2\">Course: <b>" + course + "</b></font>"); } out.println("</td></tr>"); out.println( "<tr><td><font size=\"2\">Time: <b>" + SystemUtils.getSimpleTime(start_time) + " to " + SystemUtils.getSimpleTime(end_time) + "</b></font></td>"); out.println("<td></td>"); out.println("<td><font size=\"2\">Signups: <b>" + count + "</b></font></td>"); out.println("</table>"); out.println( "<p align=center><font size=2><b><i>List Generated on " + report_date + "</i></b></font></p>"); out.println("<table align=center border=1 bgcolor=\"#F5F5DC\">"); if (master) { out.println( "<tr bgcolor=\"#8B8970\" align=center style=\"color: black; font-weight: bold\">" + "<td height=35> Pos </td>" + "<td>Sign-up Time</td>" + "<td>Members</td>" + "<td>Desired Time</td>" + "<td> Players </td>" + "<td> On Sheet </td>" + "<td>Converted At</td>" + "<td> Converted By </td>" + ((show_notes) ? "<td> Notes </td>" : "") + "</tr>"); } else { out.println( "<tr bgcolor=\"#8B8970\" align=center style=\"color: black; font-weight: bold\">" + "<td height=35> Pos </td>" + "<td>Members</td>" + "<td>Desired Time</td>" + "<td> Players </td>" + ((show_notes) ? "<td> Notes </td>" : "") + "</tr>"); // + // "<td> On Sheet </td>" + // "</tr>"); // ((multi == 0) ? "" : "<td>Course</td>") + } out.println( "<!-- wait_list_id=" + wait_list_id + ", date=" + date + ", time=" + time + " -->"); } try { pstmt = con.prepareStatement( "" + "SELECT *, " + "DATE_FORMAT(created_datetime, '%c/%e/%y %r') AS created_time, " + "DATE_FORMAT(converted_at, '%c/%e/%y %r') AS converted_time " + // %l:%i %p "FROM wait_list_signups " + "WHERE wait_list_id = ? AND date = ? " + ((master) ? "" : "AND converted = 0 ") + ((!master && sindex.equals("0")) ? "AND ok_etime > ? " : "") + "ORDER BY created_datetime"); pstmt.clearParameters(); pstmt.setInt(1, wait_list_id); pstmt.setInt(2, date); if (!master && sindex.equals("0")) { pstmt.setInt(3, time); } ResultSet rs = pstmt.executeQuery(); while (rs.next()) { wait_list_signup_id = rs.getInt("wait_list_signup_id"); if (json_mode) { ((Map) waitlist_map.get("signups")) .put("signup_id_" + wait_list_signup_id, new LinkedHashMap()); ((Map) ((Map) waitlist_map.get("signups")).get("signup_id_" + wait_list_signup_id)) .put("players", new LinkedHashMap()); ((Map) ((Map) waitlist_map.get("signups")).get("signup_id_" + wait_list_signup_id)) .put("options", new HashMap()); } else { out.print( "<tr align=center" + ((alt_row) ? " style=\"background-color:white\"" : "") + "><td>" + pos + "</td>"); if (master) { out.println("<td> " + rs.getString("created_time") + " </td>"); } out.print("<td align=left>"); } // if (multi == 1) out.println("<td>" + rs.getString("course") + "</td>"); // // Display players in this signup // pstmt2 = con.prepareStatement( "" + "SELECT * " + "FROM wait_list_signups_players " + "WHERE wait_list_signup_id = ? " + "ORDER BY pos"); pstmt2.clearParameters(); pstmt2.setInt(1, wait_list_signup_id); ResultSet rs2 = pstmt2.executeQuery(); tmp_found2 = false; player_index = 0; while (rs2.next()) { if (json_mode) { player_index++; ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("players")) .put("player_" + player_index, new HashMap()); ((Map) ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("players")) .get("player_" + player_index)) .put("player_name", rs2.getString("player_name")); ((Map) ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("players")) .get("player_" + player_index)) .put("player_name", rs2.getString("player_name")); ((Map) ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("players")) .get("player_" + player_index)) .put("cw", rs2.getString("cw")); ((Map) ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("players")) .get("player_" + player_index)) .put("9hole", rs2.getInt("9hole")); } else { fullName = rs2.getString("player_name"); cw = rs2.getString("cw"); if (rs2.getInt("9hole") == 1) { cw = cw + "9"; } if (tmp_found2) { out.print(", "); } else { out.print(" "); } out.print(fullName + " <font style=\"font-size:9px\">(" + cw + ")</font>"); tmp_found2 = true; } sum_players++; nineHole = ""; // reset } pstmt2.close(); if (json_mode) { ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("options")) .put("notes", notes); ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("options")) .put("created_time", rs.getInt("created_time")); ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("options")) .put("converted", rs.getInt("converted")); ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("options")) .put("converted_time", rs.getString("converted_time")); ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("options")) .put("converted_by", rs.getString("converted_by")); ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("options")) .put("start_time", SystemUtils.getSimpleTime(rs.getInt("ok_stime"))); ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("options")) .put("end_time", SystemUtils.getSimpleTime(rs.getInt("ok_etime"))); ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("options")) .put("wait_list_signup_id", wait_list_signup_id); ((Map) ((Map) ((Map) waitlist_map.get("signups")) .get("signup_id_" + wait_list_signup_id)) .get("options")) .put("player_count", sum_players); } else { out.print("</td>"); out.println( "<td> " + SystemUtils.getSimpleTime(rs.getInt("ok_stime")) + " - " + SystemUtils.getSimpleTime(rs.getInt("ok_etime")) + " </td>"); out.println("<td>" + sum_players + "</td>"); if (master) { tmp_converted = rs.getInt("converted") == 1; out.println("<td>" + ((tmp_converted) ? "Yes" : "No") + "</td>"); out.println( "<td>" + ((tmp_converted) ? rs.getString("converted_time") : " ") + "</td>"); out.println( "<td>" + ((tmp_converted) ? rs.getString("converted_by") : " ") + "</td>"); } if (show_notes) { notes = rs.getString("notes").trim(); if (notes.equals("")) { notes = " "; } out.println("<td>" + notes + "</td>"); } out.print("</tr>"); } pos++; sum_players = 0; alt_row = alt_row == false; } pstmt.close(); } catch (Exception exc) { SystemUtils.buildDatabaseErrMsg( "Error loading wait list signups.", exc.toString(), out, false); } if (json_mode) { ((Map) waitlist_map.get("options")).put("index", sindex); ((Map) waitlist_map.get("options")).put("wait_list_id", wait_list_id); ((Map) waitlist_map.get("options")).put("date", "" + mm + "/" + dd + "/" + yy); ((Map) waitlist_map.get("options")).put("name", name); ((Map) waitlist_map.get("options")).put("time", time); ((Map) waitlist_map.get("options")).put("jump", jump); ((Map) waitlist_map.get("options")).put("returnCourse", returnCourse); ((Map) waitlist_map.get("options")).put("course", course); ((Map) waitlist_map.get("options")).put("master", master); ((Map) waitlist_map.get("options")).put("report_date", report_date); ((Map) waitlist_map.get("options")).put("show_notes", show_notes); } else { out.println("</table><br>"); out.println("<table align=center><tr>"); out.println("<form action=\"Member_jump\" method=\"POST\" target=\"_top\">"); out.println("<input type=\"hidden\" name=\"jump\" value=\"0\">"); out.println("<input type=\"hidden\" name=\"index\" value=" + sindex + ">"); out.println( "<input type=\"hidden\" name=\"course\" value=\"" + ((!returnCourse.equals("")) ? returnCourse : course) + "\">"); out.println("<td><input type=\"submit\" value=\"Tee Sheet\"></td></form>"); out.println("<td> </td>"); out.println("<form action=\"Member_waitlist\" method=\"POST\">"); out.println("<input type=\"hidden\" name=\"waitListId\" value=\"" + wait_list_id + "\">"); out.println("<input type=\"hidden\" name=\"date\" value=\"" + date + "\">"); out.println("<input type=\"hidden\" name=\"day\" value=\"" + day_name + "\">"); out.println("<input type=\"hidden\" name=\"index\" value=\"" + sindex + "\">"); out.println("<input type=\"hidden\" name=\"course\" value=\"" + course + "\">"); out.println("<input type=\"hidden\" name=\"returnCourse\" value=\"" + returnCourse + "\">"); out.println("<input type=\"hidden\" name=\"jump\" value=\"" + jump + "\">"); out.println("<td><input type=\"submit\" value=\"Return\"></td></form>"); out.println("</tr></table></form>"); out.println("<br>"); } return waitlist_map; } // end viewSignups
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.apache.jasper.runtime.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write(" "); DataSource ds = null; Connection con = null; PreparedStatement ps = null; InitialContext ic; try { ic = new InitialContext(); ds = (DataSource) ic.lookup("java:/jdbc/AVMS"); // ds = (DataSource)ic.lookup( "java:/jboss" ); con = ds.getConnection(); ps = con.prepareStatement("SELECT * FROM dbo.ROLE"); // pr = con.prepareStatement("SELECT * FROM dbo.JMS_USERS"); ResultSet rs = ps.executeQuery(); while (rs.next()) { out.println("<br> " + rs.getString("role_name") + " | " + rs.getString("role_desc")); // out.println("<br> " +rs.getString("USERID") + " | " +rs.getString("PASSWD")); } rs.close(); ps.close(); } catch (Exception e) { out.println("Exception thrown :: " + e); } finally { if (con != null) { con.close(); } } out.write('\n'); out.write('\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); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
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); } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); Connection conn = null; PreparedStatement pstmt = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); ArrayList oldVOs = ((ArrayList[]) inputPar)[0]; ArrayList newVOs = ((ArrayList[]) inputPar)[1]; RoleFunctionCompanyVO oldVO = null; RoleFunctionCompanyVO newVO = null; Response res = null; for (int i = 0; i < oldVOs.size(); i++) { oldVO = (RoleFunctionCompanyVO) oldVOs.get(i); newVO = (RoleFunctionCompanyVO) newVOs.get(i); if (!oldVO.getCanView().booleanValue()) { // no record in SYS02 yet... if (newVO.getCanView().booleanValue()) { pstmt = conn.prepareStatement( "insert into SYS02_COMPANIES_ACCESS(PROGRESSIVE_SYS04,FUNCTION_CODE_SYS06,CAN_INS,CAN_UPD,CAN_DEL,COMPANY_CODE_SYS01) " + "values(?,?,?,?,?,?)"); pstmt.setBigDecimal(1, newVO.getProgressiveSys04SYS02()); pstmt.setString(2, newVO.getFunctionCodeSys06SYS02()); pstmt.setString(3, newVO.getCanInsSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(4, newVO.getCanUpdSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(5, newVO.getCanDelSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(6, newVO.getCompanyCodeSys01SYS02()); pstmt.execute(); } } else { // record already exists in SYS02... if (newVO.getCanView().booleanValue()) { // record in SYS02 will be updated... pstmt = conn.prepareStatement( "update SYS02_COMPANIES_ACCESS set CAN_INS=?,CAN_UPD=?,CAN_DEL=? where " + "PROGRESSIVE_SYS04=? and FUNCTION_CODE_SYS06=? and COMPANY_CODE_SYS01=? "); pstmt.setString(1, newVO.getCanInsSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(2, newVO.getCanUpdSYS02().booleanValue() ? "Y" : "N"); pstmt.setString(3, newVO.getCanDelSYS02().booleanValue() ? "Y" : "N"); pstmt.setBigDecimal(4, newVO.getProgressiveSys04SYS02()); pstmt.setString(5, newVO.getFunctionCodeSys06SYS02()); pstmt.setString(6, newVO.getCompanyCodeSys01SYS02()); pstmt.execute(); } else { // delete record from SYS02... pstmt = conn.prepareStatement( "delete from SYS02_COMPANIES_ACCESS where PROGRESSIVE_SYS04=? and FUNCTION_CODE_SYS06=? and COMPANY_CODE_SYS01=?"); pstmt.setBigDecimal(1, newVO.getProgressiveSys04SYS02()); pstmt.setString(2, newVO.getFunctionCodeSys06SYS02()); pstmt.setString(3, newVO.getCompanyCodeSys01SYS02()); pstmt.execute(); } } } Response answer = new VOListResponse(newVOs, false, newVOs.size()); // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); conn.commit(); // fires the GenericEvent.AFTER_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.AFTER_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while updating company-role-function settings", ex); try { pstmt.close(); } catch (Exception ex2) { } try { conn.rollback(); } catch (Exception ex3) { } return new ErrorResponse(ex.getMessage()); } finally { try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }
/** Business logic to execute. */ public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { Connection conn = null; PreparedStatement pstmt = null; try { conn = ConnectionManager.getConnection(context); // fires the GenericEvent.CONNECTION_CREATED event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.CONNECTION_CREATED, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, null)); Response responseVO = bean.insertItem( conn, (JournalHeaderVO) inputPar, userSessionPars, request, response, userSession, context); if (responseVO.isError()) { conn.rollback(); return responseVO; } if (inputPar instanceof JournalHeaderWithVatVO) { JournalHeaderWithVatVO vo = (JournalHeaderWithVatVO) inputPar; // insert vat rows in the specified vat register... Response regRes = vatRegisterAction.insertVatRows( conn, vo.getVats(), userSessionPars, request, response, userSession, context); if (regRes.isError()) { conn.rollback(); return regRes; } // retrieve payment instalments... Response payRes = payAction.executeCommand( new LookupValidationParams(vo.getPaymentCodeREG10(), new HashMap()), userSessionPars, request, response, userSession, context); if (payRes.isError()) { conn.rollback(); return payRes; } PaymentVO payVO = (PaymentVO) ((VOListResponse) payRes).getRows().get(0); GridParams gridParams = new GridParams(); gridParams .getOtherGridParams() .put(ApplicationConsts.PAYMENT_CODE_REG10, vo.getPaymentCodeREG10()); payRes = paysAction.executeCommand( gridParams, userSessionPars, request, response, userSession, context); if (payRes.isError()) { conn.rollback(); return payRes; } java.util.List rows = ((VOListResponse) payRes).getRows(); // create expirations in DOC19 ONLY if: // - there are more than one instalment OR // - there is only one instalment and this instalment has more than 0 instalment days if (rows.size() > 1 || (rows.size() == 1 && ((PaymentInstalmentVO) rows.get(0)).getInstalmentDaysREG17().intValue() > 0)) { // retrieve internationalization settings (Resources object)... ServerResourcesFactory factory = (ServerResourcesFactory) context.getAttribute(Controller.RESOURCES_FACTORY); Resources resources = factory.getResources(userSessionPars.getLanguageId()); PaymentInstalmentVO inVO = null; pstmt = conn.prepareStatement( "insert into DOC19_EXPIRATIONS(COMPANY_CODE_SYS01,DOC_TYPE,DOC_YEAR,DOC_NUMBER,DOC_SEQUENCE,PROGRESSIVE,DOC_DATE,EXPIRATION_DATE,NAME_1,NAME_2,VALUE,PAYED,DESCRIPTION,CUSTOMER_SUPPLIER_CODE,PROGRESSIVE_REG04,CURRENCY_CODE_REG03) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); long startTime = vo.getItemDateACC05().getTime(); // item date... if (payVO.getStartDayREG10().equals(ApplicationConsts.START_DAY_END_MONTH)) { Calendar cal = Calendar.getInstance(); if (cal.get(cal.MONTH) == 10 || cal.get(cal.MONTH) == 3 || cal.get(cal.MONTH) == 5 || cal.get(cal.MONTH) == 8) cal.set(cal.DAY_OF_MONTH, 30); else if (cal.get(cal.MONTH) == 1) { if (cal.get(cal.YEAR) % 4 == 0) cal.set(cal.DAY_OF_MONTH, 29); else cal.set(cal.DAY_OF_MONTH, 28); } else cal.set(cal.DAY_OF_MONTH, 31); startTime = cal.getTime().getTime(); } BigDecimal amount = null; for (int i = 0; i < rows.size(); i++) { inVO = (PaymentInstalmentVO) rows.get(i); pstmt.setString(1, vo.getCompanyCodeSys01ACC05()); pstmt.setString(2, vo.getDocTypeDOC19()); pstmt.setBigDecimal(3, vo.getItemYearACC05()); pstmt.setBigDecimal(4, null); pstmt.setBigDecimal(5, vo.getDocSequenceDOC19()); pstmt.setBigDecimal( 6, ProgressiveUtils.getConsecutiveProgressive( "DOC19_EXPIRATIONS", "PROGRESSIVE", conn)); pstmt.setDate(7, vo.getItemDateACC05()); pstmt.setDate( 8, new java.sql.Date( startTime + inVO.getInstalmentDaysREG17().longValue() * 86400 * 1000)); // expiration date pstmt.setString(9, vo.getName_1REG04()); pstmt.setString(10, vo.getName_2REG04()); amount = vo.getTotalValue() .multiply(inVO.getPercentageREG17()) .divide(new BigDecimal(100), BigDecimal.ROUND_HALF_UP) .setScale(vo.getTotalValue().scale(), BigDecimal.ROUND_HALF_UP); // value pstmt.setBigDecimal(11, amount); pstmt.setString(12, "N"); if (vo.getDocTypeDOC19().equals(ApplicationConsts.SALE_GENERIC_INVOICE)) pstmt.setString( 13, resources.getResource("sale generic document") + " " + vo.getDocSequenceDOC19() + "/" + vo.getItemYearACC05() + " - " + resources.getResource("valueREG01") + " " + resources.getResource("rateNumberREG17") + " " + (i + 1) + " - " + inVO.getPaymentTypeDescriptionSYS10()); // description else pstmt.setString( 13, resources.getResource("purchase generic document") + " " + vo.getDocSequenceDOC19() + "/" + vo.getItemYearACC05() + " - " + resources.getResource("valueREG01") + " " + resources.getResource("rateNumberREG17") + " " + (i + 1) + " - " + inVO.getPaymentTypeDescriptionSYS10()); // description pstmt.setString(14, vo.getCustomerCodeSAL07()); pstmt.setBigDecimal(15, vo.getProgressiveREG04()); pstmt.setString(16, vo.getCurrencyCodeREG01()); pstmt.execute(); } pstmt.close(); } // create an item registration for proceeds, according to expiration settings (e.g. retail // selling): // there must be only one instalment and this instalment has 0 instalment days if (rows.size() == 1 && ((PaymentInstalmentVO) rows.get(0)).getInstalmentDaysREG17().intValue() == 0) { // retrieve internationalization settings (Resources object)... ServerResourcesFactory factory = (ServerResourcesFactory) context.getAttribute(Controller.RESOURCES_FACTORY); Resources resources = factory.getResources(userSessionPars.getLanguageId()); HashMap map = new HashMap(); map.put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01ACC05()); map.put(ApplicationConsts.PARAM_CODE, ApplicationConsts.CASE_ACCOUNT); Response res = userParamAction.executeCommand( map, userSessionPars, request, response, userSession, context); if (res.isError()) { conn.rollback(); return res; } String caseAccountCode = ((VOResponse) res).getVo().toString(); JournalHeaderVO jhVO = new JournalHeaderVO(); jhVO.setCompanyCodeSys01ACC05(vo.getCompanyCodeSys01ACC05()); if (vo.getDocTypeDOC19().equals(ApplicationConsts.SALE_GENERIC_INVOICE)) { jhVO.setDescriptionACC05( resources.getResource("sale generic document") + " " + vo.getDocSequenceDOC19() + "/" + vo.getItemYearACC05() + " - " + resources.getResource("customer") + " " + vo.getName_1REG04() + " " + (vo.getName_2REG04() == null ? "" : vo.getName_2REG04())); jhVO.setAccountingMotiveCodeAcc03ACC05(ApplicationConsts.MOTIVE_INVOICE_PROCEEDS); } else { jhVO.setDescriptionACC05( resources.getResource("purchase generic document") + " " + vo.getDocSequenceDOC19() + "/" + vo.getItemYearACC05() + " - " + resources.getResource("supplier") + " " + vo.getName_1REG04() + " " + (vo.getName_2REG04() == null ? "" : vo.getName_2REG04())); jhVO.setAccountingMotiveCodeAcc03ACC05(ApplicationConsts.MOTIVE_PURCHASE_INVOICE_PAYED); } jhVO.setItemDateACC05(new java.sql.Date(System.currentTimeMillis())); jhVO.setItemYearACC05(new BigDecimal(Calendar.getInstance().get(Calendar.YEAR))); JournalRowVO jrVO = new JournalRowVO(); jrVO.setCompanyCodeSys01ACC06(jhVO.getCompanyCodeSys01ACC05()); if (vo.getDocTypeDOC19().equals(ApplicationConsts.SALE_GENERIC_INVOICE)) { jrVO.setAccountCodeAcc02ACC06(vo.getCreditAccountCodeAcc02SAL07()); jrVO.setAccountCodeACC06(vo.getCustomerCodeSAL07()); jrVO.setAccountCodeTypeACC06(ApplicationConsts.ACCOUNT_TYPE_CUSTOMER); jrVO.setCreditAmountACC06(vo.getTotalValue()); } else { jrVO.setAccountCodeAcc02ACC06(vo.getDebitAccountCodeAcc02PUR01()); jrVO.setAccountCodeACC06(vo.getSupplierCodePUR01()); jrVO.setAccountCodeTypeACC06(ApplicationConsts.ACCOUNT_TYPE_SUPPLIER); jrVO.setDebitAmountACC06(vo.getTotalValue()); } jrVO.setDescriptionACC06(""); jrVO.setItemYearAcc05ACC06(jhVO.getItemYearACC05()); jrVO.setProgressiveAcc05ACC06(jhVO.getProgressiveACC05()); jhVO.addJournalRow(jrVO); jrVO = new JournalRowVO(); jrVO.setCompanyCodeSys01ACC06(jhVO.getCompanyCodeSys01ACC05()); jrVO.setAccountCodeAcc02ACC06(caseAccountCode); jrVO.setAccountCodeACC06(caseAccountCode); jrVO.setAccountCodeTypeACC06(ApplicationConsts.ACCOUNT_TYPE_ACCOUNT); if (vo.getDocTypeDOC19().equals(ApplicationConsts.SALE_GENERIC_INVOICE)) { jrVO.setDebitAmountACC06(vo.getTotalValue()); } else { jrVO.setCreditAmountACC06(vo.getTotalValue()); } jrVO.setDescriptionACC06(""); jrVO.setItemYearAcc05ACC06(jhVO.getItemYearACC05()); jrVO.setProgressiveAcc05ACC06(jhVO.getProgressiveACC05()); jhVO.addJournalRow(jrVO); Response proceedsRes = bean.insertItem(conn, jhVO, userSessionPars, request, response, userSession, context); if (proceedsRes.isError()) { conn.rollback(); return proceedsRes; } } } Response answer = responseVO; // fires the GenericEvent.BEFORE_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.BEFORE_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); conn.commit(); // fires the GenericEvent.AFTER_COMMIT event... EventsManager.getInstance() .processEvent( new GenericEvent( this, getRequestName(), GenericEvent.AFTER_COMMIT, (JAIOUserSessionParameters) userSessionPars, request, response, userSession, context, conn, inputPar, answer)); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while inserting a new item in the journal", ex); try { conn.rollback(); } catch (Exception ex3) { } return new ErrorResponse(ex.getMessage()); } finally { try { pstmt.close(); } catch (Exception ex2) { } try { ConnectionManager.releaseConnection(conn, context); } catch (Exception ex1) { } } }