Homework 3
CS520, Fall 2009


Due: Friday, October 23

Package all the source files of your project into a zip file using the zip Ant target you developed in Homework 1, and upload the zip file to CSNS. Note that file uploading will be disabled automatically after 11:59PM of the due date, so please turn in your work on time.


[Reading]

[Online Assignment for CSNS]

Online Assignment is a new component of CSNS which you will develop in this quarter. This component will allow instructors to create online assignments such as quizzes, and it will also allow the students to complete these assignments online. In this homework you are going to implement the model classes and the database schema based on the following requirements:

The class OnlineAssignment must be a subclass of Assignment. In addition to the attributes of a regular assignment, an online assignment also has a description, a publish date, which will be used to control when the assignment is made available to the students, and a list of questions.

There are two types of questions for an online assignments: choice questions and text questions. A choice question has a question description and a number of possible answers, i.e. choices. A text question simply has a question description. For a choice question, the correct answer(s) should be stored so that choice questions can be graded automatically.

For an online assignment, a student will submit an online submission. The class OnlineSubmission must be a subclass of Submission. In addition to the attributes of a regular submission, an online submission contains the answers to the questions in the assignment. In particular, the answer to a choice question is the selected choices, and the answer to a text question is a string and/or an attached file.

[Model] (30pt)

Design and implement the model classes for the online assignment component, i.e. OnlineAssignment, OnlineSubmission, and so on. You may also need to change some existing classes. The classes should be placed in the package csns.model.assignment. Note that in this assignment you only need to create the model classes. Operations such as creating assignments, completing assignments, and grading will be implemented later in subsequent assignments.

[Hibernate Mapping] (40pt)

Create Hibernate mapping files for the classes you created in the previous exercise, and place these mapping files under src/hbm/assignment. If you have changed any existing classes in the previous exercise, you need to modify their Hibernate mapping files accordingly.

Run the hbm2ddl Ant task to generate a new db/csns.ddl file and check if the database schema is what you expect.

[Database Scripts] (30pt)

Based on the csns.ddl file generated in the previous exercise, modify the following database scripts:

[Subversion]

Commit all the changes to your Subversion repository, and create a tag called cs520-hw3.