petclinic-uncached
Changes
pom.xml 2(+1 -1)
src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcOwnerRepositoryImpl.java 6(+3 -3)
Details
pom.xml 2(+1 -1)
diff --git a/pom.xml b/pom.xml
index e15e6ab..201f6dd 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 840a965..ca7c97e 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 4bc2b92..536fe07 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 c58bd85..61c5187 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 e8f44a7..aaf96b6 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 31839ad..63aec2a 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 e068791..e3c02fc 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 f6e91cf..cf6ec3e 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",