Skip to content
Snippets Groups Projects
Employee.java 3.23 KiB
package com.example.schedulerapp;

import java.util.Map;

/*
    Name: Employee
    Description: Contains all employee information
*/
public class Employee {
    private int employeeID;
    private boolean isManager;
    private String firstName;
    private String lastName;
    private String email;
    private String phoneNumber;
    private float wage;
    private String[] positions;
    private Map<String, Shift> Availability;

    /*
    Name: Employee
    Parameters:
        String employeeData: All employee information from the server separated by '.'
    Description: Parses and contains the employee information into the class.
    Return: Employee
     */
    public Employee(String employeeData){
        try {
            String[] dataSplit = employeeData.split("\\.");
            this.employeeID = Integer.parseInt(dataSplit[0]);
            this.firstName = dataSplit[1];
            this.lastName = dataSplit[2];
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    /*
    Name: getEmployeeID
    Parameters: none
    Description: Gets the employee id of the employee.
    Return:
        int: The id of the employee.
     */
    public int getEmployeeID() {
        return employeeID;
    }

    /*
    Name: getFullName
    Parameters: none
    Description: Gets the full name of the employee.
    Return:
        String: The full name of the employee.
     */
    public String getFullName() {
        return firstName + " " + lastName;
    }

    /*
    Name: getFirstName
    Parameters: none
    Description: Gets the fist name of the employee.
    Return:
        String: The first name of the employee.
     */
    public String getFirstName() {
        return firstName;
    }
    /*
    Name: getLastName
    Parameters: none
    Description: Gets the last name of the employee.
    Return:
        String: The first name of the employee.
     */
    public String getLastName() {
        return lastName;
    }

    /*
    Name: getWage
    Parameters: none
    Description: Gets the wage of the employee.
    Return:
        float: The wage of the employee.
     */
    public float getWage() {
        return wage;
    }

    /*
    Name: getEmail
    Parameters: none
    Description: Gets the email of the employee.
    Return:
        String: The email of the employee.
     */
    public String getEmail() {
        return email;
    }

    /*
    Name: getPhoneNumber
    Parameters: none
    Description: Gets the phone number of the employee.
    Return:
        String: The phone number of the employee.
     */
    public String getPhoneNumber() {
        return phoneNumber;
    }

    /*
    Name: getPositions
    Parameters: none
    Description: Gets all the positions the employee is trained for.
    Return:
        String[]: String list of all trained positions.
     */
    public String[] getPositions() {
        return positions;
    }

    /*
    Name: getAvailability
    Parameters: none
    Description: Gets the availability of the employee.
    Return:
        Map : The availability of the employee where the availability on a specific day of the week is put keyed in
        by the day of the week.
     */
    public Map<String, Shift> getAvailability() {
        return Availability;
    }
}