1 package org.springframework.samples.petclinic; 2 3 import java.util.Collection; 4 5 import org.springframework.dao.DataAccessException; 6 7 /** 8 * The high-level PetClinic business interface. 9 * 10 * <p>This is basically a data access object, 11 * as PetClinic doesn't have dedicated business logic. 12 * 13 * @author Ken Krebs 14 * @author Juergen Hoeller 15 */ 16 public interface Clinic { 17 18 /** 19 * Retrieve all <code>Vet</code>s from the datastore. 20 * @return a <code>Collection</code> of <code>Vet</code>s 21 */ 22 Collection getVets() throws DataAccessException; 23 24 /** 25 * Retrieve all <code>PetType</code>s from the datastore. 26 * @return a <code>Collection</code> of <code>PetType</code>s 27 */ 28 Collection getPetTypes() throws DataAccessException; 29 30 /** 31 * Retrieve <code>Owner</code>s from the datastore by last name, 32 * returning all owners whose last name <i>starts</i> with the given name. 33 * @param lastName Value to search for 34 * @return a <code>Collection</code> of matching <code>Owner</code>s 35 * (or an empty <code>Collection</code> if none found) 36 */ 37 Collection findOwners(String lastName) throws DataAccessException; 38 39 /** 40 * Retrieve an <code>Owner</code> from the datastore by id. 41 * @param id the id to search for 42 * @return the <code>Owner</code> if found 43 * @throws org.springframework.dao.DataRetrievalFailureException if not found 44 */ 45 Owner loadOwner(int id) throws DataAccessException; 46 47 /** 48 * Retrieve a <code>Pet</code> from the datastore by id. 49 * @param id the id to search for 50 * @return the <code>Pet</code> if found 51 * @throws org.springframework.dao.DataRetrievalFailureException if not found 52 */ 53 Pet loadPet(int id) throws DataAccessException; 54 55 /** 56 * Save an <code>Owner</code> to the datastore, 57 * either inserting or updating it. 58 * @param owner the <code>Owner</code> to save 59 * @see Entity#isNew 60 */ 61 void storeOwner(Owner owner) throws DataAccessException; 62 63 /** 64 * Save a <code>Pet</code> to the datastore, 65 * either inserting or updating it. 66 * @param pet the <code>Pet</code> to save 67 * @see Entity#isNew 68 */ 69 void storePet(Pet pet) throws DataAccessException; 70 71 /** 72 * Save a <code>Visit</code> to the datastore, 73 * either inserting or updating it. 74 * @param visit the <code>Visit</code> to save 75 * @see Entity#isNew 76 */ 77 void storeVisit(Visit visit) throws DataAccessException; 78 79 } 80