Skip to content

Conversation

@jc-programs
Copy link

PRA05

Remarks

  • Modified endpoints
    As MenuItem is an abstract class /api/menuitem disapears and there is a new endpoint for each subclass:

    • /api/maincourse
    • /api/dessert
  • Added endpoints functions to demonstrate subclass-specific operations

    • /api/maincourse/vegan
    • /api/dessert/sugarfree

Tasks

  1. Refactor MenuItem to Abstract Class

    • Convert the existing MenuItem class to an abstract class
    • Identify common properties and methods to keep in the abstract class
  2. Create Subclasses

    • Create two subclasses: MainCourse and Dessert
    • Implement specific properties and methods for each subclass
  3. Create Interface Class

    • Design an interface (e.g., IMenuItem) with common methods for menu items
    • Ensure the abstract MenuItem class implements this interface
  4. Implement JPA Inheritance Strategy

    • Use the @Inheritance annotation with strategy = InheritanceType.TABLE_PER_CLASS
    • Adjust entity mappings for the abstract class and subclasses
  5. Update Repository and Service Classes

    • Modify existing repository interfaces to work with the new class hierarchy
    • Update service classes to handle the abstract class and its subclasses
  6. Create Test Classes

    • Develop test classes for the new class structure
    • Include tests for inheritance-specific scenarios
  7. Update API Endpoints

    • Modify existing endpoints to work with the new class hierarchy
    • Add new endpoints if necessary to demonstrate subclass-specific operations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants