Class Test

java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.testing.Test
All Implemented Interfaces:
Serializable, Comparable<Object>, AuthoredBean, IDBean, ViewEntry, Cacheable
Direct Known Subclasses:
CheckRide, Examination

public abstract class Test extends DatabaseBean implements AuthoredBean, ViewEntry
An class to implement commonalities between user examinations and flight videos.
Since:
1.0
Version:
8.0
Author:
Luke
See Also:
  • Field Details

    • _score

      protected int _score
  • Constructor Details

    • Test

      protected Test(String name)
      Create a new examination/video with a particular name.
      Parameters:
      name - the name of the exam/video
      Throws:
      NullPointerException - if name is null
      See Also:
  • Method Details

    • getName

      public String getName()
      Returns the name of the examination/video.
      Returns:
      the name of the exam/video
    • getFirstName

      public String getFirstName()
      Returns the Pilot's first (given) name.
      Returns:
      the Pilot's first name
      See Also:
    • getLastName

      public String getLastName()
      Returns the Pilot's last (family) name.
      Returns:
      the Pilot's last name
      See Also:
    • getAuthorID

      public int getAuthorID()
      Description copied from interface: AuthoredBean
      Returns the Author of this bean.
      Specified by:
      getAuthorID in interface AuthoredBean
      Returns:
      the author's database ID
      See Also:
    • getStatus

      public TestStatus getStatus()
      Returns the status of this examination.
      Returns:
      the Status
      See Also:
    • getAcademy

      public boolean getAcademy()
      Returns whether this Test is part of the Flight Academy.
      Returns:
      TRUE if the Test is part of the Flight Academy, otherwise FALSE
      See Also:
    • getOwner

      public AirlineInformation getOwner()
      Returns the owner Airline of this Examination.
      Returns:
      the AirlineInformation bean
      See Also:
    • getScorerID

      public int getScorerID()
      Returns the Scorer's Database ID. This corresponds to the key in the PILOTS for the entry of the Pilot who scored this Test.
      Returns:
      the database ID
      See Also:
    • getScore

      public int getScore()
      Returns the score of this examination.
      Returns:
      the score achieved, from 0 to 100.
      See Also:
    • getSize

      public abstract int getSize()
      Returns the number of questions in the examination.
      Returns:
      the size of the examination.
    • getStage

      public int getStage()
      Returns the stage level of this examination/checkride.
      Returns:
      the stage from 1 to 5
      See Also:
    • getPassFail

      public boolean getPassFail()
      Returns if the Pilot passed or failed this examination
      Returns:
      TRUE if the pilot passed, otherwise FALSE
      See Also:
    • getComments

      public String getComments()
      Returns the Examination comments.
      Returns:
      the comments
      See Also:
    • getDate

      public Instant getDate()
      Returns the date this Examination was created/performed on.
      Returns:
      the creation Date
      See Also:
    • getSubmittedOn

      public Instant getSubmittedOn()
      Returns the date/time this Examination was submitted on.
      Returns:
      the submission Date
      See Also:
    • getScoredOn

      public Instant getScoredOn()
      Returns the date/time this Examination was scored on
      Returns:
      the scoring Date
      See Also:
    • setFirstName

      public void setFirstName(String name)
      Sets the first (given) name of the Pilot.
      Parameters:
      name - the Pilot's first name
      See Also:
    • setLastName

      public void setLastName(String name)
      Sets the last (family) name of the Pilot.
      Parameters:
      name - the Pilot's last name
      See Also:
    • setAuthorID

      public void setAuthorID(int id)
      Description copied from interface: AuthoredBean
      Updates the author of this bean.
      Specified by:
      setAuthorID in interface AuthoredBean
      Parameters:
      id - the author's database ID.
      See Also:
    • setAcademy

      public void setAcademy(boolean academy)
      Marks this Test as part of the Flight Academy.
      Parameters:
      academy - TRUE if the Test is part of the Flight Academy, otherwise FALSE
      See Also:
    • setScorerID

      public void setScorerID(int id)
      Updates the database ID for the Pilot who scored this exam. This will typically be called by a DAO.
      Parameters:
      id - the new database ID
      Throws:
      IllegalArgumentException - if id is negative
      See Also:
    • setScore

      public void setScore(int score)
      Sets the score for this Examination.
      Parameters:
      score - the number of correct answers
      Throws:
      IllegalArgumentException - if score is negative or greater than getSize()
      See Also:
    • setStatus

      public void setStatus(TestStatus s)
      Sets the status for this Test.
      Parameters:
      s - the Status
      See Also:
    • setStage

      public void setStage(int stage)
      Sets the stage level for this Examination.
      Parameters:
      stage - the stage
      See Also:
    • setPassFail

      public void setPassFail(boolean passFail)
      Sets whether this Pilot passed or failed the examination.
      Parameters:
      passFail - TRUE if the Pilot passed, otherwise FALSE
      See Also:
    • setComments

      public void setComments(String comments)
      Updates the Examination comments.
      Parameters:
      comments - the comments
      See Also:
    • setSize

      public abstract void setSize(int size)
      Updates the number of questions in this examination.
      Parameters:
      size - the number of questions
    • setDate

      public void setDate(Instant dt)
      Updates this Examination's date.
      Parameters:
      dt - the new date/time
      See Also:
    • setSubmittedOn

      public void setSubmittedOn(Instant dt)
      Updates this Examination's submission date.
      Parameters:
      dt - the new submission date/time
      See Also:
    • setScoredOn

      public void setScoredOn(Instant dt)
      Updates this Examination's "scored on" date.
      Parameters:
      dt - the new date/time this Examination was graded on
      See Also:
    • setOwner

      public void setOwner(AirlineInformation ai)
      Updates this Examination's owner Airline.
      Parameters:
      ai - the AirlineInformation bean
      See Also:
    • compareTo

      public int compareTo(Object o2)
      Specified by:
      compareTo in interface Comparable<Object>
      Overrides:
      compareTo in class DatabaseBean