eschool.ejb
Class _CoursesBean

java.lang.Object
  extended byeschool.ejb._CoursesBean

public abstract class _CoursesBean
extends java.lang.Object


Constructor Summary
_CoursesBean()
           
 
Method Summary
 boolean addCourse(java.lang.String name, int owner_id, java.lang.String summary, java.lang.String adminPass)
          Adds a new course to database.
 void addQuestion(int courseID, int testID, Question question)
          Adds a question to a test
 boolean addStudent(Student student, int courseID, boolean isNew)
          Adds a student to a certain course
 void addTest(int courseID, java.lang.String title, Question question)
          Adds a test to a course.
 boolean deleteQuestion(int questionID)
          Deletes a question from a test.
 void deleteStudent(int studentID)
          Deletes a student from database
 void deleteTest(int testid)
          Deletes a test.
 void deleteTests(java.lang.String[] testIDs)
          Deletes tests from database
 void editSummary(int courseid, java.lang.String summary)
          Changes the summary informatin about a course with the provided string.
 java.util.Vector getAllCourses()
           
 java.util.Vector getAllStudents()
           
 java.util.Vector getAllStudents(int courseid)
           
 java.util.Vector getAllTests(int courseID)
           
 Course getCourseByCourseID(int courseid)
           
 Student getStudentByID(int id)
           
 Student getStudentByStudentFN(java.lang.String fn)
           
 java.util.Vector getStudentCourses(int studentid)
           
 java.util.Vector getStudentResults(int student_id)
           
 Test getTestByTestID(int testid)
           
 boolean isStudentSigned(int courseid, int studentid)
          Checks whether a certain student is signed in a certain course
 boolean removeCourses(java.lang.String[] courseIDs, int ownerid, java.lang.String adminPass)
          Remove courses from database.
 int signIn(int courseid, int studentid)
          Signs in a student into a course.
 int signOut(int courseid, int studentid)
          Signs out a student from a course.
 void test(int i)
          internal tests method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

_CoursesBean

public _CoursesBean()
Method Detail

getAllCourses

public java.util.Vector getAllCourses()
Returns:
Vector which contains all courses registered in database

getCourseByCourseID

public Course getCourseByCourseID(int courseid)
Parameters:
courseid -
Returns:
a Course by specified the course id

editSummary

public void editSummary(int courseid,
                        java.lang.String summary)
Changes the summary informatin about a course with the provided string. Course is specified by its course id

Parameters:
courseid -
summary -

getAllStudents

public java.util.Vector getAllStudents(int courseid)
Parameters:
courseid -
Returns:
a Vector which contains all students signed in a course. The course is specified by its course id.

signIn

public int signIn(int courseid,
                  int studentid)
Signs in a student into a course.

Parameters:
courseid - id of the course
studentid - id of the student
Returns:
result from the method, can be one of the following: Codes.SIGN_IN_OK, Codes.SIGN_IN_FAIL or Codes.SIGNED_IN_ALREADY

signOut

public int signOut(int courseid,
                   int studentid)
Signs out a student from a course.

Parameters:
courseid - id of the course
studentid - id of the student
Returns:
result from the method, can be one of the following: Codes.SIGN_OUT_OK, Codes.SIGN_OUT_FAIL or Codes.NOT_SIGNED_IN

getAllTests

public java.util.Vector getAllTests(int courseID)
Parameters:
courseID -
Returns:
Vector with all test for a sertain course. The course is specified by its course id.

addTest

public void addTest(int courseID,
                    java.lang.String title,
                    Question question)
Adds a test to a course.

Parameters:
courseID - id of the course
title - title of the test
question - first question to the newly created test

deleteTest

public void deleteTest(int testid)
Deletes a test.

Parameters:
testid - id of the test

getTestByTestID

public Test getTestByTestID(int testid)
Parameters:
testid - id of the test
Returns:
test by its test id

addQuestion

public void addQuestion(int courseID,
                        int testID,
                        Question question)
Adds a question to a test

Parameters:
courseID - id of the course which test will be edited by adding of this question
testID - id of the test which will be edited by adding of this question
question - Question object which will be added

deleteQuestion

public boolean deleteQuestion(int questionID)
Deletes a question from a test.

Parameters:
questionID - id of the question
Returns:
true if after deletion of the specified question there are left one or more questions in the test; false otherwise

deleteStudent

public void deleteStudent(int studentID)
Deletes a student from database

Parameters:
studentID - id of the student

getStudentByStudentFN

public Student getStudentByStudentFN(java.lang.String fn)
Parameters:
fn - facultry number (FN) of the student
Returns:
Student by its student facultry number (FN); null if there is no student with such a FN

addStudent

public boolean addStudent(Student student,
                          int courseID,
                          boolean isNew)
Adds a student to a certain course

Parameters:
student - Student to be added
courseID - id of the course
isNew - true if there is no such student in database; false otherwise
Returns:
true if the student has been added successfully; false otherwise

getAllStudents

public java.util.Vector getAllStudents()
Returns:
Vector with all students in database

getStudentByID

public Student getStudentByID(int id)
Parameters:
id - of the student
Returns:
Student by its student id

isStudentSigned

public boolean isStudentSigned(int courseid,
                               int studentid)
Checks whether a certain student is signed in a certain course

Parameters:
courseid - id of the course
studentid - id of the student
Returns:
true if the student is signed in the course; false otherwise

getStudentCourses

public java.util.Vector getStudentCourses(int studentid)
Parameters:
studentid - if of the student
Returns:
Vector of all courses where a certain student has been signed in

deleteTests

public void deleteTests(java.lang.String[] testIDs)
Deletes tests from database

Parameters:
testIDs - ids of tests that have to be deleted

getStudentResults

public java.util.Vector getStudentResults(int student_id)
Parameters:
student_id - id of the student
Returns:
Vector of all test results of a certain student

addCourse

public boolean addCourse(java.lang.String name,
                         int owner_id,
                         java.lang.String summary,
                         java.lang.String adminPass)
Adds a new course to database.

Parameters:
name - name of the new course
owner_id - id of the lecturer who wants to add the course
summary - nummary information about the course
adminPass - administrator password which allows user to add courses
Returns:
true if the new couse has been added successfully; false otherwise

removeCourses

public boolean removeCourses(java.lang.String[] courseIDs,
                             int ownerid,
                             java.lang.String adminPass)
Remove courses from database. Courses can be deleted only if the user who wants to delete them is theirs owner.

Parameters:
courseIDs - ids of courses that have to be removed
ownerid - id of lecturer who wants to delete courses
adminPass - administrator password which allows user to remove courses
Returns:
true if the couses has been deleted successfully; false otherwise

test

public void test(int i)
internal tests method

Parameters:
i -