diff --git a/pom.xml b/pom.xml index e15e6ab780a8d9e85121bf03f8bc30ed089266ad..201f6dd367a563bdd420d5a6701651e0c16a1379 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ <properties> <!-- Generic properties --> - <java.version>1.8</java.version> + <java.version>1.7</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> diff --git a/src/main/java/org/springframework/samples/petclinic/model/Owner.java b/src/main/java/org/springframework/samples/petclinic/model/Owner.java index 840a965ed4a897a9c4a52aeab5bd8122ba264cfb..ca7c97ec27175f95446ca827f157860e07a94140 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Owner.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Owner.java @@ -91,13 +91,13 @@ public class Owner extends Person { protected Set<Pet> getPetsInternal() { if (this.pets == null) { - this.pets = new HashSet<Pet>(); + this.pets = new HashSet<>(); } return this.pets; } public List<Pet> getPets() { - List<Pet> sortedPets = new ArrayList<Pet>(getPetsInternal()); + List<Pet> sortedPets = new ArrayList<>(getPetsInternal()); PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedPets); } diff --git a/src/main/java/org/springframework/samples/petclinic/model/Pet.java b/src/main/java/org/springframework/samples/petclinic/model/Pet.java index 4bc2b92f7df62043a4021c38c82a2787b158e494..536fe07e69439cbb28edb0529da64a1ecacc2425 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Pet.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Pet.java @@ -94,13 +94,13 @@ public class Pet extends NamedEntity { protected Set<Visit> getVisitsInternal() { if (this.visits == null) { - this.visits = new HashSet<Visit>(); + this.visits = new HashSet<>(); } return this.visits; } public List<Visit> getVisits() { - List<Visit> sortedVisits = new ArrayList<Visit>(getVisitsInternal()); + List<Visit> sortedVisits = new ArrayList<>(getVisitsInternal()); PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false)); return Collections.unmodifiableList(sortedVisits); } diff --git a/src/main/java/org/springframework/samples/petclinic/model/Vet.java b/src/main/java/org/springframework/samples/petclinic/model/Vet.java index c58bd85b2a14d6453da980aa6041b2d6184425cc..61c51878632c8db712220c307f6a390f7f6495d8 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Vet.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Vet.java @@ -56,14 +56,14 @@ public class Vet extends Person { protected Set<Specialty> getSpecialtiesInternal() { if (this.specialties == null) { - this.specialties = new HashSet<Specialty>(); + this.specialties = new HashSet<>(); } return this.specialties; } @XmlElement public List<Specialty> getSpecialties() { - List<Specialty> sortedSpecs = new ArrayList<Specialty>(getSpecialtiesInternal()); + List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal()); PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedSpecs); } diff --git a/src/main/java/org/springframework/samples/petclinic/model/Vets.java b/src/main/java/org/springframework/samples/petclinic/model/Vets.java index e8f44a7bcee01982c88d3c6e990ccf8a0463f99b..aaf96b68574ab63656dcf1528cbcf06218343709 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Vets.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Vets.java @@ -36,7 +36,7 @@ public class Vets { @XmlElement public List<Vet> getVetList() { if (vets == null) { - vets = new ArrayList<Vet>(); + vets = new ArrayList<>(); } return vets; } diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java index 31839ad1237cf45ab1ad15d5bb573536085c0770..63aec2a1f606ca69e2c42ff19a4b2db87d23ef71 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java @@ -73,7 +73,7 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository { */ @Override public Collection<Owner> findByLastName(String lastName) throws DataAccessException { - Map<String, Object> params = new HashMap<String, Object>(); + Map<String, Object> params = new HashMap<>(); params.put("lastName", lastName + "%"); List<Owner> owners = this.namedParameterJdbcTemplate.query( "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE last_name like :lastName", @@ -92,7 +92,7 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository { public Owner findById(int id) throws DataAccessException { Owner owner; try { - Map<String, Object> params = new HashMap<String, Object>(); + Map<String, Object> params = new HashMap<>(); params.put("id", id); owner = this.namedParameterJdbcTemplate.queryForObject( "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE id= :id", @@ -107,7 +107,7 @@ public class JdbcOwnerRepositoryImpl implements OwnerRepository { } public void loadPetsAndVisits(final Owner owner) { - Map<String, Object> params = new HashMap<String, Object>(); + Map<String, Object> params = new HashMap<>(); params.put("id", owner.getId()); final List<JdbcPet> pets = this.namedParameterJdbcTemplate.query( "SELECT pets.id, name, birth_date, type_id, owner_id, visits.id, visit_date, description, pet_id FROM pets LEFT OUTER JOIN visits ON pets.id = pet_id WHERE owner_id=:id", diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java index e068791a16f8414455339cd1cced752938cdd456..e3c02fc93fd8c894efce498e19b6107eec4f0c9b 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRepositoryImpl.java @@ -73,7 +73,7 @@ public class JdbcPetRepositoryImpl implements PetRepository { @Override public List<PetType> findPetTypes() throws DataAccessException { - Map<String, Object> params = new HashMap<String, Object>(); + Map<String, Object> params = new HashMap<>(); return this.namedParameterJdbcTemplate.query( "SELECT id, name FROM types ORDER BY name", params, @@ -84,7 +84,7 @@ public class JdbcPetRepositoryImpl implements PetRepository { public Pet findById(int id) throws DataAccessException { JdbcPet pet; try { - Map<String, Object> params = new HashMap<String, Object>(); + Map<String, Object> params = new HashMap<>(); params.put("id", id); pet = this.namedParameterJdbcTemplate.queryForObject( "SELECT id, name, birth_date, type_id, owner_id FROM pets WHERE id=:id", diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVetRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVetRepositoryImpl.java index f6e91cf5e01f0d2d8bffd031af362def8aed43ef..cf6ec3e42212acee51b8011aec4b8dfe5a9de793 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVetRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVetRepositoryImpl.java @@ -60,7 +60,7 @@ public class JdbcVetRepositoryImpl implements VetRepository { */ @Override public Collection<Vet> findAll() throws DataAccessException { - List<Vet> vets = new ArrayList<Vet>(); + List<Vet> vets = new ArrayList<>(); // Retrieve the list of all vets. vets.addAll(this.jdbcTemplate.query( "SELECT id, first_name, last_name FROM vets ORDER BY last_name,first_name",