diff --git a/pom.xml b/pom.xml
index cdd6c4522..aa3d539c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0org.springframework.samples
- spring-petclinic
+ spring-cheapy2.4.2
@@ -12,7 +12,7 @@
spring-boot-starter-parent2.4.2
- petclinic
+ cheapy
@@ -123,19 +123,7 @@
-
- io.spring.javaformat
- spring-javaformat-maven-plugin
- ${spring-format.version}
-
-
- validate
-
- validate
-
-
-
-
+
org.apache.maven.pluginsmaven-checkstyle-plugin
diff --git a/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java b/src/main/java/org/springframework/cheapy/CheapyApplication.java
similarity index 86%
rename from src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java
rename to src/main/java/org/springframework/cheapy/CheapyApplication.java
index 191253587..2912ee3d8 100644
--- a/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java
+++ b/src/main/java/org/springframework/cheapy/CheapyApplication.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.samples.petclinic;
+package org.springframework.cheapy;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -26,10 +26,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
*
*/
@SpringBootApplication(proxyBeanMethods = false)
-public class PetClinicApplication {
+public class CheapyApplication {
public static void main(String[] args) {
- SpringApplication.run(PetClinicApplication.class, args);
+ SpringApplication.run(CheapyApplication.class, args);
}
}
diff --git a/src/main/java/org/springframework/samples/petclinic/model/BaseEntity.java b/src/main/java/org/springframework/cheapy/model/BaseEntity.java
similarity index 96%
rename from src/main/java/org/springframework/samples/petclinic/model/BaseEntity.java
rename to src/main/java/org/springframework/cheapy/model/BaseEntity.java
index 4cb9ffc0c..21aab45b7 100644
--- a/src/main/java/org/springframework/samples/petclinic/model/BaseEntity.java
+++ b/src/main/java/org/springframework/cheapy/model/BaseEntity.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.model;
+package org.springframework.cheapy.model;
import java.io.Serializable;
diff --git a/src/main/java/org/springframework/samples/petclinic/model/NamedEntity.java b/src/main/java/org/springframework/cheapy/model/NamedEntity.java
similarity index 95%
rename from src/main/java/org/springframework/samples/petclinic/model/NamedEntity.java
rename to src/main/java/org/springframework/cheapy/model/NamedEntity.java
index 088e52e81..0f00a5e9c 100644
--- a/src/main/java/org/springframework/samples/petclinic/model/NamedEntity.java
+++ b/src/main/java/org/springframework/cheapy/model/NamedEntity.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.model;
+package org.springframework.cheapy.model;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java b/src/main/java/org/springframework/cheapy/model/Owner.java
similarity index 62%
rename from src/main/java/org/springframework/samples/petclinic/owner/Owner.java
rename to src/main/java/org/springframework/cheapy/model/Owner.java
index 61083bc8d..792f42753 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java
+++ b/src/main/java/org/springframework/cheapy/model/Owner.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.cheapy.model;
import java.util.ArrayList;
import java.util.Collections;
@@ -32,7 +32,6 @@ import javax.validation.constraints.NotEmpty;
import org.springframework.beans.support.MutableSortDefinition;
import org.springframework.beans.support.PropertyComparator;
import org.springframework.core.style.ToStringCreator;
-import org.springframework.samples.petclinic.model.Person;
/**
* Simple JavaBean domain object representing an owner.
@@ -59,8 +58,6 @@ public class Owner extends Person {
@Digits(fraction = 0, integer = 10)
private String telephone;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
- private Set pets;
public String getAddress() {
return this.address;
@@ -86,57 +83,7 @@ public class Owner extends Person {
this.telephone = telephone;
}
- protected Set getPetsInternal() {
- if (this.pets == null) {
- this.pets = new HashSet<>();
- }
- return this.pets;
- }
- protected void setPetsInternal(Set pets) {
- this.pets = pets;
- }
-
- public List getPets() {
- List sortedPets = new ArrayList<>(getPetsInternal());
- PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
- return Collections.unmodifiableList(sortedPets);
- }
-
- public void addPet(Pet pet) {
- if (pet.isNew()) {
- getPetsInternal().add(pet);
- }
- pet.setOwner(this);
- }
-
- /**
- * Return the Pet with the given name, or null if none found for this Owner.
- * @param name to test
- * @return true if pet name is already in use
- */
- public Pet getPet(String name) {
- return getPet(name, false);
- }
-
- /**
- * Return the Pet with the given name, or null if none found for this Owner.
- * @param name to test
- * @return true if pet name is already in use
- */
- public Pet getPet(String name, boolean ignoreNew) {
- name = name.toLowerCase();
- for (Pet pet : getPetsInternal()) {
- if (!ignoreNew || !pet.isNew()) {
- String compName = pet.getName();
- compName = compName.toLowerCase();
- if (compName.equals(name)) {
- return pet;
- }
- }
- }
- return null;
- }
@Override
public String toString() {
diff --git a/src/main/java/org/springframework/samples/petclinic/model/Person.java b/src/main/java/org/springframework/cheapy/model/Person.java
similarity index 96%
rename from src/main/java/org/springframework/samples/petclinic/model/Person.java
rename to src/main/java/org/springframework/cheapy/model/Person.java
index 15fabacc3..7e8d87c0c 100644
--- a/src/main/java/org/springframework/samples/petclinic/model/Person.java
+++ b/src/main/java/org/springframework/cheapy/model/Person.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.model;
+package org.springframework.cheapy.model;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
diff --git a/src/main/java/org/springframework/samples/petclinic/model/package-info.java b/src/main/java/org/springframework/cheapy/model/package-info.java
similarity index 92%
rename from src/main/java/org/springframework/samples/petclinic/model/package-info.java
rename to src/main/java/org/springframework/cheapy/model/package-info.java
index 37d6295e8..620e13c68 100644
--- a/src/main/java/org/springframework/samples/petclinic/model/package-info.java
+++ b/src/main/java/org/springframework/cheapy/model/package-info.java
@@ -17,4 +17,4 @@
/**
* The classes in this package represent utilities used by the domain.
*/
-package org.springframework.samples.petclinic.model;
+package org.springframework.cheapy.model;
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java b/src/main/java/org/springframework/cheapy/repository/OwnerRepository.java
similarity index 89%
rename from src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java
rename to src/main/java/org/springframework/cheapy/repository/OwnerRepository.java
index 0613e928a..67c4d6a9a 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java
+++ b/src/main/java/org/springframework/cheapy/repository/OwnerRepository.java
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.cheapy.repository;
import java.util.Collection;
+import org.springframework.cheapy.model.Owner;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
@@ -42,7 +43,7 @@ public interface OwnerRepository extends Repository {
* @return a Collection of matching {@link Owner}s (or an empty Collection if none
* found)
*/
- @Query("SELECT DISTINCT owner FROM Owner owner left join fetch owner.pets WHERE owner.lastName LIKE :lastName%")
+ @Query("SELECT DISTINCT owner FROM Owner owner WHERE owner.lastName LIKE :lastName%")
@Transactional(readOnly = true)
Collection findByLastName(@Param("lastName") String lastName);
@@ -51,7 +52,7 @@ public interface OwnerRepository extends Repository {
* @param id the id to search for
* @return the {@link Owner} if found
*/
- @Query("SELECT owner FROM Owner owner left join fetch owner.pets WHERE owner.id =:id")
+ @Query("SELECT owner FROM Owner owner WHERE id =:id")
@Transactional(readOnly = true)
Owner findById(@Param("id") Integer id);
diff --git a/src/main/java/org/springframework/cheapy/service/OwnerService.java b/src/main/java/org/springframework/cheapy/service/OwnerService.java
new file mode 100644
index 000000000..da5559f37
--- /dev/null
+++ b/src/main/java/org/springframework/cheapy/service/OwnerService.java
@@ -0,0 +1,34 @@
+package org.springframework.cheapy.service;
+
+import java.util.Collection;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cheapy.model.Owner;
+import org.springframework.cheapy.repository.OwnerRepository;
+import org.springframework.dao.DataAccessException;
+import org.springframework.stereotype.Service;
+
+@Service
+public class OwnerService {
+ private OwnerRepository ownerRepository;
+
+
+ @Autowired
+ public OwnerService(final OwnerRepository ownerRepository) {
+ this.ownerRepository = ownerRepository;
+ }
+
+ public Owner findOwnerById(final int id) {
+ return this.ownerRepository.findById(id);
+ }
+
+ public Collection findByLastName(final String lastname) { //
+ return this.ownerRepository.findByLastName(lastname);
+
+ }
+
+ public void saveOwner(final Owner owner) throws DataAccessException { //
+ this.ownerRepository.save(owner);
+
+ }
+}
diff --git a/src/main/java/org/springframework/samples/petclinic/system/CacheConfiguration.java b/src/main/java/org/springframework/cheapy/system/CacheConfiguration.java
similarity index 97%
rename from src/main/java/org/springframework/samples/petclinic/system/CacheConfiguration.java
rename to src/main/java/org/springframework/cheapy/system/CacheConfiguration.java
index 0a96582c9..d5df44632 100755
--- a/src/main/java/org/springframework/samples/petclinic/system/CacheConfiguration.java
+++ b/src/main/java/org/springframework/cheapy/system/CacheConfiguration.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.samples.petclinic.system;
+package org.springframework.cheapy.system;
import javax.cache.configuration.MutableConfiguration;
diff --git a/src/main/java/org/springframework/samples/petclinic/system/CrashController.java b/src/main/java/org/springframework/cheapy/system/CrashController.java
similarity index 93%
rename from src/main/java/org/springframework/samples/petclinic/system/CrashController.java
rename to src/main/java/org/springframework/cheapy/system/CrashController.java
index 2b28600fd..4fb7e15f5 100644
--- a/src/main/java/org/springframework/samples/petclinic/system/CrashController.java
+++ b/src/main/java/org/springframework/cheapy/system/CrashController.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.system;
+package org.springframework.cheapy.system;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.GetMapping;
* Also see how a view that resolves to "error" has been added ("error.html").
*/
@Controller
-class CrashController {
+public class CrashController {
@GetMapping("/oups")
public String triggerException() {
diff --git a/src/main/java/org/springframework/samples/petclinic/system/WelcomeController.java b/src/main/java/org/springframework/cheapy/system/WelcomeController.java
similarity index 93%
rename from src/main/java/org/springframework/samples/petclinic/system/WelcomeController.java
rename to src/main/java/org/springframework/cheapy/system/WelcomeController.java
index 9224015bc..85782e967 100644
--- a/src/main/java/org/springframework/samples/petclinic/system/WelcomeController.java
+++ b/src/main/java/org/springframework/cheapy/system/WelcomeController.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.samples.petclinic.system;
+package org.springframework.cheapy.system;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java b/src/main/java/org/springframework/cheapy/web/OwnerController.java
similarity index 80%
rename from src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java
rename to src/main/java/org/springframework/cheapy/web/OwnerController.java
index 79aa4cd9b..d95e5d120 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java
+++ b/src/main/java/org/springframework/cheapy/web/OwnerController.java
@@ -13,9 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.cheapy.web;
-import org.springframework.samples.petclinic.visit.VisitRepository;
+import java.util.Collection;
+import java.util.Map;
+
+import javax.validation.Valid;
+
+import org.springframework.cheapy.model.Owner;
+import org.springframework.cheapy.repository.OwnerRepository;
+import org.springframework.cheapy.service.OwnerService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
@@ -26,10 +33,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.servlet.ModelAndView;
-import javax.validation.Valid;
-import java.util.Collection;
-import java.util.Map;
-
/**
* @author Juergen Hoeller
* @author Ken Krebs
@@ -37,17 +40,17 @@ import java.util.Map;
* @author Michael Isvy
*/
@Controller
-class OwnerController {
+public class OwnerController {
private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm";
- private final OwnerRepository owners;
+ private final OwnerService ownerService;
- private VisitRepository visits;
- public OwnerController(OwnerRepository clinicService, VisitRepository visits) {
- this.owners = clinicService;
- this.visits = visits;
+
+ public OwnerController(final OwnerService ownerService) {
+ this.ownerService = ownerService;
+
}
@InitBinder
@@ -68,7 +71,7 @@ class OwnerController {
return VIEWS_OWNER_CREATE_OR_UPDATE_FORM;
}
else {
- this.owners.save(owner);
+ this.ownerService.saveOwner(owner);
return "redirect:/owners/" + owner.getId();
}
}
@@ -88,7 +91,7 @@ class OwnerController {
}
// find owners by last name
- Collection results = this.owners.findByLastName(owner.getLastName());
+ Collection results = this.ownerService.findByLastName(owner.getLastName());
if (results.isEmpty()) {
// no owners found
result.rejectValue("lastName", "notFound", "not found");
@@ -108,7 +111,7 @@ class OwnerController {
@GetMapping("/owners/{ownerId}/edit")
public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) {
- Owner owner = this.owners.findById(ownerId);
+ Owner owner = this.ownerService.findOwnerById(ownerId);
model.addAttribute(owner);
return VIEWS_OWNER_CREATE_OR_UPDATE_FORM;
}
@@ -121,25 +124,18 @@ class OwnerController {
}
else {
owner.setId(ownerId);
- this.owners.save(owner);
+ this.ownerService.saveOwner(owner);
return "redirect:/owners/{ownerId}";
}
}
-
- /**
- * Custom handler for displaying an owner.
- * @param ownerId the ID of the owner to display
- * @return a ModelMap with the model attributes for the view
- */
@GetMapping("/owners/{ownerId}")
public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) {
ModelAndView mav = new ModelAndView("owners/ownerDetails");
- Owner owner = this.owners.findById(ownerId);
- for (Pet pet : owner.getPets()) {
- pet.setVisitsInternal(visits.findByPetId(pet.getId()));
- }
+ Owner owner = this.ownerService.findOwnerById(ownerId);
+
mav.addObject(owner);
return mav;
}
-
+
+
}
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Pet.java b/src/main/java/org/springframework/samples/petclinic/owner/Pet.java
deleted file mode 100755
index 2b68005fd..000000000
--- a/src/main/java/org/springframework/samples/petclinic/owner/Pet.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2012-2019 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.owner;
-
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-import org.springframework.beans.support.MutableSortDefinition;
-import org.springframework.beans.support.PropertyComparator;
-import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.samples.petclinic.model.NamedEntity;
-import org.springframework.samples.petclinic.visit.Visit;
-
-/**
- * Simple business object representing a pet.
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- */
-@Entity
-@Table(name = "pets")
-public class Pet extends NamedEntity {
-
- @Column(name = "birth_date")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate birthDate;
-
- @ManyToOne
- @JoinColumn(name = "type_id")
- private PetType type;
-
- @ManyToOne
- @JoinColumn(name = "owner_id")
- private Owner owner;
-
- @Transient
- private Set visits = new LinkedHashSet<>();
-
- public void setBirthDate(LocalDate birthDate) {
- this.birthDate = birthDate;
- }
-
- public LocalDate getBirthDate() {
- return this.birthDate;
- }
-
- public PetType getType() {
- return this.type;
- }
-
- public void setType(PetType type) {
- this.type = type;
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- protected void setOwner(Owner owner) {
- this.owner = owner;
- }
-
- protected Set getVisitsInternal() {
- if (this.visits == null) {
- this.visits = new HashSet<>();
- }
- return this.visits;
- }
-
- protected void setVisitsInternal(Collection visits) {
- this.visits = new LinkedHashSet<>(visits);
- }
-
- public List getVisits() {
- List sortedVisits = new ArrayList<>(getVisitsInternal());
- PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
- return Collections.unmodifiableList(sortedVisits);
- }
-
- public void addVisit(Visit visit) {
- getVisitsInternal().add(visit);
- visit.setPetId(this.getId());
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetController.java b/src/main/java/org/springframework/samples/petclinic/owner/PetController.java
deleted file mode 100644
index a55e599af..000000000
--- a/src/main/java/org/springframework/samples/petclinic/owner/PetController.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2012-2019 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.owner;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.ModelMap;
-import org.springframework.util.StringUtils;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.WebDataBinder;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import java.util.Collection;
-
-/**
- * @author Juergen Hoeller
- * @author Ken Krebs
- * @author Arjen Poutsma
- */
-@Controller
-@RequestMapping("/owners/{ownerId}")
-class PetController {
-
- private static final String VIEWS_PETS_CREATE_OR_UPDATE_FORM = "pets/createOrUpdatePetForm";
-
- private final PetRepository pets;
-
- private final OwnerRepository owners;
-
- public PetController(PetRepository pets, OwnerRepository owners) {
- this.pets = pets;
- this.owners = owners;
- }
-
- @ModelAttribute("types")
- public Collection populatePetTypes() {
- return this.pets.findPetTypes();
- }
-
- @ModelAttribute("owner")
- public Owner findOwner(@PathVariable("ownerId") int ownerId) {
- return this.owners.findById(ownerId);
- }
-
- @InitBinder("owner")
- public void initOwnerBinder(WebDataBinder dataBinder) {
- dataBinder.setDisallowedFields("id");
- }
-
- @InitBinder("pet")
- public void initPetBinder(WebDataBinder dataBinder) {
- dataBinder.setValidator(new PetValidator());
- }
-
- @GetMapping("/pets/new")
- public String initCreationForm(Owner owner, ModelMap model) {
- Pet pet = new Pet();
- owner.addPet(pet);
- model.put("pet", pet);
- return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
- }
-
- @PostMapping("/pets/new")
- public String processCreationForm(Owner owner, @Valid Pet pet, BindingResult result, ModelMap model) {
- if (StringUtils.hasLength(pet.getName()) && pet.isNew() && owner.getPet(pet.getName(), true) != null) {
- result.rejectValue("name", "duplicate", "already exists");
- }
- owner.addPet(pet);
- if (result.hasErrors()) {
- model.put("pet", pet);
- return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
- }
- else {
- this.pets.save(pet);
- return "redirect:/owners/{ownerId}";
- }
- }
-
- @GetMapping("/pets/{petId}/edit")
- public String initUpdateForm(@PathVariable("petId") int petId, ModelMap model) {
- Pet pet = this.pets.findById(petId);
- model.put("pet", pet);
- return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
- }
-
- @PostMapping("/pets/{petId}/edit")
- public String processUpdateForm(@Valid Pet pet, BindingResult result, Owner owner, ModelMap model) {
- if (result.hasErrors()) {
- pet.setOwner(owner);
- model.put("pet", pet);
- return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
- }
- else {
- owner.addPet(pet);
- this.pets.save(pet);
- return "redirect:/owners/{ownerId}";
- }
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetRepository.java b/src/main/java/org/springframework/samples/petclinic/owner/PetRepository.java
deleted file mode 100644
index 9d25b095b..000000000
--- a/src/main/java/org/springframework/samples/petclinic/owner/PetRepository.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2012-2019 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.owner;
-
-import java.util.List;
-
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Repository class for Pet 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
- */
-public interface PetRepository extends Repository {
-
- /**
- * Retrieve all {@link PetType}s from the data store.
- * @return a Collection of {@link PetType}s.
- */
- @Query("SELECT ptype FROM PetType ptype ORDER BY ptype.name")
- @Transactional(readOnly = true)
- List findPetTypes();
-
- /**
- * Retrieve a {@link Pet} from the data store by id.
- * @param id the id to search for
- * @return the {@link Pet} if found
- */
- @Transactional(readOnly = true)
- Pet findById(Integer id);
-
- /**
- * Save a {@link Pet} to the data store, either inserting or updating it.
- * @param pet the {@link Pet} to save
- */
- void save(Pet pet);
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetType.java b/src/main/java/org/springframework/samples/petclinic/owner/PetType.java
deleted file mode 100644
index 6f0aa58d3..000000000
--- a/src/main/java/org/springframework/samples/petclinic/owner/PetType.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2012-2019 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.owner;
-
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-import org.springframework.samples.petclinic.model.NamedEntity;
-
-/**
- * @author Juergen Hoeller Can be Cat, Dog, Hamster...
- */
-@Entity
-@Table(name = "types")
-public class PetType extends NamedEntity {
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetTypeFormatter.java b/src/main/java/org/springframework/samples/petclinic/owner/PetTypeFormatter.java
deleted file mode 100644
index 4940bcb38..000000000
--- a/src/main/java/org/springframework/samples/petclinic/owner/PetTypeFormatter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2012-2019 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.owner;
-
-import java.text.ParseException;
-import java.util.Collection;
-import java.util.Locale;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.Formatter;
-import org.springframework.stereotype.Component;
-
-/**
- * Instructs Spring MVC on how to parse and print elements of type 'PetType'. Starting
- * from Spring 3.0, Formatters have come as an improvement in comparison to legacy
- * PropertyEditors. See the following links for more details: - The Spring ref doc:
- * https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/core.html#format
- *
- * @author Mark Fisher
- * @author Juergen Hoeller
- * @author Michael Isvy
- */
-@Component
-public class PetTypeFormatter implements Formatter {
-
- private final PetRepository pets;
-
- @Autowired
- public PetTypeFormatter(PetRepository pets) {
- this.pets = pets;
- }
-
- @Override
- public String print(PetType petType, Locale locale) {
- return petType.getName();
- }
-
- @Override
- public PetType parse(String text, Locale locale) throws ParseException {
- Collection findPetTypes = this.pets.findPetTypes();
- for (PetType type : findPetTypes) {
- if (type.getName().equals(text)) {
- return type;
- }
- }
- throw new ParseException("type not found: " + text, 0);
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java b/src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java
deleted file mode 100644
index e1370b428..000000000
--- a/src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2012-2019 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.owner;
-
-import org.springframework.util.StringUtils;
-import org.springframework.validation.Errors;
-import org.springframework.validation.Validator;
-
-/**
- * Validator for Pet forms.
- *
- * We're not using Bean Validation annotations here because it is easier to define such
- * validation rule in Java.
- *
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- */
-public class PetValidator implements Validator {
-
- private static final String REQUIRED = "required";
-
- @Override
- public void validate(Object obj, Errors errors) {
- Pet pet = (Pet) obj;
- String name = pet.getName();
- // name validation
- if (!StringUtils.hasLength(name)) {
- errors.rejectValue("name", REQUIRED, REQUIRED);
- }
-
- // type validation
- if (pet.isNew() && pet.getType() == null) {
- errors.rejectValue("type", REQUIRED, REQUIRED);
- }
-
- // birth date validation
- if (pet.getBirthDate() == null) {
- errors.rejectValue("birthDate", REQUIRED, REQUIRED);
- }
- }
-
- /**
- * This Validator validates *just* Pet instances
- */
- @Override
- public boolean supports(Class> clazz) {
- return Pet.class.isAssignableFrom(clazz);
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java b/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java
deleted file mode 100644
index 375980312..000000000
--- a/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2012-2019 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.owner;
-
-import java.util.Map;
-
-import javax.validation.Valid;
-
-import org.springframework.samples.petclinic.visit.Visit;
-import org.springframework.samples.petclinic.visit.VisitRepository;
-import org.springframework.stereotype.Controller;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.WebDataBinder;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.InitBinder;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-
-/**
- * @author Juergen Hoeller
- * @author Ken Krebs
- * @author Arjen Poutsma
- * @author Michael Isvy
- * @author Dave Syer
- */
-@Controller
-class VisitController {
-
- private final VisitRepository visits;
-
- private final PetRepository pets;
-
- public VisitController(VisitRepository visits, PetRepository pets) {
- this.visits = visits;
- this.pets = pets;
- }
-
- @InitBinder
- public void setAllowedFields(WebDataBinder dataBinder) {
- dataBinder.setDisallowedFields("id");
- }
-
- /**
- * Called before each and every @RequestMapping annotated method. 2 goals: - Make sure
- * we always have fresh data - Since we do not use the session scope, make sure that
- * Pet object always has an id (Even though id is not part of the form fields)
- * @param petId
- * @return Pet
- */
- @ModelAttribute("visit")
- public Visit loadPetWithVisit(@PathVariable("petId") int petId, Map model) {
- Pet pet = this.pets.findById(petId);
- pet.setVisitsInternal(this.visits.findByPetId(petId));
- model.put("pet", pet);
- Visit visit = new Visit();
- pet.addVisit(visit);
- return visit;
- }
-
- // Spring MVC calls method loadPetWithVisit(...) before initNewVisitForm is called
- @GetMapping("/owners/*/pets/{petId}/visits/new")
- public String initNewVisitForm(@PathVariable("petId") int petId, Map model) {
- return "pets/createOrUpdateVisitForm";
- }
-
- // Spring MVC calls method loadPetWithVisit(...) before processNewVisitForm is called
- @PostMapping("/owners/{ownerId}/pets/{petId}/visits/new")
- public String processNewVisitForm(@Valid Visit visit, BindingResult result) {
- if (result.hasErrors()) {
- return "pets/createOrUpdateVisitForm";
- }
- else {
- this.visits.save(visit);
- return "redirect:/owners/{ownerId}";
- }
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/vet/Specialty.java b/src/main/java/org/springframework/samples/petclinic/vet/Specialty.java
deleted file mode 100644
index ea8ec6ded..000000000
--- a/src/main/java/org/springframework/samples/petclinic/vet/Specialty.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2012-2019 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;
-
-import java.io.Serializable;
-
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-import org.springframework.samples.petclinic.model.NamedEntity;
-
-/**
- * Models a {@link Vet Vet's} specialty (for example, dentistry).
- *
- * @author Juergen Hoeller
- */
-@Entity
-@Table(name = "specialties")
-public class Specialty extends NamedEntity implements Serializable {
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/vet/Vet.java b/src/main/java/org/springframework/samples/petclinic/vet/Vet.java
deleted file mode 100644
index 014becfce..000000000
--- a/src/main/java/org/springframework/samples/petclinic/vet/Vet.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2012-2019 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;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlElement;
-
-import org.springframework.beans.support.MutableSortDefinition;
-import org.springframework.beans.support.PropertyComparator;
-import org.springframework.samples.petclinic.model.Person;
-
-/**
- * Simple JavaBean domain object representing a veterinarian.
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Arjen Poutsma
- */
-@Entity
-@Table(name = "vets")
-public class Vet extends Person {
-
- @ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(name = "vet_specialties", joinColumns = @JoinColumn(name = "vet_id"),
- inverseJoinColumns = @JoinColumn(name = "specialty_id"))
- private Set specialties;
-
- protected Set getSpecialtiesInternal() {
- if (this.specialties == null) {
- this.specialties = new HashSet<>();
- }
- return this.specialties;
- }
-
- protected void setSpecialtiesInternal(Set specialties) {
- this.specialties = specialties;
- }
-
- @XmlElement
- public List getSpecialties() {
- List sortedSpecs = new ArrayList<>(getSpecialtiesInternal());
- PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
- return Collections.unmodifiableList(sortedSpecs);
- }
-
- public int getNrOfSpecialties() {
- return getSpecialtiesInternal().size();
- }
-
- public void addSpecialty(Specialty specialty) {
- getSpecialtiesInternal().add(specialty);
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/vet/VetController.java b/src/main/java/org/springframework/samples/petclinic/vet/VetController.java
deleted file mode 100644
index fb5e321ba..000000000
--- a/src/main/java/org/springframework/samples/petclinic/vet/VetController.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2012-2019 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;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import java.util.Map;
-
-/**
- * @author Juergen Hoeller
- * @author Mark Fisher
- * @author Ken Krebs
- * @author Arjen Poutsma
- */
-@Controller
-class VetController {
-
- private final VetRepository vets;
-
- public VetController(VetRepository clinicService) {
- this.vets = clinicService;
- }
-
- @GetMapping("/vets.html")
- public String showVetList(Map model) {
- // 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();
- vets.getVetList().addAll(this.vets.findAll());
- model.put("vets", vets);
- return "vets/vetList";
- }
-
- @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.vets.findAll());
- return vets;
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java b/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java
deleted file mode 100644
index 549b1c229..000000000
--- a/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2012-2019 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;
-
-import java.util.Collection;
-
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.dao.DataAccessException;
-import org.springframework.data.repository.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Repository class for Vet 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
- */
-public interface VetRepository extends Repository {
-
- /**
- * Retrieve all Vets from the data store.
- * @return a Collection of Vets
- */
- @Transactional(readOnly = true)
- @Cacheable("vets")
- Collection findAll() throws DataAccessException;
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/vet/Vets.java b/src/main/java/org/springframework/samples/petclinic/vet/Vets.java
deleted file mode 100644
index cea665629..000000000
--- a/src/main/java/org/springframework/samples/petclinic/vet/Vets.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2012-2019 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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * Simple domain object representing a list of veterinarians. Mostly here to be used for
- * the 'vets' {@link org.springframework.web.servlet.view.xml.MarshallingView}.
- *
- * @author Arjen Poutsma
- */
-@XmlRootElement
-public class Vets {
-
- private List vets;
-
- @XmlElement
- public List getVetList() {
- if (vets == null) {
- vets = new ArrayList<>();
- }
- return vets;
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/visit/Visit.java b/src/main/java/org/springframework/samples/petclinic/visit/Visit.java
deleted file mode 100755
index df9f25fe0..000000000
--- a/src/main/java/org/springframework/samples/petclinic/visit/Visit.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2012-2019 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.visit;
-
-import java.time.LocalDate;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.validation.constraints.NotEmpty;
-
-import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.samples.petclinic.model.BaseEntity;
-
-/**
- * Simple JavaBean domain object representing a visit.
- *
- * @author Ken Krebs
- * @author Dave Syer
- */
-@Entity
-@Table(name = "visits")
-public class Visit extends BaseEntity {
-
- @Column(name = "visit_date")
- @DateTimeFormat(pattern = "yyyy-MM-dd")
- private LocalDate date;
-
- @NotEmpty
- @Column(name = "description")
- private String description;
-
- @Column(name = "pet_id")
- private Integer petId;
-
- /**
- * Creates a new instance of Visit for the current date
- */
- public Visit() {
- this.date = LocalDate.now();
- }
-
- public LocalDate getDate() {
- return this.date;
- }
-
- public void setDate(LocalDate date) {
- this.date = date;
- }
-
- public String getDescription() {
- return this.description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Integer getPetId() {
- return this.petId;
- }
-
- public void setPetId(Integer petId) {
- this.petId = petId;
- }
-
-}
diff --git a/src/main/java/org/springframework/samples/petclinic/visit/VisitRepository.java b/src/main/java/org/springframework/samples/petclinic/visit/VisitRepository.java
deleted file mode 100644
index d5a3334c6..000000000
--- a/src/main/java/org/springframework/samples/petclinic/visit/VisitRepository.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2012-2019 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.visit;
-
-import java.util.List;
-
-import org.springframework.dao.DataAccessException;
-import org.springframework.data.repository.Repository;
-import org.springframework.samples.petclinic.model.BaseEntity;
-
-/**
- * Repository class for Visit 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
- */
-public interface VisitRepository extends Repository {
-
- /**
- * Save a Visit to the data store, either inserting or updating it.
- * @param visit the Visit to save
- * @see BaseEntity#isNew
- */
- void save(Visit visit) throws DataAccessException;
-
- List findByPetId(Integer petId);
-
-}
diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt
index 6225d1208..da0aacccf 100644
--- a/src/main/resources/banner.txt
+++ b/src/main/resources/banner.txt
@@ -1,15 +1,9 @@
-
-
- |\ _,,,--,,_
- /,`.-'`' ._ \-;;,_
- _______ __|,4- ) )_ .;.(__`'-'__ ___ __ _ ___ _______
- | | '---''(_/._)-'(_\_) | | | | | | | | |
- | _ | ___|_ _| | | | | |_| | | | __ _ _
- | |_| | |___ | | | | | | | | | | \ \ \ \
- | ___| ___| | | | _| |___| | _ | | _| \ \ \ \
- | | | |___ | | | |_| | | | | | | |_ ) ) ) )
- |___| |_______| |___| |_______|_______|___|_| |__|___|_______| / / / /
- ==================================================================/_/_/_/
+ __^__ __^__
+ ( ___ )------------------------------------( ___ )
+ | / | | \ |
+ | / | Cheapy | \ |
+ |___| |___|
+ (_____)------------------------------------(_____)
:: Built with Spring Boot :: ${spring-boot.version}
diff --git a/src/main/resources/templates/fragments/layout.html b/src/main/resources/templates/fragments/layout.html
index f3b207483..3ca576a08 100755
--- a/src/main/resources/templates/fragments/layout.html
+++ b/src/main/resources/templates/fragments/layout.html
@@ -8,9 +8,9 @@
-
+
- PetClinic :: a Spring Framework demonstration
+ Cheapy