mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-16 12:55:50 +00:00
Compare commits
2 commits
588fd808f8
...
cb85d87ee3
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cb85d87ee3 | ||
![]() |
1587384b43 |
3 changed files with 34 additions and 2 deletions
8
pom.xml
8
pom.xml
|
@ -18,7 +18,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
|
|
||||||
<!-- Generic properties -->
|
<!-- Generic properties -->
|
||||||
<java.version>17</java.version>
|
<java.version>21</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<!-- Important for reproducible builds. Update using e.g. ./mvnw versions:set
|
<!-- Important for reproducible builds. Update using e.g. ./mvnw versions:set
|
||||||
|
@ -156,6 +156,11 @@
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.gitlab.haynes</groupId>
|
||||||
|
<artifactId>libsass-maven-plugin</artifactId>
|
||||||
|
<version>0.2.29</version>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-enforcer-plugin</artifactId>
|
<artifactId>maven-enforcer-plugin</artifactId>
|
||||||
|
@ -287,6 +292,7 @@
|
||||||
<artifactId>cyclonedx-maven-plugin</artifactId>
|
<artifactId>cyclonedx-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<licenses>
|
<licenses>
|
||||||
|
|
|
@ -172,4 +172,17 @@ public class Owner extends Person {
|
||||||
pet.addVisit(visit);
|
pet.addVisit(visit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updatePet(Pet newPet)
|
||||||
|
{
|
||||||
|
for(int i=0 ; i<pets.size() ; i++)
|
||||||
|
{
|
||||||
|
Pet existingPet = pets.get(i);
|
||||||
|
if(existingPet.getId().equals(newPet.getId()))
|
||||||
|
{
|
||||||
|
pets.set(i,newPet);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ class privatePetController {
|
||||||
RedirectAttributes redirectAttributes) {
|
RedirectAttributes redirectAttributes) {
|
||||||
|
|
||||||
String petName = pet.getName();
|
String petName = pet.getName();
|
||||||
|
System.out.println(pet.getId()+" SOUMEN");
|
||||||
// checking if the pet name already exist for the owner
|
// checking if the pet name already exist for the owner
|
||||||
if (StringUtils.hasText(petName)) {
|
if (StringUtils.hasText(petName)) {
|
||||||
Pet existingPet = owner.getPet(petName, false);
|
Pet existingPet = owner.getPet(petName, false);
|
||||||
|
@ -147,6 +147,13 @@ class privatePetController {
|
||||||
return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
|
return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
owner.addPet(pet);
|
||||||
|
owner.updatePet(pet);
|
||||||
|
|
||||||
|
||||||| 6148ddd
|
||||||
|
owner.addPet(pet);
|
||||||
|
=======
|
||||||
//owner.addPet(pet);
|
//owner.addPet(pet);
|
||||||
|
|
||||||
List<Pet> petlist = owner.getPets();
|
List<Pet> petlist = owner.getPets();
|
||||||
|
@ -159,9 +166,15 @@ class privatePetController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
>>>>>>> 588fd808f860ff0896eb2e4cb841f8cacd19855b
|
||||||
this.owners.save(owner);
|
this.owners.save(owner);
|
||||||
redirectAttributes.addFlashAttribute("message", "Pet details has been edited");
|
redirectAttributes.addFlashAttribute("message", "Pet details has been edited");
|
||||||
return "redirect:/owners/{ownerId}";
|
return "redirect:/owners/{ownerId}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue