Class QuestionProfile

All Implemented Interfaces:
Serializable, Cloneable, Comparable<Object>, Auditable, IDBean, PassStatistics, ViewEntry, Cacheable
Direct Known Subclasses:
MultiChoiceQuestionProfile

public class QuestionProfile extends Question implements Auditable, PassStatistics, ViewEntry
A class to store Exam Question profiles.
Since:
1.0
Version:
9.1
Author:
Luke
See Also:
  • Constructor Details

    • QuestionProfile

      public QuestionProfile(String text)
      Creates a new Question Profile.
      Parameters:
      text - the question text
      Throws:
      NullPointerException - if text is null
  • Method Details

    • getExams

      public Collection<String> getExams()
      Returns the Examinatios associated with this Question.
      Returns:
      a Collection of Examination names
      See Also:
    • getActive

      public boolean getActive()
      Returns whether this Question is active.
      Returns:
      TRUE if the Question can be included in an Examination, otherwise FALSE
      See Also:
    • getOwner

      public AirlineInformation getOwner()
      Returns the Owner Airline for this Question.
      Returns:
      an AirlineInformation bean
      See Also:
    • getAirlines

      public Collection<AirlineInformation> getAirlines()
      Returns the Airlines that can access this Question.
      Returns:
      a Collection of AirlineInformation beans
      See Also:
    • getTotal

      public int getTotal()
      Description copied from interface: PassStatistics
      Returns the total number of invocations.
      Specified by:
      getTotal in interface PassStatistics
      Returns:
      the number of invocations
    • getPassCount

      public int getPassCount()
      Description copied from interface: PassStatistics
      Returns the number of test passes or correct answers.
      Specified by:
      getPassCount in interface PassStatistics
      Returns:
      the number of successes
    • setNumber

      public final void setNumber(int number)
      Sets the Question Number. DISABLED
      Overrides:
      setNumber in class Question
      Parameters:
      number - the question number
      Throws:
      UnsupportedOperationException - always
      See Also:
    • setQuestion

      public void setQuestion(String text)
      Updates the Question text.
      Parameters:
      text - the quesstion
      Throws:
      NullPointerException - if text is null
      See Also:
    • addExam

      public void addExam(String examName)
      Links this Question to an Examination.
      Parameters:
      examName - the Examination name
      See Also:
    • setExams

      public void setExams(Collection<String> exams)
      Links this Question to a number of Examinations.
      Parameters:
      exams - a Collection of examination names
      See Also:
    • setActive

      public void setActive(boolean active)
      Marks this Question as Active.
      Parameters:
      active - TRUE if the Question can be included in an Examination, otherwise FALSE
      See Also:
    • setCorrectAnswers

      public void setCorrectAnswers(int count)
      Updates the total number of times this Question has been answered correctly.
      Parameters:
      count - the number of correct answers
      See Also:
    • setTotalAnswers

      public void setTotalAnswers(int count)
      Updates the total number of times this Question has been included in an Examination.
      Parameters:
      count - the number of times included
      See Also:
    • setOwner

      public void setOwner(AirlineInformation ai)
      Sets which airline is the owner of this Question.
      Parameters:
      ai - the AirlineInformation bean for the owner airline
      See Also:
    • addAirline

      public void addAirline(AirlineInformation ai)
      Makes this Question visible to an Airline.
      Parameters:
      ai - the AirlineInformation bean
      See Also:
    • setAirlines

      public void setAirlines(Collection<AirlineInformation> airlines)
      Sets the Airlines that this Question will be visible to.
      Parameters:
      airlines - a Collection of AirlineInformation beans
    • compareTo

      public final int compareTo(Object o2)
      Description copied from class: Question
      Compares to another Question by comparing the Question Numbers.
      Specified by:
      compareTo in interface Comparable<Object>
      Overrides:
      compareTo in class Question
      See Also:
    • getRowClassName

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

      public String getAuditID()
      Description copied from interface: Auditable
      Returns the object ID for this auditable object.
      Specified by:
      getAuditID in interface Auditable
      Returns:
      the ID
    • toQuestion

      public Question toQuestion()
      Converts this question profile into a question. Subclasess should extend this method to create the necessary Question subclasses.
      Returns:
      a Question bean