📄 testmanager.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;import javax.ejb.*;import java.rmi.RemoteException;/*** TestManager is an interface to a facade that provides* useful methods for managing tests.** @author Alexander Yap*/public interface TestManager extends EJBObject{ /** * Adds a new test to the database. * @param name Test name * @param ownerHierId Owner hierarchy ID. * @param passPercentage Passing percentage, between 0 and 100 * @param timeLimitSecs Time limit in seconds * @param multiQuesMode true to enable multi-questions mode, false to disable it * @param suppressQuesFeedback true to suppress question result feedback, false to allow it * @param suppressTestEndFeedback true to suppress test results feedback, false to allow it. * @return Unique ID of the new test. * @throws RemoteException if there is a problem creating the test. */ public String addTest(String name, String ownerHierId, double passPercentage, int timeLimitSecs, boolean multiQuesMode, boolean suppressQuesFeedback, boolean suppressTestEndFeedback) throws RemoteException; /** * Deactives the specified test, after which it may be considered to * be logically removed from the system. * This method may perform some checks first to ensure that the test * can be safely deactivated. * * @param id Test ID * @return true if the test is deactivated, false if it is not (either a problem or it is already inactive) * @throws RemoteException if the test can't be found. */ public boolean deactivateTest(String id) throws RemoteException; /** * Gets list of tests belonging to a specified owner hierarchy ID. * @param ownerHierId Owner hierarchy ID to filter tests, or null to ignore the hierarchy ID. * @param activeOnly true to only return active tests, false to return all tests. * @return Array of TestData instances. * @throws RemoteException */ public TestData[] getTests(String ownerHierId, boolean activeOnly) throws RemoteException; /** * Gets active tests assigned to a specified user. * @param ownerHierId Owner hierarchy ID to filter tests, or null to ignore the hierarchy ID. * @param userId User ID to search for. * @return Array of TestData instances. * @throws RemoteException */ public TestData[] getTestsForUser(String ownerHierId, String userId) throws RemoteException; /** * Gets active tests that are <b>not</b> assigned to a specified user. * @param ownerHierId Owner hierarchy ID to filter tests, or null to ignore the hierarchy ID. * @param userId User ID to exclude. * @return Array of TestData instances. * @throws RemoteException */ public TestData[] getTestsForNotUser(String ownerHierId, String userId) throws RemoteException; /** * Adds a question to a test. Both question and test must exist and be active. * @param testId Test ID * @param quesId Question ID * @throws RemoteException if either test or question is missing or inactive. */ public void addQuestionToTest( String testId, String quesId) throws RemoteException; /** * Removes a question from a test. Both question and test must exist. * @param testId Test ID * @param quesId Question ID * @throws RemoteException if either test or question is missing. */ public void removeQuestionFromTest( String testId, String quesId) throws RemoteException; /** * Gets data of resources (questions) for a test. * @param testId Test ID. * @param count Maximum number of resources to retrieve. * @return Array of ResourceListData instances. * @throws RemoteException if test is missing. */ public ResourceListData[] getResourcesDataFromTest( String testId, int count) throws RemoteException; /** * Gets data of a test. * @param id Test ID. * @return TestData instance storing the test's data. * @throws RemoteException if test is missing. */ public TestData getTestData(String id) throws RemoteException; /** * Updates the data of an existing test. * @param id Test ID. * @param data TestData instance with the test's data. * @throws RemoteException if test is missing, or there is a problem updating the test. */ public void setTestData(String id, TestData data) throws RemoteException; /** * Checks the user's answer for a question. The user is * awarded a score if the answer is correct. This method also * creates an AnswerHistoryRecordBean instance to log this answer * and the awarded score. * * @param testId Test ID * @param quesId Question ID * @param userId User ID * @param quesIndex Index of the question within the test. * @param userAnswer User's answer as an index to the multiple answer choices. * @param testSecs Amount of time in seconds the user took to complete the test (applicable only if multiQuestionsMode is enabled). * @param quesSecs Amount of time in seconds the user took to answer this question (applicable only if multiQuestionsMode is disabled). * @return The result status of the answer, one of the constants defined in IAnswerStatus. * @throws RemoteException if the test or question is missing, or some other error. */ public int checkQuestionAnswer(String testId, String quesId, String userId, int quesIndex, Integer userAnswer, int testSecs, int quesSecs) throws RemoteException; /** * Gets the test score data for a user. Optionally consider the test's suppressTestEndFeedback * setting to hide the score when appropriate. If the score is hidden, this method returns null. * @param testId Test ID * @param userId User ID * @param applySuppressResults true to consider the test's suppressTestEndFeedback setting, false to ignore it. * @return ScoreData instance storing score information, null if the user has not taken the test yet or if it has been suppressed by the test's suppressTestEndFeedback setting. * @throws RemoteException if the test is missing. */ public ScoreData getTestScoreForUser(String testId, String userId, boolean applySuppressResults) throws RemoteException; /** * Assigns a test to a user. * @param testId Test ID * @param userId User ID * @throws RemoteException */ public void addTestToUser( String testId, String userId) throws RemoteException; /** * Removes a test from a user. * @param testId Test ID * @param userId User ID * @throws RemoteException if the test is missing or some other error. */ public void removeTestFromUser( String testId, String userId) throws RemoteException;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -