In this homework, we will complete the mapping of the domain model for RentIt’s information system. In fact, the homework is an extension of the work we started during lecture and lab sessions 2. For completeness, you will find the Domain model of RentIt’s information system in the following figure.

Domain model

p2 domainmodel v4 p2 enumerations v1

Tasks

clipboard checklist pencil icon display Your to do list
  • Refactor the domain model above, now considering value objects. (You must include a PDF in the root folder of the Bitbucket repository that you will use for your submission).

  • Complete the mapping of the Domain model into JPA classes (i.e. entity embeddable classes, etc.),including the refactored version of classes MaintenanceTask and PlantReservation using the class BusinesPeriod

  • Specify all the required repositories (initially empty)

  • Write tests and specify the corresponding repository methods and/or @Query annotated methods. You must add test fixtures as required. YOU ARE EXPECTED TO IMPLEMENT THE LOGIC ASSOCIATED WITH THE QUERY IN THE QUERY ITSELF. Retrieving data and postprocessing it in the repository (e.g. filtering some elements in the result set) will not receive the maximum amount of points assigned the corresponding query.

    • Query the list of available plants for rental in the plant catalog using the plant name (a substring of it) and the rental period. Note that the query must return the plant information (i.e. PlantInventoryEntry) and the number of items available (i.e. the count of PlantInventoryItem s). One item is considered available if it is serviceable at the moment of the query or the requested period is at least three weeks later in the future and the plant is programed for maintenance at least one week before the rental. Plants marked as UnserviceableCondemned cannot be available as they cannot be fixed.

    • Query the list of plants that have not been scheduled for any maintenance task during the last 12 months.

    • Compute the cost due to preventive repairs per year for the last 5 years (the query result must include the year and the cost associated with that year)

    • Query the list of plants (i.e. PlantInventoryItem s) in a given period along with their number of rentals and also the number of corrective tasks associated with them. The list must be ordered by number of rentals, and then by number of corrective tasks. Note that the query must return the plant information, the number of rentals and the number of corrective tasks.

You must submit the link to your bitbucket repository (no github) to the course’s submission web page. (Use your university account when creating your Bitbucket repository to get an academic account: that account would allow you to add more than 5 members to your repositories). Add the teaching staff as collaborators to your Bitbucket repository. Remember that the homework must be submitted by teams. Add the name of the team members in a file to Git repository (e.g. text file or markdown file).

Several of the queries above return a list of values. JPA provides multiples approaches to accomplish this. You will find some examples on how to do it in the following links: here and here.