⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 answerhistoryrecordbean.java

📁 老外的在线考试
💻 JAVA
字号:
/* * SchoolEJB - CyberDemia's library of EJBs for educational related services. * Copyright (C) 2003 CyberDemia Research and Services * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License for more details. *  * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA  02111-1307, USA. * * See the COPYING file located in the top-level-directory of * the archive of this library for complete text of license. */package com.cyberdemia.school.impl;import com.cyberdemia.school.*;import java.util.Date;import javax.ejb.*;/** * AnswerHistoryRecordBean records the answer given by a user to a specific * question. It forms a historical record of the users' answers.  * The information here is mainly intended for reporting and logging. *  * @author Alexander Yap */public abstract class AnswerHistoryRecordBean implements EntityBean{	/**	* Gets the User ID of this history record.	* @return User ID.	*/	public abstract String getUserId();	/**	* Sets the User ID of this history record.	* @param userId User ID.	*/	public abstract void setUserId(String userId);	/**	* Gets the Test ID of this history record.	* @return Test ID.	*/	public abstract String getTestId();	/**	* Sets the Test ID of this history record.	* @param testId Test ID.	*/	public abstract void setTestId(String testId);	/**	* Gets the Question ID of this history record.	* @return Question ID.	*/	public abstract String getQuestionId();	/**	* Sets the Question ID of this history record.	* @param quesId Question ID.	*/	public abstract void setQuestionId(String quesId);	/**	 * Gets the index of the question within its owner test.	 * @return Question's index within its test.	 */	public abstract int getQuestionIndex();		/**	 * Sets the index of the question within its owner test.	 * @param index Question's index within its test.	 */	public abstract void setQuestionIndex(int index);		/**	 * Gets the score that the question is worth.	 * @return Question's score	 */	public abstract int getQuestionScore();		/**	 * Sets the score that the question is worth.	 * @param score Question's score	 */	public abstract void setQuestionScore(int score);		/**	 * Gets the score actually awarded to the user for this question.	 * @return Score awarded to the user.	 */	public abstract int getUserScore();		/**	 * Sets the score actually awarded to the user for this question.	 * @param score Score awarded to the user	 */	public abstract void setUserScore(int score);		/**	 * Gets the user's answer to the question.	 * @return User's answer	 */	public abstract int getUserAnswer();		/**	 * Sets the user's answer to the question.	 * @param answer User's answer	 */	public abstract void setUserAnswer(int answer);		/**	 * Gets the correct answer to the question.	 * @return Question's correct answer.	 */	public abstract int getCorrectAnswer();		/**	 * Sets the correct answer to the question.	 * @param answer Correct answer	 */	public abstract void setCorrectAnswer(int answer);		/**	 * Gets the exceeded question time flag.	 * @return true if this question's time limit has been exceeded.	 */	public abstract boolean getExceededQuestionTime();	/**	 * Sets the exceeded question time flag.	 * @param exceeded true if this question's time limit has been exceeded.	 */	public abstract void setExceededQuestionTime(boolean exceeded);	/**	 * Gets the timestamp in milliseconds when the user answered the question.	 * @return Timestamp in milliseconds when the user answered the question.	 */	public abstract long getTimestampMillis();	/**	 * Gets the timestamp in milliseconds when the user answered the question.	 * @param millis Timestamp in milliseconds when the user answered the question.	 */	public abstract void setTimestampMillis(long millis);	/**	 * Gets the timestamp when the user answered the question.	 * @return Timestamp when the user answered the question.	 */	public Date getTimestamp()	{		return new Date(getTimestampMillis());	}	/**	 * Gets the timestamp when the user answered the question.	 * @param dt Timestamp when the user answered the question.	 */	public void setTimestamp(Date dt)	{		setTimestampMillis(dt.getTime());	}	/**	 * Checks if the user answered the question correctly.	 * @return true if the user answered the question correctly, otherwise false.	 */	public boolean isAnswerCorrect()	{		return (getUserAnswer()==getCorrectAnswer());	}		//-----------------------------	// Create methods.	//-----------------------------	public AnswerHistoryRecordKey ejbCreate( String testId, String questionId, String userId, int questionIndex, int questionScore, int userScore,int userAnswer, int correctAnswer, boolean exceedQuesTime ) throws CreateException	{		setUserId(userId);		setTestId(testId);		setQuestionId(questionId);		setQuestionIndex(questionIndex);		setQuestionScore(questionScore);		setUserScore(userScore);		setUserAnswer(userAnswer);		setCorrectAnswer(correctAnswer);		setTimestamp(new Date());		setExceededQuestionTime(exceedQuesTime);		return null;	}	public void ejbPostCreate( String testId, String questionId, String userId, int questionIndex, int questionScore, int userScore, int userAnswer, int correctAnswer, boolean exceedQuesTime )	{	}	//-----------------------------	// Container methods. Override in subclasses if appropriate.	//-----------------------------	public void setEntityContext(EntityContext ctx) { }	public void ejbActivate() { }	public void ejbPassivate() { }	public void ejbLoad() { }	public void ejbStore() { }	public void ejbRemove() { }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -