Class Course

java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.academy.Course
All Implemented Interfaces:
Serializable, Comparable<Object>, IDBean, ViewEntry, Cacheable

public class Course extends DatabaseBean implements ViewEntry
A bean to store Flight Academy Course information.
Since:
1.0
Version:
8.0
Author:
Luke
See Also:
  • Constructor Details

    • Course

      public Course(String name, int pilotID)
      Creates a new Course bean.
      Parameters:
      name - the Certification name
      pilotID - the database ID of the Pilot taking the course
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if pilotID is zero or negative
  • Method Details

    • getName

      public String getName()
      Returns the certification name.
      Returns:
      the name
      See Also:
    • getCode

      public String getCode()
      Returns the certification code.
      Returns:
      the code
      See Also:
    • getPilotID

      public int getPilotID()
      Returns the database ID of the Pilot taking the course.
      Returns:
      the database ID
      See Also:
    • getInstructorID

      public int getInstructorID()
      Returns the database ID of the assigned Instructor.
      Returns:
      the Instructor's database ID
      See Also:
    • getStatus

      public Status getStatus()
      Returns the status of this Course.
      Returns:
      the status code
      See Also:
    • getStage

      public int getStage()
      Returns the stage value of this Course.
      Returns:
      the stage
      See Also:
    • getStartDate

      public Instant getStartDate()
      Returns the date this Course was started.
      Returns:
      the start date/time
      See Also:
    • getEndDate

      public Instant getEndDate()
      Returns the date this Course was completed or abandoned.
      Returns:
      the end date/time, or null if in progress
      See Also:
    • getLastComment

      public Instant getLastComment()
      Returns the date of the last comment. This may not be populated.
      Returns:
      the date/time of the last comment, or null
      See Also:
    • getProgress

      public Collection<CourseProgress> getProgress()
      Returns any progress entries associated with this Course.
      Returns:
      a Collection of CourseProgress beans
      See Also:
    • getProgressEntry

      public CourseProgress getProgressEntry(int seq)
      Returns a particular progress entry.
      Parameters:
      seq - the sequence number
      Returns:
      a CourgeProgress bean, or null if not found
    • getComments

      public Collection<CourseComment> getComments()
      Returns any comments associated with this Course.
      Returns:
      a Collection of CourseComment beans
      See Also:
    • getRideCount

      public int getRideCount()
      Returns the number of Check Rides required for this Course.
      Returns:
      the number of Check Rides
      See Also:
    • getNextCheckRide

      public int getNextCheckRide()
      Returns the index of the next required Check Ride.
      Returns:
      the Check Ride index
    • getCheckRides

      public Collection<CheckRide> getCheckRides()
      Returns the most recent check ride for this Course.
      Returns:
      a CheckRide object, or null if none
      See Also:
    • addProgress

      public void addProgress(CourseProgress cp)
      Adds a new Progress entry. If an existing entry is found, it is overwritten.
      Parameters:
      cp - the Progress bean
      See Also:
    • addComment

      public void addComment(CourseComment c)
      Adds a new Comment entry.
      Parameters:
      c - the Comment bean
      See Also:
    • setCode

      public void setCode(String code)
      Updates the Certification code.
      Parameters:
      code - the code
      Throws:
      NullPointerException - if code is null
      See Also:
    • setPilotID

      public void setPilotID(int id)
      Updates the database ID of the enrolled Pilot.
      Parameters:
      id - the database ID
      Throws:
      IllegalArgumentException - if id is zero or negative or changes
      See Also:
    • setInstructorID

      public void setInstructorID(int id)
      Updates the database ID of the assigned Instructor.
      Parameters:
      id - the database ID
      See Also:
    • setName

      public void setName(String name)
      Updates the certification name for this Course.
      Parameters:
      name - the name
      Throws:
      NullPointerException - if name is null
      See Also:
    • setRideCount

      public void setRideCount(int cr)
      Updates the number of Check Rides required for this Course.
      Parameters:
      cr - the number of Check Rides
      See Also:
    • setStatus

      public void setStatus(Status s)
      Updates this Course's completion status.
      Parameters:
      s - the Status
      See Also:
    • setStage

      public void setStage(int stage)
      Updates this Course's stage.
      Parameters:
      stage - the stage number
      See Also:
    • setStartDate

      public void setStartDate(Instant dt)
      Updates the start date for this Course.
      Parameters:
      dt - the start date/time
      See Also:
    • setEndDate

      public void setEndDate(Instant dt)
      Updates the completion date for this Course.
      Parameters:
      dt - the end date/time
      Throws:
      IllegalArgumentException - if dt is before startDate
      See Also:
    • setLastComment

      public void setLastComment(Instant dt)
      Updates the date of the last commnet. This may not be populated.
      Parameters:
      dt - the date/time of the last comment
      See Also:
    • addCheckRide

      public void addCheckRide(CheckRide cr)
      Sets the most recent Check Ride for this Course.
      Parameters:
      cr - the CheckRide object, or null
      See Also:
    • getRowClassName

      public String getRowClassName()
      Returns the CSS row class name if displayed in a view table.
      Specified by:
      getRowClassName in interface ViewEntry
      Returns:
      the CSS class name
    • compareTo

      public int compareTo(Object o)
      Compares two Courses by comparing their start date/times and Pilot IDs.
      Specified by:
      compareTo in interface Comparable<Object>
      Overrides:
      compareTo in class DatabaseBean
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object