Homework 3
CS520, Spring 2011


Due: Friday, April 29

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]

[Calendar for CSNS]

Calendar is a new component of CSNS which you will develop in this quarter. In this assignment you are going to implement the model classes and the database schema based on the following requirements:

[calendar.png]

Figure 1. A Calendar with Two Events and Three Tasks

[Model] (30pt)

Design and implement the model classes for the calendar, e.g. Event and Task. You may also need to change existing classes. The classes should be placed under the package csns.model.calendar. To receive full credit for this exercise, your classes must be sufficient to support the features described above, which you will implement in subsequent assignments. For example, to support the file attachment feature, your Event class must have some field to hold those file attachments [2].

[Hibernate Mapping] (30pt)

Create Hibernate mapping files for the classes you created in the previous exercise, and place these mapping files under src/hbm/calendar. 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] (10pt)

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

[Subversion]

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

[Notes]

1. A course taught in a particular quarter is called a section in CSNS, represented by the csns.model.Section class. The information about sections is stored in the sections table. A section may have more than one instructor, and this information is stored in the instructors table, from which you can obtain the instructors who is teaching or has taught a particular course. Please see db/csns-create.sql for details.

2. Please see csns.model.Message class for an example of an object that contains file attachments.