Skip to content
Snippets Groups Projects
user avatar
Rafi authored
Refactored how updates are handled, now when there is a change the client is told to update there local copy with the specific change, rather than resend either the whole list of employees information, or the whole list of shift information. This change to updates should make changes to the staff or schedule more efficient especially when there are multiple clients.
In coming data from the server is now stored in HashMaps where the key is either the shift or employee IDs, and the value is of Shift or Employee classes.
All the methods in this class were made to help with these 2 changes.
Cleaned up warnings.
87c9a19a
History

cmpt-370-group-project

To run the scheduling app properly you must have the database running and the server connected to it.

How to set up the MySQL database:

- Download and run the MySQL Installer, make sure that MySQL Server is installed 
  (optionally install MySQL Workbench).
- Create a MySQL server and with whatever host address you like and an available
  port. If your running it locally than you can keep it these values as default.
- In MySQL open the sql file "ScheduleApp.sql" and execute the following 
  commands:
    * create database ScheduleApp;
    * use ScheduleApp;
    * create table Employees(
        employee_ID INT NOT NULL auto_increment,
        first_name varchar(25),
        last_name varchar(25),
        primary key (employee_ID)
        );
    * create table Shifts(
        shift_id INT NOT NULL auto_increment UNIQUE,
        full_date DATE,
        start_time INT,
        end_time INT,
        employee_ID INT,
        PRIMARY KEY (shift_id),
        FOREIGN KEY (employee_ID) REFERENCES Employees(employee_ID)
    );
- Open the 'server' tab at the top and select 'server status', and make sure that
  the server status is 'Running'

How to set up the Scheduling Server:

- In the main method in the ScheduleServer input the proper parameters:
    * ip: The local address that you want the server to listen to. If your running the
        server and the client on the same machine set it to "localhost".
    * port: The port that you want the server to listen to.
    * dbURL: "jdbc:mysql://hostname:port/DB_Name". Change 'hostname' to the MySQL
      MySQL server address, Change 'port' to the MySQL server port, and
      'DB_Name' to the MySQL server database. (This should be ScheduleApp)
        to the 
    * dbUser: The user name of the MySQL server.
    * dbPass: The password of the MySQL password.
- Save, then run the main method.