Chapter 11. Unidirectional Associations Practice Projects

Table of Contents

1. Assign a director and actors to a movie
2. Assign cities and a capital to a country, and members to an organization

All projects include the following tasks:

  1. Make an OO class model derived from the given design model. Hint: replace associations with corresponding reference properties.

  2. Make a JavaScript class model or a Java Entity class model derived from the OO class model. Hint: add check and setter methods.

  3. Code your JS class model or Java Entity class model, following the provided guidelines.

Make sure that your pages comply with the XML syntax of HTML5, and that your JavaScript code complies with our Coding Guidelines and is checked with (JSHint).

1. Assign a director and actors to a movie

This project is based on the information design model shown below. The app from the previous assignments is to be extended by adding the possibility to manage data about the actors and the director of a movie. This is achieved by adding a model class Person and two unidirectional associations between Movie and Person:

  1. a many-to-one association assigning exactly one person as the director of a movie, and

  2. a many-to-many association assigning zero or more persons as the actors of a movie.

You can use the following sample data for testing your app:

Movies
Movie ID Title Release date Director Actors
1 Pulp Fiction 1994-05-12 3 4, 5
2 Star Wars 1977-05-25 2 6, 7
3 Dangerous Liaisons 1988-12-16 1 8, 4
People
Person ID Name
1 Stephen Frears
2 George Lucas
3 Quentin Tarantino
4 Uma Thurman
5 John Travolta
6 Ewan McGregor
7 Natalie Portman
8 Keanu Reeves

More movie data can be found on the IMDb website.