Every summer Wisconsin hosts a number of major music festivals, including SummerFest in Milwaukee, Mile of Music in Appleton, and Eaux Claires in Eau Claire. You have been asked to build a system that will make it easier for fans to find performances by their favorite artists at one of these festivals.
For this exam problem we will work with three entities: artists, venues, and performances.
Artists will have an id number, a name, and a genre. Venues will have an id number, a name, and an address. Performances will have an artist, a venue, a start time and an end time.
Click the button above to download the starter project for this exam. This project contains code for controller classes and DTOs. Your job will be to write the remaining classes and interfaces needed to get everything working.
The starter project I have provided contains a couple of controller classes. In those classes you will find methods to support these actions:
You will need to construct the Entity classes for this project and the Repository interfaces to go with them.
For this exam problem you will need just one service class. I have set up that class for you. You will need to add all of the methods needed to make the service class work. Note that I have already written code in the controller classes that calls methods in the service class - you will need to write the code for those methods.
Note also that the code in the controller classes is set up to handle exceptions that the service methods may throw. Your job will also include having those service class methods throw the appropriate exceptions when things go wrong.
I have already configured the starter project to use Spring Data. I have also configured the application.properties file to work with a database named festival. All you will need to do is to create a new, empty database with that name in MySQL. When you run your application for the first time your server will automatically create all of the necessary tables in the database.
To help you get started I have already provided three DTO classes in the starter project.
When a client posts an artist they will supply the name and genre for the artist. The system will generate an id for the artist automatically and return that id in the ArtistDTO in the response.
When a client posts a venue they will supply a name and an address for the venue. The system will generate an id for the venue automatically and return that id in the VenueDTO in the response.
To post a performance, the client will supply the id number of the artist, the id number of the venue, a start time, and an end time in the PerformanceDTO they post to you.
When a client requests a list of performances for an artist you should include the artist name and the venue name in the PerformanceDTO objects you return as a result.
I have already added a dependency for the OpenDoc library to this project. When you run your project you can point your browser to the URL
http://localhost:8085/swagger-ui/index.html
That documentation page contains "Try It Out" buttons for each REST method that you can use to test your API. This is a faster and easier way to test your project than using Postman.