Doctor
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
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Michael Isvy
- */
-public interface DoctorRepository extends RepositoryDoctor
s from the data store.
- *
- * @return a Collection
of Doctor
s
- */
- @Transactional(readOnly = true)
- @Cacheable("doctors")
- CollectionBaseEntity
. Used as a base class for objects
- * needing these properties.
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- */
-@MappedSuperclass
-public class NamedEntity extends BaseEntity {
-
- @Column(name = "name")
- private String name;
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return this.getName();
- }
-
-}
diff --git a/kidclinic/src/main/java/org/springframework/samples/kidclinic/model/Person.java b/kidclinic/src/main/java/org/springframework/samples/kidclinic/model/Person.java
deleted file mode 100644
index 38fa1ca95..000000000
--- a/kidclinic/src/main/java/org/springframework/samples/kidclinic/model/Person.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2002-2013 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
- *
- * http://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.kidclinic.model;
-
-import javax.persistence.Column;
-import javax.persistence.MappedSuperclass;
-
-import org.hibernate.validator.constraints.NotEmpty;
-
-/**
- * Simple JavaBean domain object representing an person.
- *
- * @author Ken Krebs
- */
-@MappedSuperclass
-public class Person extends BaseEntity {
-
- @Column(name = "first_name")
- @NotEmpty
- private String firstName;
-
- @Column(name = "last_name")
- @NotEmpty
- private String lastName;
-
- public String getFirstName() {
- return this.firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return this.lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
-}
diff --git a/kidclinic/src/main/java/org/springframework/samples/kidclinic/model/package-info.java b/kidclinic/src/main/java/org/springframework/samples/kidclinic/model/package-info.java
deleted file mode 100644
index bac1b029c..000000000
--- a/kidclinic/src/main/java/org/springframework/samples/kidclinic/model/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * The classes in this package represent utilities used by the domain.
- */
-package org.springframework.samples.kidclinic.model;
-
diff --git a/kidclinic/src/main/java/org/springframework/samples/kidclinic/parent/Kid.java b/kidclinic/src/main/java/org/springframework/samples/kidclinic/parent/Kid.java
deleted file mode 100644
index 84835eed2..000000000
--- a/kidclinic/src/main/java/org/springframework/samples/kidclinic/parent/Kid.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2002-2013 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
- *
- * http://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.kidclinic.parent;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-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 javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.springframework.beans.support.MutableSortDefinition;
-import org.springframework.beans.support.PropertyComparator;
-import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.samples.kidclinic.model.NamedEntity;
-import org.springframework.samples.kidclinic.visit.Visit;
-
-/**
- * Simple business object representing a pet.
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- */
-@Entity
-@Table(name = "kids")
-public class Kid extends NamedEntity {
-
- @Column(name = "birth_date")
- @Temporal(TemporalType.DATE)
- @DateTimeFormat(pattern = "yyyy/MM/dd")
- private Date birthDate;
-
- @ManyToOne
- @JoinColumn(name = "gender_id")
- private KidGender gender;
-
- @ManyToOne
- @JoinColumn(name = "parent_id")
- private Parent parent;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "kidId", fetch = FetchType.EAGER)
- private SetKid
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
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Michael Isvy
- */
-public interface KidRepository extends RepositoryValidator
for Kid
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 KidValidator implements Validator { - - private static final String REQUIRED = "required"; - - @Override - public void validate(Object obj, Errors errors) { - Kid kid = (Kid) obj; - String name = kid.getName(); - // name validation - if (!StringUtils.hasLength(name)) { - errors.rejectValue("name", REQUIRED, REQUIRED); - } - - // gender validation - if (kid.isNew() && kid.getGender() == null) { - errors.rejectValue("gender", REQUIRED, REQUIRED); - } - - // birth date validation - if (kid.getBirthDate() == null) { - errors.rejectValue("birthDate", REQUIRED, REQUIRED); - } - } - - /** - * This Validator validates *just* Kid instances - */ - @Override - public boolean supports(Class> clazz) { - return Kid.class.isAssignableFrom(clazz); - } - - -} diff --git a/kidclinic/src/main/java/org/springframework/samples/kidclinic/parent/Parent.java b/kidclinic/src/main/java/org/springframework/samples/kidclinic/parent/Parent.java deleted file mode 100644 index 662c47aae..000000000 --- a/kidclinic/src/main/java/org/springframework/samples/kidclinic/parent/Parent.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2002-2013 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 - * - * http://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.kidclinic.parent; - -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 org.springframework.samples.kidclinic.model.Person; - -/** - * Simple JavaBean domain object representing an parent. - * - * @author Ken Krebs - * @author Juergen Hoeller - * @author Sam Brannen - * @author Michael Isvy - */ -@Entity -@Table(name = "parents") -public class Parent extends Person { - @Column(name = "address") - @NotEmpty - private String address; - - @Column(name = "city") - @NotEmpty - private String city; - - @Column(name = "telephone") - @NotEmpty - @Digits(fraction = 0, integer = 10) - private String telephone; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "parent") - private SetParent
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
- *
- * @author Ken Krebs
- * @author Juergen Hoeller
- * @author Sam Brannen
- * @author Michael Isvy
- */
-public interface ParentRepository extends Repository