diff --git a/src/main/java/org/springframework/samples/petclinic/model/Person.java b/src/main/java/org/springframework/samples/petclinic/model/Person.java index 7ee1f03974b..3eb82cb9359 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Person.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Person.java @@ -31,6 +31,12 @@ public class Person extends BaseEntity { @NotBlank private String firstName; + @Column(name = "middle_name") // <-- ADD THIS LINE + private String middleName; + + @Column(name = "mother_name") // <-- ADD THIS LINE + private String mothername; + @Column(name = "last_name") @NotBlank private String lastName; @@ -51,4 +57,20 @@ public void setLastName(String lastName) { this.lastName = lastName; } + public void setMiddleName(String middleName) { + this.middleName = middleName; + } + + public String getMiddleName() { + return this.middleName; + } + + public void setMotherName(String motherName) { + this.motherName = motherName; + } + + public String getMotherName() { + return this.motherName; + } + } diff --git a/src/main/java/org/springframework/samples/petclinic/vet/Vet.java b/src/main/java/org/springframework/samples/petclinic/vet/Vet.java index fb2bd71ee0a..fd423f19a01 100644 --- a/src/main/java/org/springframework/samples/petclinic/vet/Vet.java +++ b/src/main/java/org/springframework/samples/petclinic/vet/Vet.java @@ -58,12 +58,14 @@ protected Set getSpecialtiesInternal() { @XmlElement public List getSpecialties() { + // This is safe because we return a copy return getSpecialtiesInternal().stream() .sorted(Comparator.comparing(NamedEntity::getName)) .collect(Collectors.toList()); } public int getNrOfSpecialties() { + // This method is for the convenience of unit tests return getSpecialtiesInternal().size(); } diff --git a/src/main/java/org/springframework/samples/petclinic/vet/VetController.java b/src/main/java/org/springframework/samples/petclinic/vet/VetController.java index 89ad9bc41c0..823e3486c8a 100644 --- a/src/main/java/org/springframework/samples/petclinic/vet/VetController.java +++ b/src/main/java/org/springframework/samples/petclinic/vet/VetController.java @@ -52,6 +52,7 @@ public String showVetList(@RequestParam(defaultValue = "1") int page, Model mode } private String addPaginationModel(int page, Page paginated, Model model) { + // Get content for page object List listVets = paginated.getContent(); model.addAttribute("currentPage", page); model.addAttribute("totalPages", paginated.getTotalPages()); @@ -59,15 +60,20 @@ private String addPaginationModel(int page, Page paginated, Model model) { model.addAttribute("listVets", listVets); return "vets/vetList"; } + private Page findPaginated(int page) { int pageSize = 5; + //test changes + int count = 10; + System.out.println("count: " + count); Pageable pageable = PageRequest.of(page - 1, pageSize); return vetRepository.findAll(pageable); } @GetMapping({ "/vets" }) public @ResponseBody Vets showResourcesVetList() { + // This is a test comment to trigger the analysis. // Here we are returning an object of type 'Vets' rather than a collection of Vet // objects so it is simpler for JSon/Object mapping Vets vets = new Vets();