diff --git a/src/main/java/org/springframework/samples/kidclinic/doctor/Doctor.java b/src/main/java/org/springframework/samples/kidclinic/doctor/Doctor.java index ffd47a76d..153adbbbe 100644 --- a/src/main/java/org/springframework/samples/kidclinic/doctor/Doctor.java +++ b/src/main/java/org/springframework/samples/kidclinic/doctor/Doctor.java @@ -21,6 +21,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; @@ -29,6 +30,7 @@ import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.xml.bind.annotation.XmlElement; +import org.hibernate.validator.constraints.NotEmpty; import org.springframework.beans.support.MutableSortDefinition; import org.springframework.beans.support.PropertyComparator; import org.springframework.samples.kidclinic.model.Person; @@ -48,6 +50,18 @@ public class Doctor extends Person { @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "doctor_specialties", joinColumns = @JoinColumn(name = "doctor_id"), inverseJoinColumns = @JoinColumn(name = "specialty_id")) private Set specialties; + + @Column(name = "address") + @NotEmpty + private String address; + + @Column(name = "city") + @NotEmpty + private String city; + + @Column(name = "state") + @NotEmpty + private String state; protected Set getSpecialtiesInternal() { if (this.specialties == null) { @@ -75,5 +89,29 @@ public class Doctor extends Person { public void addSpecialty(Specialty specialty) { getSpecialtiesInternal().add(specialty); } + + public String getAddress() { + return this.address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCity() { + return this.city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState(){ + return this.state; + } + + public void setState(String state){ + this.state = state; + } } diff --git a/src/main/resources/db/hsqldb/data.sql b/src/main/resources/db/hsqldb/data.sql index 0839f919c..e5976dace 100644 --- a/src/main/resources/db/hsqldb/data.sql +++ b/src/main/resources/db/hsqldb/data.sql @@ -1,9 +1,9 @@ -INSERT INTO doctors VALUES (1, 'James', 'Carter'); -INSERT INTO doctors VALUES (2, 'Helen', 'Leary'); -INSERT INTO doctors VALUES (3, 'Linda', 'Douglas'); -INSERT INTO doctors VALUES (4, 'Rafael', 'Ortega'); -INSERT INTO doctors VALUES (5, 'Henry', 'Stevens'); -INSERT INTO doctors VALUES (6, 'Sharon', 'Jenkins'); +INSERT INTO doctors VALUES (1, 'James', 'Carter', '3424 University Ave.', 'Madison', 'WI'); +INSERT INTO doctors VALUES (2, 'Helen', 'Leary', '750 Hilldale Way', 'Madison', 'WI'); +INSERT INTO doctors VALUES (3, 'Linda', 'Douglas', '6136 University Ave.', 'Middleton', 'WI'); +INSERT INTO doctors VALUES (4, 'Rafael', 'Ortega', '8300 Airport Rd.', 'Middleton', 'WI'); +INSERT INTO doctors VALUES (5, 'Henry', 'Stevens', '876 Jupiter Dr.', 'Madison', 'WI'); +INSERT INTO doctors VALUES (6, 'Sharon', 'Jenkins', '4905 Monona Dr.', 'Monona', 'WI'); INSERT INTO specialties VALUES (1, 'radiology'); INSERT INTO specialties VALUES (2, 'surgery'); diff --git a/src/main/resources/db/hsqldb/schema.sql b/src/main/resources/db/hsqldb/schema.sql index 29ffa11ef..b4d09e4ff 100644 --- a/src/main/resources/db/hsqldb/schema.sql +++ b/src/main/resources/db/hsqldb/schema.sql @@ -10,7 +10,10 @@ DROP TABLE parents IF EXISTS; CREATE TABLE doctors ( id INTEGER IDENTITY PRIMARY KEY, first_name VARCHAR(30), - last_name VARCHAR(30) + last_name VARCHAR(30), + address VARCHAR(255), + city VARCHAR(80), + state VARCHAR(80) ); CREATE INDEX doctors_last_name ON doctors (last_name); diff --git a/src/main/resources/templates/doctors/doctorList.html b/src/main/resources/templates/doctors/doctorList.html index 54a430b06..bab58028b 100644 --- a/src/main/resources/templates/doctors/doctorList.html +++ b/src/main/resources/templates/doctors/doctorList.html @@ -11,12 +11,18 @@ Name + Address + City + State Specialties + + + none