From 9efc2282c2f5d923605c83c7ebfe4a0e10a9b6e4 Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Wed, 12 Apr 2017 10:21:21 -0400 Subject: [PATCH 1/4] Error Page Exists Now --- WebContent/WEB-INF/web.xml | 11 +++++ .../my-icons-collection-128px/png/warning.png | Bin 0 -> 3138 bytes WebContent/html/webpages/error.jsp | 40 ++++++++++++++++++ WebContent/html/webpages/navbar.jsp | 13 +++--- src/entities/User.java | 4 ++ 5 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 WebContent/WEB-INF/web.xml create mode 100644 WebContent/html/imgs/my-icons-collection-128px/png/warning.png create mode 100644 WebContent/html/webpages/error.jsp diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000..c98448e --- /dev/null +++ b/WebContent/WEB-INF/web.xml @@ -0,0 +1,11 @@ + + + Application Name + + index.jsp + + + 404 + /html/webpages/error.jsp + + \ No newline at end of file diff --git a/WebContent/html/imgs/my-icons-collection-128px/png/warning.png b/WebContent/html/imgs/my-icons-collection-128px/png/warning.png new file mode 100644 index 0000000000000000000000000000000000000000..68f62c6ec0844943f3acd12e7d9b4f528ad3c682 GIT binary patch literal 3138 zcmV-I488M-P)__RFik(rhF_XRtr`; zRu5J`)(F-Z)&!Ox>oS#}{@ED)JN@+Ew9}tKepY@ej#Vm{or~3k)rB>LHHn2dX_Eeq zF8Vuj6#(K5w_(*|bzqHRUEyeWB3+@+u$w-UO##5qco$YTR?tGj6Ddfa(WL-jV|pQ0 z8`ikQrpMAaefB~HfPUji(A9@^6`=8vx=P>0sQ^f9d>z(63YZ>CzFT$E7Iv`;u$&zp(<^QL|kN z0O*_#=d+Lhrw2||PBTBGsqe3aHXYp#_FEO8}tj zd{9e0-&Z%F;7Dmq0JN##`5K5z#7rvy@IZ^A{fDdLny=}63GzL-9vTE5p#aeBT~IrG zQ;)ArY<_4eI97$co51ZDHVXlO9_+x{+sE^I;Dhp{0nh@%wmOJs2M(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O9?*%^oo?$nACL6Tz1P4GAAadz_2VL~$6Q0-K zOw!-cMSo{5^zj1^Kny7IX&~7`??vpPH>8fxyOJm9t?8Gk{PfSp=-=t5|E8V(4Dz$` cQ*o^R2Wv_%4$#d22><{907*qoM6N<$f_`kv@c;k- literal 0 HcmV?d00001 diff --git a/WebContent/html/webpages/error.jsp b/WebContent/html/webpages/error.jsp new file mode 100644 index 0000000..91076ee --- /dev/null +++ b/WebContent/html/webpages/error.jsp @@ -0,0 +1,40 @@ + + + + + + + + + + + Synchrony Financial + + + + + + + + + + + +
+

Error

+ +

Page Does Not Exist

+
+ + \ No newline at end of file diff --git a/WebContent/html/webpages/navbar.jsp b/WebContent/html/webpages/navbar.jsp index ab6850c..b647029 100644 --- a/WebContent/html/webpages/navbar.jsp +++ b/WebContent/html/webpages/navbar.jsp @@ -8,10 +8,11 @@ - + -      -

+
+ +

+ +<% +Cookie[] usercookies = request.getCookies(); +String navsso = "invalid"; +String navname = "error"; +User self = new User(); +Cookie newCookie; +//iterate cookies +if(usercookies != null){ + for(Cookie c : usercookies){ + if(c.getName().equals("ssoNum")){//when (and if) we get to user cookie we want to reset it + navsso = c.getValue(); + c.setMaxAge(0);//delete current + newCookie = new Cookie("ssoNum",navsso);//make new one + newCookie.setMaxAge(30*60); + response.addCookie(newCookie); + break; + } + } +} +if(navsso.equals("invalid") == false)//if we did get cookie, redirect to the homepage! + response.sendRedirect("html/webpages/index.jsp"); + %> From f6a8c2ea5e932f7dadd742bc8a0241c1deb6e1bb Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Wed, 12 Apr 2017 14:19:35 -0400 Subject: [PATCH 3/4] Handling MySQL Errors Max User Connections problem should be really fixed at this point. You also cannot delete a location unless no devices/employees are there. There is now a "something went wrong!" page in case someone works around that. --- WebContent/adminLogin.jsp | 17 +- .../my-icons-collection-128px/png/wrong.png | Bin 0 -> 4009 bytes WebContent/html/webpages/adminLocation.jsp | 13 +- WebContent/html/webpages/deviceRedirect.jsp | 1 - WebContent/html/webpages/locationRedirect.jsp | 6 +- .../html/webpages/profileSettingsRedirect.jsp | 1 - WebContent/html/webpages/somethingwrong.jsp | 40 +++++ WebContent/index.jsp | 14 +- WebContent/userLogin.jsp | 17 +- src/database/EmployeeQueries.java | 43 +++-- src/database/LocationQueries.java | 150 ++++++++++++------ src/database/MySQLAccess.java | 32 ---- src/database/TicketQueries.java | 32 ++-- src/entities/Location.java | 27 +++- 14 files changed, 262 insertions(+), 131 deletions(-) create mode 100644 WebContent/html/imgs/my-icons-collection-128px/png/wrong.png create mode 100644 WebContent/html/webpages/somethingwrong.jsp delete mode 100644 src/database/MySQLAccess.java diff --git a/WebContent/adminLogin.jsp b/WebContent/adminLogin.jsp index de40b3c..6341098 100644 --- a/WebContent/adminLogin.jsp +++ b/WebContent/adminLogin.jsp @@ -8,10 +8,15 @@ String pass; Cookie adminCookie; ssoNum = Integer.parseInt(request.getParameter("ssoNum2")); pass = request.getParameter("pass"); -MySQLAccess myaccess = new MySQLAccess(); -Statement statement = myaccess.getStatement(); +String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317"; +String user = "b372dfe7409692"; +String password = "74f6e317"; +System.getenv("VCAP_SERVICES"); +Class.forName("com.mysql.jdbc.Driver"); +Connection connection = DriverManager.getConnection(database, user, password); +Statement stmt = connection.createStatement(); ResultSet result; -result = statement.executeQuery("select * FROM admin where Admin_ID='" + ssoNum + "' AND Password='" + pass + "'"); +result = stmt.executeQuery("select * FROM admin where Admin_ID='" + ssoNum + "' AND Password='" + pass + "'"); if (result.next()){ request.getSession(); @@ -19,10 +24,12 @@ if (result.next()){ adminCookie = new Cookie("ssoNum", Integer.toString(ssoNum)); adminCookie.setMaxAge(30*60); response.addCookie(adminCookie); - statement.close(); + stmt.close(); + connection.close(); response.sendRedirect("html/webpages/admin.jsp"); } else { - statement.close(); + stmt.close(); + connection.close(); response.sendRedirect("index.jsp"); } diff --git a/WebContent/html/imgs/my-icons-collection-128px/png/wrong.png b/WebContent/html/imgs/my-icons-collection-128px/png/wrong.png new file mode 100644 index 0000000000000000000000000000000000000000..6107cee75857189a2ae7b24ce9ed3feb88795a14 GIT binary patch literal 4009 zcmV;a4_5GrP)ro~`F;yO~`!&0B~D-sSG4 zyhQ5_TfDcLF4mJ|-r^~%?b$FZDFp@zP*TJztAN}QL>c6oGk`a671U&qfpPWS-)}g> z0-k}HIq!Mr%<%s4`J>cxe)Ii)&wHOay$B(_I6W6G0uKNefd_!Y1Hj<{;P3!&cmSM) zTfeOQ1Kafhb@W@H-v=Hm3ImMgd{KHO7W_MH8?S zn1aFN0ibXE<3I>-PC=%d<2n!uJi!AX-T1!1R-oAdj2CMaz62iS0kGcq0YDt^Uk5b4 zGdkcC;P*TLmQCBfbrR#nx`s7M955=u_&&fwpxz0M?+i{)R{;<30JNI_5>U_sj2D|m zy7uS*2-Bv99%#Oa7GOz_3xF`6-(ZKu8>JFu&n|(r`40j6xaoJHw$~Cf>;Ario89G1 zVUkk@06y4c;08CjTkZ&}o_(Am078Gip7-}wlf-IVAa?-5xS2MS2;Aea0f6E^;3i6D zt3w7rIGn+oeL8&XPyv8~hYP1@xOwz=#~}g$g+2>h;f7J?7T}}k0N|D0f^-0FaulJ-zp{mP|Q+p3Uk&dA^=dxlRbP(*Pdq%pHV^p z_|BgF*lX7SKmjwj33kWNE&+fWKMeeb8(?=Tf&1+dfQ?*y#juWP0N{p?@V$LSfy?gC zu?)axTy({8fJp#^uVFVb`A`+_5rcXGX~~~UnsfX~%ZWL}P_z*K{|aTBQEsYxj!^ep zq3-wOzV|p50oWwB>H5rRJzdG;DkNE_4xn$<0JJ(wsd*Ibi_P^%+oi!f>eX zIq|w9pC?WG+@bEbpw7Z6{ zAP&qKfM@QA4+xa8fpv^#iQj9QV#%Jv>){&Uhu@C zX*5J^d!lv^lYLxZC|gc+aRZfH_gpywKz-`hw0~sRqCmHxPxd1%d9#d9T=Vf+M1Rx= z#B%AnJ4o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SbT1IO8-5w5>HM$3F^0T4p)XW*)o05lv5B){$n=n*ugEVNs{FG~PA|GFrL zI>EHfryc+y1S`2&)QOqhAq4;6rcpzME3b0+BwGN45Cn1aBoi&C`LYH;2*LZ@ zM4O2L?vc|U*#jVi-~(=^)x@zdpGg4PwFGy#u@;+uFAHCo1waUauhew{C+C*XTJ~n; z3DW=wA$SVN<7SJl@VT?}!Y%<2LU14O4L7}wBea)y6&-+fL3oSB31bC=zm>FB?rEN4 z10aOpMIgHenqLWwx2N`s2td0a%n(FzcH^%L3uN~xL3hOjpxxLYND#@{jK`zfp}-%N zqPOA#&@Kp%0ACBDIfMBLKtHAFtk?jw3qn8O2L~M};@r#;0C0r& z44wf#1fEd3t_~9bkyZiEAJ!dnIJ;x%NxR( P00000NkvXXu0mjfB+!)1 literal 0 HcmV?d00001 diff --git a/WebContent/html/webpages/adminLocation.jsp b/WebContent/html/webpages/adminLocation.jsp index 1e75e6d..1a22413 100644 --- a/WebContent/html/webpages/adminLocation.jsp +++ b/WebContent/html/webpages/adminLocation.jsp @@ -230,8 +230,8 @@ - - + + @@ -323,6 +323,15 @@ function modifyModal(){ $("#modifyState").val(locations[i].state); $("#modifyZip").val(locations[i].zip); $("#modifyID").val(locations[i].id); + + if(locations[i].numDevices > 0 || locations[i].numEmployees > 0){ + $('#thedeletebutton').attr('disabled',true); + $('#thedeletebutton').attr('title','Cannot delete because devices and/or employees are at this location!'); + } + else{ + $('#thedeletebutton').attr('disabled',false); + $('#thedeletebutton').removeAttr('title'); + } $("#modifyModal").show(); } diff --git a/WebContent/html/webpages/deviceRedirect.jsp b/WebContent/html/webpages/deviceRedirect.jsp index d0e4ceb..8b90d60 100644 --- a/WebContent/html/webpages/deviceRedirect.jsp +++ b/WebContent/html/webpages/deviceRedirect.jsp @@ -28,7 +28,6 @@ <% //make instance -MySQLAccess myaccess = new MySQLAccess(); String name = request.getParameter("name").replace("\"","\\\""); String description = request.getParameter("description").replace("\"","\\\""); String status = request.getParameter("status"); diff --git a/WebContent/html/webpages/locationRedirect.jsp b/WebContent/html/webpages/locationRedirect.jsp index 5483488..3995a44 100644 --- a/WebContent/html/webpages/locationRedirect.jsp +++ b/WebContent/html/webpages/locationRedirect.jsp @@ -34,6 +34,7 @@ String address = request.getParameter("address").replace("\"","\\\""); String town = request.getParameter("town").replace("\"","\\\""); String state = request.getParameter("state"); String zip = request.getParameter("zip"); +int er = 0; //add form was submitted if(request.getParameter("add") != null){ Location location = new Location(name,address,town,state,zip,0); @@ -52,11 +53,14 @@ if(request.getParameter("modify") != null){ if(request.getParameter("delete") != null){ String strID = request.getParameter("id"); int id = Integer.parseInt(strID); - LocationQueries.deleteLocation(id); + er = LocationQueries.deleteLocation(id); } %> diff --git a/WebContent/html/webpages/profileSettingsRedirect.jsp b/WebContent/html/webpages/profileSettingsRedirect.jsp index bbce74c..da95137 100644 --- a/WebContent/html/webpages/profileSettingsRedirect.jsp +++ b/WebContent/html/webpages/profileSettingsRedirect.jsp @@ -28,7 +28,6 @@ <% //make instance -MySQLAccess myaccess = new MySQLAccess(); String name = request.getParameter("name").replace("\"","\\\""); int id = Integer.parseInt(request.getParameter("sso")); String phone = request.getParameter("phone"); diff --git a/WebContent/html/webpages/somethingwrong.jsp b/WebContent/html/webpages/somethingwrong.jsp new file mode 100644 index 0000000..d86d296 --- /dev/null +++ b/WebContent/html/webpages/somethingwrong.jsp @@ -0,0 +1,40 @@ + + + + + + + + + + + Synchrony Financial + + + + + + + + + + + +
+

Something Went Wrong!

+ +

Try Again Later.

+
+ + \ No newline at end of file diff --git a/WebContent/index.jsp b/WebContent/index.jsp index 81aecdd..c9e4a6a 100644 --- a/WebContent/index.jsp +++ b/WebContent/index.jsp @@ -68,7 +68,7 @@ div.menuOption{ display: inline-block; width: 250px; - height: 150px; + height: 210px; vertical-align: top; border: solid; padding: 10px; @@ -95,16 +95,16 @@ @@ -124,7 +124,7 @@ if(usercookies != null){ if(c.getName().equals("ssoNum")){//when (and if) we get to user cookie we want to reset it navsso = c.getValue(); c.setMaxAge(0);//delete current - newCookie = new Cookie("ssoNum",navsso);//make new one + newCookie = new Cookie("ssoNum",navsso); //make new one newCookie.setMaxAge(30*60); response.addCookie(newCookie); break; diff --git a/WebContent/userLogin.jsp b/WebContent/userLogin.jsp index 5c3805d..54f84ca 100644 --- a/WebContent/userLogin.jsp +++ b/WebContent/userLogin.jsp @@ -6,10 +6,15 @@ int ssoNum; Cookie userCookie; ssoNum = Integer.parseInt(request.getParameter("ssoNum")); -MySQLAccess myaccess = new MySQLAccess(); -Statement statement = myaccess.getStatement(); +System.getenv("VCAP_SERVICES"); +Class.forName("com.mysql.jdbc.Driver"); +String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317"; +String user = "b372dfe7409692"; +String password = "74f6e317"; +Connection connection = DriverManager.getConnection(database, user, password); +Statement stmt = connection.createStatement(); ResultSet result; -result = statement.executeQuery("select * FROM employee where Employee_ID='" + ssoNum + "'"); +result = stmt.executeQuery("select * FROM employee where Employee_ID='" + ssoNum + "'"); if (result.next()){ request.getSession(); @@ -17,10 +22,12 @@ if (result.next()){ userCookie = new Cookie("ssoNum", Integer.toString(ssoNum)); userCookie.setMaxAge(30*60); response.addCookie(userCookie); - statement.close(); + stmt.close(); + connection.close(); response.sendRedirect("html/webpages/index.jsp"); } else { - statement.close(); + stmt.close(); + connection.close(); response.sendRedirect("index.jsp"); } diff --git a/src/database/EmployeeQueries.java b/src/database/EmployeeQueries.java index 5930e08..3c5b3af 100644 --- a/src/database/EmployeeQueries.java +++ b/src/database/EmployeeQueries.java @@ -12,17 +12,22 @@ public class EmployeeQueries { public static void initializeEmployee(int id) throws ClassNotFoundException, SQLException { - MySQLAccess access = new MySQLAccess(); - Statement statement = access.getStatement(); - statement.executeUpdate("INSERT INTO employee (Employee_ID) VALUES ("+id+");"); - access.closeConnection(); + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + stmt.executeUpdate("INSERT INTO employee (Employee_ID) VALUES ("+id+");"); + stmt.close(); + connection.close(); } public static void updateEmployee(int id, String name, String phone, int location, String email) throws ClassNotFoundException, SQLException { System.out.println("Updating employee "+id+": "+name+".\nPhone: "+phone+", location: "+location); - MySQLAccess access = new MySQLAccess(); - Statement statement = access.getStatement(); + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); String query = ""; query+="UPDATE employee SET "; query+="Name='"+name; @@ -31,8 +36,9 @@ public static void updateEmployee(int id, String name, String phone, int locatio query+=", Email='"+email; query+="' WHERE Employee_ID="+id; System.out.println(query); - statement.executeUpdate(query); - access.closeConnection(); + stmt.executeUpdate(query); + stmt.close(); + connection.close(); } public static void updateEmployee(int id, String name, int icon, String phone, String email) throws ClassNotFoundException, SQLException @@ -57,9 +63,11 @@ public static void updateEmployee(int id, String name, int icon, String phone, S public static User getEmployeeByID(int id) throws ClassNotFoundException, SQLException { - MySQLAccess access = new MySQLAccess(); - Statement statement = access.getStatement(); - ResultSet resultSet = statement.executeQuery("Select * FROM employee WHERE Employee_ID = "+id); + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + ResultSet resultSet = stmt.executeQuery("Select * FROM employee WHERE Employee_ID = "+id); resultSet.next(); User employee = new User( id, @@ -69,18 +77,20 @@ public static User getEmployeeByID(int id) throws ClassNotFoundException, SQLExc resultSet.getString("Email"), resultSet.getInt("Img_Index") ); - resultSet = statement.executeQuery("SELECT Address FROM location WHERE Location_ID = "+employee.getLocation()); + resultSet = stmt.executeQuery("SELECT Address FROM location WHERE Location_ID = "+employee.getLocation()); resultSet.next(); employee.setLocationName(resultSet.getString("Address")); - access.closeConnection(); + stmt.close(); + connection.close(); return employee; } public static User[] getAllUsers() throws SQLException, ClassNotFoundException{ //database connect System.getenv("VCAP_SERVICES"); - MySQLAccess access = new MySQLAccess(); - Statement stmt = access.getStatement(); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); ResultSet resultSet = stmt.executeQuery("SELECT * FROM employee"); int counter = 0; @@ -97,7 +107,8 @@ public static User[] getAllUsers() throws SQLException, ClassNotFoundException{ counter++; } - access.closeConnection(); + stmt.close(); + connection.close(); return users; } } \ No newline at end of file diff --git a/src/database/LocationQueries.java b/src/database/LocationQueries.java index 7dc01a1..eb5d6f5 100644 --- a/src/database/LocationQueries.java +++ b/src/database/LocationQueries.java @@ -6,24 +6,36 @@ public class LocationQueries { + private static String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317"; + private static String user = "b372dfe7409692"; + private static String password = "74f6e317"; + public static int locationStringToInt(String locString) throws SQLException, ClassNotFoundException { - MySQLAccess access = new MySQLAccess(); - Statement statement = access.getStatement(); - ResultSet resultSet = statement.executeQuery("SELECT Location_ID FROM location WHERE Address = '"+locString+"'"); + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT Location_ID FROM location WHERE Address = '"+locString+"'"); resultSet.next(); - access.closeConnection(); - return resultSet.getInt("Location_ID"); + int returnResult = resultSet.getInt("Location_ID"); + stmt.close(); + connection.close(); + return returnResult; } public static String locationIntToString(int locInt) throws ClassNotFoundException, SQLException { - MySQLAccess access = new MySQLAccess(); - Statement statement = access.getStatement(); - ResultSet resultSet = statement.executeQuery("SELECT Address FROM location WHERE Location_ID = "+locInt); + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT Address FROM location WHERE Location_ID = "+locInt); resultSet.next(); - access.closeConnection(); - return resultSet.getString("Address"); + String returnResult = resultSet.getString("Address"); + stmt.close(); + connection.close(); + return returnResult; } // returns ID of new location @@ -36,8 +48,9 @@ public static int addLocation(String name, String state, String address, String public static int addLocation(Location location) throws SQLException, ClassNotFoundException { System.getenv("VCAP_SERVICES"); - MySQLAccess access = new MySQLAccess(); - Statement stmt = access.getStatement(); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); int i = -1; int id=0; while(i <= 0){ @@ -50,16 +63,18 @@ public static int addLocation(Location location) throws SQLException, ClassNotFo System.out.println("INSERT INTO location (Location_ID,Name,Address,Town,State,Zip_Code,Employee_Flag) VALUES (" + id +",\"" + location.getName() + "\",\"" + location.getAddress()+ "\",\"" + location.getTown() + "\",\"" + location.getState() + "\",\"" + location.getZip()+"\","+location.getEmployeeFlag() + ")"); i = stmt.executeUpdate("INSERT INTO location (Location_ID,Name,Address,Town,State,Zip_Code,Employee_Flag) VALUES (" + id +",\"" + location.getName() + "\",\"" + location.getAddress()+ "\",\"" + location.getTown() + "\",\"" + location.getState() + "\",\"" + location.getZip()+"\","+location.getEmployeeFlag() + ")"); } - access.closeConnection(); + stmt.close(); + connection.close(); return id; } public static Location[] getAdminLocations() throws ClassNotFoundException, SQLException{ //database connect System.getenv("VCAP_SERVICES"); - MySQLAccess access = new MySQLAccess(); - Statement stmt = access.getStatement(); - ResultSet resultSet = stmt.executeQuery("SELECT * FROM location WHERE Zip_Code <> \"00000\""); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT * FROM location WHERE Employee_Flag = 0"); int counter = 0; resultSet.last(); @@ -74,7 +89,8 @@ public static Location[] getAdminLocations() throws ClassNotFoundException, SQLE locations[counter] = new Location(resultSet.getInt("Location_ID"),resultSet.getString("Name"),resultSet.getString("Address"),resultSet.getString("Town"),resultSet.getString("State"),resultSet.getString("Zip_Code")); counter++; } - access.closeConnection(); + stmt.close(); + connection.close(); return locations; } @@ -85,12 +101,14 @@ public static Location[] getLocations() throws ClassNotFoundException, SQLExcept public static Location[] getLocations(int userID) throws SQLException, ClassNotFoundException { String query = "SELECT * FROM location WHERE Employee_Flag = 0 OR Employee_Flag = "+userID+" ORDER BY Name ASC"; //TODO filter for custom locations (needs db change) - MySQLAccess access = new MySQLAccess(); - Statement statement = access.getStatement(); - ResultSet rs = statement.executeQuery("SELECT COUNT(Location_ID) FROM location WHERE Employee_Flag = 0 OR Employee_Flag = "+userID); + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + ResultSet rs = stmt.executeQuery("SELECT COUNT(Location_ID) FROM location WHERE Employee_Flag = 0 OR Employee_Flag = "+userID); rs.next(); Location[] locations = new Location[rs.getInt("COUNT(Location_ID)")]; - rs = statement.executeQuery(query); + rs = stmt.executeQuery(query); int i=0; while(rs.next()) { @@ -104,7 +122,8 @@ public static Location[] getLocations(int userID) throws SQLException, ClassNotF ); i++; } - access.closeConnection(); + stmt.close(); + connection.close(); return locations; } @@ -130,38 +149,79 @@ public static void modifyLocation(Location location) throws ClassNotFoundExcepti * @throws ClassNotFoundException * @throws SQLException */ - public static void deleteLocation(int id) throws ClassNotFoundException, SQLException{ + public static int deleteLocation(int id) throws ClassNotFoundException, SQLException{ System.getenv("VCAP_SERVICES"); Class.forName("com.mysql.jdbc.Driver"); Connection connect = DriverManager.getConnection("jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317", "b372dfe7409692", "74f6e317"); Statement stmt = connect.createStatement(); - stmt.executeUpdate("DELETE from location WHERE Location_ID = " + id); + try { + stmt.executeUpdate("DELETE from location WHERE Location_ID = " + id); + } catch (SQLException e) { + stmt.close(); + connect.close(); + return -1; + } stmt.close(); connect.close(); + return 0; } public static Location[] getAllLocations() throws SQLException, ClassNotFoundException{ //database connect - System.getenv("VCAP_SERVICES"); - MySQLAccess access = new MySQLAccess(); - Statement stmt = access.getStatement(); - ResultSet resultSet = stmt.executeQuery("SELECT * FROM location"); - int counter = 0; - - resultSet.last(); - int rows = resultSet.getRow(); - resultSet.beforeFirst(); - - //Covers amount of rows, and 6 attributes (indices 0-5) - Location[] locations = new Location[rows]; - - //iterate result set - while(resultSet.next()){ - locations[counter] = new Location(resultSet.getInt("Location_ID"),resultSet.getString("Name"),resultSet.getString("Address"),resultSet.getString("Town"),resultSet.getString("State"),resultSet.getString("Zip_Code")); - counter++; - } - - access.closeConnection(); - return locations; + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT * FROM location"); + int counter = 0; + + resultSet.last(); + int rows = resultSet.getRow(); + resultSet.beforeFirst(); + + //Covers amount of rows, and 6 attributes (indices 0-5) + Location[] locations = new Location[rows]; + + //iterate result set + while(resultSet.next()){ + locations[counter] = new Location(resultSet.getInt("Location_ID"),resultSet.getString("Name"),resultSet.getString("Address"),resultSet.getString("Town"),resultSet.getString("State"),resultSet.getString("Zip_Code")); + counter++; + } + + stmt.close(); + connection.close(); + return locations; + } + + /** + * This method returns the number of devices at a given location + * @return + * @throws ClassNotFoundException + * @throws SQLException + */ + public static int numberDevices(int id) throws ClassNotFoundException, SQLException{ + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT COUNT(*) FROM devices WHERE Location = " + id ); + resultSet.next(); + int num = resultSet.getInt(1); + stmt.close(); + connection.close(); + return num; + } + + public static int numberEmployees(int id) throws ClassNotFoundException, SQLException{ + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT COUNT(*) FROM employee WHERE Location_ID = " + id ); + resultSet.next(); + int num = resultSet.getInt(1); + stmt.close(); + connection.close(); + return num; } } \ No newline at end of file diff --git a/src/database/MySQLAccess.java b/src/database/MySQLAccess.java deleted file mode 100644 index 66714ee..0000000 --- a/src/database/MySQLAccess.java +++ /dev/null @@ -1,32 +0,0 @@ -package database; - -import java.sql.*; - -public class MySQLAccess { - - private String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317"; - private String user = "b372dfe7409692"; - private String password = "74f6e317"; - - private Connection connection; - private Statement statement; - - public MySQLAccess() throws ClassNotFoundException, SQLException { - connectDB(); - } - - public void connectDB() throws SQLException, ClassNotFoundException { - Class.forName("com.mysql.jdbc.Driver"); - connection = DriverManager.getConnection(database, user, password); - statement = connection.createStatement(); - } - - public Statement getStatement() { - return statement; - } - - public void closeConnection() throws SQLException { - statement.close(); - connection.close(); - } -} \ No newline at end of file diff --git a/src/database/TicketQueries.java b/src/database/TicketQueries.java index ca8eff3..53ffa3d 100644 --- a/src/database/TicketQueries.java +++ b/src/database/TicketQueries.java @@ -6,13 +6,19 @@ public class TicketQueries { + private static String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317"; + private static String user = "b372dfe7409692"; + private static String password = "74f6e317"; + public static void generateTicket(int requester, int location, int device, String returnDate) throws ClassNotFoundException, SQLException { long time = new Date().getTime(); //Using milliseconds because sql is annoying with dates. int ticketID = (int)((time+requester+device+location)%10000); String stat = "Requested"; - MySQLAccess access = new MySQLAccess(); - Statement statement = access.getStatement(); + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); String query = ""; query+="INSERT INTO ticket (Ticket_ID, Requestor, Request_Date, Location, Device_ID, Status, Status_Date_Fields, Return_Date) "; query+="VALUES ("; @@ -25,20 +31,23 @@ public static void generateTicket(int requester, int location, int device, Strin query+= "'"+time+"'" +","; query+= "'"+returnDate+"'" +");"; System.out.println(query); - statement.executeUpdate(query); - access.closeConnection(); + stmt.executeUpdate(query); + stmt.close(); + connection.close(); } //get all tickets public Ticket[] getTickets() throws SQLException, ClassNotFoundException{ String status = "Requested"; int i = 0; - MySQLAccess myaccess = new MySQLAccess(); - Statement statement = myaccess.getStatement(); - ResultSet resultSet = statement.executeQuery("Select COUNT(Ticket_ID) FROM ticket WHERE Status = '" +status + "'"); + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + ResultSet resultSet = stmt.executeQuery("Select COUNT(Ticket_ID) FROM ticket WHERE Status = '" +status + "'"); resultSet.next(); Ticket[] tickets = new Ticket[resultSet.getInt("COUNT(Ticket_ID)")]; - resultSet = statement.executeQuery("Select * FROM ticket WHERE Status = '" +status + "'"); + resultSet = stmt.executeQuery("Select * FROM ticket WHERE Status = '" +status + "'"); while(resultSet.next()){ tickets[i] = new Ticket( resultSet.getInt("Ticket_ID"), @@ -51,14 +60,15 @@ public Ticket[] getTickets() throws SQLException, ClassNotFoundException{ ); i++; } - myaccess.closeConnection(); + stmt.close(); + connection.close(); return tickets; } public static void acceptTicket(int ticketid, int deviceid, int locationid, int sso) throws SQLException, ClassNotFoundException{ System.getenv("VCAP_SERVICES"); Class.forName("com.mysql.jdbc.Driver"); - Connection connect = DriverManager.getConnection("jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317", "b372dfe7409692", "74f6e317"); + Connection connect = DriverManager.getConnection(database, user, password); Statement stmt = connect.createStatement(); stmt.executeUpdate("UPDATE ticket SET Status = \"Approved\" WHERE Ticket_ID = " + ticketid); stmt.executeUpdate("UPDATE devices SET Ticket_ID = " + ticketid + ", Status = \"Shipped\", Renter = " + sso + ", Location = " + locationid + " WHERE Device_ID = " + deviceid); @@ -69,7 +79,7 @@ public static void acceptTicket(int ticketid, int deviceid, int locationid, int public static void rejectTicket(int id) throws SQLException, ClassNotFoundException{ System.getenv("VCAP_SERVICES"); Class.forName("com.mysql.jdbc.Driver"); - Connection connect = DriverManager.getConnection("jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317", "b372dfe7409692", "74f6e317"); + Connection connect = DriverManager.getConnection(database, user, password); Statement stmt = connect.createStatement(); stmt.executeUpdate("UPDATE ticket SET Status = \"Rejected\" WHERE Ticket_ID = " + id); stmt.close(); diff --git a/src/entities/Location.java b/src/entities/Location.java index a2a19d8..97c044e 100644 --- a/src/entities/Location.java +++ b/src/entities/Location.java @@ -1,5 +1,9 @@ package entities; +import java.sql.SQLException; + +import database.LocationQueries; + /** * Representation of locations from database. * @author conno @@ -13,6 +17,8 @@ public class Location { private String state; private String zip; private int employee_flag; + private int numDevices; + private int numEmployees; /** * Constructor for existing location. @@ -21,14 +27,18 @@ public class Location { * @param town * @param state * @param zip + * @throws SQLException + * @throws ClassNotFoundException */ - public Location(int id, String name, String address, String town, String state, String zip){ + public Location(int id, String name, String address, String town, String state, String zip) throws ClassNotFoundException, SQLException{ this.id = id; this.name = name; this.address = address; this.town = town; this.state = state; this.zip = zip; + this.numDevices = LocationQueries.numberDevices(id); + this.numEmployees = LocationQueries.numberEmployees(id); } /** @@ -38,22 +48,28 @@ public Location(int id, String name, String address, String town, String state, * @param town * @param state * @param zip + * @throws SQLException + * @throws ClassNotFoundException */ - public Location(String name, String address, String town, String state, String zip){ + public Location(String name, String address, String town, String state, String zip) throws ClassNotFoundException, SQLException{ this.name = name; this.address = address; this.town = town; this.state = state; this.zip = zip; + this.numDevices = LocationQueries.numberDevices(id); + this.numEmployees = LocationQueries.numberEmployees(id); } - public Location(String name, String address, String town, String state, String zip, int employee_flag) { + public Location(String name, String address, String town, String state, String zip, int employee_flag) throws ClassNotFoundException, SQLException { this.name = name; this.address = address; this.town = town; this.state = state; this.zip = zip; this.employee_flag = employee_flag; + this.numDevices = LocationQueries.numberDevices(id); + this.numEmployees = LocationQueries.numberEmployees(id); } /** @@ -67,6 +83,8 @@ public String toString(){ sb.append("\"address\": \"").append(address.replace("\"", """)).append("\"").append(comma); sb.append("\"town\": \"").append(town.replace("\"", """)).append("\"").append(comma); sb.append("\"state\": \"").append(state).append("\"").append(comma); + sb.append("\"numDevices\":").append(numDevices).append(comma); + sb.append("\"numEmployees\":").append(numEmployees).append(comma); sb.append("\"zip\": \"").append(zip).append("\""); sb.append("}"); return sb.toString(); @@ -120,6 +138,5 @@ public void setEmployeeFlag(int ID) public int getEmployeeFlag() { return employee_flag; - } - + } } From 2afb2eb2c907db87ca670e75b8431614cc271000 Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Wed, 12 Apr 2017 15:39:19 -0400 Subject: [PATCH 4/4] Enhancements annd Bugs --- .../html/webpages/adminDeviceSettings.jsp | 3 +++ WebContent/html/webpages/deviceRedirect.jsp | 1 + WebContent/html/webpages/orderFormHandler.jsp | 17 ++++++----------- WebContent/html/webpages/shoppingCart.jsp | 13 ++----------- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/WebContent/html/webpages/adminDeviceSettings.jsp b/WebContent/html/webpages/adminDeviceSettings.jsp index 798da3e..65db663 100644 --- a/WebContent/html/webpages/adminDeviceSettings.jsp +++ b/WebContent/html/webpages/adminDeviceSettings.jsp @@ -265,10 +265,13 @@ window.onclick = function(e){var add = document.getElementById('addModal'); var var manuHTML = ''; var hardwareHTML = ''; var availabilityHTML = ''; +manufacturers.sort(); for(var i = 0; i < manufacturers.length; i++) manuHTML += ''; + hardwares.sort(); for(var i = 0; i < hardwares.length; i++) hardwareHTML += ''; +availabilities.sort(); for(var i = 0; i < availabilities.length; i++) availabilityHTML += ''; document.getElementById('addManu').innerHTML = manuHTML; diff --git a/WebContent/html/webpages/deviceRedirect.jsp b/WebContent/html/webpages/deviceRedirect.jsp index 8b90d60..d3e9558 100644 --- a/WebContent/html/webpages/deviceRedirect.jsp +++ b/WebContent/html/webpages/deviceRedirect.jsp @@ -20,6 +20,7 @@ diff --git a/WebContent/html/webpages/orderFormHandler.jsp b/WebContent/html/webpages/orderFormHandler.jsp index 9efd92b..469a6f2 100644 --- a/WebContent/html/webpages/orderFormHandler.jsp +++ b/WebContent/html/webpages/orderFormHandler.jsp @@ -8,16 +8,11 @@ pageEncoding="ISO-8859-1"%> +