Chapter 10. Practice Projects

Table of Contents

1. Project 1 - Develop a Java Back-End App with Enumeration Attributes

1. Project 1 - Develop a Java Back-End App with Enumeration Attributes

The purpose of the app to be built is managing information about movies. The app deals with just one object type, Movie, and with two enumerations, as depicted in the following class diagram. In the subsequent parts of the tutorial, you will extend this simple app by adding actors and directors as further model classes, and the associations between them.

Figure 10.1. The object type Movie defined together with two enumerations.

The object type Movie defined together with two enumerations.

First make a list of all the constraints that have been expressed in this model. Then code the app by following the guidance of this tutorial (and the Validation Tutorial.

Compared to the practice project of our validation tutorial, two attributes have been added: the optional single-valued enumeration attribute rating, and the multi-valued enumeration attribute genres.

You have to take care of

  1. defining the enumeration datatypes MovieRatingEL and GenreEL with the help of the meta-class Enumeration;

  2. defining the single-valued enumeration attribute Movie::rating together with a check and a setter;

  3. defining the multi-valued enumeration attributes Movie::genres together with a check and a setter;

  4. extending the methods Movie.update, and Movie.prototype.toString such that they take care of the added enumeration attributes.

in the model code of your app, while In the user interface ("view") code you have to take care of

  1. adding new table columns in listMovies.html and suitable form controls (such as selection lists, radio button groups or checkbox groups) in createMovie.html and upateMovie.html;

  2. creating output for the new attributes in the method ...view.listMovies.setupUserInterface();

  3. allowing input for the new attributes in the methods ...view.createMovie.setupUserInterface() and ...view.upateMovie.setupUserInterface().

Also in this assignment, and in all further assignment, you have to make sure that your pages comply with the XML syntax of HTML5 (by means of XHTML5 validation), and that your JavaScript code complies with our Coding Guidelines and is checked with JSLint (http://www.jslint.com).