├── src ├── conf │ └── MANIFEST.MF └── java │ ├── DriverRideManagementModule │ ├── Car.java │ ├── WeeklyRide.java │ ├── SingleRide.java │ └── Ride.java │ ├── CarpoolDatabase │ ├── DbCredentialsSingleton.java │ └── DbRepo.java │ ├── EmailInterface │ ├── EmailConfiguration.java │ └── EmailSender.java │ ├── PassengerRideManagementModule │ ├── Location.java │ └── Request.java │ ├── UserManagementModule │ ├── User.java │ ├── Account.java │ ├── Platform.java │ └── Admin.java │ └── Controller │ ├── ViewDriverInfoController.java │ ├── ViewDriverAndRideInfoController.java │ ├── LogoutController.java │ ├── CancelRideController.java │ ├── ViewDriverApplicationDetailsController.java │ ├── ViewPassengerInfoController.java │ ├── ViewPassengerRequestsController.java │ ├── ViewOfferedRidesController.java │ ├── ViewDriverRequestsController.java │ ├── ViewPassengerConfirmedRidesController.java │ ├── RequestSelectedRideController.java │ ├── AcceptRejectDriverApplicationController.java │ ├── PassengerActionController.java │ ├── RegisterController.java │ ├── RegisterDriverController.java │ ├── SearchRidesController.java │ ├── ConfirmRemovePassengerController.java │ ├── LoginController.java │ └── OfferARideController.java ├── .gitattributes ├── web ├── META-INF │ └── context.xml ├── DriverAcceptedOrRejected.jsp ├── RideRequestConfirmation.jsp ├── WEB-INF │ └── web.xml ├── CancelRideForm.jsp ├── PassengerRemovedOrNotConfirmed.jsp ├── db_credential_loader.jsp ├── RemoveRegisteredPassenger.jsp ├── navbaradmin.html ├── ConfirmOrRemovePendingPassenger.jsp ├── ViewDriverInfo.jsp ├── navbarPassenger.html ├── ViewDriverApplications.jsp ├── navbar.html ├── viewPassengerInfo.jsp ├── test_jsp.jsp ├── ViewDriverDetails.jsp ├── ViewDriverAndRideInfo.jsp ├── NewUserRegistration.jsp ├── RegisterAsDriver.jsp ├── index.jsp ├── MakeRideRequest.jsp ├── viewPassengerRequests.jsp ├── findRide.jsp ├── OfferARide.jsp ├── ViewOfferedRides.jsp └── ViewPassengerConfirmedRides.jsp ├── .gitignore ├── nbproject ├── genfiles.properties ├── project.xml └── project.properties ├── README.md └── test ├── DriverRideManagementModule └── RideTest.java └── UserManagementModule ├── AdminTest.java ├── PlatformTest.java └── AccountTest.java /src/conf/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /web/META-INF/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | # netbeans 26 | /nbproject/private/ 27 | build/ 28 | nbbuild/ 29 | /dist/ -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=78e356d5 2 | build.xml.script.CRC32=b915eb4f 3 | build.xml.stylesheet.CRC32=651128d4@1.77.1.1 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=78e356d5 7 | nbproject/build-impl.xml.script.CRC32=532acd54 8 | nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # University Student Carpooling Website 2 | 3 | [![MIT License](https://img.shields.io/badge/license-MIT-green.svg)](https://opensource.org/licenses/MIT) 4 | 5 | Team E's Final Project for COE420 Software Engineering at American Universiy of Sharjah (AUS) 6 | *** 7 | Video Demo: https://www.youtube.com/watch?v=mIwSW94mXR4 8 | ### Repo owners: 9 | 10 | [Taslim Mahbub](https://github.com/Taslim-M) 11 | 12 | [Azadan Bhagwagar](https://github.com/AHB99) 13 | 14 | [Reem AlAmeeri](https://github.com/ReemAlAmeeri) 15 | 16 | [Ayah Al-Harathy](https://github.com/AyahAL28) 17 | *** 18 | The University Student Carpooling Platform is an application that will allow volunteer drivers to offer students of their university car rides to and from the campus. 19 | 20 | Developed using Netbeans IDE 8.2. 21 | -------------------------------------------------------------------------------- /web/DriverAcceptedOrRejected.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : CancelRideForm 3 | Created on : Apr 4, 2020, 1:35:49 AM 4 | Author : reem 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Redirected: Display Message 14 | 15 | 16 | 17 | 18 |

${Message}

19 |
20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /web/RideRequestConfirmation.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : RideRequestConfirmation 3 | Created on : Apr 4, 2020, 5:39:23 PM 4 | Author : azada 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | Ride Request 13 | 14 | 15 | 16 | 17 |
18 |

${outcome_message}

19 | 20 |
21 | 22 |
23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 30 6 | 7 | 8 | 9 | dbUrl 10 | jdbc:oracle:thin:@coeoracle.aus.edu:1521:orcl 11 | 12 | 13 | dbUsername 14 | b00075270 15 | 16 | 17 | dbPassword 18 | b00075270 19 | 20 | 21 | index.jsp 22 | 23 | 24 | -------------------------------------------------------------------------------- /web/CancelRideForm.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : CancelRideForm 3 | Created on : Apr 4, 2020, 1:35:49 AM 4 | Author : reem 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Confirm or Remove Registered Passenger: 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

${Message}

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /web/PassengerRemovedOrNotConfirmed.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : CancelRideForm 3 | Created on : Apr 4, 2020, 1:35:49 AM 4 | Author : reem 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Redirected: Display Message 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

${Message}

23 |
24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /web/db_credential_loader.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : db_credential_loader 3 | Created on : Apr 1, 2020, 11:58:16 AM 4 | Author : azada 5 | --%> 6 | <%-- 7 | This page is required as the loading of credentials from 8 | the Deployment Descriptor (web.xml) is only possible through a 9 | .jsp file. 10 | --%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | JSP Page 17 | 18 | 19 | <% 20 | CarpoolDatabase.DbCredentialsSingleton.setDbUrl(getServletContext().getInitParameter("dbUrl")); 21 | CarpoolDatabase.DbCredentialsSingleton.setDbUsername(getServletContext().getInitParameter("dbUsername")); 22 | CarpoolDatabase.DbCredentialsSingleton.setDbPassword(getServletContext().getInitParameter("dbPassword")); 23 | System.out.println("Singleton URL: " + getServletContext().getInitParameter("dbUrl")); 24 | 25 | %> 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/java/DriverRideManagementModule/Car.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package DriverRideManagementModule; 7 | 8 | /** 9 | * 10 | * @author Tasli 11 | */ 12 | public class Car { 13 | public Car(){ 14 | 15 | } 16 | public Car(String carModel, Integer carCapacity) { 17 | this.carModel = carModel; 18 | this.carCapacity = carCapacity; 19 | } 20 | private String carModel; 21 | private Integer carCapacity; 22 | 23 | public String getCarModel() { 24 | return carModel; 25 | } 26 | 27 | public void setCarModel(String carModel) { 28 | this.carModel = carModel; 29 | } 30 | 31 | public Integer getCarCapacity() { 32 | return carCapacity; 33 | } 34 | 35 | public void setCarCapacity(Integer carCapacity) { 36 | this.carCapacity = carCapacity; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "Car{" + "carModel=" + carModel + ", carCapacity=" + carCapacity + '}'; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/java/CarpoolDatabase/DbCredentialsSingleton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package CarpoolDatabase; 7 | 8 | /** 9 | * 10 | * @author azada 11 | */ 12 | public class DbCredentialsSingleton { 13 | 14 | public static String getDbUrl() { 15 | return dbUrl; 16 | } 17 | 18 | public static void setDbUrl(String dbUrl) { 19 | DbCredentialsSingleton.dbUrl = dbUrl; 20 | } 21 | 22 | public static String getDbUsername() { 23 | return dbUsername; 24 | } 25 | 26 | public static void setDbUsername(String dbUsername) { 27 | DbCredentialsSingleton.dbUsername = dbUsername; 28 | } 29 | 30 | public static String getDbPassword() { 31 | return dbPassword; 32 | } 33 | 34 | public static void setDbPassword(String dbPassword) { 35 | DbCredentialsSingleton.dbPassword = dbPassword; 36 | } 37 | 38 | public DbCredentialsSingleton() { 39 | 40 | } 41 | 42 | private static String dbUrl = null; 43 | private static String dbUsername = null; 44 | private static String dbPassword = null; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/java/CarpoolDatabase/DbRepo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package CarpoolDatabase; 7 | 8 | import java.sql.ResultSet; 9 | import java.sql.SQLException; 10 | import java.util.logging.Level; 11 | import java.util.logging.Logger; 12 | import javax.sql.rowset.CachedRowSet; 13 | import javax.sql.rowset.RowSetProvider; 14 | 15 | /** 16 | * 17 | * @author azada 18 | */ 19 | public class DbRepo { 20 | 21 | 22 | public static CachedRowSet getConfiguredConnection() { 23 | CachedRowSet crs = null; 24 | try { 25 | Class.forName("oracle.jdbc.driver.OracleDriver"); 26 | crs = RowSetProvider.newFactory().createCachedRowSet(); 27 | crs.setUrl("jdbc:oracle:thin:@coeoracle.aus.edu:1521:orcl"); 28 | crs.setUsername("b00075270"); 29 | crs.setPassword("b00075270"); 30 | 31 | } catch (SQLException ex) { 32 | Logger.getLogger(DbRepo.class.getName()).log(Level.SEVERE, null, ex); 33 | } catch (ClassNotFoundException ex) { 34 | Logger.getLogger(DbRepo.class.getName()).log(Level.SEVERE, null, ex); 35 | } 36 | return crs; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/java/EmailInterface/EmailConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package EmailInterface; 7 | 8 | import java.util.Properties; 9 | import javax.mail.PasswordAuthentication; 10 | import javax.mail.Session; 11 | 12 | /** 13 | * 14 | * @author Tasli 15 | */ 16 | public class EmailConfiguration { 17 | 18 | private static String host = "smtp.gmail.com"; 19 | private static String port = "587"; 20 | private static final String userName = "carpoolappaus@gmail.com"; 21 | private static final String password = "CarAus1234"; 22 | 23 | public static String getUserName() { 24 | return userName; 25 | } 26 | 27 | 28 | 29 | public static Session getSession() { 30 | Properties properties = new Properties(); 31 | properties.put("mail.smtp.host", host); 32 | properties.put("mail.smtp.port", port); 33 | properties.put("mail.smtp.auth", "true"); 34 | properties.put("mail.smtp.starttls.enable", "true"); 35 | Session session = Session.getInstance(properties, 36 | new javax.mail.Authenticator() { 37 | protected PasswordAuthentication getPasswordAuthentication() { 38 | return new PasswordAuthentication(userName, password); 39 | } 40 | }); 41 | return session; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/DriverRideManagementModule/RideTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package DriverRideManagementModule; 7 | 8 | import org.junit.After; 9 | import org.junit.AfterClass; 10 | import org.junit.Before; 11 | import org.junit.BeforeClass; 12 | import org.junit.Test; 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * 17 | * @author azada 18 | */ 19 | public class RideTest { 20 | 21 | public RideTest() { 22 | } 23 | 24 | @BeforeClass 25 | public static void setUpClass() { 26 | } 27 | 28 | @AfterClass 29 | public static void tearDownClass() { 30 | } 31 | 32 | @Before 33 | public void setUp() { 34 | } 35 | 36 | @After 37 | public void tearDown() { 38 | } 39 | 40 | // TODO add test methods here. 41 | // The methods must be annotated with annotation @Test. For example: 42 | // 43 | // @Test 44 | // public void hello() {} 45 | @Test 46 | public void testIsValid() { 47 | assertTrue(Ride.isValid("10:15")); 48 | assertTrue(Ride.isValid("21:15")); 49 | assertTrue(Ride.isValid("03:15")); 50 | assertFalse(Ride.isValid("abc")); 51 | assertFalse(Ride.isValid("23:15")); 52 | assertFalse(Ride.isValid("22:15")); 53 | assertFalse(Ride.isValid("02:15")); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /web/RemoveRegisteredPassenger.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : CancelRideForm 3 | Created on : Apr 4, 2020, 1:35:49 AM 4 | Author : reem 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Registered Passenger Form 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

${Message}

23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /src/java/PassengerRideManagementModule/Location.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package PassengerRideManagementModule; 7 | 8 | /** 9 | * 10 | * @author Tasli 11 | */ 12 | public class Location { 13 | 14 | 15 | private float longitude; 16 | private float latitude; 17 | 18 | public float getLongitude() { 19 | return longitude; 20 | } 21 | 22 | public void setLongitude(Integer longitude) { 23 | this.longitude = longitude; 24 | } 25 | 26 | public float getLatitude() { 27 | return latitude; 28 | } 29 | 30 | public void setLatitude(Integer latitude) { 31 | this.latitude = latitude; 32 | } 33 | public Location(){ 34 | 35 | } 36 | public Location(String location){ 37 | String[] longlat = location.split(","); 38 | this.latitude = Float.parseFloat(longlat[0]); 39 | this.longitude = Float.parseFloat(longlat[1]); 40 | } 41 | public Location(float latitude, float longitude) { 42 | this.longitude = longitude; 43 | this.latitude = latitude; 44 | } 45 | 46 | 47 | @Override 48 | public String toString() { 49 | return "latitude=" + latitude + ", longitude=" + longitude; 50 | } 51 | 52 | public String toDbString() { 53 | return latitude + "," + longitude; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.web.project 4 | 5 | 6 | COE420-TeamE-FinalProject 7 | 1.6.5 8 | 9 | 10 | ${libs.JAVADB_DRIVER_LABEL.classpath} 11 | WEB-INF/lib 12 | 13 | 14 | ${file.reference.ojdbc7.jar} 15 | WEB-INF/lib 16 | 17 | 18 | ${libs.junit_4.classpath} 19 | WEB-INF/lib 20 | 21 | 22 | ${libs.hamcrest.classpath} 23 | WEB-INF/lib 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/UserManagementModule/AdminTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package UserManagementModule; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import UserManagementModule.Admin; 10 | import java.sql.SQLException; 11 | import java.util.ArrayList; 12 | import org.junit.After; 13 | import org.junit.AfterClass; 14 | import org.junit.Before; 15 | import org.junit.BeforeClass; 16 | import org.junit.Test; 17 | import static org.junit.Assert.*; 18 | 19 | /** 20 | * 21 | * @author Tasli 22 | */ 23 | public class AdminTest { 24 | 25 | public AdminTest() { 26 | } 27 | 28 | @BeforeClass 29 | public static void setUpClass() { 30 | } 31 | 32 | @AfterClass 33 | public static void tearDownClass() { 34 | } 35 | 36 | @Before 37 | public void setUp() { 38 | } 39 | 40 | @After 41 | public void tearDown() { 42 | } 43 | 44 | @Test 45 | public void testretriveDriverRequests() throws SQLException { 46 | ArrayList expectedList = Admin.retriveDriverRequests(); 47 | assertTrue(expectedList.size() > 0); 48 | Driver d = expectedList.get(0); 49 | assertTrue(d != null); 50 | assertTrue(d.getEmailID() != null); 51 | assertTrue(d.getMyCar() != null); 52 | 53 | } 54 | // TODO add test methods here. 55 | // The methods must be annotated with annotation @Test. For example: 56 | // 57 | // @Test 58 | // public void hello() {} 59 | } 60 | -------------------------------------------------------------------------------- /web/navbaradmin.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /web/ConfirmOrRemovePendingPassenger.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : CancelRideForm 3 | Created on : Apr 4, 2020, 1:35:49 AM 4 | Author : reem 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Pending Passenger Form 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

${Message}

23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/java/UserManagementModule/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package UserManagementModule; 7 | 8 | /** 9 | * 10 | * @author azada 11 | */ 12 | public abstract class User { 13 | 14 | public User(String firstName, String lastName, String gender, String mobileNumber, String emailID) { 15 | this.firstName = firstName; 16 | this.lastName = lastName; 17 | this.gender = gender; 18 | this.mobileNumber = mobileNumber; 19 | this.emailID = emailID; 20 | } 21 | 22 | private String firstName; 23 | private String lastName; 24 | private String gender; 25 | private String mobileNumber; 26 | private String emailID; 27 | 28 | public String getEmailID() { 29 | return emailID; 30 | } 31 | 32 | public void setEmailID(String emailID) { 33 | this.emailID = emailID; 34 | } 35 | public String getFirstName() { 36 | return firstName; 37 | } 38 | 39 | public String getLastName() { 40 | return lastName; 41 | } 42 | 43 | public void setLastName(String lastName) { 44 | this.lastName = lastName; 45 | } 46 | 47 | public String getGender() { 48 | return gender; 49 | } 50 | 51 | public void setGender(String gender) { 52 | this.gender = gender; 53 | } 54 | 55 | public String getMobileNumber() { 56 | return mobileNumber; 57 | } 58 | 59 | public void setMobileNumber(String mobileNumber) { 60 | this.mobileNumber = mobileNumber; 61 | } 62 | 63 | public void setFirstName(String firstName) { 64 | this.firstName = firstName; 65 | } 66 | 67 | public User() { 68 | 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/java/PassengerRideManagementModule/Request.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package PassengerRideManagementModule; 7 | 8 | import DriverRideManagementModule.Ride; 9 | 10 | /** 11 | * 12 | * @author Tasli 13 | */ 14 | public class Request { 15 | 16 | private String requested_ride_id; 17 | private String passengerid; 18 | private Location pickupLocation; 19 | private Location dropoffLocation; 20 | private String confirmationbutton; 21 | 22 | 23 | public void setRequested_ride_id(String requested_ride_id) { 24 | this.requested_ride_id = requested_ride_id; 25 | } 26 | 27 | public void setPassengerid(String passengerid) 28 | { 29 | this.passengerid = passengerid; 30 | } 31 | 32 | public void setPickupLocation(Location pickupLocation) { 33 | this.pickupLocation = pickupLocation; 34 | } 35 | 36 | public void setDropoffLocation(Location dropoffLocation) { 37 | this.dropoffLocation = dropoffLocation; 38 | } 39 | 40 | 41 | public void setConfirmationbutton(String confirmationbutton) { 42 | this.confirmationbutton = confirmationbutton; 43 | } 44 | 45 | 46 | 47 | 48 | public String getRequested_ride_id() { 49 | return requested_ride_id; 50 | } 51 | 52 | public String getPassengerid() 53 | { 54 | return passengerid; 55 | } 56 | 57 | public Location getPickupLocation() { 58 | return pickupLocation; 59 | } 60 | 61 | public Location getDropoffLocation() { 62 | return dropoffLocation; 63 | } 64 | 65 | 66 | public String getConfirmationbutton() { 67 | return confirmationbutton; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /web/ViewDriverInfo.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : ViewDriverInfo 3 | Created on : Apr 4, 2020, 6:15:00 PM 4 | Author : azada 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | Driver Information 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

Driver Information

21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
First Name${selected_driver.firstName}
Last Name${selected_driver.lastName}
Gender${selected_driver.gender}
Car Model${selected_driver.myCar.carModel}
44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /web/navbarPassenger.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /web/ViewDriverApplications.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : ViewDriverApplications 3 | Created on : Apr 5, 2020, 9:29:46 PM 4 | Author : Ayah 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | Driver Application Requests 13 | 14 | 15 | 16 |
17 |

Driver Application Requests

18 |
19 | 20 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 37 | 38 | 39 | 40 | 41 |
Email 24 | View Details 25 |
${driver.emailID} 32 |
33 | 34 | 35 |
36 |
42 |
43 |
44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/java/UserManagementModule/Account.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package UserManagementModule; 7 | 8 | import CarpoolDatabase.DbRepo; 9 | import java.io.UnsupportedEncodingException; 10 | import java.security.MessageDigest; 11 | import java.security.NoSuchAlgorithmException; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | import javax.sql.rowset.CachedRowSet; 15 | 16 | /** 17 | * 18 | * @author Tasli 19 | */ 20 | public class Account { 21 | 22 | private String emailID = null; 23 | private String password = null; 24 | private DbRepo dbCon = null; 25 | 26 | public String getEmailID() { 27 | return emailID; 28 | } 29 | 30 | public void setEmailID(String emailID) { 31 | this.emailID = emailID; 32 | } 33 | 34 | public String getPassword() { 35 | return password; 36 | } 37 | 38 | public void setPassword(String password) { 39 | this.password = password; 40 | } 41 | 42 | public Account(String un, String pw) { 43 | this.emailID = un; 44 | this.password = pw; 45 | this.dbCon = new DbRepo(); 46 | } 47 | 48 | public Account() { 49 | this.dbCon = new DbRepo(); 50 | } 51 | 52 | public boolean login() throws SQLException, NoSuchAlgorithmException, UnsupportedEncodingException { 53 | CachedRowSet crs = CarpoolDatabase.DbRepo.getConfiguredConnection(); 54 | crs.setCommand("Select * from ACCOUNTS WHERE USERNAME = ? "); 55 | crs.setString(1, emailID); 56 | crs.execute(); 57 | String usernameDB = ""; 58 | String pwdDB = ""; 59 | MessageDigest md = MessageDigest.getInstance("MD5"); 60 | byte[] sign = md.digest(this.password.getBytes()); 61 | 62 | String pwdHash = new String(sign, "UTF-8"); 63 | 64 | if (crs.next()) { 65 | usernameDB = crs.getString("USERNAME"); 66 | pwdDB = crs.getString("PASSWORD"); 67 | return (this.emailID.equals(usernameDB) && pwdHash.equals(pwdDB)); 68 | } else { 69 | return false; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/java/DriverRideManagementModule/WeeklyRide.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package DriverRideManagementModule; 7 | 8 | import PassengerRideManagementModule.Location; 9 | import java.sql.SQLException; 10 | import java.util.logging.Level; 11 | import java.util.logging.Logger; 12 | import javax.sql.rowset.CachedRowSet; 13 | 14 | /** 15 | * 16 | * @author Tasli 17 | */ 18 | public class WeeklyRide extends Ride{ 19 | 20 | private String day; 21 | 22 | 23 | public String getDay() { 24 | return day; 25 | } 26 | 27 | public void setDay(String day) { 28 | this.day = day; 29 | } 30 | 31 | public WeeklyRide(String day, Integer rideId, boolean isToUni, String arrivalDepartureTime, Location startingLocation, Location endingLocation, Integer seatAvailability, Driver driver) { 32 | super(rideId, isToUni, arrivalDepartureTime, startingLocation, endingLocation, seatAvailability, driver); 33 | this.day = day; 34 | } 35 | public WeeklyRide(){ 36 | 37 | } 38 | 39 | 40 | @Override 41 | public boolean updateRideInfo() { 42 | boolean parentSucceeded = super.updateRideInfo(); 43 | if (!parentSucceeded) { 44 | return false; 45 | } 46 | try { 47 | CachedRowSet crs1 = CarpoolDatabase.DbRepo.getConfiguredConnection(); 48 | crs1.setCommand("select max(ride_id) as target_ride from offered_rides where driver_id = ?"); 49 | crs1.setString(1, getDriver().getEmailID()); 50 | crs1.execute(); 51 | crs1.next(); 52 | 53 | CachedRowSet crs2 = CarpoolDatabase.DbRepo.getConfiguredConnection(); 54 | crs2.setCommand("INSERT INTO OFFERED_WEEKLY_RIDES (ride_id, day) VALUES (?,?)"); 55 | crs2.setString(1, crs1.getString("target_ride")); 56 | crs2.setString(2, getDay()); 57 | crs2.execute(); 58 | return true; 59 | } catch (SQLException ex) { 60 | Logger.getLogger(Ride.class.getName()).log(Level.SEVERE, null, ex); 61 | return false; 62 | } 63 | } 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /web/navbar.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/java/DriverRideManagementModule/SingleRide.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package DriverRideManagementModule; 7 | 8 | import PassengerRideManagementModule.Location; 9 | import java.sql.SQLException; 10 | import java.sql.Timestamp; 11 | import java.time.LocalDate; 12 | import java.time.LocalDateTime; 13 | import java.time.LocalTime; 14 | import java.time.format.DateTimeFormatter; 15 | import java.util.logging.Level; 16 | import java.util.logging.Logger; 17 | import javax.sql.rowset.CachedRowSet; 18 | 19 | /** 20 | * 21 | * @author Tasli 22 | */ 23 | public class SingleRide extends Ride{ 24 | 25 | public SingleRide(LocalDate date, Integer rideId, boolean isToUni, String arrivalDepartureTime, Location startingLocation, Location endingLocation, Integer seatAvailability, Driver driver) { 26 | super(rideId, isToUni, arrivalDepartureTime, startingLocation, endingLocation, seatAvailability, driver); 27 | this.date = date; 28 | } 29 | 30 | public SingleRide(){ 31 | 32 | } 33 | 34 | private LocalDate date; 35 | 36 | public LocalDate getDate() { 37 | return date; 38 | } 39 | 40 | public void setDate(LocalDate date) { 41 | this.date = date; 42 | } 43 | 44 | @Override 45 | public boolean updateRideInfo() { 46 | boolean parentSucceeded = super.updateRideInfo(); 47 | if (!parentSucceeded) return false; 48 | try { 49 | CachedRowSet crs1 = CarpoolDatabase.DbRepo.getConfiguredConnection(); 50 | crs1.setCommand("select max(ride_id) as target_ride from offered_rides where driver_id = ?"); 51 | crs1.setString(1, getDriver().getEmailID()); 52 | crs1.execute(); 53 | crs1.next(); 54 | 55 | CachedRowSet crs2 = CarpoolDatabase.DbRepo.getConfiguredConnection(); 56 | crs2.setCommand("INSERT INTO OFFERED_SINGLE_RIDES (ride_id, ride_date) VALUES (?,?)"); 57 | crs2.setString(1,crs1.getString("target_ride")); 58 | crs2.setDate(2, java.sql.Date.valueOf( getDate() )); 59 | crs2.execute(); 60 | return true; 61 | } catch (SQLException ex) { 62 | Logger.getLogger(Ride.class.getName()).log(Level.SEVERE, null, ex); 63 | return false; 64 | } 65 | } 66 | 67 | 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/java/EmailInterface/EmailSender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package EmailInterface; 7 | 8 | import javax.mail.Message; 9 | import javax.mail.MessagingException; 10 | import javax.mail.Session; 11 | import javax.mail.Transport; 12 | import javax.mail.internet.InternetAddress; 13 | import javax.mail.internet.MimeMessage; 14 | 15 | /** 16 | * 17 | * @author Tasli 18 | */ 19 | public class EmailSender { 20 | 21 | public static void sendEmail(String toAddress) throws MessagingException { 22 | Session session = EmailConfiguration.getSession(); 23 | String userName = EmailConfiguration.getUserName(); 24 | try { 25 | 26 | Message message = new MimeMessage(session); 27 | message.setFrom(new InternetAddress(userName)); 28 | message.setRecipients( 29 | Message.RecipientType.TO, 30 | InternetAddress.parse(toAddress) 31 | ); 32 | message.setSubject("Hello from Carpool Website"); 33 | message.setText("Dear Admins," 34 | + "\n\n Please do not spam my email!"); 35 | 36 | Transport.send(message); 37 | System.out.println("Email Sent"); 38 | 39 | } catch (MessagingException e) { 40 | e.printStackTrace(); 41 | } 42 | } 43 | 44 | public static void notifyAdminNewApplicant(String toAddress, String emailDriver) throws MessagingException { 45 | Session session = EmailConfiguration.getSession(); 46 | String userName = EmailConfiguration.getUserName(); 47 | try { 48 | 49 | Message message = new MimeMessage(session); 50 | message.setFrom(new InternetAddress(userName)); 51 | message.setRecipients( 52 | Message.RecipientType.TO, 53 | InternetAddress.parse(toAddress) 54 | ); 55 | message.setSubject("New Driver Applicant: Needs Review"); 56 | message.setText("Dear Admin," 57 | + "\n\n Please review a new driver application which is pending!" 58 | + "\n The email address of the driver is: "+ emailDriver); 59 | 60 | Transport.send(message); 61 | System.out.println("Email Sent"); 62 | 63 | } catch (MessagingException e) { 64 | e.printStackTrace(); 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/java/UserManagementModule/Platform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package UserManagementModule; 7 | 8 | import PassengerRideManagementModule.Passenger; 9 | import java.io.UnsupportedEncodingException; 10 | import java.security.MessageDigest; 11 | import java.security.NoSuchAlgorithmException; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.sql.rowset.CachedRowSet; 16 | 17 | /** 18 | * 19 | * @author Tasli 20 | */ 21 | public class Platform { 22 | 23 | private String universityName; 24 | 25 | public String getUniversityName() { 26 | return universityName; 27 | } 28 | 29 | public void setUniversityName(String universityName) { 30 | this.universityName = universityName; 31 | } 32 | 33 | public boolean submitRegistrationFormDetails(String email, String password, String fname, String lname, String gender, String mobileNo) throws SQLException, NoSuchAlgorithmException, UnsupportedEncodingException { 34 | if (doesIDExist(email)) { 35 | return false; 36 | } 37 | 38 | MessageDigest md = MessageDigest.getInstance("MD5"); 39 | byte[] sign = md.digest(password.getBytes()); 40 | 41 | String pwdHash = new String(sign, "UTF-8"); 42 | 43 | CachedRowSet crs = CarpoolDatabase.DbRepo.getConfiguredConnection(); 44 | crs.setCommand("INSERT INTO USERS (EMAIL_ID, FIRST_NAME, LAST_NAME, GENDER, MOBILE_NO) VALUES (?,?,?,?,?) "); 45 | crs.setString(1, email); 46 | crs.setString(2, fname); 47 | crs.setString(3, lname); 48 | crs.setString(4, gender); 49 | crs.setString(5, mobileNo); 50 | crs.execute(); 51 | 52 | crs.setCommand("INSERT INTO ACCOUNTS (USERNAME, PASSWORD) VALUES (?,?) "); 53 | crs.setString(1, email); 54 | crs.setString(2, pwdHash); 55 | crs.execute(); 56 | 57 | return true; 58 | } 59 | 60 | public boolean doesIDExist(String emailID) { 61 | try { 62 | CachedRowSet crs = CarpoolDatabase.DbRepo.getConfiguredConnection(); 63 | crs.setCommand("Select USERNAME from ACCOUNTS WHERE USERNAME = ? "); 64 | crs.setString(1, emailID); 65 | crs.execute(); 66 | if (crs.next()) { 67 | return true; 68 | } 69 | } catch (SQLException ex) { 70 | Logger.getLogger(Passenger.class.getName()).log(Level.SEVERE, null, ex); 71 | } 72 | 73 | return false; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /test/UserManagementModule/PlatformTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package UserManagementModule; 7 | 8 | import UserManagementModule.Platform; 9 | import java.io.UnsupportedEncodingException; 10 | import java.security.NoSuchAlgorithmException; 11 | import java.sql.SQLException; 12 | import javax.sql.rowset.CachedRowSet; 13 | import org.junit.After; 14 | import org.junit.AfterClass; 15 | import org.junit.Before; 16 | import org.junit.BeforeClass; 17 | import org.junit.Test; 18 | import static org.junit.Assert.*; 19 | 20 | /** 21 | * 22 | * @author Tasli 23 | */ 24 | public class PlatformTest { 25 | 26 | Platform platform; 27 | String testEmail; 28 | String testPassword; 29 | String testFname; 30 | String testLname; 31 | String testGender; 32 | String testMobile; 33 | 34 | public PlatformTest() { 35 | } 36 | 37 | @BeforeClass 38 | public static void setUpClass() { 39 | } 40 | 41 | @AfterClass 42 | public static void tearDownClass() { 43 | } 44 | 45 | @Before 46 | public void setUp() { 47 | platform = new Platform(); 48 | testEmail = "unitTest@aus.edu"; 49 | testPassword = "abc"; 50 | testFname = "Tester"; 51 | testLname = "LastName"; 52 | testGender = "M"; 53 | testMobile = "0501234567"; 54 | } 55 | 56 | @Test 57 | public void testsubmitRegistrationFormDetails() throws SQLException, NoSuchAlgorithmException, UnsupportedEncodingException { 58 | platform.submitRegistrationFormDetails(testEmail, testPassword, testFname, testLname, testGender, testMobile); 59 | boolean isAdded = platform.doesIDExist(testEmail); 60 | assertTrue(isAdded); 61 | } 62 | 63 | @After 64 | public void tearDown() throws SQLException { 65 | 66 | //Clean Up Added Record 67 | CachedRowSet crs = CarpoolDatabase.DbRepo.getConfiguredConnection(); 68 | crs.setCommand("Delete from ACCOUNTS where USERNAME = ?"); 69 | crs.setString(1, testEmail); 70 | crs.execute(); 71 | crs.setCommand("Delete from USERS where EMAIL_ID = ?"); 72 | crs.setString(1, testEmail); 73 | crs.execute(); 74 | 75 | platform = null; 76 | testEmail = null; 77 | testPassword = null; 78 | testFname = null; 79 | testLname = null; 80 | testGender = null; 81 | testMobile = null; 82 | } 83 | 84 | // TODO add test methods here. 85 | // The methods must be annotated with annotation @Test. For example: 86 | // 87 | // @Test 88 | // public void hello() {} 89 | } 90 | -------------------------------------------------------------------------------- /web/viewPassengerInfo.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : ViewConfirmedRides 3 | Created on : Apr 2, 2020, 9:34:20 PM 4 | Author : reem 5 | --%> 6 | 7 | 8 | 9 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 10 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 11 | 12 | 13 | 14 | 15 | Passenger Information 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |

Passenger Information

25 |
26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
Passenger ID${passenger.emailID}
First Name ${passenger.firstName}
Last Name${passenger.lastName}
Gender${passenger.gender}
Mobile Number${passenger.mobileNumber}
53 | 54 | 55 |
56 |
57 |
58 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /web/test_jsp.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : test_jsp 3 | Created on : Mar 30, 2020, 11:14:21 AM 4 | Author : azada 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 9 | 10 | 11 | 12 | 13 | JSP Page 14 | 15 | 28 | 59 | 61 | 62 | 63 | 64 | 65 | 66 |

This is a test jsp file

67 | 68 |
69 | 70 |
71 |
72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /test/UserManagementModule/AccountTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package UserManagementModule; 7 | 8 | import java.io.UnsupportedEncodingException; 9 | import java.security.NoSuchAlgorithmException; 10 | import java.sql.SQLException; 11 | import javax.sql.rowset.CachedRowSet; 12 | import org.junit.After; 13 | import org.junit.AfterClass; 14 | import org.junit.Before; 15 | import org.junit.BeforeClass; 16 | import org.junit.Test; 17 | import static org.junit.Assert.*; 18 | 19 | /** 20 | * 21 | * @author Tasli 22 | */ 23 | public class AccountTest { 24 | 25 | Platform platform; 26 | Account account; 27 | String testEmail; 28 | String testPassword; 29 | String testFname; 30 | String testLname; 31 | String testGender; 32 | String testMobile; 33 | String testFakePassword; 34 | public AccountTest() { 35 | } 36 | 37 | @BeforeClass 38 | public static void setUpClass() { 39 | } 40 | 41 | @AfterClass 42 | public static void tearDownClass() { 43 | } 44 | 45 | @Before 46 | public void setUp() throws SQLException, NoSuchAlgorithmException, UnsupportedEncodingException { 47 | platform = new Platform(); 48 | account = new Account(); 49 | testEmail = "unitTest@aus.edu"; 50 | testPassword = "abc"; 51 | testFname = "Tester"; 52 | testLname = "LastName"; 53 | testGender = "M"; 54 | testMobile = "0501234567"; 55 | testFakePassword = "Fake"; 56 | platform.submitRegistrationFormDetails(testEmail, testPassword, testFname, testLname, testGender, testMobile); 57 | account.setEmailID(testEmail); 58 | account.setPassword(testPassword); 59 | } 60 | 61 | @Test 62 | public void testlogin() throws SQLException, NoSuchAlgorithmException, UnsupportedEncodingException { 63 | assertTrue(account.login()); 64 | account.setPassword(testFakePassword); 65 | assertFalse(account.login()); 66 | } 67 | 68 | @After 69 | public void tearDown() throws SQLException { 70 | 71 | //Clean Up Added Record 72 | CachedRowSet crs = CarpoolDatabase.DbRepo.getConfiguredConnection(); 73 | crs.setCommand("Delete from ACCOUNTS where USERNAME = ?"); 74 | crs.setString(1, testEmail); 75 | crs.execute(); 76 | crs.setCommand("Delete from USERS where EMAIL_ID = ?"); 77 | crs.setString(1, testEmail); 78 | crs.execute(); 79 | 80 | platform = null; 81 | account = null; 82 | testEmail = null; 83 | testPassword = null; 84 | testFname = null; 85 | testLname = null; 86 | testGender = null; 87 | testMobile = null; 88 | } 89 | 90 | // TODO add test methods here. 91 | // The methods must be annotated with annotation @Test. For example: 92 | // 93 | // @Test 94 | // public void hello() {} 95 | } 96 | -------------------------------------------------------------------------------- /src/java/Controller/ViewDriverInfoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import DriverRideManagementModule.Ride; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | import javax.servlet.RequestDispatcher; 13 | import javax.servlet.ServletException; 14 | import javax.servlet.annotation.WebServlet; 15 | import javax.servlet.http.HttpServlet; 16 | import javax.servlet.http.HttpServletRequest; 17 | import javax.servlet.http.HttpServletResponse; 18 | 19 | /** 20 | * 21 | * @author azada 22 | */ 23 | @WebServlet(name = "ViewDriverInfoController", urlPatterns = {"/ViewDriverInfoController"}) 24 | public class ViewDriverInfoController extends HttpServlet { 25 | 26 | /** 27 | * Processes requests for both HTTP GET and POST 28 | * methods. 29 | * 30 | * @param request servlet request 31 | * @param response servlet response 32 | * @throws ServletException if a servlet-specific error occurs 33 | * @throws IOException if an I/O error occurs 34 | */ 35 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 36 | throws ServletException, IOException { 37 | Driver selectedDriver = Ride.retrieveDriverInfo(request.getParameter("driver_id")); 38 | RequestDispatcher rd = request.getRequestDispatcher("ViewDriverInfo.jsp"); 39 | request.setAttribute("selected_driver", selectedDriver); 40 | rd.forward(request, response); 41 | } 42 | 43 | // 44 | /** 45 | * Handles the HTTP GET method. 46 | * 47 | * @param request servlet request 48 | * @param response servlet response 49 | * @throws ServletException if a servlet-specific error occurs 50 | * @throws IOException if an I/O error occurs 51 | */ 52 | @Override 53 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 54 | throws ServletException, IOException { 55 | processRequest(request, response); 56 | } 57 | 58 | /** 59 | * Handles the HTTP POST method. 60 | * 61 | * @param request servlet request 62 | * @param response servlet response 63 | * @throws ServletException if a servlet-specific error occurs 64 | * @throws IOException if an I/O error occurs 65 | */ 66 | @Override 67 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 68 | throws ServletException, IOException { 69 | processRequest(request, response); 70 | } 71 | 72 | /** 73 | * Returns a short description of the servlet. 74 | * 75 | * @return a String containing servlet description 76 | */ 77 | @Override 78 | public String getServletInfo() { 79 | return "Short description"; 80 | }// 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/java/Controller/ViewDriverAndRideInfoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import DriverRideManagementModule.Ride; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | import javax.servlet.RequestDispatcher; 13 | import javax.servlet.ServletException; 14 | import javax.servlet.annotation.WebServlet; 15 | import javax.servlet.http.HttpServlet; 16 | import javax.servlet.http.HttpServletRequest; 17 | import javax.servlet.http.HttpServletResponse; 18 | 19 | /** 20 | * 21 | * @author azada 22 | */ 23 | @WebServlet(name = "ViewDriverAndRideInfoController", urlPatterns = {"/ViewDriverAndRideInfoController"}) 24 | public class ViewDriverAndRideInfoController extends HttpServlet { 25 | 26 | /** 27 | * Processes requests for both HTTP GET and POST 28 | * methods. 29 | * 30 | * @param request servlet request 31 | * @param response servlet response 32 | * @throws ServletException if a servlet-specific error occurs 33 | * @throws IOException if an I/O error occurs 34 | */ 35 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 36 | throws ServletException, IOException { 37 | Driver selectedDriver = Ride.retrieveDriverInfo(request.getParameter("driver_id")); 38 | RequestDispatcher rd = request.getRequestDispatcher("ViewDriverAndRideInfo.jsp"); 39 | request.setAttribute("selected_driver", selectedDriver); 40 | rd.forward(request, response); 41 | } 42 | 43 | // 44 | /** 45 | * Handles the HTTP GET method. 46 | * 47 | * @param request servlet request 48 | * @param response servlet response 49 | * @throws ServletException if a servlet-specific error occurs 50 | * @throws IOException if an I/O error occurs 51 | */ 52 | @Override 53 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 54 | throws ServletException, IOException { 55 | processRequest(request, response); 56 | } 57 | 58 | /** 59 | * Handles the HTTP POST method. 60 | * 61 | * @param request servlet request 62 | * @param response servlet response 63 | * @throws ServletException if a servlet-specific error occurs 64 | * @throws IOException if an I/O error occurs 65 | */ 66 | @Override 67 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 68 | throws ServletException, IOException { 69 | processRequest(request, response); 70 | } 71 | 72 | /** 73 | * Returns a short description of the servlet. 74 | * 75 | * @return a String containing servlet description 76 | */ 77 | @Override 78 | public String getServletInfo() { 79 | return "Short description"; 80 | }// 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/java/Controller/LogoutController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import java.io.IOException; 9 | import java.io.PrintWriter; 10 | import javax.servlet.RequestDispatcher; 11 | import javax.servlet.ServletException; 12 | import javax.servlet.annotation.WebServlet; 13 | import javax.servlet.http.HttpServlet; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | import javax.servlet.http.HttpSession; 17 | 18 | /** 19 | * 20 | * @author Tasli 21 | */ 22 | @WebServlet(name = "LogoutController", urlPatterns = {"/LogoutController"}) 23 | public class LogoutController extends HttpServlet { 24 | 25 | /** 26 | * Processes requests for both HTTP GET and POST 27 | * methods. 28 | * 29 | * @param request servlet request 30 | * @param response servlet response 31 | * @throws ServletException if a servlet-specific error occurs 32 | * @throws IOException if an I/O error occurs 33 | */ 34 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 35 | throws ServletException, IOException { 36 | HttpSession session = request.getSession(false); //Fetch session object 37 | if (session != null) //If session is not null 38 | { 39 | session.invalidate(); //removes all session attributes bound to the session 40 | RequestDispatcher rd = request.getRequestDispatcher("index.jsp"); 41 | request.setAttribute("errmsg", "Logout Successful"); 42 | rd.forward(request, response); 43 | } 44 | 45 | } 46 | 47 | // 48 | /** 49 | * Handles the HTTP GET method. 50 | * 51 | * @param request servlet request 52 | * @param response servlet response 53 | * @throws ServletException if a servlet-specific error occurs 54 | * @throws IOException if an I/O error occurs 55 | */ 56 | @Override 57 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 58 | throws ServletException, IOException { 59 | processRequest(request, response); 60 | } 61 | 62 | /** 63 | * Handles the HTTP POST method. 64 | * 65 | * @param request servlet request 66 | * @param response servlet response 67 | * @throws ServletException if a servlet-specific error occurs 68 | * @throws IOException if an I/O error occurs 69 | */ 70 | @Override 71 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 72 | throws ServletException, IOException { 73 | processRequest(request, response); 74 | } 75 | 76 | /** 77 | * Returns a short description of the servlet. 78 | * 79 | * @return a String containing servlet description 80 | */ 81 | @Override 82 | public String getServletInfo() { 83 | return "Short description"; 84 | }// 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/java/Controller/CancelRideController.java: -------------------------------------------------------------------------------- 1 | package Controller; 2 | 3 | import DriverRideManagementModule.Driver; 4 | import PassengerRideManagementModule.Passenger; 5 | import java.io.IOException; 6 | import java.io.PrintWriter; 7 | import java.util.ArrayList; 8 | import javax.servlet.RequestDispatcher; 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | 16 | /** 17 | * 18 | * @author reem 19 | */ 20 | @WebServlet(name = "CancelRideController", urlPatterns = {"/CancelRideController"}) 21 | public class CancelRideController extends HttpServlet { 22 | 23 | /** 24 | * Processes requests for both HTTP GET and POST 25 | * methods. 26 | * 27 | * @param request servlet request 28 | * @param response servlet response 29 | * @throws ServletException if a servlet-specific error occurs 30 | * @throws IOException if an I/O error occurs 31 | */ 32 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 33 | throws ServletException, IOException { 34 | String Ride_ID = request.getParameter("rideid"); 35 | HttpSession session = request.getSession(); 36 | Driver d = (Driver) session.getAttribute("driver"); //Get the Driver logged in Right now 37 | if (d != null) { 38 | d.CancelRide(Ride_ID); 39 | String Message = "Your Ride was Successfully Canceled!"; 40 | RequestDispatcher rd = request.getRequestDispatcher("CancelRideForm.jsp"); 41 | request.setAttribute("Message", Message); 42 | rd.forward(request, response); 43 | } 44 | } 45 | 46 | // 47 | /** 48 | * Handles the HTTP GET method. 49 | * 50 | * @param request servlet request 51 | * @param response servlet response 52 | * @throws ServletException if a servlet-specific error occurs 53 | * @throws IOException if an I/O error occurs 54 | */ 55 | @Override 56 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 57 | throws ServletException, IOException { 58 | processRequest(request, response); 59 | } 60 | 61 | /** 62 | * Handles the HTTP POST method. 63 | * 64 | * @param request servlet request 65 | * @param response servlet response 66 | * @throws ServletException if a servlet-specific error occurs 67 | * @throws IOException if an I/O error occurs 68 | */ 69 | @Override 70 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | processRequest(request, response); 73 | } 74 | 75 | /** 76 | * Returns a short description of the servlet. 77 | * 78 | * @return a String containing servlet description 79 | */ 80 | @Override 81 | public String getServletInfo() { 82 | return "Short description"; 83 | }// 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/java/UserManagementModule/Admin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package UserManagementModule; 7 | 8 | import DriverRideManagementModule.Car; 9 | import DriverRideManagementModule.Driver; 10 | import DriverRideManagementModule.SingleRide; 11 | import PassengerRideManagementModule.Location; 12 | import PassengerRideManagementModule.Passenger; 13 | import UserManagementModule.User; 14 | import java.sql.Connection; 15 | import java.sql.DriverManager; 16 | import java.sql.PreparedStatement; 17 | import java.sql.ResultSet; 18 | import java.sql.SQLException; 19 | import java.sql.Statement; 20 | import java.util.ArrayList; 21 | import java.util.logging.Level; 22 | import java.util.logging.Logger; 23 | import javax.sql.rowset.CachedRowSet; 24 | import javax.swing.JOptionPane; 25 | 26 | /** 27 | * 28 | * @author Tasli 29 | */ 30 | public class Admin extends User { 31 | 32 | public static boolean isAdmin(String emailID) throws SQLException { 33 | CachedRowSet crs = CarpoolDatabase.DbRepo.getConfiguredConnection(); 34 | crs.setCommand("Select * from ADMINS WHERE ADM_EMAIL_ID = ? "); 35 | crs.setString(1, emailID); 36 | crs.execute(); 37 | String usernameDB = ""; 38 | //If there is a record 39 | if (crs.next()) { 40 | return true; 41 | } else { 42 | return false; 43 | } 44 | } 45 | 46 | //retrieveDriverRequests (then to display to user) 47 | //select driver call passenger class 48 | public static ArrayList retriveDriverRequests() throws SQLException { 49 | 50 | ArrayList drivers = new ArrayList<>(); 51 | CachedRowSet crs = CarpoolDatabase.DbRepo.getConfiguredConnection(); 52 | 53 | //crs.setCommand("select first_name from b00075270.users where exists (select email_id from b00075270.driver_applications where b00075270.driver_applications.email_id = b00075270.users.email_id)"); 54 | crs.setCommand("SELECT email_id, car_model, car_capacity FROM DRIVER_APPLICATIONS where email_id NOT IN (select driver_id from drivers)"); 55 | 56 | crs.execute(); 57 | while (crs.next()) { 58 | Driver currDriver = new Driver(); 59 | currDriver.setEmailID(crs.getString("email_id")); 60 | Car c = new Car(crs.getString("car_model"), crs.getInt("car_capacity")); 61 | currDriver.setMyCar(c); 62 | drivers.add(currDriver); 63 | } 64 | return drivers; 65 | } 66 | 67 | public static void acceptDriverRequest(String Driver_ID) { 68 | Driver d = new Driver(); 69 | d.setEmailID(Driver_ID); 70 | try { 71 | d.makeDriver(); 72 | } catch (SQLException ex) { 73 | Logger.getLogger(Passenger.class.getName()).log(Level.SEVERE, null, ex); 74 | } 75 | } 76 | 77 | public static void rejectDriverRequest(String Driver_ID) { 78 | Driver d = new Driver(); 79 | d.setEmailID(Driver_ID); 80 | try { 81 | d.rejectDriverRequest(); 82 | } catch (SQLException ex) { 83 | Logger.getLogger(Passenger.class.getName()).log(Level.SEVERE, null, ex); 84 | } 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/java/Controller/ViewDriverApplicationDetailsController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import DriverRideManagementModule.Ride; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.RequestDispatcher; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * 24 | * @author Tasli 25 | */ 26 | @WebServlet(name = "ViewDriverApplicationDetailsController", urlPatterns = {"/ViewDriverApplicationDetailsController"}) 27 | public class ViewDriverApplicationDetailsController extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | 41 | try { 42 | Driver selectedDriver = Driver.getDriverInfo(request.getParameter("driverID")); 43 | RequestDispatcher rd = request.getRequestDispatcher("ViewDriverDetails.jsp"); 44 | request.setAttribute("selected_driver", selectedDriver); 45 | rd.forward(request, response); 46 | } catch (SQLException ex) { 47 | Logger.getLogger(ViewDriverApplicationDetailsController.class.getName()).log(Level.SEVERE, null, ex); 48 | } 49 | } 50 | 51 | // 52 | /** 53 | * Handles the HTTP GET method. 54 | * 55 | * @param request servlet request 56 | * @param response servlet response 57 | * @throws ServletException if a servlet-specific error occurs 58 | * @throws IOException if an I/O error occurs 59 | */ 60 | @Override 61 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 62 | throws ServletException, IOException { 63 | processRequest(request, response); 64 | } 65 | 66 | /** 67 | * Handles the HTTP POST method. 68 | * 69 | * @param request servlet request 70 | * @param response servlet response 71 | * @throws ServletException if a servlet-specific error occurs 72 | * @throws IOException if an I/O error occurs 73 | */ 74 | @Override 75 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 76 | throws ServletException, IOException { 77 | processRequest(request, response); 78 | } 79 | 80 | /** 81 | * Returns a short description of the servlet. 82 | * 83 | * @return a String containing servlet description 84 | */ 85 | @Override 86 | public String getServletInfo() { 87 | return "Short description"; 88 | }// 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/java/Controller/ViewPassengerInfoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import PassengerRideManagementModule.Passenger; 10 | import PassengerRideManagementModule.Request; 11 | import java.io.IOException; 12 | import java.io.PrintWriter; 13 | import java.util.ArrayList; 14 | import javax.servlet.RequestDispatcher; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | import javax.servlet.http.HttpSession; 21 | 22 | /** 23 | * 24 | * @author reem 25 | */ 26 | @WebServlet(name = "ViewPassengerInfoController", urlPatterns = {"/ViewPassengerInfoController"}) 27 | public class ViewPassengerInfoController extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | String Passenger_ID = request.getParameter("passengerid"); 41 | HttpSession session = request.getSession(); 42 | Driver d = (Driver) session.getAttribute("driver"); //Get the Driver logged in Right now 43 | if (d != null) { 44 | ArrayList Passengers = d.viewPassengerInfo(Passenger_ID); 45 | RequestDispatcher rd = request.getRequestDispatcher("viewPassengerInfo.jsp"); 46 | request.setAttribute("Passengers", Passengers); 47 | rd.forward(request, response); 48 | } 49 | } 50 | 51 | // 52 | /** 53 | * Handles the HTTP GET method. 54 | * 55 | * @param request servlet request 56 | * @param response servlet response 57 | * @throws ServletException if a servlet-specific error occurs 58 | * @throws IOException if an I/O error occurs 59 | */ 60 | @Override 61 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 62 | throws ServletException, IOException { 63 | processRequest(request, response); 64 | } 65 | 66 | /** 67 | * Handles the HTTP POST method. 68 | * 69 | * @param request servlet request 70 | * @param response servlet response 71 | * @throws ServletException if a servlet-specific error occurs 72 | * @throws IOException if an I/O error occurs 73 | */ 74 | @Override 75 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 76 | throws ServletException, IOException { 77 | processRequest(request, response); 78 | } 79 | 80 | /** 81 | * Returns a short description of the servlet. 82 | * 83 | * @return a String containing servlet description 84 | */ 85 | @Override 86 | public String getServletInfo() { 87 | return "Short description"; 88 | }// 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/java/Controller/ViewPassengerRequestsController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import PassengerRideManagementModule.Passenger; 10 | import PassengerRideManagementModule.Request; 11 | import java.io.IOException; 12 | import java.io.PrintWriter; 13 | import java.util.ArrayList; 14 | import javax.servlet.RequestDispatcher; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | import javax.servlet.http.HttpSession; 21 | 22 | /** 23 | * 24 | * @author reem 25 | */ 26 | @WebServlet(name = "ViewPassengerRequestsController", urlPatterns = {"/ViewPassengerRequestsController"}) 27 | public class ViewPassengerRequestsController extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | String Ride_ID = request.getParameter("rideid"); 41 | HttpSession session = request.getSession(); 42 | Driver d = (Driver) session.getAttribute("driver"); //Get the Driver logged in Right now 43 | if (d != null) { 44 | ArrayList Requests = d.viewPassengerRequests(Ride_ID); 45 | RequestDispatcher rd = request.getRequestDispatcher("viewPassengerRequests.jsp"); 46 | request.setAttribute("Requests", Requests); 47 | rd.forward(request, response); 48 | } 49 | } 50 | 51 | // 52 | /** 53 | * Handles the HTTP GET method. 54 | * 55 | * @param request servlet request 56 | * @param response servlet response 57 | * @throws ServletException if a servlet-specific error occurs 58 | * @throws IOException if an I/O error occurs 59 | */ 60 | @Override 61 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 62 | throws ServletException, IOException { 63 | processRequest(request, response); 64 | } 65 | 66 | /** 67 | * Handles the HTTP POST method. 68 | * 69 | * @param request servlet request 70 | * @param response servlet response 71 | * @throws ServletException if a servlet-specific error occurs 72 | * @throws IOException if an I/O error occurs 73 | */ 74 | @Override 75 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 76 | throws ServletException, IOException { 77 | processRequest(request, response); 78 | } 79 | 80 | /** 81 | * Returns a short description of the servlet. 82 | * 83 | * @return a String containing servlet description 84 | */ 85 | @Override 86 | public String getServletInfo() { 87 | return "Short description"; 88 | }// 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/java/Controller/ViewOfferedRidesController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import DriverRideManagementModule.SingleRide; 10 | import DriverRideManagementModule.WeeklyRide; 11 | import java.io.IOException; 12 | import java.io.PrintWriter; 13 | import java.util.ArrayList; 14 | import javax.servlet.RequestDispatcher; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | import javax.servlet.http.HttpSession; 21 | 22 | /** 23 | * 24 | * @author Tasli 25 | */ 26 | @WebServlet(name = "ViewOfferedRidesController", urlPatterns = {"/ViewOfferedRidesController"}) 27 | public class ViewOfferedRidesController extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | HttpSession session = request.getSession(); 41 | Driver d = (Driver) session.getAttribute("driver"); //Get the Driver logged in Right now 42 | if (d != null) { 43 | ArrayList singleRides = d.viewSingleOfferedRides(); 44 | ArrayList weeklyRides = d.viewWeeklyOfferedRides(); 45 | RequestDispatcher rd = request.getRequestDispatcher("ViewOfferedRides.jsp"); 46 | request.setAttribute("singleRides", singleRides); 47 | request.setAttribute("weeklyRides", weeklyRides); 48 | rd.forward(request, response); 49 | 50 | } 51 | } 52 | 53 | // 54 | /** 55 | * Handles the HTTP GET method. 56 | * 57 | * @param request servlet request 58 | * @param response servlet response 59 | * @throws ServletException if a servlet-specific error occurs 60 | * @throws IOException if an I/O error occurs 61 | */ 62 | @Override 63 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 64 | throws ServletException, IOException { 65 | processRequest(request, response); 66 | } 67 | 68 | /** 69 | * Handles the HTTP POST method. 70 | * 71 | * @param request servlet request 72 | * @param response servlet response 73 | * @throws ServletException if a servlet-specific error occurs 74 | * @throws IOException if an I/O error occurs 75 | */ 76 | @Override 77 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 78 | throws ServletException, IOException { 79 | processRequest(request, response); 80 | } 81 | 82 | /** 83 | * Returns a short description of the servlet. 84 | * 85 | * @return a String containing servlet description 86 | */ 87 | @Override 88 | public String getServletInfo() { 89 | return "Short description"; 90 | }// 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/java/Controller/ViewDriverRequestsController.java: -------------------------------------------------------------------------------- 1 | ///* 2 | // * To change this license header, choose License Headers in Project Properties. 3 | // * To change this template file, choose Tools | Templates 4 | // * and open the template in the editor. 5 | // */ 6 | /** 7 | * 8 | * @author ayahal-harthy 9 | */ 10 | package Controller; 11 | 12 | import DriverRideManagementModule.Driver; 13 | import UserManagementModule.Admin; 14 | import java.io.IOException; 15 | import java.io.PrintWriter; 16 | import java.sql.SQLException; 17 | import java.util.ArrayList; 18 | import java.util.logging.Level; 19 | import java.util.logging.Logger; 20 | import javax.servlet.RequestDispatcher; 21 | import javax.servlet.ServletException; 22 | import javax.servlet.annotation.WebServlet; 23 | import javax.servlet.http.HttpServlet; 24 | import javax.servlet.http.HttpServletRequest; 25 | import javax.servlet.http.HttpServletResponse; 26 | import javax.servlet.http.HttpSession; 27 | import javax.sql.rowset.CachedRowSet; 28 | 29 | @WebServlet(name = "ViewDriverRequestsController", urlPatterns = {"/ViewDriverRequestsController"}) 30 | public class ViewDriverRequestsController extends HttpServlet { 31 | 32 | /** 33 | * Processes requests for both HTTP GET and POST 34 | * methods. 35 | * 36 | * @param request servlet request 37 | * @param response servlet response 38 | * @throws ServletException if a servlet-specific error occurs 39 | * @throws IOException if an I/O error occurs 40 | * @throws java.sql.SQLException 41 | */ 42 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 43 | throws ServletException, IOException { 44 | 45 | try { 46 | HttpSession session = request.getSession(); 47 | ArrayList driverList = Admin.retriveDriverRequests(); 48 | RequestDispatcher rd = request.getRequestDispatcher("ViewDriverApplications.jsp"); 49 | request.setAttribute("DriverList", driverList); 50 | rd.forward(request, response); 51 | } catch (SQLException ex) { 52 | Logger.getLogger(ViewDriverRequestsController.class.getName()).log(Level.SEVERE, null, ex); 53 | } 54 | 55 | } 56 | 57 | // 58 | /** 59 | * Handles the HTTP GET method. 60 | * 61 | * @param request servlet request 62 | * @param response servlet response 63 | * @throws ServletException if a servlet-specific error occurs 64 | * @throws IOException if an I/O error occurs 65 | */ 66 | @Override 67 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 68 | throws ServletException, IOException { 69 | processRequest(request, response); 70 | } 71 | 72 | /** 73 | * Handles the HTTP POST method. 74 | * 75 | * @param request servlet request 76 | * @param response servlet response 77 | * @throws ServletException if a servlet-specific error occurs 78 | * @throws IOException if an I/O error occurs 79 | */ 80 | @Override 81 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 82 | throws ServletException, IOException { 83 | processRequest(request, response); 84 | } 85 | 86 | /** 87 | * Returns a short description of the servlet. 88 | * 89 | * @return a String containing servlet description 90 | */ 91 | @Override 92 | public String getServletInfo() { 93 | return "Short description"; 94 | }// 95 | 96 | } 97 | -------------------------------------------------------------------------------- /web/ViewDriverDetails.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : ViewDriverApplications 3 | Created on : Apr 5, 2020, 9:29:46 PM 4 | Author : Ayah 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | Driver Details 13 | 14 | 15 | 16 | 17 |
18 |

Driver Application Details

19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | 63 | 64 | 65 | 66 |
Email Address${selected_driver.emailID}
Car Model${selected_driver.myCar.carModel}
Car Capacity${selected_driver.myCar.carCapacity}
License Image
Car Registration Image
Emirates ID Image
50 |
51 | 52 | 53 | 54 |
55 |
57 |
58 | 59 | 60 | 61 |
62 |
67 |
68 |
69 |
70 | 71 | -------------------------------------------------------------------------------- /src/java/Controller/ViewPassengerConfirmedRidesController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Ride; 9 | import DriverRideManagementModule.SingleRide; 10 | import DriverRideManagementModule.WeeklyRide; 11 | import PassengerRideManagementModule.Passenger; 12 | import java.io.IOException; 13 | import java.io.PrintWriter; 14 | import java.sql.SQLException; 15 | import java.util.ArrayList; 16 | import java.util.logging.Level; 17 | import java.util.logging.Logger; 18 | import javax.servlet.RequestDispatcher; 19 | import javax.servlet.ServletException; 20 | import javax.servlet.annotation.WebServlet; 21 | import javax.servlet.http.HttpServlet; 22 | import javax.servlet.http.HttpServletRequest; 23 | import javax.servlet.http.HttpServletResponse; 24 | import javax.servlet.http.HttpSession; 25 | import javax.sql.rowset.CachedRowSet; 26 | 27 | /** 28 | * 29 | * @author azada 30 | */ 31 | @WebServlet(name = "ViewPassengerConfirmedRidesController", urlPatterns = {"/ViewPassengerConfirmedRidesController"}) 32 | public class ViewPassengerConfirmedRidesController extends HttpServlet { 33 | 34 | /** 35 | * Processes requests for both HTTP GET and POST 36 | * methods. 37 | * 38 | * @param request servlet request 39 | * @param response servlet response 40 | * @throws ServletException if a servlet-specific error occurs 41 | * @throws IOException if an I/O error occurs 42 | */ 43 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 44 | throws ServletException, IOException { 45 | ArrayList singleRides; 46 | ArrayList weeklyRides; 47 | HttpSession session = request.getSession(); 48 | Passenger p = (Passenger) session.getAttribute("passenger"); //Get the Driver logged in Right now 49 | if (p != null){ 50 | singleRides = p.viewSingleConfirmedRides(); 51 | weeklyRides = p.viewWeeklyConfirmedRides(); 52 | 53 | 54 | RequestDispatcher rd = request.getRequestDispatcher("ViewPassengerConfirmedRides.jsp"); 55 | 56 | request.setAttribute("singleRides", singleRides); 57 | request.setAttribute("weeklyRides", weeklyRides); 58 | rd.forward(request, response); 59 | } 60 | 61 | 62 | 63 | 64 | } 65 | 66 | // 67 | /** 68 | * Handles the HTTP GET method. 69 | * 70 | * @param request servlet request 71 | * @param response servlet response 72 | * @throws ServletException if a servlet-specific error occurs 73 | * @throws IOException if an I/O error occurs 74 | */ 75 | @Override 76 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 77 | throws ServletException, IOException { 78 | processRequest(request, response); 79 | } 80 | 81 | /** 82 | * Handles the HTTP POST method. 83 | * 84 | * @param request servlet request 85 | * @param response servlet response 86 | * @throws ServletException if a servlet-specific error occurs 87 | * @throws IOException if an I/O error occurs 88 | */ 89 | @Override 90 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 91 | throws ServletException, IOException { 92 | processRequest(request, response); 93 | } 94 | 95 | /** 96 | * Returns a short description of the servlet. 97 | * 98 | * @return a String containing servlet description 99 | */ 100 | @Override 101 | public String getServletInfo() { 102 | return "Short description"; 103 | }// 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/java/Controller/RequestSelectedRideController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Ride; 9 | import PassengerRideManagementModule.Passenger; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | import javax.servlet.RequestDispatcher; 13 | import javax.servlet.ServletException; 14 | import javax.servlet.annotation.WebServlet; 15 | import javax.servlet.http.HttpServlet; 16 | import javax.servlet.http.HttpServletRequest; 17 | import javax.servlet.http.HttpServletResponse; 18 | import javax.servlet.http.HttpSession; 19 | import javax.sql.rowset.CachedRowSet; 20 | 21 | /** 22 | * 23 | * @author azada 24 | */ 25 | @WebServlet(name = "RequestSelectedRideController", urlPatterns = {"/RequestSelectedRideController"}) 26 | public class RequestSelectedRideController extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | String outcomeMessage = null; 41 | HttpSession session = request.getSession(); 42 | Passenger p = (Passenger) session.getAttribute("passenger"); 43 | 44 | if (p.getEmailID().equals(request.getParameter("driver_id"))){ 45 | outcomeMessage = "Error! Can't request own ride"; 46 | } 47 | else{ 48 | boolean addSuccess = Ride.createRequest(Integer.parseInt(request.getParameter("selected_ride")), p.getEmailID(), request.getParameter("pickup_location"), request.getParameter("dropoff_location")); 49 | if (addSuccess) { 50 | outcomeMessage = "Successfully requested ride!"; 51 | } else { 52 | outcomeMessage = "Error! Unable to request ride"; 53 | } 54 | } 55 | 56 | RequestDispatcher rd = request.getRequestDispatcher("RideRequestConfirmation.jsp"); 57 | request.setAttribute("outcome_message", outcomeMessage); 58 | rd.forward(request, response); 59 | } 60 | 61 | // 62 | /** 63 | * Handles the HTTP GET method. 64 | * 65 | * @param request servlet request 66 | * @param response servlet response 67 | * @throws ServletException if a servlet-specific error occurs 68 | * @throws IOException if an I/O error occurs 69 | */ 70 | @Override 71 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 72 | throws ServletException, IOException { 73 | processRequest(request, response); 74 | } 75 | 76 | /** 77 | * Handles the HTTP POST method. 78 | * 79 | * @param request servlet request 80 | * @param response servlet response 81 | * @throws ServletException if a servlet-specific error occurs 82 | * @throws IOException if an I/O error occurs 83 | */ 84 | @Override 85 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 86 | throws ServletException, IOException { 87 | processRequest(request, response); 88 | } 89 | 90 | /** 91 | * Returns a short description of the servlet. 92 | * 93 | * @return a String containing servlet description 94 | */ 95 | @Override 96 | public String getServletInfo() { 97 | return "Short description"; 98 | }// 99 | 100 | } 101 | -------------------------------------------------------------------------------- /web/ViewDriverAndRideInfo.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : ViewDriverAndRideInfo 3 | Created on : Apr 8, 2020, 6:00:50 PM 4 | Author : azada 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | Full Ride Info 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

Driver Information

21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
First Name${selected_driver.firstName}
Last Name${selected_driver.lastName}
Gender${selected_driver.gender}
Car Model${selected_driver.myCar.carModel}
Mobile Number${selected_driver.mobileNumber}
48 | 49 |
50 |
51 | <% 52 | System.out.println("Start: "+request.getParameter("starting_location")); 53 | %> 54 |
55 |

Ride Information

56 |
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
Seat Availability${param.seat_availability}
Starting Location${param.starting_location}
Ending Location${param.ending_location}
Arrival/Departure Time${param.arrival_dep_time}
79 | 80 |
81 | 82 | 83 | -------------------------------------------------------------------------------- /src/java/Controller/AcceptRejectDriverApplicationController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import PassengerRideManagementModule.Passenger; 10 | import UserManagementModule.Admin; 11 | import java.io.IOException; 12 | import java.io.PrintWriter; 13 | import java.util.ArrayList; 14 | import javax.servlet.RequestDispatcher; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | import javax.servlet.http.HttpSession; 21 | 22 | /** 23 | * 24 | * @author reem 25 | */ 26 | @WebServlet(name = "AcceptRejectDriverApplicationController", urlPatterns = {"/AcceptRejectDriverApplicationController"}) 27 | public class AcceptRejectDriverApplicationController extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | String Driver_ID = request.getParameter("driverID"); 41 | String Action = request.getParameter("action"); 42 | 43 | HttpSession session = request.getSession(); 44 | 45 | if ("accept".equals(Action)) 46 | { 47 | Admin.acceptDriverRequest(Driver_ID); 48 | String Message = "Driver Application Request Accepted Successfully!"; 49 | RequestDispatcher rd = request.getRequestDispatcher("DriverAcceptedOrRejected.jsp"); 50 | request.setAttribute("Message", Message); 51 | rd.forward(request, response); 52 | 53 | 54 | } 55 | else if("cancel".equals(Action)) 56 | { 57 | Admin.rejectDriverRequest(Driver_ID); 58 | String Message = "Driver Application Request Rejected Successfully!"; 59 | RequestDispatcher rd = request.getRequestDispatcher("DriverAcceptedOrRejected.jsp"); 60 | request.setAttribute("Message", Message); 61 | rd.forward(request, response); 62 | } 63 | 64 | 65 | 66 | 67 | } 68 | 69 | // 70 | /** 71 | * Handles the HTTP GET method. 72 | * 73 | * @param request servlet request 74 | * @param response servlet response 75 | * @throws ServletException if a servlet-specific error occurs 76 | * @throws IOException if an I/O error occurs 77 | */ 78 | @Override 79 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 80 | throws ServletException, IOException { 81 | processRequest(request, response); 82 | } 83 | 84 | /** 85 | * Handles the HTTP POST method. 86 | * 87 | * @param request servlet request 88 | * @param response servlet response 89 | * @throws ServletException if a servlet-specific error occurs 90 | * @throws IOException if an I/O error occurs 91 | */ 92 | @Override 93 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 94 | throws ServletException, IOException { 95 | processRequest(request, response); 96 | } 97 | 98 | /** 99 | * Returns a short description of the servlet. 100 | * 101 | * @return a String containing servlet description 102 | */ 103 | @Override 104 | public String getServletInfo() { 105 | return "Short description"; 106 | }// 107 | 108 | } -------------------------------------------------------------------------------- /src/java/Controller/PassengerActionController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import PassengerRideManagementModule.Passenger; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | import java.util.ArrayList; 13 | import javax.servlet.RequestDispatcher; 14 | import javax.servlet.ServletException; 15 | import javax.servlet.annotation.WebServlet; 16 | import javax.servlet.http.HttpServlet; 17 | import javax.servlet.http.HttpServletRequest; 18 | import javax.servlet.http.HttpServletResponse; 19 | import javax.servlet.http.HttpSession; 20 | 21 | /** 22 | * 23 | * @author reem 24 | */ 25 | @WebServlet(name = "PassengerActionController", urlPatterns = {"/PassengerActionController"}) 26 | public class PassengerActionController extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | String Passenger_ID = request.getParameter("passengerid"); 40 | String Ride_ID = request.getParameter("rideid"); 41 | String Passenger_Status = request.getParameter("passengerstatus"); 42 | HttpSession session = request.getSession(); 43 | Driver d = (Driver) session.getAttribute("driver"); //Get the Driver logged in Right now 44 | if (d != null) { 45 | if ("Confirm/Remove".equals(Passenger_Status)) 46 | { 47 | String Message = "Confirm or Remove Pending Passenger:"; 48 | RequestDispatcher rd = request.getRequestDispatcher("ConfirmOrRemovePendingPassenger.jsp"); 49 | request.setAttribute("Message", Message); 50 | request.setAttribute("Passenger_ID", Passenger_ID); 51 | request.setAttribute("Ride_ID", Ride_ID); 52 | rd.forward(request, response); 53 | } 54 | else 55 | { 56 | 57 | String Message = "Remove Registered Passenger:"; 58 | RequestDispatcher rd = request.getRequestDispatcher("RemoveRegisteredPassenger.jsp"); 59 | request.setAttribute("Message", Message); 60 | request.setAttribute("Passenger_ID", Passenger_ID); 61 | request.setAttribute("Ride_ID", Ride_ID); 62 | rd.forward(request, response); 63 | } 64 | 65 | 66 | } 67 | } 68 | 69 | // 70 | /** 71 | * Handles the HTTP GET method. 72 | * 73 | * @param request servlet request 74 | * @param response servlet response 75 | * @throws ServletException if a servlet-specific error occurs 76 | * @throws IOException if an I/O error occurs 77 | */ 78 | @Override 79 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 80 | throws ServletException, IOException { 81 | processRequest(request, response); 82 | } 83 | 84 | /** 85 | * Handles the HTTP POST method. 86 | * 87 | * @param request servlet request 88 | * @param response servlet response 89 | * @throws ServletException if a servlet-specific error occurs 90 | * @throws IOException if an I/O error occurs 91 | */ 92 | @Override 93 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 94 | throws ServletException, IOException { 95 | processRequest(request, response); 96 | } 97 | 98 | /** 99 | * Returns a short description of the servlet. 100 | * 101 | * @return a String containing servlet description 102 | */ 103 | @Override 104 | public String getServletInfo() { 105 | return "Short description"; 106 | }// 107 | 108 | } 109 | -------------------------------------------------------------------------------- /web/NewUserRegistration.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : newUserRegistration 3 | Created on : Apr 1, 2020, 9:11:50 PM 4 | Author : Tasli 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Register 14 | 15 | 31 | 32 | 33 |
34 |
35 |
36 |
37 |
38 |

New User Registration

39 | 40 |
41 | ${errmsg} 42 |
43 |
44 |
45 | 46 | 47 |
48 |
49 | 50 | 51 |
52 |
53 | 54 | 55 |
56 |
57 | 58 | 59 |
60 |
61 | 62 | 63 |
64 |
65 | 66 | 70 |
71 |

72 | 73 |
74 | 75 |
76 |
77 | 78 |
79 |
80 |
81 | 82 | 83 |
84 |
85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /web/RegisterAsDriver.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : RegisterAsDriver 3 | Created on : Apr 3, 2020, 4:38:39 PM 4 | Author : Tasli 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Register As Driver 14 | 15 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 |
50 |

Register As Driver

51 | 52 |
53 | ${errmsg} 54 |
55 |
56 |
57 | 58 | 59 |
60 | 61 |
62 | 63 | 71 |
72 | 73 |
74 |
75 | Choose Emirates ID Image file 76 | 77 |
78 |
79 | 80 |
81 |
82 | Choose License Image file 83 | 84 |
85 |
86 |
87 |
88 | Choose Registration Image file 89 | 90 |
91 |
92 |

93 | 94 |
95 | 96 |
97 |
98 | 99 |
100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/java/Controller/RegisterController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import UserManagementModule.Platform; 9 | import java.io.IOException; 10 | import java.io.PrintWriter; 11 | import java.io.UnsupportedEncodingException; 12 | import java.security.NoSuchAlgorithmException; 13 | import java.sql.SQLException; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import javax.servlet.RequestDispatcher; 17 | import javax.servlet.ServletException; 18 | import javax.servlet.annotation.WebServlet; 19 | import javax.servlet.http.HttpServlet; 20 | import javax.servlet.http.HttpServletRequest; 21 | import javax.servlet.http.HttpServletResponse; 22 | 23 | /** 24 | * 25 | * @author Tasli 26 | */ 27 | @WebServlet(name = "RegisterController", urlPatterns = {"/RegisterController"}) 28 | public class RegisterController extends HttpServlet { 29 | 30 | /** 31 | * Processes requests for both HTTP GET and POST 32 | * methods. 33 | * 34 | * @param request servlet request 35 | * @param response servlet response 36 | * @throws ServletException if a servlet-specific error occurs 37 | * @throws IOException if an I/O error occurs 38 | */ 39 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 40 | throws ServletException, IOException { 41 | 42 | String email = request.getParameter("email"); 43 | String password = request.getParameter("pwd"); 44 | String fname = request.getParameter("fname"); 45 | String lname = request.getParameter("lname"); 46 | String gender = request.getParameter("gender"); 47 | String mobilenumber = request.getParameter("mobilenumber"); 48 | 49 | boolean isAdded; 50 | try { 51 | isAdded = (new Platform()).submitRegistrationFormDetails(email, password, fname, lname, gender, mobilenumber); 52 | if (isAdded) { 53 | RequestDispatcher rd = request.getRequestDispatcher("index.jsp"); 54 | request.setAttribute("errmsg", "You can now log-in with your registered ID"); 55 | rd.forward(request, response); 56 | } else { 57 | RequestDispatcher rd = request.getRequestDispatcher("NewUserRegistration.jsp"); 58 | request.setAttribute("errmsg", "User Already Exist"); 59 | rd.forward(request, response); 60 | } 61 | } catch (SQLException ex) { 62 | RequestDispatcher rd = request.getRequestDispatcher("NewUserRegistration.jsp"); 63 | request.setAttribute("errmsg", "Connection Issues. Try again later. Please note you can only submit the form once."); 64 | rd.forward(request, response); 65 | Logger.getLogger(RegisterController.class.getName()).log(Level.SEVERE, null, ex); 66 | } catch (NoSuchAlgorithmException ex) { 67 | Logger.getLogger(RegisterController.class.getName()).log(Level.SEVERE, null, ex); 68 | } catch (UnsupportedEncodingException ex) { 69 | Logger.getLogger(RegisterController.class.getName()).log(Level.SEVERE, null, ex); 70 | } 71 | 72 | } 73 | 74 | // 75 | /** 76 | * Handles the HTTP GET method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | processRequest(request, response); 87 | } 88 | 89 | /** 90 | * Handles the HTTP POST method. 91 | * 92 | * @param request servlet request 93 | * @param response servlet response 94 | * @throws ServletException if a servlet-specific error occurs 95 | * @throws IOException if an I/O error occurs 96 | */ 97 | @Override 98 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 99 | throws ServletException, IOException { 100 | processRequest(request, response); 101 | } 102 | 103 | /** 104 | * Returns a short description of the servlet. 105 | * 106 | * @return a String containing servlet description 107 | */ 108 | @Override 109 | public String getServletInfo() { 110 | return "Short description"; 111 | }// 112 | 113 | } 114 | -------------------------------------------------------------------------------- /web/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : index 3 | Created on : Apr 5, 2020, 1:57:47 PM 4 | Author : Tasli 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Login Page 14 | 15 | 26 | 74 | 75 | 76 | 77 |
78 |
79 |
80 | 81 |
82 | 108 |
109 |
110 |
111 | 112 | 113 |
114 | 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /src/java/Controller/RegisterDriverController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import PassengerRideManagementModule.Passenger; 10 | import java.io.IOException; 11 | import java.io.InputStream; 12 | import java.io.PrintWriter; 13 | import java.sql.SQLException; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import javax.servlet.RequestDispatcher; 17 | import javax.servlet.ServletException; 18 | import javax.servlet.annotation.MultipartConfig; 19 | import javax.servlet.annotation.WebServlet; 20 | import javax.servlet.http.HttpServlet; 21 | import javax.servlet.http.HttpServletRequest; 22 | import javax.servlet.http.HttpServletResponse; 23 | import javax.servlet.http.HttpSession; 24 | import javax.servlet.http.Part; 25 | import javax.sql.rowset.CachedRowSet; 26 | 27 | /** 28 | * 29 | * @author Tasli 30 | */ 31 | @MultipartConfig 32 | @WebServlet(name = "RegisterDriverController", urlPatterns = {"/RegisterDriverController"}) 33 | public class RegisterDriverController extends HttpServlet { 34 | 35 | /** 36 | * Processes requests for both HTTP GET and POST 37 | * methods. 38 | * 39 | * @param request servlet request 40 | * @param response servlet response 41 | * @throws ServletException if a servlet-specific error occurs 42 | * @throws IOException if an I/O error occurs 43 | */ 44 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 45 | throws ServletException, IOException { 46 | 47 | String carModel = request.getParameter("carModel"); 48 | String capacity = request.getParameter("capacity"); 49 | 50 | // obtains the upload file part in this multipart request 51 | Part filePartEID = request.getPart("EID"); 52 | Part filePartLicense = request.getPart("license"); 53 | Part filePartCarReg = request.getPart("carReg"); 54 | System.out.println(filePartCarReg); 55 | HttpSession session = request.getSession(); 56 | Passenger p = (Passenger) session.getAttribute("passenger"); 57 | Integer carCapacity = Integer.parseInt(capacity); 58 | 59 | boolean checkDetails = p.checkDriverRegistrationDetails(carModel, carCapacity, filePartEID, filePartLicense, filePartCarReg); 60 | if(checkDetails){ 61 | try { 62 | System.out.println("Inside"); 63 | Driver d = new Driver(); 64 | boolean success = d.updateDriverProfile(p.getEmailID(), carModel, carCapacity, filePartEID, filePartLicense, filePartCarReg); 65 | if(success){ 66 | request.setAttribute("errmsg", "Submitted your application. Please wait for admin to review."); 67 | }else{ 68 | System.out.println("Driver did not add"); 69 | request.setAttribute("errmsg", "Something went wrong. Try again Later"); 70 | } 71 | } catch (SQLException ex) { 72 | Logger.getLogger(RegisterDriverController.class.getName()).log(Level.SEVERE, null, ex); 73 | request.setAttribute("errmsg", "Something went wrong. If you already submitted a request earlier, please have patience."); 74 | } 75 | }else{ 76 | System.out.println("Passenger said false"); 77 | request.setAttribute("errmsg", "Something went wrong. Please enter details correctly."); 78 | } 79 | RequestDispatcher rd = request.getRequestDispatcher("RegisterAsDriver.jsp"); 80 | rd.forward(request, response); 81 | } 82 | 83 | // 84 | /** 85 | * Handles the HTTP GET method. 86 | * 87 | * @param request servlet request 88 | * @param response servlet response 89 | * @throws ServletException if a servlet-specific error occurs 90 | * @throws IOException if an I/O error occurs 91 | */ 92 | @Override 93 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 94 | throws ServletException, IOException { 95 | processRequest(request, response); 96 | } 97 | 98 | /** 99 | * Handles the HTTP POST method. 100 | * 101 | * @param request servlet request 102 | * @param response servlet response 103 | * @throws ServletException if a servlet-specific error occurs 104 | * @throws IOException if an I/O error occurs 105 | */ 106 | @Override 107 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 108 | throws ServletException, IOException { 109 | processRequest(request, response); 110 | } 111 | 112 | /** 113 | * Returns a short description of the servlet. 114 | * 115 | * @return a String containing servlet description 116 | */ 117 | @Override 118 | public String getServletInfo() { 119 | return "Short description"; 120 | }// 121 | 122 | } 123 | -------------------------------------------------------------------------------- /nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=true 3 | annotation.processing.processors.list= 4 | annotation.processing.run.all.processors=true 5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 6 | build.classes.dir=${build.web.dir}/WEB-INF/classes 7 | build.classes.excludes=**/*.java,**/*.form 8 | build.dir=build 9 | build.generated.dir=${build.dir}/generated 10 | build.generated.sources.dir=${build.dir}/generated-sources 11 | build.test.classes.dir=${build.dir}/test/classes 12 | build.test.results.dir=${build.dir}/test/results 13 | build.web.dir=${build.dir}/web 14 | build.web.excludes=${build.classes.excludes} 15 | client.urlPart= 16 | compile.jsps=false 17 | conf.dir=${source.root}/conf 18 | debug.classpath=${build.classes.dir}:${javac.classpath} 19 | debug.test.classpath=\ 20 | ${run.test.classpath} 21 | display.browser=true 22 | # Files to be excluded from distribution war 23 | dist.archive.excludes= 24 | dist.dir=dist 25 | dist.ear.war=${dist.dir}/${war.ear.name} 26 | dist.javadoc.dir=${dist.dir}/javadoc 27 | dist.war=${dist.dir}/${war.name} 28 | endorsed.classpath=\ 29 | ${libs.javaee-endorsed-api-7.0.classpath} 30 | excludes= 31 | file.reference.ojdbc7.jar=ojdbc7.jar 32 | includes=** 33 | j2ee.compile.on.save=true 34 | j2ee.copy.static.files.on.save=true 35 | j2ee.deploy.on.save=true 36 | j2ee.platform=1.7-web 37 | j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/cdi-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar 38 | j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar 39 | j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar 40 | j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar 41 | j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar 42 | j2ee.platform.wsit.classpath= 43 | j2ee.server.type=gfv3ee6 44 | jar.compress=false 45 | javac.classpath=\ 46 | ${libs.JAVADB_DRIVER_LABEL.classpath}:\ 47 | ${file.reference.ojdbc7.jar}:\ 48 | ${libs.junit_4.classpath}:\ 49 | ${libs.hamcrest.classpath} 50 | # Space-separated list of extra javac options 51 | javac.compilerargs= 52 | javac.debug=true 53 | javac.deprecation=false 54 | javac.processorpath=\ 55 | ${javac.classpath} 56 | javac.source=1.8 57 | javac.target=1.8 58 | javac.test.classpath=\ 59 | ${javac.classpath}:\ 60 | ${build.classes.dir} 61 | javac.test.processorpath=\ 62 | ${javac.test.classpath} 63 | javadoc.additionalparam= 64 | javadoc.author=false 65 | javadoc.encoding=${source.encoding} 66 | javadoc.noindex=false 67 | javadoc.nonavbar=false 68 | javadoc.notree=false 69 | javadoc.preview=true 70 | javadoc.private=false 71 | javadoc.splitindex=true 72 | javadoc.use=true 73 | javadoc.version=false 74 | javadoc.windowtitle= 75 | lib.dir=${web.docbase.dir}/WEB-INF/lib 76 | persistence.xml.dir=${conf.dir} 77 | platform.active=default_platform 78 | resource.dir=setup 79 | run.test.classpath=\ 80 | ${javac.test.classpath}:\ 81 | ${build.test.classes.dir} 82 | # Space-separated list of JVM arguments used when running a class with a main method or a unit test 83 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): 84 | runmain.jvmargs= 85 | source.encoding=UTF-8 86 | source.root=src 87 | src.dir=${source.root}/java 88 | test.src.dir=test 89 | war.content.additional= 90 | war.ear.name=${war.name} 91 | war.name=COE420-TeamE-FinalProject.war 92 | web.docbase.dir=web 93 | webinf.dir=web/WEB-INF 94 | -------------------------------------------------------------------------------- /src/java/Controller/SearchRidesController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Ride; 9 | import PassengerRideManagementModule.Location; 10 | import PassengerRideManagementModule.Passenger; 11 | import java.io.IOException; 12 | import java.io.PrintWriter; 13 | import java.time.LocalDate; 14 | import java.util.ArrayList; 15 | import javax.servlet.RequestDispatcher; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * 24 | * @author azada 25 | */ 26 | @WebServlet(name = "SearchRidesController", urlPatterns = {"/SearchRidesController"}) 27 | public class SearchRidesController extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | //Collect and parse all form inputs 41 | boolean isSingle = request.getParameter("single_or_weekly").equals("single"); 42 | String isToUni = (request.getParameter("to_from_uni").equals("to") ? "1" : "0"); 43 | LocalDate date = null; 44 | ArrayList days = null; 45 | if (isSingle){ 46 | date = LocalDate.parse(request.getParameter("ride_date")); 47 | } 48 | else{ 49 | days = new ArrayList<>(); 50 | for (String day : request.getParameterValues("ride_days")){ 51 | days.add(day); 52 | } 53 | } 54 | 55 | float homeLongitude = Float.parseFloat(request.getParameter("home_location_longitude")); 56 | float homeLatitude = Float.parseFloat(request.getParameter("home_location_latitude")); 57 | Location homeLocation = new Location(homeLatitude, homeLongitude); 58 | float uniLongitude = Float.parseFloat(request.getParameter("uni_location_longitude")); 59 | float uniLatitude = Float.parseFloat(request.getParameter("uni_location_latitude")); 60 | Location uniLocation = new Location(uniLatitude, uniLongitude); 61 | 62 | String rideTime = request.getParameter("ride_time"); 63 | ArrayList foundRides; 64 | if (isToUni.equals("1")){ 65 | foundRides = Passenger.searchRides(isSingle, isToUni, date, days, homeLocation, uniLocation, rideTime); 66 | request.setAttribute("pickup_location", (request.getParameter("home_location_latitude") + ", " + request.getParameter("home_location_longitude"))); 67 | request.setAttribute("dropoff_location", (request.getParameter("uni_location_latitude") + ", " + request.getParameter("uni_location_longitude"))); 68 | 69 | } 70 | else{ 71 | foundRides = Passenger.searchRides(isSingle, isToUni, date, days, uniLocation, homeLocation, rideTime); 72 | request.setAttribute("dropoff_location", (request.getParameter("home_location_latitude") + ", " + request.getParameter("home_location_longitude"))); 73 | request.setAttribute("pickup_location", (request.getParameter("uni_location_latitude") + ", " + request.getParameter("uni_location_longitude"))); 74 | } 75 | 76 | RequestDispatcher rd = request.getRequestDispatcher("MakeRideRequest.jsp"); 77 | request.setAttribute("found_rides", foundRides); 78 | rd.forward(request,response); 79 | } 80 | 81 | // 82 | /** 83 | * Handles the HTTP GET method. 84 | * 85 | * @param request servlet request 86 | * @param response servlet response 87 | * @throws ServletException if a servlet-specific error occurs 88 | * @throws IOException if an I/O error occurs 89 | */ 90 | @Override 91 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 92 | throws ServletException, IOException { 93 | processRequest(request, response); 94 | } 95 | 96 | /** 97 | * Handles the HTTP POST method. 98 | * 99 | * @param request servlet request 100 | * @param response servlet response 101 | * @throws ServletException if a servlet-specific error occurs 102 | * @throws IOException if an I/O error occurs 103 | */ 104 | @Override 105 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 106 | throws ServletException, IOException { 107 | processRequest(request, response); 108 | } 109 | 110 | /** 111 | * Returns a short description of the servlet. 112 | * 113 | * @return a String containing servlet description 114 | */ 115 | @Override 116 | public String getServletInfo() { 117 | return "Short description"; 118 | }// 119 | 120 | } 121 | -------------------------------------------------------------------------------- /src/java/Controller/ConfirmRemovePassengerController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import PassengerRideManagementModule.Passenger; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | import java.util.ArrayList; 13 | import javax.servlet.RequestDispatcher; 14 | import javax.servlet.ServletException; 15 | import javax.servlet.annotation.WebServlet; 16 | import javax.servlet.http.HttpServlet; 17 | import javax.servlet.http.HttpServletRequest; 18 | import javax.servlet.http.HttpServletResponse; 19 | import javax.servlet.http.HttpSession; 20 | 21 | /** 22 | * 23 | * @author reem 24 | */ 25 | @WebServlet(name = "ConfirmRemovePassengerController", urlPatterns = {"/ConfirmRemovePassengerController"}) 26 | public class ConfirmRemovePassengerController extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | String Passenger_ID = request.getParameter("passenger_id"); 40 | String Ride_ID = request.getParameter("rideid"); 41 | String Choice = request.getParameter("choice"); 42 | 43 | HttpSession session = request.getSession(); 44 | Driver d = (Driver) session.getAttribute("driver"); //Get the Driver logged in Right now 45 | if (d != null) { 46 | 47 | if ("Confirm".equals(Choice)) 48 | { 49 | String Confirmation = d.ConfirmPassengerRequest(Ride_ID, Passenger_ID); 50 | if("Confirmed".equals(Confirmation)) 51 | { 52 | String Message = "Passenger Confirmed Successfully!"; 53 | RequestDispatcher rd = request.getRequestDispatcher("RemoveRegisteredPassenger.jsp"); 54 | request.setAttribute("Message", Message); 55 | request.setAttribute("Ride_ID", Ride_ID); 56 | request.setAttribute("Passenger_ID", Passenger_ID); 57 | rd.forward(request, response); 58 | } 59 | else if ("No Seats".equals(Confirmation)) 60 | { 61 | String Message = "No Seats Available in Requested Ride!"; 62 | RequestDispatcher rd = request.getRequestDispatcher("PassengerRemovedOrNotConfirmed.jsp"); 63 | request.setAttribute("Message", Message); 64 | request.setAttribute("Ride_ID", Ride_ID); 65 | rd.forward(request, response); 66 | } 67 | } 68 | else if("RemoveNew".equals(Choice)) 69 | { 70 | d.RemovePassenger(Ride_ID, Passenger_ID); 71 | String Message = "Passenger Request Rejected Successfully!"; 72 | RequestDispatcher rd = request.getRequestDispatcher("PassengerRemovedOrNotConfirmed.jsp"); 73 | request.setAttribute("Message", Message); 74 | request.setAttribute("Ride_ID", Ride_ID); 75 | rd.forward(request, response); 76 | } 77 | else if("RemoveRegistered".equals(Choice)) 78 | { 79 | d.RemovePassenger(Ride_ID, Passenger_ID); 80 | String Message = "Passenger Removed Successfully!"; 81 | RequestDispatcher rd = request.getRequestDispatcher("PassengerRemovedOrNotConfirmed.jsp"); 82 | request.setAttribute("Message", Message); 83 | request.setAttribute("Ride_ID", Ride_ID); 84 | rd.forward(request, response); 85 | } 86 | 87 | 88 | 89 | } 90 | } 91 | 92 | // 93 | /** 94 | * Handles the HTTP GET method. 95 | * 96 | * @param request servlet request 97 | * @param response servlet response 98 | * @throws ServletException if a servlet-specific error occurs 99 | * @throws IOException if an I/O error occurs 100 | */ 101 | @Override 102 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 103 | throws ServletException, IOException { 104 | processRequest(request, response); 105 | } 106 | 107 | /** 108 | * Handles the HTTP POST method. 109 | * 110 | * @param request servlet request 111 | * @param response servlet response 112 | * @throws ServletException if a servlet-specific error occurs 113 | * @throws IOException if an I/O error occurs 114 | */ 115 | @Override 116 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 117 | throws ServletException, IOException { 118 | processRequest(request, response); 119 | } 120 | 121 | /** 122 | * Returns a short description of the servlet. 123 | * 124 | * @return a String containing servlet description 125 | */ 126 | @Override 127 | public String getServletInfo() { 128 | return "Short description"; 129 | }// 130 | 131 | } 132 | -------------------------------------------------------------------------------- /web/MakeRideRequest.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : MakeRideRequest 3 | Created on : Apr 4, 2020, 2:42:22 PM 4 | Author : azada 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Ride Request 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |

Found Rides

26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
Ride ID To Uni?Arrival/Departure TimeStart LocationEnd LocationCurrent Seat AvailabilityDateDayRequest RideView Driver Info
${ride.rideId}${ride.isToUni}${ride.arrivalDepartureTime}${ride.startingLocation}${ride.endingLocation}${ride.seatAvailability}${ride.date}${ride.day}
84 |
85 | 86 |
87 | 88 | 89 | -------------------------------------------------------------------------------- /src/java/Controller/LoginController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import DriverRideManagementModule.Driver; 8 | import PassengerRideManagementModule.Passenger; 9 | import UserManagementModule.Account; 10 | import UserManagementModule.Admin; 11 | import java.io.IOException; 12 | import java.io.PrintWriter; 13 | import java.io.UnsupportedEncodingException; 14 | import java.security.NoSuchAlgorithmException; 15 | import java.sql.SQLException; 16 | import java.util.ArrayList; 17 | import java.util.logging.Level; 18 | import java.util.logging.Logger; 19 | import javax.servlet.RequestDispatcher; 20 | import javax.servlet.ServletException; 21 | import javax.servlet.annotation.WebServlet; 22 | import javax.servlet.http.HttpServlet; 23 | import javax.servlet.http.HttpServletRequest; 24 | import javax.servlet.http.HttpServletResponse; 25 | import javax.servlet.http.HttpSession; 26 | 27 | /** 28 | * 29 | * @author Tasli 30 | */ 31 | @WebServlet("/LoginController") 32 | public class LoginController extends HttpServlet { 33 | 34 | /** 35 | * Processes requests for both HTTP GET and POST 36 | * methods. 37 | * 38 | * @param request servlet request 39 | * @param response servlet response 40 | * @throws ServletException if a servlet-specific error occurs 41 | * @throws IOException if an I/O error occurs 42 | */ 43 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 44 | throws ServletException, IOException { 45 | 46 | try { 47 | String userName = request.getParameter("email"); 48 | String password = request.getParameter("pwd"); 49 | boolean isValid= false; 50 | try { 51 | isValid = (new Account(userName, password)).login(); 52 | } catch (NoSuchAlgorithmException ex) { 53 | Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex); 54 | } catch (UnsupportedEncodingException ex) { 55 | Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex); 56 | } 57 | if (isValid) {//Successful login 58 | HttpSession session = request.getSession(); 59 | if (session != null) //If session is not null 60 | { 61 | //removes all session attributes bound to the session 62 | while (session.getAttributeNames().hasMoreElements()) { 63 | session.removeAttribute(session.getAttributeNames().nextElement()); 64 | } 65 | } 66 | session.setAttribute("username", userName); 67 | //If admin, go to the view driver applications page 68 | if (Admin.isAdmin(userName)) { 69 | 70 | 71 | RequestDispatcher rd = request.getRequestDispatcher("ViewDriverRequestsController"); 72 | 73 | 74 | rd.forward(request, response); 75 | } 76 | //else passenger and/or driver login 77 | Passenger p = Passenger.getPassenger(userName); 78 | session.setAttribute("passenger", p); 79 | if (p.isDriver()) { 80 | Driver d = new Driver(); 81 | d.setEmailID(userName); 82 | session.setAttribute("driver", d); 83 | System.out.println("setting as driver" + userName); 84 | } 85 | RequestDispatcher rd = request.getRequestDispatcher("findRide.jsp"); 86 | rd.forward(request, response); 87 | } else { // GO back to login page 88 | request.setAttribute("errmsg", "Username or Password is Invalid"); 89 | RequestDispatcher rd = request.getRequestDispatcher("index.jsp"); 90 | rd.forward(request, response); 91 | } 92 | } catch (SQLException ex) { 93 | Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex); 94 | request.setAttribute("errmsg", "Connection Error"); 95 | RequestDispatcher rd = request.getRequestDispatcher("index.jsp"); 96 | rd.forward(request, response); 97 | } 98 | 99 | } 100 | 101 | // 102 | /** 103 | * Handles the HTTP GET method. 104 | * 105 | * @param request servlet request 106 | * @param response servlet response 107 | * @throws ServletException if a servlet-specific error occurs 108 | * @throws IOException if an I/O error occurs 109 | */ 110 | @Override 111 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 112 | throws ServletException, IOException { 113 | processRequest(request, response); 114 | } 115 | 116 | /** 117 | * Handles the HTTP POST method. 118 | * 119 | * @param request servlet request 120 | * @param response servlet response 121 | * @throws ServletException if a servlet-specific error occurs 122 | * @throws IOException if an I/O error occurs 123 | */ 124 | @Override 125 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 126 | throws ServletException, IOException { 127 | processRequest(request, response); 128 | } 129 | 130 | /** 131 | * Returns a short description of the servlet. 132 | * 133 | * @return a String containing servlet description 134 | */ 135 | @Override 136 | public String getServletInfo() { 137 | return "Short description"; 138 | }// 139 | 140 | } 141 | -------------------------------------------------------------------------------- /web/viewPassengerRequests.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : ViewConfirmedRides 3 | Created on : Apr 2, 2020, 9:34:20 PM 4 | Author : reem 5 | --%> 6 | 7 | 8 | 9 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 10 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 11 | 12 | 13 | 14 | 15 | Passenger Requests 16 | 17 | 30 | 63 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
74 |

Passengers for Selected Ride

75 |
76 | 77 | 78 | 79 | 80 | 89 | 90 | 91 | <% int i=1;%> 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | <% i++;%> 104 | 105 | 106 | 107 | 108 |
Passenger No. 81 | Ride_ID 82 | Passenger_ID 83 | Pickup Location 84 | Dropoff Location 85 | View Passenger Information 86 | Action 87 | 88 |
<%out.println(i);%>${request.requested_ride_id}${request.passengerid}${request.pickupLocation}${request.dropoffLocation}
109 |
110 | 111 | 112 |
113 | 114 |
115 |
116 | 117 | -------------------------------------------------------------------------------- /web/findRide.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : findRIde 3 | Created on : Apr 1, 2020, 7:35:50 PM 4 | Author : Tasli 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Find A Ride 14 | 15 | 16 | 17 | 18 | 19 | <%-- 20 | 21 | 22 | 23 | --%> 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 |

Hello ${sessionScope.passenger.firstName}! Find A Ride!

35 |
36 | 37 |
38 |
39 |

Select Ride Frequency

40 | Single 41 | Weekly 42 |
43 | 44 |
45 |

Select Ride Mode

46 | To University 47 | From University 48 | 49 |
50 |
51 |
52 | 53 | 54 |
55 |
56 |
57 |
58 | 66 |
67 | 68 |
69 |

Home Area

70 | 71 | 72 | 73 |
74 |
75 | 76 |
77 |

University Area

78 | 79 | 80 | 81 |
82 |
83 | 84 |
85 |

Time

86 | 87 |
88 | 89 |
90 | 91 |
92 | 93 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /src/java/Controller/OfferARideController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package Controller; 7 | 8 | import DriverRideManagementModule.Driver; 9 | import DriverRideManagementModule.Ride; 10 | import DriverRideManagementModule.SingleRide; 11 | import DriverRideManagementModule.WeeklyRide; 12 | import PassengerRideManagementModule.Location; 13 | import PassengerRideManagementModule.Passenger; 14 | import java.io.IOException; 15 | import java.io.PrintWriter; 16 | import java.time.LocalDate; 17 | import java.util.ArrayList; 18 | import javax.servlet.RequestDispatcher; 19 | import javax.servlet.ServletException; 20 | import javax.servlet.annotation.WebServlet; 21 | import javax.servlet.http.HttpServlet; 22 | import javax.servlet.http.HttpServletRequest; 23 | import javax.servlet.http.HttpServletResponse; 24 | import javax.servlet.http.HttpSession; 25 | 26 | 27 | @WebServlet(name = "OfferARideController", urlPatterns = {"/OfferARideController"}) 28 | public class OfferARideController extends HttpServlet { 29 | 30 | public void setRideAttributes(Ride r, String isToUni, Location startingLocation, Location endingLocation,Driver d, String arrivalDepTime) { 31 | if (isToUni.equals("1")) { 32 | r.setIsToUni(true); 33 | } else { 34 | r.setIsToUni(false); 35 | } 36 | r.setStartingLocation(startingLocation); 37 | r.setEndingLocation(endingLocation); 38 | r.setDriver(d); 39 | r.setArrivalDepartureTime(arrivalDepTime); 40 | } 41 | 42 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 43 | throws ServletException, IOException { 44 | //Collect and parse all form inputs 45 | 46 | String rideTime = request.getParameter("ride_time"); 47 | if (Ride.isValid(rideTime)) { 48 | HttpSession session = request.getSession(); 49 | Driver d = (Driver) session.getAttribute("driver"); //Get the Driver logged in Right now 50 | Ride r = null; 51 | String isToUni = (request.getParameter("to_from_uni").equals("to") ? "1" : "0"); 52 | float startingLocationLongitude = 0; 53 | float startingLocationLatitude = 0; 54 | float endingLocationLongitude = 0; 55 | float endingLocationLatitude = 0; 56 | 57 | if (isToUni.equals("1")) { 58 | //Starting location is home,,, dropoff is uni 59 | startingLocationLongitude = Float.parseFloat(request.getParameter("home_location_longitude")); 60 | startingLocationLatitude = Float.parseFloat(request.getParameter("home_location_latitude")); 61 | endingLocationLongitude = Float.parseFloat(request.getParameter("uni_location_longitude")); 62 | endingLocationLatitude = Float.parseFloat(request.getParameter("uni_location_latitude")); 63 | } else { 64 | 65 | //Starting is Uni, dropoff is home 66 | startingLocationLongitude = Float.parseFloat(request.getParameter("uni_location_longitude")); 67 | startingLocationLatitude = Float.parseFloat(request.getParameter("uni_location_latitude")); 68 | endingLocationLongitude = Float.parseFloat(request.getParameter("home_location_longitude")); 69 | endingLocationLatitude = Float.parseFloat(request.getParameter("home_location_latitude")); 70 | } 71 | Location startingLocation = new Location(startingLocationLatitude, startingLocationLongitude); 72 | Location endingLocation = new Location(endingLocationLatitude, endingLocationLongitude); 73 | 74 | //Single or Weekly Rides 75 | boolean isSingle = request.getParameter("single_or_weekly").equals("single"); 76 | if (isSingle) { 77 | r = new SingleRide(); 78 | setRideAttributes(r,isToUni,startingLocation,endingLocation,d, rideTime); 79 | LocalDate date = LocalDate.parse(request.getParameter("ride_date")); 80 | ((SingleRide) r).setDate(date); 81 | ((SingleRide) r).updateRideInfo(); 82 | } else { 83 | r = new WeeklyRide(); 84 | setRideAttributes(r,isToUni,startingLocation,endingLocation,d, rideTime); 85 | for (String day : request.getParameterValues("ride_days")) { 86 | ((WeeklyRide)r).setDay(day); 87 | ((WeeklyRide)r).updateRideInfo(); 88 | } 89 | } 90 | 91 | } else { 92 | RequestDispatcher rd = request.getRequestDispatcher("OfferARide.jsp"); 93 | request.setAttribute("errmsg", "Invalid Ride Timing. Please offer a time before 10p.m and after 3a.m"); 94 | rd.forward(request, response); 95 | } 96 | 97 | request.setAttribute("successmsg", "Successfully Offered Ride!"); 98 | RequestDispatcher rd = request.getRequestDispatcher("OfferARide.jsp"); 99 | rd.forward(request, response); 100 | } 101 | 102 | // 103 | /** 104 | * Handles the HTTP GET method. 105 | * 106 | * @param request servlet request 107 | * @param response servlet response 108 | * @throws ServletException if a servlet-specific error occurs 109 | * @throws IOException if an I/O error occurs 110 | */ 111 | @Override 112 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 113 | throws ServletException, IOException { 114 | processRequest(request, response); 115 | } 116 | 117 | /** 118 | * Handles the HTTP POST method. 119 | * 120 | * @param request servlet request 121 | * @param response servlet response 122 | * @throws ServletException if a servlet-specific error occurs 123 | * @throws IOException if an I/O error occurs 124 | */ 125 | @Override 126 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 127 | throws ServletException, IOException { 128 | processRequest(request, response); 129 | } 130 | 131 | /** 132 | * Returns a short description of the servlet. 133 | * 134 | * @return a String containing servlet description 135 | */ 136 | @Override 137 | public String getServletInfo() { 138 | return "Short description"; 139 | }// 140 | 141 | } 142 | -------------------------------------------------------------------------------- /web/OfferARide.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : findRIde 3 | Created on : Apr 1, 2020, 7:35:50 PM 4 | Author : Ayah 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | Offer a ride 14 | 15 | 16 | 17 | 18 | 19 | <%-- 20 | 21 | 22 | 23 | --%> 24 | 25 | 26 | 27 | 28 |
29 |

Yalla ${sessionScope.passenger.firstName}! Offer A Ride!

30 |
31 | 32 |
33 | 34 | 35 |
36 | ${errmsg} 37 |
38 |
39 | 40 |
41 | ${successmsg} 42 |
43 |
44 |
45 | 46 |
47 |

Select Ride Frequency

48 | Single 49 | Weekly 50 |
51 | 52 |
53 |

Select Ride Mode

54 | To University 55 | From University 56 | 57 |
58 |
59 |
60 | 61 | 62 |
63 |
64 |
65 |
66 | 74 |
75 | 76 |
77 |

Home Area

78 | 79 | 80 | 81 |
82 |
83 | 84 |
85 |

University Area

86 | 87 | 88 | 89 |
90 |
91 | 92 |
93 |

Time

94 | 95 |
96 | 97 |
98 | 99 |
100 | 101 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /src/java/DriverRideManagementModule/Ride.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package DriverRideManagementModule; 7 | 8 | /** 9 | * 10 | * @author Tasli 11 | */ 12 | import PassengerRideManagementModule.Location; 13 | import java.sql.Date; 14 | import java.sql.SQLException; 15 | import java.sql.Timestamp; 16 | import java.time.LocalDate; 17 | import java.time.LocalDateTime; 18 | import java.time.LocalTime; 19 | import java.time.format.DateTimeFormatter; 20 | import java.util.logging.Level; 21 | import java.util.logging.Logger; 22 | import static javafx.beans.binding.Bindings.and; 23 | import javax.sql.rowset.CachedRowSet; 24 | 25 | public abstract class Ride { 26 | 27 | @Override 28 | public String toString() { 29 | return "Ride{" + "rideId=" + rideId + ", isToUni=" + isToUni + ", arrivalDepartureTime=" + arrivalDepartureTime + ", startingLocation=" + startingLocation + ", endingLocation=" + endingLocation + ", seatAvailability=" + seatAvailability + ", driver=" + driver + '}'; 30 | } 31 | 32 | public Ride(Integer rideId, boolean isToUni, String arrivalDepartureTime, Location startingLocation, Location endingLocation, Integer seatAvailability, Driver driver) { 33 | this.rideId = rideId; 34 | this.isToUni = isToUni; 35 | this.arrivalDepartureTime = arrivalDepartureTime; 36 | this.startingLocation = startingLocation; 37 | this.endingLocation = endingLocation; 38 | this.seatAvailability = seatAvailability; 39 | this.driver = driver; 40 | } 41 | 42 | public Ride() { 43 | 44 | } 45 | 46 | private Integer rideId; 47 | private boolean isToUni; 48 | private String arrivalDepartureTime; 49 | private Location startingLocation; 50 | private Location endingLocation; 51 | private Integer seatAvailability; 52 | private Driver driver; 53 | 54 | public Integer getRideId() { 55 | return rideId; 56 | } 57 | 58 | public void setRideId(Integer rideId) { 59 | this.rideId = rideId; 60 | } 61 | 62 | public boolean isIsToUni() { 63 | return isToUni; 64 | } 65 | 66 | public void setIsToUni(boolean isToUni) { 67 | this.isToUni = isToUni; 68 | } 69 | 70 | public String getArrivalDepartureTime() { 71 | return arrivalDepartureTime; 72 | } 73 | 74 | public void setArrivalDepartureTime(String arrivalDepartureTime) { 75 | this.arrivalDepartureTime = arrivalDepartureTime; 76 | } 77 | 78 | public Location getStartingLocation() { 79 | return startingLocation; 80 | } 81 | 82 | public void setStartingLocation(Location startingLocation) { 83 | this.startingLocation = startingLocation; 84 | } 85 | 86 | public Location getEndingLocation() { 87 | return endingLocation; 88 | } 89 | 90 | public void setEndingLocation(Location endingLocation) { 91 | this.endingLocation = endingLocation; 92 | } 93 | 94 | public Integer getSeatAvailability() { 95 | return seatAvailability; 96 | } 97 | 98 | public void setSeatAvailability(Integer seatAvailability) { 99 | this.seatAvailability = seatAvailability; 100 | } 101 | 102 | public Driver getDriver() { 103 | return driver; 104 | } 105 | 106 | public void setDriver(Driver driver) { 107 | this.driver = driver; 108 | } 109 | 110 | public static boolean createRequest(int rideId, String passengerId, String pickupLocation, String dropoffLocation) { 111 | CachedRowSet crs = CarpoolDatabase.DbRepo.getConfiguredConnection(); 112 | try { 113 | crs.setCommand("INSERT INTO RIDE_REQUESTS (RIDE_ID, PASSENGER_ID, PICKUP_LOCATION, DROPOFF_LOCATION) VALUES (?,?,?,?)"); 114 | crs.setInt(1, rideId); 115 | crs.setString(2, passengerId); 116 | crs.setString(3, pickupLocation); 117 | crs.setString(4, dropoffLocation); 118 | crs.execute(); 119 | return true; 120 | } catch (SQLException ex) { 121 | Logger.getLogger(Ride.class.getName()).log(Level.SEVERE, null, ex); 122 | return false; 123 | } 124 | 125 | } 126 | 127 | public boolean updateRideInfo(){ 128 | try { 129 | CachedRowSet crs1 = CarpoolDatabase.DbRepo.getConfiguredConnection(); 130 | crs1.setCommand("select * from driver_applications where email_id = ?"); 131 | crs1.setString(1,driver.getEmailID()); 132 | crs1.execute(); 133 | crs1.next(); 134 | 135 | CachedRowSet crs2 = CarpoolDatabase.DbRepo.getConfiguredConnection(); 136 | crs2.setCommand("INSERT INTO OFFERED_RIDES (driver_id, is_to_uni, arrival_dep_time, start_location, end_location, current_seat_avail) VALUES (?,?,?,?,?,?)"); 137 | crs2.setString(1,driver.getEmailID()); 138 | crs2.setString(2,isToUni ? "1" : "0"); 139 | 140 | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm"); 141 | LocalTime t = LocalTime.parse(arrivalDepartureTime, formatter); 142 | LocalDateTime date = LocalDateTime.of(LocalDate.now(), t); 143 | Timestamp ts = Timestamp.valueOf(date); 144 | crs2.setTimestamp(3, ts); 145 | 146 | crs2.setString(4, startingLocation.toDbString()); 147 | crs2.setString(5, endingLocation.toDbString()); 148 | crs2.setInt(6,crs1.getInt("car_capacity")); 149 | 150 | crs2.execute(); 151 | return true; 152 | } catch (SQLException ex) { 153 | Logger.getLogger(Ride.class.getName()).log(Level.SEVERE, null, ex); 154 | return false; 155 | } 156 | } 157 | 158 | public static boolean isValid(String rideTime) { 159 | String[] time1 = rideTime.split(":"); 160 | Integer hours; 161 | try{ 162 | hours = Integer.parseInt(time1[0]); 163 | } 164 | catch (NumberFormatException e){ 165 | return false; 166 | } 167 | if (hours >= 22 || hours < 3) { 168 | return false; 169 | } 170 | return true; 171 | } 172 | 173 | 174 | public static Driver retrieveDriverInfo(String driverId) { 175 | Driver retrievedDriver = null; 176 | CachedRowSet crs = CarpoolDatabase.DbRepo.getConfiguredConnection(); 177 | try { 178 | crs.setCommand("select u.email_id as email_id, u.FIRST_NAME as first_name, u.LAST_NAME as last_name, u.GENDER as gender, u.mobile_no as mobile_no, dra.CAR_MODEL as car_model from drivers dr, driver_applications dra, users u where dr.DRIVER_ID = u.EMAIL_ID AND u.EMAIL_ID = dra.EMAIL_ID AND dr.driver_id = ?"); 179 | crs.setString(1, driverId); 180 | crs.execute(); 181 | if (crs.next()) { 182 | retrievedDriver = new Driver(null, null, null, 183 | new Car(crs.getString("car_model"), 0), 184 | crs.getString("first_name"), crs.getString("last_name"), 185 | crs.getString("gender"), crs.getString("mobile_no"), driverId); 186 | } 187 | } catch (SQLException ex) { 188 | Logger.getLogger(Ride.class.getName()).log(Level.SEVERE, null, ex); 189 | } 190 | return retrievedDriver; 191 | } 192 | 193 | } 194 | -------------------------------------------------------------------------------- /web/ViewOfferedRides.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : ViewConfirmedRides 3 | Created on : Apr 2, 2020, 9:34:20 PM 4 | Author : reem 5 | --%> 6 | 7 | 8 | 9 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 10 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 11 | 12 | 13 | 14 | 15 | Confirmed Rides 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |

Upcoming Rides of ${sessionScope.passenger.firstName}

27 |
28 |

Single Rides

29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
Ride ID To Uni?Arrival/Departure TimeStart LocationEnd LocationCurrent Seat AvailabilityDateView Passenger Requests Cancel Ride
${ride.rideId}${ride.isToUni}${ride.arrivalDepartureTime}${ride.startingLocation}${ride.endingLocation}${ride.seatAvailability}${ride.date}
65 |
66 |
67 |

Weekly Rides

68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 |
Ride ID To Uni?Arrival/Departure TimeStart LocationEnd LocationCurrent Seat AvailabilityDayView Passenger Requests Cancel Ride
${ride.rideId}${ride.isToUni}${ride.arrivalDepartureTime}${ride.startingLocation}${ride.endingLocation}${ride.seatAvailability}${ride.day}
109 |
110 | 111 | 112 |
113 | 114 | 115 | -------------------------------------------------------------------------------- /web/ViewPassengerConfirmedRides.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : ViewPassengerConfirmedRides 3 | Created on : Apr 7, 2020, 11:19:10 PM 4 | Author : azada 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 9 | 10 | 11 | 12 | 13 | 14 | Confirmed Rides 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |

Confirmed Rides of ${sessionScope.passenger.firstName}

27 |
28 |

Single Rides

29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 66 | 67 | 68 | 69 | 70 |
Ride ID To Uni?Arrival/Departure TimeStart LocationEnd LocationCurrent Seat AvailabilityDateMore Info
${ride.rideId}${ride.isToUni}${ride.arrivalDepartureTime}${ride.startingLocation}${ride.endingLocation}${ride.seatAvailability}${ride.date} 57 |
58 | 59 | 60 | 61 | 62 | 63 | 64 |
65 |
71 |
72 |
73 |

Weekly Rides

74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 117 | 118 | 119 | 120 | 121 |
Ride ID To Uni?Arrival/Departure TimeStart LocationEnd LocationCurrent Seat AvailabilityDayMore Info
${ride.rideId}${ride.isToUni}${ride.arrivalDepartureTime}${ride.startingLocation}${ride.endingLocation}${ride.seatAvailability}${ride.day} 108 |
109 | 110 | 111 | 112 | 113 | 114 | 115 |
116 |
122 |
123 | 124 | 125 |
126 | 127 | 128 | --------------------------------------------------------------------------------