Kodall
Exercises

Exercise 10: Movie Production

Rendering diagram...

Description

  • The property "name" in the table "movie_state" can have the values: "Planned", "Canceled", "Filming", "Finalized", "Released".
  • The property "name" in the table "time_units" can have the values: "Minutes", "Hours" and "Days".
  • In entity "movie_state", name represents the state that will be displayed on the screen, label represents the value that programmer will use to filter the states, and the uuid represents a value to distinguish the states.
  • A movie can have multiple characters, and one character can be played by many actors (in sequences, the actors can change).
  • OBS: The value of the field "uuid" is generated automatically.

Tasks

  • actor/movie/character/movie_state/movie_character/schedule/time_units: Add, Edit, Delete.
    • When the movie is created, it will automatically become "Planned".
    • The field "Movie state" from entity "movie" will be read-only in edit view.
  • Create a catalog for entities: "movie_state", "movie", "actor" and "character" and "time_units".
  • Create event listeners for tables that needs validations (e.g., adding an actor without a name, movie without title, etc., should not be allowed).
  • The movie's "release_date" should not be in between "filming_start_date" and "filming_end_date". If it is → validation message.
  • Check if the actor is occupied in the time interval of a movie (if he is filming in that schedule in another movie), if he is → validation message.
    • To calculate when the actor ends his movie filming (schedule), use datetime→plusMinutes(dateStart, duration) and datetime→plusHours(dateStart, duration).
  • Calculate the total cost of the film, which is the total cost of the characters who played in that film.
    • Check if the budget of the movie is smaller than the cost of the characters in that movie. If it is → validation message.
  • Add an entity action at the movie level "Initiate movie":
    • Validate that at least one character is playing in a movie;
    • Check if the movie has already been initiated (it already has the status "Filming"), if it has → validation message;
    • After the initiation of the movie, the state will change from "Planned" → "Filming";
    • A movie cannot be initiated if it has the "Canceled", "Completed" or "Released" state, if it has → validation message.
  • Add a new entity action at the movie level “Cancel movie”:
    • It will change the movie status from "Planned" → "Canceled";
    • A movie cannot be canceled if it is in the "Filming", "Finalized" or "Released" state → validation message;
    • A movie cannot be canceled if it is already in the "Canceled" state → validation message.
  • Add a new entity action at the actor level "Create schedule":
    • It can't create a schedule for another movie if it overlaps with an existing one (ex. an actor has a schedule from 3 to 5 and another one from 4 to 6), if the interval overlaps → validation message;
    • It can't create a schedule for a movie that has "filming_end_date" lower that the schedule.
  • Add a new entity action at the movie level "Finalize filming":
    • First check if the movie has already been finalized (it already has the status "Finalized"), if it has → validation message;
    • It will change the movie status from "Filming" → "Finalized";
    • A movie cannot be finalized if it is in the "Planned", "Canceled" or "Released" state, if it is → validation message.
  • Add a new entity action at the movie level "Release movie":
    • First check if the movie has already been released (it already has the status "Released"), if it has → validation message;
    • It will change the movie status from "Finalized" → "Released";
    • A movie cannot be released if it is in the "Planned", "Filming" or "Canceled" state, if it is → validation message;
  • Actor report: movie situation at actor level (total number of movies, character value).
  • Character report: movie situation at character level (total number of movies, character value).