Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
708288e
Update OwnerController.java
ky7721 Apr 17, 2026
da1f7a4
Change UI color
ky7721 Apr 18, 2026
19c5f46
Change UI color
ky7721 Apr 18, 2026
13db3ee
Add Welcome text
ky7721 Apr 18, 2026
deca6f1
Change message
ky7721 Apr 18, 2026
70b427c
Update OwnerController.java
ky7721 Apr 18, 2026
b774500
Updated vet repository implementation
Apr 18, 2026
d8c55de
Merge pull request #1 from BigRen0606/feature/request-validation
BigRen0606 Apr 18, 2026
94fc35a
Update UI Text labels in vet list page
Apr 18, 2026
2c83887
Merge pull request #3 from ky7721/feature/ui-text-update
ky7721 Apr 18, 2026
a0fa874
Update Owner List UI
Apr 18, 2026
b38e86a
Update the Successfull messages for PetController
WJunn987 Apr 18, 2026
b8af30f
Merge pull request #4 from ky7721/feature/owner-list-update
BigRen0606 Apr 18, 2026
2ce65df
Merge pull request #5 from ky7721/WJChanges
WJunn987 Apr 18, 2026
6ae9627
Add CI pipeline using Github Actions
Apr 18, 2026
efd7941
Update Pet Controller Add Successfull Msg
WJunn987 Apr 18, 2026
6fbd3da
Fix VetRepository class definition
Apr 18, 2026
967aae1
Merge branch 'main' into PetControllerUpdate
WJunn987 Apr 18, 2026
448eb19
Merge pull request #6 from ky7721/PetControllerUpdate
ky7721 Apr 18, 2026
9be2311
Change UI color
ky7721 Apr 18, 2026
993eb5f
Merge pull request #7 from ky7721/UIUpdate
ky7721 Apr 18, 2026
39a503d
Updated Pet Controller Successfull Msg
WJunn987 Apr 19, 2026
685c828
Update UI for ownerDetail
SushiJk Apr 19, 2026
1b84c1c
Merge pull request #8 from ky7721/feature/owner-details-ui
SushiJk Apr 19, 2026
392c2b3
Merge branch 'main' into PetControllerMsgUpdate
WJunn987 Apr 19, 2026
6cb6757
Merge pull request #9 from ky7721/PetControllerMsgUpdate
BigRen0606 Apr 19, 2026
4fef434
Updated PetController Success Msg
WJunn987 Apr 19, 2026
bce820f
Merge branch 'main' into PetControllerSuccessMsg
WJunn987 Apr 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public String processCreationForm(Owner owner, @Valid Pet pet, BindingResult res

owner.addPet(pet);
this.owners.save(owner);
redirectAttributes.addFlashAttribute("message", "New Pet has been Added");
redirectAttributes.addFlashAttribute("message", "Pet added successfully.");
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These success messages now use sentence case with trailing periods, but other controllers use title case without punctuation (e.g., OwnerController: "New Owner Created", VisitController: "Your visit has been booked"). Consider aligning the message style across controllers for consistent UI, or move these to i18n message bundles if you want more control over copy/translation.

Suggested change
redirectAttributes.addFlashAttribute("message", "Pet added successfully.");
redirectAttributes.addFlashAttribute("message", "Pet Added Successfully");

Copilot uses AI. Check for mistakes.
return "redirect:/owners/{ownerId}";
}

Expand Down Expand Up @@ -154,7 +154,7 @@ public String processUpdateForm(Owner owner, @Valid Pet pet, BindingResult resul
}

updatePetDetails(owner, pet);
redirectAttributes.addFlashAttribute("message", "Pet details has been edited");
redirectAttributes.addFlashAttribute("message", "Pet details updated successfully.");
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These success messages now use sentence case with trailing periods, but other controllers use title case without punctuation (e.g., OwnerController: "Owner Values Updated"). Consider aligning the message style across controllers for consistent UI, or move these to i18n message bundles if you want more control over copy/translation.

Suggested change
redirectAttributes.addFlashAttribute("message", "Pet details updated successfully.");
redirectAttributes.addFlashAttribute("message", "Pet Details Updated");

Copilot uses AI. Check for mistakes.
return "redirect:/owners/{ownerId}";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,58 +1,69 @@
/*
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.samples.petclinic.vet;

Comment on lines 16 to 17
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Apache 2.0 license header that is present in other source files (e.g., VetController.java, PetController.java) has been removed from this file. Please restore the standard header to keep licensing consistent across the codebase.

Copilot uses AI. Check for mistakes.
import org.springframework.cache.annotation.Cacheable;
import org.springframework.dao.DataAccessException;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
* Repository class for <code>Vet</code> domain objects All method names are compliant
* with Spring Data naming conventions so this interface can easily be extended for Spring
* Data. See:
* https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.query-creation
*
* @author Ken Krebs
* @author Juergen Hoeller
* @author Sam Brannen
* @author Michael Isvy
* @author Mark Fisher
* @author Ken Krebs
* @author Arjen Poutsma
*/
public interface VetRepository extends Repository<Vet, Integer> {

/**
* Retrieve all <code>Vet</code>s from the data store.
* @return a <code>Collection</code> of <code>Vet</code>s
*/
@Transactional(readOnly = true)
@Cacheable("vets")
Collection<Vet> findAll() throws DataAccessException;

/**
* Retrieve all <code>Vet</code>s from data store in Pages
* @param pageable
* @return
* @throws DataAccessException
*/
@Transactional(readOnly = true)
@Cacheable("vets")
Page<Vet> findAll(Pageable pageable) throws DataAccessException;

}
@Controller
class VetController {

private static final int PAGE_SIZE = 5;

Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title suggests this is only about PetController success messaging, but this change set also rewrites vet UI text and replaces VetRepository with controller logic. If these vet changes are unintended, consider splitting them into a separate PR (or dropping them) to keep scope focused and reviewable.

Copilot uses AI. Check for mistakes.
private final VetRepository vetRepository;

public VetController(VetRepository vetRepository) {
this.vetRepository = vetRepository;
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VetRepository.java no longer defines a VetRepository interface; it now contains a @Controller VetController class and references a VetRepository type that doesn't exist anywhere in the codebase. This will break compilation and also duplicates org.springframework.samples.petclinic.vet.VetController which already exists in VetController.java. Restore VetRepository as a Spring Data repository interface, and keep/move controller logic in VetController.java (or rename/move the controller to a correctly named file).

Copilot uses AI. Check for mistakes.
}

@GetMapping("/vets.html")
public String showVetList(@RequestParam(defaultValue = "1") int page, Model model) {
int currentPage = Math.max(page, 1);

// Here we are returning an object of type 'Vets' rather than a collection of Vet
// objects so it is simpler for Object-Xml mapping
Vets vets = new Vets();
Page<Vet> paginated = findPaginated(currentPage);
vets.getVetList().addAll(paginated.toList());

return addPaginationModel(currentPage, paginated, model);
}

private String addPaginationModel(int page, Page<Vet> paginated, Model model) {
List<Vet> listVets = paginated.getContent();
model.addAttribute("currentPage", page);
model.addAttribute("totalPages", paginated.getTotalPages());
model.addAttribute("totalItems", paginated.getTotalElements());
model.addAttribute("listVets", listVets);
model.addAttribute("hasNext", paginated.hasNext());
model.addAttribute("hasPrevious", paginated.hasPrevious());
return "vets/vetList";
}

private Page<Vet> findPaginated(int page) {
Pageable pageable = PageRequest.of(page - 1, PAGE_SIZE);
return vetRepository.findAll(pageable);
}

@GetMapping({ "/vets" })
public @ResponseBody Vets showResourcesVetList() {
// 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();
vets.getVetList().addAll(this.vetRepository.findAll());
return vets;
}

}
6 changes: 3 additions & 3 deletions src/main/resources/templates/vets/vetList.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<body>

<h2 th:text="#{vets}">Veterinarians</h2>
<h2 th:text="#{vets}">Veterinarian Directory</h2>
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Thymeleaf, th:text="#\{vets\}" replaces the element body with the value from the message bundle (messages*.properties). Since vets is defined (e.g., messages.properties:20), the new fallback text "Veterinarian Directory" will never be shown in normal operation. If the intent is to change the visible heading, update the vets message value (and translations) or use a new message key.

Suggested change
<h2 th:text="#{vets}">Veterinarian Directory</h2>
<h2 th:text="#{vets}">Vets</h2>

Copilot uses AI. Check for mistakes.

<table id="vets" class="table table-striped">
<thead>
<tr>
<th th:text="#{name}">Name</th>
<th th:text="#{specialties}">Specialties</th>
<th th:text="#{name}">Veterinarian Name</th>
<th th:text="#{specialties}">Areas of Expertise</th>
Comment on lines +12 to +13
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These header text changes are only fallbacks; the actual rendered text comes from #{name} and #{specialties} (both defined in messages*.properties), so the page will still display the translated "Name" / "Specialties" strings. If you want the UI to read "Veterinarian Name" / "Areas of Expertise", introduce dedicated message keys (and translations) or change the existing message values (not just the fallback text).

Suggested change
<th th:text="#{name}">Veterinarian Name</th>
<th th:text="#{specialties}">Areas of Expertise</th>
<th th:text="'Veterinarian Name'">Veterinarian Name</th>
<th th:text="'Areas of Expertise'">Areas of Expertise</th>

Copilot uses AI. Check for mistakes.
</tr>
</thead>
<tbody>
Expand Down
Loading