Class QuestionProfile
java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.DatabaseBlobBean
org.deltava.beans.ImageBean
org.deltava.beans.testing.Question
org.deltava.beans.testing.QuestionProfile
- All Implemented Interfaces:
Serializable, Cloneable, Comparable<Object>, Auditable, IDBean, PassStatistics, ViewEntry, Cacheable
- Direct Known Subclasses:
MultiChoiceQuestionProfile
A class to store Exam Question profiles.
- Since:
- 1.0
- Version:
- 9.1
- Author:
- Luke
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ImageBean
ImageBean.ImageFormat -
Field Summary
Fields inherited from class DatabaseBlobBean
_buffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidMakes this Question visible to an Airline.voidLinks this Question to an Examination.final intCompares to another Question by comparing the Question Numbers.booleanReturns whether this Question is active.Returns the Airlines that can access this Question.Returns the object ID for this auditable object.getExams()Returns the Examinatios associated with this Question.getOwner()Returns the Owner Airline for this Question.intReturns the number of test passes or correct answers.Returns the CSS row class name if included in a view table.intgetTotal()Returns the total number of invocations.voidsetActive(boolean active) Marks this Question as Active.voidsetAirlines(Collection<AirlineInformation> airlines) Sets the Airlines that this Question will be visible to.voidsetCorrectAnswers(int count) Updates the total number of times this Question has been answered correctly.voidsetExams(Collection<String> exams) Links this Question to a number of Examinations.final voidsetNumber(int number) Sets the Question Number.voidSets which airline is the owner of this Question.voidsetQuestion(String text) Updates the Question text.voidsetTotalAnswers(int count) Updates the total number of times this Question has been included in an Examination.Converts this question profile into a question.Methods inherited from class Question
getAnswer, getCorrectAnswer, getExactMatch, getImageType, getNumber, getQuestion, getReference, isCorrect, setAnswer, setCorrect, setCorrectAnswer, setReferenceModifier and TypeMethodDescriptionReturns the User's answer to the Question.Returns the Correct Answer to the Question.booleanReturns if the user has provided the exact correct answer.Returns the database image type.intReturns the Question Number.Returns the Question text.Returns an optional reference to the correct answer.booleanReturns if the question was answered correctly.voidSets the User-provided answer to this Question.voidsetCorrect(boolean isOK) Marks a Question as correctly answered.voidsetCorrectAnswer(String answer) Sets the correct answer to this Question.voidsetReference(String ref) Sets the reference to the correct answer to this Question.Methods inherited from class ImageBean
checkParam, getFormat, getHasImage, getHeight, getSize, getWidth, load, load, setFormat, setHeight, setSize, setWidthModifier and TypeMethodDescriptionprotected static voidcheckParam(int param, String msg) Helper method to check for negative numeric parameters.Returns the type of image.booleanQueries if the bean has an associated Image.intReturns the height of the image.intgetSize()Returns the size of the image.intgetWidth()Returns the width of the image.final voidload(byte[] buffer) Updates the image buffer.final voidload(InputStream is) Loads an image into the buffer.voidUpdates the image format.voidsetHeight(int y) Updates the height of this image.voidsetSize(int newSize) Updates the size of this image.voidsetWidth(int x) Updates the width of this image.Methods inherited from class DatabaseBlobBean
clear, getInputStream, isLoadedMethods inherited from class DatabaseBean
cacheKey, equals, getHexID, getID, hashCode, setID, validateID, validateIDModifier and TypeMethodDescriptioncacheKey()Returns the cache key for this object.booleangetHexID()Returns the hexadecimal database ID of this object.intgetID()Returns the database ID of this object.inthashCode()voidsetID(int id) Update the database row ID of this bean.static voidvalidateID(int oldID, int newID) Validates a database ID.static voidvalidateID(int oldID, int newID, boolean allowZero) Validates a database ID.Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Auditable
getAuditType, isCrossAppModifier and TypeMethodDescriptiondefault StringReturns the audit type for this auditable object.default booleanReturns whether this object is within multiple web applications.
-
Constructor Details
-
QuestionProfile
Creates a new Question Profile.- Parameters:
text- the question text- Throws:
NullPointerException- if text is null
-
-
Method Details
-
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
Returns the Owner Airline for this Question.- Returns:
- an AirlineInformation bean
- See Also:
-
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:PassStatisticsReturns the total number of invocations.- Specified by:
getTotalin interfacePassStatistics- Returns:
- the number of invocations
-
getPassCount
public int getPassCount()Description copied from interface:PassStatisticsReturns the number of test passes or correct answers.- Specified by:
getPassCountin interfacePassStatistics- Returns:
- the number of successes
-
setNumber
public final void setNumber(int number) Sets the Question Number. DISABLED- Overrides:
setNumberin classQuestion- Parameters:
number- the question number- Throws:
UnsupportedOperationException- always- See Also:
-
setQuestion
Updates the Question text.- Parameters:
text- the quesstion- Throws:
NullPointerException- if text is null- See Also:
-
addExam
Links this Question to an Examination.- Parameters:
examName- the Examination name- See Also:
-
setExams
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
Sets which airline is the owner of this Question.- Parameters:
ai- the AirlineInformation bean for the owner airline- See Also:
-
addAirline
Makes this Question visible to an Airline.- Parameters:
ai- the AirlineInformation bean- See Also:
-
setAirlines
Sets the Airlines that this Question will be visible to.- Parameters:
airlines- a Collection of AirlineInformation beans
-
compareTo
-
getRowClassName
Returns the CSS row class name if included in a view table.- Specified by:
getRowClassNamein interfaceViewEntry- Returns:
- the CSS class name
-
getAuditID
Description copied from interface:AuditableReturns the object ID for this auditable object.- Specified by:
getAuditIDin interfaceAuditable- Returns:
- the ID
-
toQuestion
Converts this question profile into a question. Subclasess should extend this method to create the necessary Question subclasses.- Returns:
- a Question bean
-