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 c0efd4670f5fcf1561cba85b7df46053bebaaa26..840a965ed4a897a9c4a52aeab5bd8122ba264cfb 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Owner.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Owner.java @@ -15,15 +15,24 @@ */ package org.springframework.samples.petclinic.model; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.validation.constraints.Digits; + import org.hibernate.validator.constraints.NotEmpty; import org.springframework.beans.support.MutableSortDefinition; import org.springframework.beans.support.PropertyComparator; import org.springframework.core.style.ToStringCreator; -import javax.persistence.*; -import javax.validation.constraints.Digits; -import java.util.*; - /** * Simple JavaBean domain object representing an owner. * diff --git a/src/main/java/org/springframework/samples/petclinic/model/Person.java b/src/main/java/org/springframework/samples/petclinic/model/Person.java index 5e8655d920741d24bb026ccf3b8916a7449ae737..d3e03c0ddf61a9c3bf2209a13b88cc11f1a5c897 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Person.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Person.java @@ -15,11 +15,11 @@ */ package org.springframework.samples.petclinic.model; -import org.hibernate.validator.constraints.NotEmpty; - import javax.persistence.Column; import javax.persistence.MappedSuperclass; +import org.hibernate.validator.constraints.NotEmpty; + /** * Simple JavaBean domain object representing an person. * 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 5b3c806f9036411544feff523df782c91d91c137..4bc2b92f7df62043a4021c38c82a2787b158e494 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Pet.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Pet.java @@ -15,15 +15,27 @@ */ package org.springframework.samples.petclinic.model; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + import org.hibernate.annotations.Type; import org.joda.time.DateTime; import org.springframework.beans.support.MutableSortDefinition; import org.springframework.beans.support.PropertyComparator; import org.springframework.format.annotation.DateTimeFormat; -import javax.persistence.*; -import java.util.*; - /** * Simple business object representing a pet. * 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 4d767e0f35e6c071239f32c4769b9d1155ab1761..c58bd85b2a14d6453da980aa6041b2d6184425cc 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Vet.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Vet.java @@ -15,12 +15,22 @@ */ package org.springframework.samples.petclinic.model; -import org.springframework.beans.support.MutableSortDefinition; -import org.springframework.beans.support.PropertyComparator; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; -import javax.persistence.*; +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 java.util.*; + +import org.springframework.beans.support.MutableSortDefinition; +import org.springframework.beans.support.PropertyComparator; /** * Simple JavaBean domain object representing a veterinarian. 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 48676e9a68ba974b900b8db3e4bf7c02d849f21b..e8f44a7bcee01982c88d3c6e990ccf8a0463f99b 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Vets.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Vets.java @@ -16,11 +16,12 @@ */ package org.springframework.samples.petclinic.model; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; 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}. diff --git a/src/main/java/org/springframework/samples/petclinic/model/Visit.java b/src/main/java/org/springframework/samples/petclinic/model/Visit.java index 9ea0897f86064758dd5a39b024c5c0e505874155..ea03bde74b25eb1a3d97711c7a3119197af5c01e 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Visit.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Visit.java @@ -15,13 +15,17 @@ */ package org.springframework.samples.petclinic.model; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + import org.hibernate.annotations.Type; import org.hibernate.validator.constraints.NotEmpty; import org.joda.time.DateTime; import org.springframework.format.annotation.DateTimeFormat; -import javax.persistence.*; - /** * Simple JavaBean domain object representing a visit. * diff --git a/src/main/java/org/springframework/samples/petclinic/repository/OwnerRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/OwnerRepository.java index e87aa5fbda2a165120c28c71b315ddf88ff3ee9f..1318337066da3aa97ff041d76f76c342ec2c2067 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/OwnerRepository.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/OwnerRepository.java @@ -30,12 +30,12 @@ */ package org.springframework.samples.petclinic.repository; +import java.util.Collection; + import org.springframework.dao.DataAccessException; import org.springframework.samples.petclinic.model.BaseEntity; import org.springframework.samples.petclinic.model.Owner; -import java.util.Collection; - /** * Repository class for <code>Owner</code> domain objects All method names are compliant with Spring Data naming * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation diff --git a/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java index a075bc00ade20fc84f00b9b9aeea2c89a4970fe8..693b2e5e91ecdbdcc1855517fe9b0e4d944f6773 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/PetRepository.java @@ -15,13 +15,13 @@ */ package org.springframework.samples.petclinic.repository; +import java.util.List; + import org.springframework.dao.DataAccessException; import org.springframework.samples.petclinic.model.BaseEntity; import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.PetType; -import java.util.List; - /** * Repository class for <code>Pet</code> domain objects All method names are compliant with Spring Data naming * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation diff --git a/src/main/java/org/springframework/samples/petclinic/repository/VetRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/VetRepository.java index 44f504d3a7167734dfe5dcd2bd9634e8e6e34600..923c3c23df40791f471922259d5789652ce754a4 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/VetRepository.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/VetRepository.java @@ -15,11 +15,11 @@ */ package org.springframework.samples.petclinic.repository; +import java.util.Collection; + import org.springframework.dao.DataAccessException; import org.springframework.samples.petclinic.model.Vet; -import java.util.Collection; - /** * 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 here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation diff --git a/src/main/java/org/springframework/samples/petclinic/repository/VisitRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/VisitRepository.java index 760f2001dab8040c25e58155652cabeec93c23dc..96b7a208c8540326f551849a4be677e462924c24 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/VisitRepository.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/VisitRepository.java @@ -15,12 +15,12 @@ */ package org.springframework.samples.petclinic.repository; +import java.util.List; + import org.springframework.dao.DataAccessException; import org.springframework.samples.petclinic.model.BaseEntity; import org.springframework.samples.petclinic.model.Visit; -import java.util.List; - /** * Repository class for <code>Visit</code> domain objects All method names are compliant with Spring Data naming * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation 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 646378d6cdc30d1e61cdaa0ffd97a7af2e72e551..717817b48b0177623df02de91500bcf07beaceb6 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 @@ -15,6 +15,13 @@ */ package org.springframework.samples.petclinic.repository.jdbc; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.dao.EmptyResultDataAccessException; @@ -32,12 +39,6 @@ import org.springframework.samples.petclinic.repository.VisitRepository; import org.springframework.samples.petclinic.util.EntityUtils; import org.springframework.stereotype.Repository; -import javax.sql.DataSource; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * A simple JDBC-based implementation of the {@link OwnerRepository} interface. * 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 f11b5b05b9d62019ab035d26b381ff96c951cad3..c594ead1baead0d7549543249e88f0d28a4fc683 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 @@ -15,6 +15,12 @@ */ package org.springframework.samples.petclinic.repository.jdbc; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.dao.EmptyResultDataAccessException; @@ -33,11 +39,6 @@ import org.springframework.samples.petclinic.repository.VisitRepository; import org.springframework.samples.petclinic.util.EntityUtils; import org.springframework.stereotype.Repository; -import javax.sql.DataSource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * @author Ken Krebs * @author Juergen Hoeller diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRowMapper.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRowMapper.java index 0193a86530478353946b8724cbf19f05b1d0a728..7bc551e99ffdab7269a3a19b11d04e9a344b5be9 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRowMapper.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcPetRowMapper.java @@ -15,13 +15,13 @@ */ package org.springframework.samples.petclinic.repository.jdbc; -import org.joda.time.DateTime; -import org.springframework.jdbc.core.simple.ParameterizedRowMapper; - import java.sql.ResultSet; import java.sql.SQLException; import java.util.Date; +import org.joda.time.DateTime; +import org.springframework.jdbc.core.simple.ParameterizedRowMapper; + /** * {@link ParameterizedRowMapper} implementation mapping data from a {@link ResultSet} to the corresponding properties * of the {@link JdbcPet} class. 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 a354c2a83f72647533f50946027eb9bfa713115e..14d3c8eea1dd1d7edbe0f1cded4ee4f8510d8108 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 @@ -15,6 +15,12 @@ */ package org.springframework.samples.petclinic.repository.jdbc; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.Cacheable; import org.springframework.dao.DataAccessException; @@ -27,12 +33,6 @@ import org.springframework.samples.petclinic.repository.VetRepository; import org.springframework.samples.petclinic.util.EntityUtils; import org.springframework.stereotype.Repository; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - /** * A simple JDBC-based implementation of the {@link VetRepository} interface. Uses @Cacheable to cache the result of the * {@link findAll} method diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVisitRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVisitRepositoryImpl.java index e8081aaef4d87bc11ae16184097c51e1b72a90da..fee5af5b407104aa23da784a958a08d27ceb8b6c 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVisitRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVisitRepositoryImpl.java @@ -15,6 +15,13 @@ */ package org.springframework.samples.petclinic.repository.jdbc; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.List; + +import javax.sql.DataSource; + import org.joda.time.DateTime; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; @@ -26,12 +33,6 @@ import org.springframework.samples.petclinic.model.Visit; import org.springframework.samples.petclinic.repository.VisitRepository; import org.springframework.stereotype.Repository; -import javax.sql.DataSource; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Date; -import java.util.List; - /** * A simple JDBC-based implementation of the {@link VisitRepository} interface. * diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaOwnerRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaOwnerRepositoryImpl.java index 426f71170bb45b5b607a4754827d195d06a0c155..dfa00ce3e1f33d4c1883b6c5b43019930afbdb4a 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaOwnerRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaOwnerRepositoryImpl.java @@ -15,15 +15,16 @@ */ package org.springframework.samples.petclinic.repository.jpa; -import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter; -import org.springframework.samples.petclinic.model.Owner; -import org.springframework.samples.petclinic.repository.OwnerRepository; -import org.springframework.stereotype.Repository; +import java.util.Collection; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; -import java.util.Collection; + +import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter; +import org.springframework.samples.petclinic.model.Owner; +import org.springframework.samples.petclinic.repository.OwnerRepository; +import org.springframework.stereotype.Repository; /** * JPA implementation of the {@link OwnerRepository} interface. diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaPetRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaPetRepositoryImpl.java index 4073c9d863f84ac23d83e14eb4fd81ba94bcc3f5..ea185cc9b49b372e3597b4a0105879673d8047d9 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaPetRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaPetRepositoryImpl.java @@ -15,15 +15,16 @@ */ package org.springframework.samples.petclinic.repository.jpa; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.PetType; import org.springframework.samples.petclinic.repository.PetRepository; import org.springframework.stereotype.Repository; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import java.util.List; - /** * JPA implementation of the {@link PetRepository} interface. * diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVetRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVetRepositoryImpl.java index 5ab58d3ec86a894ae8ede2e79745fbaecc22890d..3049fb8e29fd37eea96854b2702d89c7c6d948cc 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVetRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVetRepositoryImpl.java @@ -15,15 +15,16 @@ */ package org.springframework.samples.petclinic.repository.jpa; +import java.util.Collection; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + import org.springframework.cache.annotation.Cacheable; import org.springframework.samples.petclinic.model.Vet; import org.springframework.samples.petclinic.repository.VetRepository; import org.springframework.stereotype.Repository; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import java.util.Collection; - /** * JPA implementation of the {@link VetRepository} interface. * diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVisitRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVisitRepositoryImpl.java index e9fbf07a867c17d929fff0556cc0cd0d6cbd65f9..58d3709c7fcb09e54e7d7fec97ee07060efd0b42 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVisitRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVisitRepositoryImpl.java @@ -15,14 +15,15 @@ */ package org.springframework.samples.petclinic.repository.jpa; -import org.springframework.samples.petclinic.model.Visit; -import org.springframework.samples.petclinic.repository.VisitRepository; -import org.springframework.stereotype.Repository; +import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; -import java.util.List; + +import org.springframework.samples.petclinic.model.Visit; +import org.springframework.samples.petclinic.repository.VisitRepository; +import org.springframework.stereotype.Repository; /** * JPA implementation of the ClinicService interface using EntityManager. diff --git a/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/JpaOwnerRepositoryImpl.java b/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/JpaOwnerRepositoryImpl.java index 1ce4a6aad03ac2a13e7618847db0a23e9fbf6c16..de27b1b0654f1c1a7163758f0730a8ac0a8dcd23 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/JpaOwnerRepositoryImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/JpaOwnerRepositoryImpl.java @@ -15,14 +15,15 @@ */ package org.springframework.samples.petclinic.repository.springdatajpa; -import org.springframework.samples.petclinic.model.Owner; -import org.springframework.samples.petclinic.repository.OwnerRepository; -import org.springframework.stereotype.Repository; +import java.util.Collection; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; -import java.util.Collection; + +import org.springframework.samples.petclinic.model.Owner; +import org.springframework.samples.petclinic.repository.OwnerRepository; +import org.springframework.stereotype.Repository; /** * Using native JPA instead of Spring Data JPA here because of this query: "SELECT owner FROM Owner owner left join diff --git a/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/SpringDataPetRepository.java b/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/SpringDataPetRepository.java index e510facd9a102d04261a7ceecf12377c64f882a4..56a41314737bc5d9374c996ab927afdc460398b2 100644 --- a/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/SpringDataPetRepository.java +++ b/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa/SpringDataPetRepository.java @@ -15,6 +15,8 @@ */ package org.springframework.samples.petclinic.repository.springdatajpa; +import java.util.List; + import org.springframework.dao.DataAccessException; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; @@ -22,8 +24,6 @@ import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.PetType; import org.springframework.samples.petclinic.repository.PetRepository; -import java.util.List; - /** * Spring Data JPA specialization of the {@link PetRepository} interface * diff --git a/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java b/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java index 0ea3d7f16d9931f5c56b25bc7a3d0d2c5ae25086..c4a65e61eddd56660a5726db2e608fc54d4d4357 100644 --- a/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java +++ b/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java @@ -15,11 +15,15 @@ */ package org.springframework.samples.petclinic.service; -import org.springframework.dao.DataAccessException; -import org.springframework.samples.petclinic.model.*; - import java.util.Collection; +import org.springframework.dao.DataAccessException; +import org.springframework.samples.petclinic.model.Owner; +import org.springframework.samples.petclinic.model.Pet; +import org.springframework.samples.petclinic.model.PetType; +import org.springframework.samples.petclinic.model.Vet; +import org.springframework.samples.petclinic.model.Visit; + /** * Mostly used as a facade for all Petclinic controllers diff --git a/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java b/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java index e03c1eb2cc744f16f95a171c2159578f4579b485..df628d3b9169a5843af2f068d7d2ed6a12476cc2 100644 --- a/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java +++ b/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java @@ -15,9 +15,15 @@ */ package org.springframework.samples.petclinic.service; +import java.util.Collection; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; -import org.springframework.samples.petclinic.model.*; +import org.springframework.samples.petclinic.model.Owner; +import org.springframework.samples.petclinic.model.Pet; +import org.springframework.samples.petclinic.model.PetType; +import org.springframework.samples.petclinic.model.Vet; +import org.springframework.samples.petclinic.model.Visit; import org.springframework.samples.petclinic.repository.OwnerRepository; import org.springframework.samples.petclinic.repository.PetRepository; import org.springframework.samples.petclinic.repository.VetRepository; @@ -25,8 +31,6 @@ import org.springframework.samples.petclinic.repository.VisitRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Collection; - /** * Mostly used as a facade for all Petclinic controllers * diff --git a/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java b/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java index 5e538bdca0da046309b283e09b5bcdcac4a3ec88..ea4e40a84128d83e52836de360a5baa63714df85 100644 --- a/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java +++ b/src/main/java/org/springframework/samples/petclinic/util/EntityUtils.java @@ -16,11 +16,11 @@ package org.springframework.samples.petclinic.util; +import java.util.Collection; + import org.springframework.orm.ObjectRetrievalFailureException; import org.springframework.samples.petclinic.model.BaseEntity; -import java.util.Collection; - /** * Utility methods for handling entities. Separate from the BaseEntity class mainly because of dependency on the * ORM-associated ObjectRetrievalFailureException. diff --git a/src/main/java/org/springframework/samples/petclinic/web/OwnerController.java b/src/main/java/org/springframework/samples/petclinic/web/OwnerController.java index b05ecbf86f926b1f5a01443f1afd5a1c9016a219..3d4b84a6b6a605654f3f1da19f7e94504912cae1 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/OwnerController.java +++ b/src/main/java/org/springframework/samples/petclinic/web/OwnerController.java @@ -15,6 +15,10 @@ */ package org.springframework.samples.petclinic.web; +import java.util.Collection; + +import javax.validation.Valid; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.samples.petclinic.model.Owner; import org.springframework.samples.petclinic.service.ClinicService; @@ -22,13 +26,14 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.servlet.ModelAndView; -import javax.validation.Valid; -import java.util.Collection; - /** * @author Juergen Hoeller * @author Ken Krebs diff --git a/src/main/java/org/springframework/samples/petclinic/web/PetController.java b/src/main/java/org/springframework/samples/petclinic/web/PetController.java index 3161071d99d73bb20c4e75543d0f3475882ba2f4..87df5638219632606961d75e3876bb6782b15045 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/PetController.java +++ b/src/main/java/org/springframework/samples/petclinic/web/PetController.java @@ -15,6 +15,8 @@ */ package org.springframework.samples.petclinic.web; +import java.util.Collection; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.samples.petclinic.model.Owner; import org.springframework.samples.petclinic.model.Pet; @@ -24,11 +26,14 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.*; +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.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.support.SessionStatus; -import java.util.Collection; - /** * @author Juergen Hoeller * @author Ken Krebs diff --git a/src/main/java/org/springframework/samples/petclinic/web/PetTypeFormatter.java b/src/main/java/org/springframework/samples/petclinic/web/PetTypeFormatter.java index 725f32f30f1b407c7f267437bae1a559fe143881..3d47d220179bd4d7962f5c8392db1056d76585a3 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/PetTypeFormatter.java +++ b/src/main/java/org/springframework/samples/petclinic/web/PetTypeFormatter.java @@ -16,15 +16,15 @@ package org.springframework.samples.petclinic.web; +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.samples.petclinic.model.PetType; import org.springframework.samples.petclinic.service.ClinicService; -import java.text.ParseException; -import java.util.Collection; -import java.util.Locale; - /** * 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 diff --git a/src/main/java/org/springframework/samples/petclinic/web/VetsAtomView.java b/src/main/java/org/springframework/samples/petclinic/web/VetsAtomView.java index d379aebf1412185c27af4b7a918fb6e14bafcc28..3de619ac494108c10a274bbf0d0ce675fea0b093 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/VetsAtomView.java +++ b/src/main/java/org/springframework/samples/petclinic/web/VetsAtomView.java @@ -15,18 +15,20 @@ */ package org.springframework.samples.petclinic.web; -import com.sun.syndication.feed.atom.Content; -import com.sun.syndication.feed.atom.Entry; -import com.sun.syndication.feed.atom.Feed; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.springframework.samples.petclinic.model.Vet; import org.springframework.samples.petclinic.model.Vets; import org.springframework.web.servlet.view.feed.AbstractAtomFeedView; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import com.sun.syndication.feed.atom.Content; +import com.sun.syndication.feed.atom.Entry; +import com.sun.syndication.feed.atom.Feed; /** * A view creating a Atom representation from a list of Visit objects. diff --git a/src/main/java/org/springframework/samples/petclinic/web/VisitController.java b/src/main/java/org/springframework/samples/petclinic/web/VisitController.java index 7de96693931f9890c80ca77454826d2f60fed2fe..4b534442cdb9c99a1047afa96b7e165ea4dcf4f1 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/VisitController.java +++ b/src/main/java/org/springframework/samples/petclinic/web/VisitController.java @@ -15,6 +15,8 @@ */ package org.springframework.samples.petclinic.web; +import javax.validation.Valid; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.Visit; @@ -23,12 +25,14 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.servlet.ModelAndView; -import javax.validation.Valid; - /** * @author Juergen Hoeller * @author Ken Krebs diff --git a/src/test/java/org/springframework/samples/petclinic/model/OwnerTests.java b/src/test/java/org/springframework/samples/petclinic/model/OwnerTests.java index 2eba3d997a313a11b08ebab00ecbee9c715769a8..d5044fd789e32ef82501e81c197d4b33ea5ef9e6 100644 --- a/src/test/java/org/springframework/samples/petclinic/model/OwnerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/model/OwnerTests.java @@ -15,12 +15,12 @@ */ package org.springframework.samples.petclinic.model; -import org.junit.Test; -import org.springframework.transaction.annotation.Transactional; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import org.junit.Test; +import org.springframework.transaction.annotation.Transactional; + /** * JUnit test for the {@link Owner} class. * diff --git a/src/test/java/org/springframework/samples/petclinic/service/AbstractClinicServiceTests.java b/src/test/java/org/springframework/samples/petclinic/service/AbstractClinicServiceTests.java index d0d9e55bac1bd20419ea07941e5f159618439705..b29fb9462ea1b7e51db3f880e536588bd666743d 100644 --- a/src/test/java/org/springframework/samples/petclinic/service/AbstractClinicServiceTests.java +++ b/src/test/java/org/springframework/samples/petclinic/service/AbstractClinicServiceTests.java @@ -15,6 +15,11 @@ */ package org.springframework.samples.petclinic.service; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Collection; + import org.joda.time.DateTime; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -23,16 +28,10 @@ import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.PetType; import org.springframework.samples.petclinic.model.Vet; import org.springframework.samples.petclinic.model.Visit; -import org.springframework.samples.petclinic.service.ClinicService; import org.springframework.samples.petclinic.util.EntityUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.transaction.annotation.Transactional; -import java.util.Collection; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - /** * <p> Base class for {@link ClinicService} integration tests. </p> <p> Subclasses should specify Spring context * configuration using {@link ContextConfiguration @ContextConfiguration} annotation </p> <p> diff --git a/src/test/java/org/springframework/samples/petclinic/web/VisitsViewTest.java b/src/test/java/org/springframework/samples/petclinic/web/VisitsViewTest.java index 8fb3480c449baef0924ce79304bfc7faff13d52e..793c1323290c199dfd10ef2054d8bc1305d77e22 100644 --- a/src/test/java/org/springframework/samples/petclinic/web/VisitsViewTest.java +++ b/src/test/java/org/springframework/samples/petclinic/web/VisitsViewTest.java @@ -16,6 +16,13 @@ package org.springframework.samples.petclinic.web; +import static org.hamcrest.Matchers.containsString; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.xpath; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,12 +37,6 @@ import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import static org.hamcrest.Matchers.containsString; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; -import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*; - /** * @author Arjen Poutsma