diff --git a/WebContent/html/webpages/adminDeviceSettings.jsp b/WebContent/html/webpages/adminDeviceSettings.jsp new file mode 100644 index 0000000..31c0744 --- /dev/null +++ b/WebContent/html/webpages/adminDeviceSettings.jsp @@ -0,0 +1,342 @@ +<%@ page import = "database.MySQLAccess,entities.Device" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + + Synchrony Financial + + + + + + + + + + + + + + + + + + + + + +
+ +

Device Listing

+ + + + + + + + + + + + + + + + +
NameDescriptionMAC AddressManufacturerHardware TypeModel NameSerial NumberNFC ID
+ +
+<% +//database connection +MySQLAccess myaccess = new MySQLAccess(); +//database query +Location[] locations = myaccess.getAdminLocations(); +//string representation of array. +String locationString = Location.arrayToString(locations); +locationString = locationString.replace("'","\\'"); +%> + + + + + + \ No newline at end of file diff --git a/src/entities/Device.java b/src/entities/Device.java new file mode 100644 index 0000000..8ec6f6a --- /dev/null +++ b/src/entities/Device.java @@ -0,0 +1,86 @@ +package entities; + +/** + * Java representation of a mobile device. + * @author conno + * + */ +public class Device { + private String Device_ID; + private String Device_Name; + private String Device_Description; + private String Ticket_ID; + //Smartphone, tablet, etc. + private String Hardware; + //iPhone, Galaxy S5, etc. + private String Model; + private String Borrow_Date; + + public Device(String id, String name, String desc, String ticketid, String hardware, String model, String date){ + Device_ID = id; + Device_Name = name; + Device_Description = desc; + Ticket_ID = ticketid; + Hardware = hardware; + Model = model; + Borrow_Date = date; + } +/** + * Formatting the device to fit a JSON object. + */ + public String toString(){ + StringBuilder sb = new StringBuilder(); + String comma = ", "; + sb.append("{\"id\": ").append(Device_ID).append(comma); + sb.append("\"name\": \"").append(Device_Name).append("\"").append(comma); + sb.append("\"description\": \"").append(Device_Description).append("\"").append(comma); + sb.append("\"ticket\": \"").append(Ticket_ID).append("\"").append(comma); + sb.append("\"hardware\": \"").append(Hardware).append("\"").append(comma); + sb.append("\"model\": \"").append(Model).append("\"").append(comma); + sb.append("\"checkout\": \"").append(Borrow_Date).append("\""); + sb.append("}"); + return sb.toString(); + } + + /** + * This is a static function which will turn a Rented Device array into its proper string. + * @param array + * @return + */ + public static String arrayToString(Device[] array){ + StringBuilder sb = new StringBuilder(); + sb.append("["); + for(int i = 0; i < array.length; i++){ + sb.append(array[i].toString()); + if(i+1 != array.length){ + sb.append(","); + } + } + sb.append("]"); + return sb.toString(); + } + + public String getID(){ + return Device_ID; + } + + public String getName(){ + return Device_Name; + } + + public String getDesc(){ + return Device_Description; + } + + public String getTicketID(){ + return Ticket_ID; + } + + public String getModel(){ + return Model; + } + + public String getHardware(){ + return Hardware; + } +}